Conversions

Conversions

Convert USD from your custody account into INR in your balance. Quote, accept, and follow the conversion to the end.

A conversion turns US dollars into INR in your Superpay balance, which payouts spend. The dollars come from the stablecoins in your custody account: when you accept a quote, Superpay pulls what the conversion needs from one of your wallets.

StepCallResult
1POST /v1/conversions/quotesA quote with the exact sell, buy and expires_at
2POST /v1/conversionsA conversion in CREATED
3GET /v1/conversions/{id}, or the fx.executed and fx.failed eventsEXECUTED: the buy amount is in your balance. Or FAILED

Before you convert:

EndpointScopeIdempotency-Key
POST /v1/conversions/quotesfx:quoteRequired
GET /v1/conversions/quotes/{id}fx:read—
POST /v1/conversions/quotes/{id}/rejectfx:quote—
POST /v1/conversionsfx:executeRequired
GET /v1/conversions/{id}fx:read—

/v1/fx/quotes, /v1/fx/quotes/{id}, /v1/fx/orders and /v1/fx/orders/{id} are older names for the same endpoints and return the same objects. Use the /v1/conversions paths. An Idempotency-Key belongs to the path you first used it on: it does not replay across the two names.

Amounts are integers in minor units (Money):

CurrencyMinor units1 unit is
USD2100
INR2100

Create a quote#

POST/v1/conversions/quotesfx:quote

Prices converting a fixed amount of USD into INR. A quote moves no money: it reserves nothing, and reads neither your balance nor your wallets. A quote that sells USD does check that your business verification lets you convert.

sell_currencystringRequired

USD, upper case. Your custody account funds conversions that sell USD: your stablecoins are sold for their dollar value. Do not send USDC or USDT here: conversions sell dollars only, and a quote that sells a stablecoin is refused with 422 QUOTE_UNAVAILABLE.

buy_currencystringRequired

INR. Must differ from sell_currency.

sell_amountobjectRequired

The amount to convert, as a money object: amount (integer in minor units, greater than 0) and currency (must equal sell_currency). The spread is taken out of this amount.

buy_amountobject

Instead of sell_amount: the amount to receive, in buy_currency. Only for conversions priced by Superpay's dealing desk; any other quote that sends it returns 422 QUOTE_UNAVAILABLE. Send sell_amount or buy_amount, never both.

Shell
curl https://api.withsuperpay.com/v1/conversions/quotes \
  -H "Authorization: Bearer $SUPERPAY_TOKEN" \
  -H "Idempotency-Key: 3f6c1a52-8e4b-4d0a-9b7e-2c5d9f1e6a07" \
  -H "Content-Type: application/json" \
  -d '{
    "sell_currency": "USD",
    "buy_currency": "INR",
    "sell_amount": { "amount": 100000, "currency": "USD" }
  }'

This quote sells 1,000.00 USD. The spread is 5.00 USD, and the remaining 995.00 USD converts into ₹83,082.50. The figures are illustrative: your spread and rate are on each quote. The response has no Location header.

How a quote is priced#

  • sell equals your sell_amount exactly. It includes the spread.
  • spread is Superpay's spread, in the sell currency: spread_bps of sell, rounded half to even to a whole minor unit. On very small amounts it can be 0.
  • buy is exactly what an executed conversion credits to your balance.
  • rate.value is the all-in rate after the spread: buy divided by sell in whole units, rounded to 8 decimal places. The amounts are authoritative; the rate is for display.
  • The price comes from Superpay's banking partner at the moment you ask. A currency it does not sell, or a pair or amount it cannot price, returns 422 QUOTE_UNAVAILABLE.
  • A price that had already expired when it reached Superpay is not handed out: the request returns 503 PROVIDER_UNAVAILABLE, no quote is created, and you ask again.

A dealing-desk quote that fixes buy_amount works the other way round: buy is your amount, and sell is what it costs, spread included and rounded up.

Quote expiry#

A quote can be accepted until expires_at. That is at most 60 seconds after created_at, and can be sooner. Always read expires_at rather than assuming 60 seconds.

