Conventions

Conventions

The rules every request follows, from money and IDs to idempotency and pagination.

Every Superpay object follows the same rules. One example shows most of them.

Shell
curl https://api.withsuperpay.com/v1/conversions/quotes/fxq_01M2FPWJ40B1MVJFJRHGFWTP27 \
  -H "Authorization: Bearer $SUPERPAY_TOKEN"
ConventionIn the example
object names the type"object": "fx_quote"
IDs are prefixedfxq_01M2FPWJ40B1MVJFJRHGFWTP27
Money is an integer in minor units"amount": 100000 is 1,000.00 USD
Rates are decimal strings"value": "83.08250000"
Timestamps are RFC 3339, UTC"2026-09-30T10:20:00Z"
livemode says which modefalse in test mode

Base URL#

WhatURL
API resourceshttps://api.withsuperpay.com/v1/...
Access tokenshttps://api.withsuperpay.com/oauth2/token
  • Use HTTPS. Every response carries Strict-Transport-Security.
  • One host for test and live. Your credentials pick the mode, not the URL. See Test mode and live mode.
  • Paths are exact. A trailing slash (/v1/payouts/) or an unsupported method returns 404 UNKNOWN_ENDPOINT. The API never returns 405.
  • Every /v1 request is authenticated before the route is matched. A bad token on an unknown path returns 401, not 404.
  • Call the API from your servers. It sends no CORS headers, so browsers cannot call it directly.

Requests#

Shell
curl https://api.withsuperpay.com/v1/payouts \
  -H "Authorization: Bearer $SUPERPAY_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 3f6c9a4e-2b1d-4c8e-9f7a-5d2e1b0c4a67" \
  -d '{
    "originator_id": "org_01M2FPKH20W4N5X6M3P9R2T1VA",
    "beneficiary_id": "ben_01M2FPNHGG6C8D0F2H4K6M8P0R",
    "amount": { "amount": 5000000, "currency": "INR" },
    "purpose_code": "P1301",
    "reference": "INV-2026-0042"
  }'
  • Bodies are one JSON object. Send Content-Type: application/json.
  • Field names are snake_case. Use them exactly as documented.
  • Unknown fields are rejected, including inside nested objects. A typo fails loudly instead of being dropped.
  • Query parameters you misspell are ignored, not rejected. Check them.

Exceptions to JSON bodies:

EndpointBody
POST /oauth2/tokenForm-encoded. See Authentication
The three document uploadsmultipart/form-data
POST /v1/payouts/{id}/cancel, POST /v1/conversions/quotes/{id}/rejectNone
POST /v1/webhook-subscriptions/{id}/rotate-secretOptional
CodeHTTPWhen
REQUEST_BODY_INVALID400Empty body, malformed JSON, an unknown field, a value of the wrong JSON type, data after the JSON object, or a null in a correction (PATCH)
REQUEST_BODY_TOO_LARGE400A JSON body larger than 1 MiB. Document uploads have their own limit
INVALID_ARGUMENT400One or more fields or query parameters failed validation. The failing fields are listed in errors, each with a code, message and field

detail and each error's message are for people. Branch on code. See Errors.

Corrections and updates#

EndpointHow it merges
PATCH /v1/originators/{id}, PATCH /v1/beneficiaries/{id}Send only what changes. A field left out is unchanged; "" clears an optional field; null is refused. An originator's and a beneficiary's address and id_document are replaced whole; a beneficiary's account takes only the fields you send, and its date_of_birth and nationality cannot be emptied
POST /v1/webhook-subscriptions/{id}Send only what changes. A field left out, or sent as null, is unchanged

Responses#

  • Successful bodies are JSON. Errors are problem documents, described in Errors.
  • Every resource has an object field naming its type, and a livemode field.
  • Optional fields with no value are left out. Two kinds of object send null instead: webhook subscriptions and their deliveries. A custody wallet's balance is null when it could not be read.
