Skip to main content

Documentation

A partner-facing quote endpoint that returns the best executable swap quote from Ring Protocol Pools.

Structured reference
TOC available

Ring Routing API

A partner-facing quote endpoint that returns the best executable swap quote from Ring Protocol Pools.

Endpoint

POST https://gateway.ring.exchange/v1/partner/quote

A staging environment is available at https://gateway.testring.org/v1/partner/quote — coordinate with the Ring team before targeting it.

Authentication

Every request requires three headers:

HeaderRequiredDescription
x-api-keyYesYour partner API key. Issued by Ring — email [email protected] to request one (see Getting access). Treat as a secret; proxy through your backend, do not ship to end-user devices.
x-partner-idYesYour partner slug (lower-case), assigned during onboarding (e.g. orbs). The slug and key are cross-checked: a key issued to partner A cannot impersonate partner B.
Content-TypeYesapplication/json

A missing or invalid x-api-key returns 403 (rejected by the gateway). A missing or mismatched x-partner-id returns 400 with errorCode: VALIDATION_ERROR.

Supported chains

Currently only Ethereum Mainnet (chainId: 1) is supported. Additional chains will be enabled as they are reviewed and rolled out. Coordinate with the Ring team before targeting other chains.

Quick start

curl -X POST "https://gateway.ring.exchange/v1/partner/quote" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-partner-id: YOUR_PARTNER_SLUG" \
-d '{
"tokenIn": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"tokenOut": "0x0000000000000000000000000000000000000000",
"amount": "1000000000101000000",
"tokenInChainId": 1,
"tokenOutChainId": 1,
"swapper": "0xYourFillerContractAddress",
"type": "EXACT_INPUT"
}'

Required fields

FieldDescription
tokenIn / tokenOutToken addresses. Use 0x0000000000000000000000000000000000000000 for the chain's native asset (ETH).
amountRaw amount in the token's smallest unit (wei for ETH, 6-decimal units for USDT, etc.). For EXACT_INPUT this is the input amount; for EXACT_OUTPUT it's the desired output amount.
tokenInChainId / tokenOutChainIdChain ID. Both must equal 1 (Ethereum mainnet).
swapperYour filler contract address. Used to generate the calldata, and set as the recipient of the swap output. If wrong, the calldata won't match and output tokens will be sent to the wrong address.
typeEXACT_INPUT or EXACT_OUTPUT.

Optional fields

FieldDefaultDescription
protocols["FewV2"]Liquidity sources to consider for the route. Currently only FewV2 is supported.
autoSlippageSet to DEFAULT for automatic slippage selection.

Response

A successful request returns HTTP 200:

{
"requestId": "fe67ff8b-79e7-46c7-84d3-b6816d2c136a",
"routing": "CLASSIC",
"quote": {
"chainId": 1,
"tradeType": "EXACT_INPUT",
"swapper": "0xYourFillerContractAddress",
"input": {
"amount": "1000000000101000000",
"token": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
},
"output": {
"amount": "405123456789",
"token": "0x0000000000000000000000000000000000000000",
"recipient": "0xYourFillerContractAddress"
},
"methodParameters": {
"to": "0x24e743CcE93235641f2be8Ce7ffC6330903ab96f",
"calldata": "0x...",
"value": "0"
},
"route": [ /* ordered list of pool hops */ ],
"slippage": 0.5,
"gasFee": "662490501387712",
"gasFeeUSD": "1.59",
"gasUseEstimate": "63592",
"quoteId": "d21e3281-5f14-4a4c-8369-d1a7250fca9f"
},
"permitData": { /* Permit2 typed data, when input token requires approval */ }
}

What to grab from the response

To execute the swap on-chain, take these three fields and submit a transaction:

FieldUse
quote.methodParameters.toRouter contract address — destination of your transaction
quote.methodParameters.calldataEncoded swap calldata — the data field of your transaction
quote.methodParameters.valueNative token value to attach (in wei) — the value field of your transaction

If permitData is present, sign the Permit2 typed data first and submit the signature alongside the swap.

The endpoint does not validate sender balances or token approvals — it only returns calldata. If you call it from a filler contract, make sure the contract has the input tokens (and required approvals) before submitting the transaction.

Other useful fields

FieldDescription
routingRouting mode used to produce the quote. Currently CLASSIC.
quote.input.amount, quote.output.amountFinal input and output amounts (wei).
quote.slippageEffective slippage applied (percent).
quote.gasFee, quote.gasFeeUSDEstimated gas fee in wei and USD.
quote.routeOrdered list of pool hops used for the quote.
quote.quoteId, requestIdUUIDs — useful for support tickets and log correlation.

Errors

StatuserrorCodeCause
400VALIDATION_ERRORMissing or malformed field, missing x-partner-id, partner-id / API-key mismatch, unsupported chain.
403Missing or invalid x-api-key. Rejected at the gateway, never reaches the service.
404NO_QUOTES_AVAILABLENo quoter returned a usable price for the requested pair.
429TOO_MANY_REQUESTSPer-partner rate limit (default 10 rps / burst 20) or monthly quota (default 5M / month) exceeded. Honor Retry-After.
500variesUpstream quoter failure. Retry with exponential backoff.

Integration notes

  • Token addresses: use the checksummed ERC-20 contract address. For native ETH, use 0x0000000000000000000000000000000000000000.
  • Amounts are strings in the token's smallest unit.
  • Permit2: when permitData is present in the response, sign the typed data with the swapper key and include the signature in your transaction. Without it, the swap will revert.
  • FewV2 routing: quotes are sourced from Ring Protocol Pools and route through FewToken-wrapped liquidity, which can offer better pricing for certain pairs.

Getting access

To request a partner API key, email [email protected] with your project name, website / app URL, intended use, and estimated traffic. The Ring team will review and reply with your API key and assigned x-partner-id slug.