After expires_at the quote reads as EXPIRED, and accepting it returns 422 QUOTE_EXPIRED. An expired quote costs nothing. Request a new one.

Large conversions#

Superpay can have its dealing desk price conversions at or above a set amount, counted in the currency of the side you fix. Ask Superpay whether this is enabled, and from what amount. Such a quote comes back 201 with status PENDING_OTC and origin OTC:

While PENDING_OTCOnce priced
The side you fixed has your amount. The other side, rate and spread are zerostatus becomes ACTIVE, with the desk's sell, buy, rate and spread
expires_at is how long the desk has to price it, a few hours by default. Unpriced by then, it reads EXPIREDexpires_at is reset: accept before it, typically within 15 minutes
Accepting returns 422 QUOTE_PENDING_OTCAccept it like any quote

No event announces that a desk quote is priced. Retrieve the quote to see it. created_at stays the time you asked.

Retrieve a quote#

GET/v1/conversions/quotes/{id}fx:read

Returns the quote with its current status. The example is the quote above after the conversion below used it.

idstringRequired

Path parameter. An fxq_ id.

Shell
curl https://api.withsuperpay.com/v1/conversions/quotes/fxq_01M2FPWJ40B1MVJFJRHGFWTP27 \
  -H "Authorization: Bearer $SUPERPAY_TOKEN"

There is no endpoint to list quotes.

Decline a quote#

POST/v1/conversions/quotes/{id}/rejectfx:quote

Tells Superpay you will not take an ACTIVE quote. It becomes REJECTED and can no longer be accepted. Returns 200 OK with the quote.

Shell
curl -X POST https://api.withsuperpay.com/v1/conversions/quotes/fxq_01M2FPWJ40B1MVJFJRHGFWTP27/reject \
  -H "Authorization: Bearer $SUPERPAY_TOKEN"
  • No body and no Idempotency-Key. Repeating it is safe: a quote that is already REJECTED or EXPIRED is returned unchanged, with 200.
  • A quote that a conversion has used returns 409 QUOTE_CONSUMED.
  • Declining is optional: a quote you ignore simply expires.

The quote object#

FieldTypeDescription
objectstringAlways fx_quote.
idstringfxq_ followed by 26 characters.
statusstringACTIVE, PENDING_OTC, EXPIRED, CONSUMED or REJECTED. See Quote statuses.
sellmoneyThe amount you sell, spread included.
buymoneyThe amount an executed conversion credits to you.
rateobjectvalue: decimal string with 8 decimal places, buy units per sell unit after the spread. base: the sell currency. quote: the buy currency.
spreadmoneySuperpay's spread, in the sell currency. Included in sell.
spread_bpsintegerThe spread in basis points.
originstringAPI: priced automatically when you asked. OTC: priced by Superpay's dealing desk.
expires_atstringWhen the quote stops being acceptable. UTC, whole seconds, e.g. 2026-09-30T10:21:00Z.
livemodebooleantrue for live credentials, false for test.
created_atstringWhen you asked for the quote. UTC, whole seconds.

Quote statuses#

StatusMeaningWhat you do
ACTIVEPriced and acceptable until expires_at.Accept it before expires_at, or decline it.
PENDING_OTCWaiting for Superpay's dealing desk to price it.Retrieve it until it is ACTIVE.
EXPIREDexpires_at passed without an acceptance. Final.Request a new quote.
CONSUMEDA conversion was created from it. Final, even after expires_at.Track the conversion.
REJECTEDYou declined it. Final.Request a new quote if you need one.
FromTo
ACTIVECONSUMED, REJECTED or EXPIRED
PENDING_OTCACTIVE or EXPIRED

Each quote backs at most one conversion.

Accept a quote#

POST/v1/conversionsfx:execute

Accepts an ACTIVE quote at exactly its quoted amounts, and creates the conversion. The quote becomes CONSUMED in the same step.

quote_idstringRequired

The fxq_ id of an ACTIVE quote created with credentials in the same mode.