StatusReturned by
200 OKReads, lists, corrections (PATCH), POST /v1/payouts/{id}/cancel, quote rejection, webhook subscription updates and secret rotations, POST /oauth2/token, and a repeated business verification, custody account opening or document upload
201 CreatedCreates. Most also send a Location header with the new object's path, e.g. /v1/payouts/po_01M2FPYTCG9B1D3F5H7K9M1P3R. Quotes, business verification, the custody account and document uploads do not
202 AcceptedPOST /v1/webhook-subscriptions/{id}/deliveries, which queues a redelivery
204 No ContentDELETE /v1/beneficiaries/{id} and DELETE /v1/webhook-subscriptions/{id}. No body
objectResource
business_verificationBusiness verification
custody_accountCustody account
fx_quote, fx_orderConversions
balance, treasury_capacity, treasury_fundingBalances
originatorOriginators
beneficiaryBeneficiaries
party_verificationVerification
kyc_documentDocuments
payoutPayouts
eventEvents
webhook_subscription, webhook_deliveryWebhooks
listA page of objects. See Pagination

Most work is asynchronous: verifications, conversions and payouts progress after the request returns. Follow them with webhooks, or by polling each object's GET endpoint.

Money#

Every amount is an object with an integer in the currency's minor units.

JSON
{ "amount": 5000000, "currency": "INR" }
CurrencyDecimal places1 unit isExample
INR2100₹50,000.00 = 5000000
USD21001,000.00 USD = 100000

USDC and USDT, with 6 decimal places, appear only in stablecoin fundings made before custody accounts. Custody wallet balances are shown in USD.

DoDon't
"amount": 5000000"amount": "5000000"
"amount": 5000000"amount": 50000.00 or "amount": 5e6
"currency": "INR""currency": "inr"
  • amount must be a bare JSON integer. Strings, decimals, exponents and a leading + are rejected with 400 REQUEST_BODY_INVALID.
  • currency is an upper-case code.
  • Amounts you send must be positive. Zero or negative amounts fail validation on that field.
  • Never use floating point. Keep amounts as integers (BigInt in JavaScript, int in Python, int64 in Go) and convert to decimals only for display.

Rates#

Exchange rates are objects with a decimal string, never a number.

JSON
{ "value": "83.08250000", "base": "USD", "quote": "INR" }

value is how many units of quote one unit of base buys. Parse it with a decimal type. See Conversions.

Identifiers#

po_01M2FPYTCG9B1D3F5H7K9M1P3R: a type prefix, an underscore, then a 26-character ULID.

PrefixObject
cus_Business verification, and the custody account it opened
ctr_A pull from your custody account
fxq_Quote
fxo_Conversion (FX order)
org_Originator
ben_Beneficiary
kyd_Document
po_Payout
evt_Event
whs_Webhook subscription
whd_Webhook delivery
tf_Stablecoin funding
req_Request ID
cli_API client ID (your credentials)
  • IDs are time-ordered: the ULID starts with its creation time in milliseconds, so a newer ID sorts after an older one. Most lists use them as cursors. Events are the exception: they are listed in publication order, not ID order.
  • Treat IDs as opaque, case-sensitive strings. Store them exactly as received.
  • A malformed ID in a path returns the resource's not-found error, e.g. 404 PAYOUT_NOT_FOUND, not a 400. One exception: POST /v1/originators/{id}/beneficiaries reports a malformed originator ID as a 400 field error on originator_id.
  • An ID from the other mode, or from another account, also returns not found.

Timestamps#

JSON
"created_at": "2026-09-30T10:20:00Z"
  • RFC 3339, in UTC, with a Z suffix and whole seconds.
  • Date-only fields, such as date_of_birth and id_document.expires_on, are YYYY-MM-DD.
  • One exception: on payout capacity, banking_window.next_open and banking_window.next_cutoff are in the banking window's local time with its UTC offset, e.g. 2026-10-01T09:30:00+05:30. banking_window.zone names the time zone.
  • Webhook requests carry Webhook-Timestamp in Unix seconds. See Webhooks.

Parse every timestamp with an RFC 3339 parser that honours offsets.

Test mode and live mode#

Test modeLive mode
Client secret starts withsk_test_sk_live_
livemode on objects and tokensfalsetrue
  • The mode comes from the credentials used to get the access token. No header, parameter or path changes it.
  • Test and live data are fully separate: business verification, custody account, balances, parties, conversions, payouts, events and webhook subscriptions alike. Objects created in one mode are invisible in the other.
  • Idempotency keys are separate per mode too.
  • Every object carries livemode. The list envelope does not; each item in data does.

See Authentication and Testing.

Idempotency#

Retry a create safely. It runs once, however many times you send it.

HTTP
Idempotency-Key: 3f6c9a4e-2b1d-4c8e-9f7a-5d2e1b0c4a67

When to send a key#

Required on these requests:

EndpointScope
POST /v1/business-verificationtreasury:manage
POST /v1/conversions/quotesfx:quote
POST /v1/conversionsfx:execute
POST /v1/originatorsoriginators:write
PATCH /v1/originators/{id}originators:write
POST /v1/originators/{id}/beneficiariesbeneficiaries:write
POST /v1/beneficiariesbeneficiaries:write
PATCH /v1/beneficiaries/{id}beneficiaries:write
POST /v1/payoutspayouts:write
POST /v1/payouts/{id}/cancelpayouts:write
POST /v1/webhook-subscriptionswebhooks:manage
POST /v1/webhook-subscriptions/{id}webhooks:manage
POST /v1/webhook-subscriptions/{id}/rotate-secretwebhooks:manage
POST /v1/webhook-subscriptions/{id}/deliverieswebhooks:manage
POST /v1/fx/quotes, POST /v1/fx/orders, the older names of the conversion routesfx:quote, fx:execute
POST /v1/treasury/fundings, retiredtreasury:manage

Not taken, and ignored if you send one:

  • GET and DELETE requests. DELETE is safe to repeat: it returns 204 again.
  • The three document uploads, which are idempotent by content.
  • POST /v1/conversions/quotes/{id}/reject, which is safe to repeat.
  • POST /v1/custody/account, which returns the existing account when repeated.
  • POST /oauth2/token. Each call issues a new token.

Key format#

  • 16 to 64 characters.
  • Printable ASCII only. No spaces.
  • Use a UUID. Generate one per operation, not per attempt.

What counts as the same request#

A retry matches the original when all of these are equal:

PartCompared as
Method and pathExactly. A key belongs to one path: a key used on /v1/fx/quotes cannot be replayed on /v1/conversions/quotes
JSON bodyBy content. Key order and whitespace don't matter. Values, number spelling (1 vs 1.0) and field-name casing do
ModeTest and live keys never collide

Query strings and headers are not compared. For POST /v1/payouts/{id}/cancel, send the same body on every attempt; an empty body and {} are different requests.

Keys are shared by every credential on your account, per mode. Two systems using different credentials on one account still share one key space, so a key one of them used is taken for the other. UUIDs avoid collisions.

Outcomes#

You sendYou get
A new keyThe request runs. Normal response
The same key and request, after it finished with a 2xx or 4xxThe stored response: same status, same body, plus Idempotent-Replayed: true
The same key and request, while the first is still running409 RESOURCE_LOCKED, "retryable": true. Retry shortly with the same key
The same key with a different request409 IDEMPOTENCY_KEY_REUSED. Use a new key
No key400 IDEMPOTENCY_KEY_REQUIRED
A key of the wrong length or with invalid characters400 IDEMPOTENCY_KEY_INVALID
Replayed response
HTTP/1.1 201 Created
Content-Type: application/json
Location: /v1/payouts/po_01M2FPYTCG9B1D3F5H7K9M1P3R
Idempotent-Replayed: true
X-Request-Id: req_01M2FPYWB0HQWV1N8F1VM1C2BH

A replay shows the object as it was when first created. A payout replayed an hour later still shows its original status. GET the object for its current state.

A replay only restores Content-Type and Location. X-Request-Id is the retry's own ID, while a replayed error body keeps the original request_id.

A replay of a webhook subscription's create or secret rotation shows the same signing secret again. That is the only way to see a secret twice.

Errors are replayed too#