Before it creates the conversion, Superpay checks that your custody account can fund it:

  1. Your business verification is ACTIVE.
  2. It works out the shortfall: the quote's sell less any USD already available in your balance.
  3. One wallet on its own holds at least the shortfall, read live. If none does, the request returns 422 CUSTODY_BALANCE_INSUFFICIENT, and its detail gives the largest single wallet's balance.

It does not move or reserve anything yet.

Shell
curl https://api.withsuperpay.com/v1/conversions \
  -H "Authorization: Bearer $SUPERPAY_TOKEN" \
  -H "Idempotency-Key: 9a2e7d14-5c3b-4f8e-a1d6-0b7c4e2f9d53" \
  -H "Content-Type: application/json" \
  -d '{ "quote_id": "fxq_01M2FPWJ40B1MVJFJRHGFWTP27" }'

The response carries Location: /v1/fx/orders/{id}, the older name of /v1/conversions/{id}. A new conversion is always CREATED.

Then, in the background, Superpay works out the shortfall again and pulls it from the first of your wallets that holds it, credits it to your balance in USD, reserves the whole sell and runs the conversion. The pull appears in your custody account's pulls.

Retrieve a conversion#

GET/v1/conversions/{id}fx:read

Returns the conversion's current state. Its object is fx_order.

idstringRequired

Path parameter. An fxo_ id.

Shell
curl https://api.withsuperpay.com/v1/conversions/fxo_01M2FPY3K8D5N2Q7R9S4T6V8WX \
  -H "Authorization: Bearer $SUPERPAY_TOKEN"

There is no endpoint to list or cancel conversions.

The conversion object#

FieldTypeDescription
objectstringAlways fx_order.
idstringfxo_ followed by 26 characters.
quote_idstringThe quote this conversion executes.
statusstringCREATED, EXECUTING, UNKNOWN, EXECUTED or FAILED. See Conversion statuses.
sellmoneyCopied from the quote. Reserved, then debited, from your USD balance.
buymoneyCopied from the quote. Credited to your INR balance on EXECUTED.
spreadmoneyCopied from the quote. Included in sell.
failure_reasonstringWhy the conversion failed. Present only when status is FAILED. See Failure reasons.
livemodebooleantrue for live credentials, false for test.
created_atstringUTC timestamp, whole seconds.
executed_atstringWhen the conversion was recorded as executed. Present only when status is EXECUTED.

The conversion does not repeat the rate. Read it from the quote.

Conversion statuses#

CREATEDEXECUTINGEXECUTED
StatusMeaningWhat you do
CREATEDAccepted. Superpay is pulling the shortfall from your custody account. Nothing is reserved yet.Wait. It usually moves on within seconds, once Superpay's custody partner accepts the pull.
EXECUTINGsell is reserved from your USD balance and the conversion is in progress.Wait.
UNKNOWNThe outcome of the conversion is not confirmed yet. Superpay is confirming it with its banking partner. sell stays reserved.Keep waiting. Don't create a replacement conversion. If it stays UNKNOWN for more than 24 hours, contact support with the conversion id.
EXECUTEDDone. buy is in your INR available balance. Final.Use the funds for payouts.
FAILEDNot converted. Final.Read failure_reason. Request a new quote to try again.
FromTo
CREATEDEXECUTING, or FAILED with INSUFFICIENT_FUNDS or a CUSTODY_ reason
EXECUTINGEXECUTED, FAILED or UNKNOWN
UNKNOWNEXECUTED or FAILED

EXECUTED and FAILED never change. A conversion does not expire and cannot be cancelled.

Failure reasons#

failure_reason starts with a code. Match on the code, the part before any : . Any text after it is informational and can change. Events carry the code alone.

CodeMeaningYour balanceWhat you do
CUSTODY_ACCOUNT_REQUIREDYou have no custody account to fund the conversion.Nothing moved.Submit your business verification. If you are verified with the form, wait for your people to submit it.
CUSTODY_KYB_PENDINGYour business verification is not ACTIVE yet.Nothing moved.Wait for it, or supply what it asks for.
CUSTODY_ACCOUNT_REJECTEDYour business verification was rejected.Nothing moved.See business verification.
CUSTODY_BALANCE_INSUFFICIENTNo single wallet held the shortfall when the pull was made.Nothing moved.Deposit more, then request a new quote.
CUSTODY_TRANSFER_FAILEDSuperpay's custody partner refused or could not make the pull.Nothing left your wallet.Request a new quote. Contact Superpay if it repeats.
INSUFFICIENT_FUNDSYour USD balance did not cover sell when it was reserved.Nothing was reserved.Request a new quote.
PROVIDER_REJECTEDThe conversion was declined, or could not be sent.The reserved USD returns to available.Request a new quote. Contact support if it repeats.
PROVIDER_FAILEDThe conversion failed during execution.The reserved USD returns to available.Request a new quote. Contact support if it repeats.

USD pulled for a conversion that then fails stays in your balance as available, and your next USD conversion spends it first. It is not returned to your custody account automatically: ask Superpay if you want it back. See also Failures on objects.

Effect on balances#

Read balances with GET /v1/balances. Using the example above, with no USD in your balance and 12,500.00 USD in your chosen wallet:

Conversion statusUSD availableUSD reservedWallet balanceINR available
Before accepting0012500000
CREATED001250000 until the pull0
EXECUTING or UNKNOWN010000011500000
EXECUTED0011500008308250
FAILED with a CUSTODY_ reason0012500000
FAILED after the pull100000011500000
  • The whole sell, spread included, is reserved and then debited.
  • The credit is exactly the quoted buy. It does not move with the market after the quote.
  • A quote on its own never changes a balance.
  • A currency you have never held is absent from GET /v1/balances rather than listed as 0. INR first appears once a conversion is EXECUTED.

Track a conversion#

Superpay sends fx.executed or fx.failed when a conversion ends. Subscribe a webhook to fx.*, or poll GET /v1/conversions/{id} every few seconds, backing off if it stays CREATED, EXECUTING or UNKNOWN. No event announces EXECUTING or UNKNOWN: if neither event has arrived when you expect, retrieve the conversion.

Idempotency and retries#

Creating a quote and accepting one require an Idempotency-Key: 16 to 64 printable ASCII characters, no spaces. A UUID works. The full rules are in Idempotency.

  • Lost response. Resend the same body with the same key, on the same path. You get the original response with the header Idempotent-Replayed: true. For conversions this is the only way to recover one: a new key on the same quote returns 409 QUOTE_CONSUMED, and conversions cannot be looked up by quote.
  • Replays are snapshots. A replayed quote can still say ACTIVE, and a replayed conversion can still say CREATED. Call the GET endpoint for the current state.
  • One key, one request. A key reused with a different body, or on a different path, returns 409 IDEMPOTENCY_KEY_REUSED. Use separate keys for the quote and the acceptance.
  • 4xx responses are stored. Resending with the same key returns the same error, e.g. QUOTE_EXPIRED or CUSTODY_KYB_PENDING, even once its cause has gone. After you change the request, or the cause clears, use a new key.
  • 5xx responses are not stored. Retry PROVIDER_UNAVAILABLE, CUSTODY_UNAVAILABLE and INTERNAL with the same key.

Errors#

Errors are problem documents. Branch on code; detail is human-readable and can change. Authentication, scope and idempotency errors are the same on every endpoint and are listed on Errors.

422 Unprocessable Entity
{
  "type": "about:blank",
  "title": "FAILED_PRECONDITION",
  "status": 422,
  "detail": "the quote has expired; request a new one",
  "instance": "/v1/conversions",
  "code": "QUOTE_EXPIRED",
  "request_id": "req_01M2FPZ6A1C3E5G7J9K2M4N6P8"
}

Create a quote errors#