The response is stored once the request finishes with any 2xx or 4xx. A 400 validation error, a 404, 409 REFERENCE_EXISTS, a 410 or a 422 is replayed on every retry with that key.

Fixed the request? Use a new key.

Resending a corrected body with the old key returns 409 IDEMPOTENCY_KEY_REUSED. Resending the same body with the old key replays the old error, even if the condition behind a 422 has since cleared.

These are not stored. Fix the cause and retry with the same key:

  • 401 and 403 errors from a missing or invalid token, or a missing scope
  • 400 IDEMPOTENCY_KEY_REQUIRED, 400 IDEMPOTENCY_KEY_INVALID, 400 REQUEST_BODY_TOO_LARGE
  • 409 IDEMPOTENCY_KEY_REUSED and 409 RESOURCE_LOCKED
  • Any 5xx

Timeouts and server errors#

Retry with the same key.

  • After a 5xx, the retry runs the request again. If the failed attempt had already created the object, the retry returns that object instead of creating a second one.
  • After a timeout or dropped connection, the original may still be running. Retries get 409 RESOURCE_LOCKED for up to about a minute. Keep retrying with backoff.
  • If the original was interrupted after creating the object, a later retry returns that object with Idempotent-Replayed: true. It shows the object's current state.
  • Quotes are the exception. If a quote request is interrupted before its response is stored, a retry with the same key may price and return a new quote. Quotes move no money and expire on their own.
CodeHTTPWhenWhat to do
IDEMPOTENCY_LEASE_LOST409The original attempt ran for over a minute and a retry with the same key took it overRetry with the same key to get that result
IDEMPOTENCY_RECOVERY_FAILED503A retry of an interrupted request could not complete. "retryable": trueWait Retry-After seconds, then retry with the same key

Retention#

A key's stored response is kept for 24 hours from its first request. After that the key is forgotten, and sending it again starts a new request. Treat a key as permanently bound to its first request and never reuse one.

Retry pattern#

Node.js
import { randomUUID } from 'node:crypto';

export async function createPayout(payout, getToken) {
  const key = randomUUID(); // once per payout, reused on every attempt
  const body = JSON.stringify(payout); // identical bytes on every attempt

  for (let attempt = 0; attempt < 6; attempt++) {
    let res = null;
    try {
      res = await fetch('https://api.withsuperpay.com/v1/payouts', {
        method: 'POST',
        headers: {
          Authorization: `Bearer ${await getToken()}`,
          'Content-Type': 'application/json',
          'Idempotency-Key': key,
        },
        body,
      });
    } catch {
      // Network error: the payout may exist. Retry with the same key.
    }

    if (res && res.status < 400) return res.json();
    if (res && res.status < 500 && res.status !== 401) {
      const problem = await res.json();
      const retry = problem.retryable || problem.code === 'IDEMPOTENCY_LEASE_LOST';
      if (!retry) throw problem; // Fix the request, then send it with a new key.
    }

    const retryAfter = Number(res?.headers.get('Retry-After')) * 1000;
    await new Promise((r) => setTimeout(r, retryAfter || 250 * 2 ** attempt));
  }
  throw new Error(`Gave up. Retry later with Idempotency-Key ${key}`);
}

getToken should return a cached token and fetch a new one when it has expired. A 401 is never stored, so retrying it with a fresh token and the same key is safe.

Pagination#

These lists are paged. All return newest first.

EndpointCursorsFilters
GET /v1/payoutsstarting_after, ending_beforestatus, beneficiary_id. See Payouts
GET /v1/eventsstarting_after, ending_beforetype, resource_id. See Events
GET /v1/webhook-subscriptionsstarting_after, ending_beforestatus
GET /v1/webhook-subscriptions/{id}/deliveriesstarting_after, ending_beforestatus, event_id, event_type, kind
GET /v1/treasury/fundingsstarting_afterNone

GET /v1/balances uses the same envelope but returns everything in one page: its has_next is always false. The document lists return the newest 100 documents with no cursors.

Parameters#

limitinteger

Items per page, 1 to 100. Default 10. A value that is not an integer from 1 to 100 returns 400 INVALID_ARGUMENT with a parameter_range_invalid error on limit.

starting_afterstring

An object ID. Returns the page of objects older than it. Pass the id of the last item in data to get the next page.

ending_beforestring

An object ID. Returns the page of objects newer than it, still newest first. Pass the id of the first item in data to go back a page. Sending both cursors returns 400 INVALID_ARGUMENT with a parameter_value_invalid error on starting_after.

The list object#

Shell
curl "https://api.withsuperpay.com/v1/payouts?limit=2" \
  -H "Authorization: Bearer $SUPERPAY_TOKEN"
FieldTypeDescription
objectstringAlways list
dataarrayThe page of objects. [] when empty, never null
has_nextbooleantrue when another, older page exists

There is no total count and no next-page URL. Walk the list with the last id.

  • With ending_before, has_next is always true, because the older pages you came from still exist. It cannot tell you that you reached the newest page; stop when data has fewer items than limit, or, for events, when it is empty.
  • Payout and funding cursors are compared, not looked up: an unknown ID still returns the objects before or after it, which may be an empty page. Event cursors must be published events of yours from the last 30 days, and webhook cursors must be well-formed whs_ or whd_ IDs.

Fetch everything#

Node.js
async function* allPayouts(token) {
  let cursor;
  while (true) {
    const qs = new URLSearchParams({ limit: '100' });
    if (cursor) qs.set('starting_after', cursor);
    const res = await fetch(`https://api.withsuperpay.com/v1/payouts?${qs}`, {
      headers: { Authorization: `Bearer ${token}` },
    });
    const page = await res.json();
    if (!res.ok) throw page; // a problem document
    yield* page.data;
    if (!page.has_next) return;
    cursor = page.data.at(-1).id;
  }
}

Request IDs#

Every response carries an X-Request-Id header. Log it, and quote it when you contact Superpay.

HTTP
X-Request-Id: req_01M2FPWK38HE29JN297FGY8D2J
  • Send your own X-Request-Id to tie our logs to yours. It must be 1 to 128 characters of letters, digits, _, ., : or -.
  • If you send none, or one that breaks those rules, Superpay replaces it with a req_ ID. An invalid value is not an error.
  • Problem documents repeat it as request_id. A replayed error body keeps the request_id of the original request.

Headers#

Request headers#

HeaderWhen
Authorization: Bearer <token>Every /v1 request. See Authentication
Content-Typeapplication/json with a JSON body. multipart/form-data for document uploads
Idempotency-KeyThe requests in When to send a key
X-Request-IdOptional. See Request IDs

Response headers#

HeaderWhen
X-Request-IdAlways
Content-Typeapplication/json on success bodies (a 204 has no body), application/problem+json on /v1 errors. Token endpoint errors are application/json; see Authentication
LocationMost 201 creates and the 202 redelivery. A path, not a full URL. POST /v1/conversions points at /v1/fx/orders/{id}, which serves the same object as /v1/conversions/{id}
Idempotent-Replayed: trueThe response is a stored replay
Retry-After503 responses. Seconds to wait before retrying
WWW-Authenticate401 responses
Cache-Control: no-storeAll /v1 responses. Do not cache them
X-Content-Type-Options: nosniffAll responses

Versioning#

  • The version is in the path: /v1. There is no version header and no per-request version pinning.
  • Build tolerant clients: ignore response fields you don't recognise, and handle status values you don't recognise without crashing.
  • Branch on error code, never on title or detail.
  • Events have their own rules for how they change.

These older forms still work, so existing integrations keep running:

Older formNowStatus
/v1/fx/quotes, /v1/fx/quotes/{id}, /v1/fx/orders, /v1/fx/orders/{id}/v1/conversions/quotes, /v1/conversions/quotes/{id}, /v1/conversions, /v1/conversions/{id}Same objects and behaviour. Use the new paths
POST /v1/custody/accountPOST /v1/business-verificationDeprecated
Corridor IN-NREIN-INR-BANKAccepted as a corridor value. Payouts created before the change keep IN-NRE
POST /v1/treasury/fundingsDeposit into custodyRetired: announcing a USDC or USDT funding returns 410