CodeHTTPWhenWhat you do
REQUEST_BODY_INVALID400The body is empty or not valid JSON, has an unknown field or a field of the wrong JSON type, or has a money object with an extra key, an amount that is not a JSON integer, or a currency that is not 3 to 5 uppercase letters.Fix the body. Resend with a new key.
INVALID_ARGUMENT400A field failed validation. errors[] names each field: a currency code that is not 3 to 5 uppercase letters, the same currency on both sides, neither or both of sell_amount and buy_amount (reported on sell_amount), or an amount that is not positive or not in its side's currency.Fix the fields. Resend with a new key.
CURRENCY_UNSUPPORTED400A well-formed currency code that Superpay does not know.Sell USD and buy INR. Resend with a new key.
AMOUNT_TOO_SMALL400sell_amount does not cover the spread.Increase the amount. Resend with a new key.
QUOTE_UNAVAILABLE422Superpay's banking partner cannot price this request, e.g. sell_currency is one it does not sell, such as USDC or USDT, the pair or amount is not supported, or buy_amount was sent for a quote the dealing desk does not price.Sell USD, or change the request. Resend with a new key.
PROVIDER_UNAVAILABLE503Pricing is temporarily unavailable, or the price received had already expired. No quote is created. retryable is true and Retry-After is 5.Retry with the same key.
QUOTE_INCONSISTENT500The price could not be used, for example because the amount converts to less than one minor unit.Retry with the same key. If it persists, change the amount or contact support.

A USD quote can also return the first three custody errors.

Custody errors#

Returned when a quote selling USD, or its acceptance, cannot be funded from your custody account.

CodeHTTPEndpointWhenWhat you do
CUSTODY_ACCOUNT_REQUIRED422Quote, acceptYou have no business verification in this mode: nothing was submitted, through the API or the form.Submit it, or wait for business.verification_updated if you are verified with the form. Then deposit stablecoins.
CUSTODY_KYB_PENDING422Quote, acceptYour business verification is not ACTIVE yet. sub_code is KYC_PENDING, or KYC_REQUIREMENTS_DUE with requirements_due listing the documents it needs.Wait for ACTIVE, or upload the documents. Then ask again with a new key.
CUSTODY_ACCOUNT_REJECTED422Quote, acceptYour business verification was rejected. sub_code holds its reason code.See business verification.
CUSTODY_BALANCE_INSUFFICIENT422AcceptNo single wallet holds the shortfall. sub_code is CUSTODY_BALANCE_INSUFFICIENT.Deposit more into one wallet, or convert a smaller amount. Use a new key.
CUSTODY_UNAVAILABLE503AcceptSuperpay's custody partner did not answer. retryable is true and Retry-After is 5.Retry with the same key.

Accept a quote errors#

CodeHTTPWhenWhat you do
REQUEST_BODY_INVALID400The body is empty or not valid JSON, has an unknown field, or quote_id is not a JSON string.Fix the body. Resend with a new key.
INVALID_ARGUMENT400quote_id is missing or is not a well-formed fxq_ id.Send a real quote id. Resend with a new key.
QUOTE_NOT_FOUND404No quote with this id for your credentials, including a quote from the other mode.Check the id and mode. Resend with a new key.
QUOTE_CONSUMED409The quote already has a conversion.If you are retrying your own request, resend it with its original key to get the conversion. Otherwise request a new quote.
QUOTE_EXPIRED422expires_at has passed.Request a new quote and accept it before its expires_at, with a new key.
QUOTE_PENDING_OTC422The dealing desk has not priced the quote yet.Wait until it is ACTIVE, then accept it with a new key.
QUOTE_REJECTED422You declined the quote.Request a new quote.

It can also return the custody errors. A problem with the quote itself is reported before a custody error.

Decline a quote errors#

CodeHTTPWhenWhat you do
QUOTE_NOT_FOUND404No quote with this id for your credentials. Also returned for a malformed id, or a quote from the other mode.Check the id and mode.
QUOTE_CONSUMED409A conversion already used the quote.Nothing to decline. Track the conversion.

Retrieve errors#

CodeHTTPWhenWhat you do
QUOTE_NOT_FOUND404Retrieve a quote: no quote with this id for your credentials. Also returned for a malformed id, or a quote from the other mode.Check the id and which credentials you are using.
FX_ORDER_NOT_FOUND404Retrieve a conversion: no conversion with this id for your credentials. Also returned for a malformed id, or a conversion from the other mode.Check the id and which credentials you are using.

Test and live are separate: quotes and conversions created with test credentials are not visible with live credentials. See Test mode and live mode and Testing.