SettlraSettlra/Docs
DashboardAPI Playground

Quotes API

A quote locks in an exchange rate for a USDC → local currency conversion. Create a quote before initiating a payout. Quotes are valid for 5 minutes and can only be used once.

POST/v1/quotes

Create a new FX quote. Returns the locked rate and a quote ID to use when creating a payout.

Create a quote

Request body

FieldTypeRequiredDescription
source_amount_usdcnumberYesAmount in whole USDC (e.g., 100 = $100). Min: 0.01
target_currencystringYesTarget fiat currency code. One of: UGX, KES, NGN, GHS, TZS
idempotency_keystringYesUnique key to deduplicate requests. Max 128 chars.

Response

FieldTypeDescription
quote_idstringUnique quote identifier. Use this when creating a payout.
source_currencystringAlways "USDC"
target_currencystringThe requested target currency.
source_amountnumberAmount in USDC being converted.
target_amountnumberAmount in target currency the recipient will receive.
exchange_ratenumberLocked rate: target currency units per 1 USDC (inclusive of spread).
spread_percentnumberSettlra's margin, e.g. 0.01 = 1%.
statusstringACTIVE, LOCKED, USED, or EXPIRED
expires_atstringISO 8601 timestamp. Quote expires 5 minutes after creation.
created_atstringISO 8601 timestamp.

curl example

bash
"color:#ff7b72">curl "color:#79c0ff">-X POST https://api-sandbox.settlra.com/v1/quotes \
  "color:#79c0ff">-H "Authorization: Bearer sk_sandbox_your_key" \
  "color:#79c0ff">-H "Content-Type: application/json" \
  "color:#79c0ff">-d '{
    "source_amount_usdc": 500,
    "target_currency": "UGX",
    "idempotency_key": "quote-abc123"
  }'

Node.js example

javascript
"color:#ff7b72">const quote = "color:#ff7b72">await fetch('https://api-sandbox.settlra.com/v1/quotes', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.SETTLRA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    source_amount_usdc: 500,
    target_currency: 'UGX',
    idempotency_key: 'quote-abc123',
  }),
}).then(r => r.json());

Response example

json
{
  "quote_id": "q_01j3ab4cd5ef6gh7ij8kl9mn0p",
  "source_currency": "USDC",
  "target_currency": "UGX",
  "source_amount": 500,
  "target_amount": 1871250,
  "exchange_rate": 3742.5,
  "spread_percent": 0.01,
  "status": "ACTIVE",
  "expires_at": "2024-07-01T12:05:00.000Z",
  "created_at": "2024-07-01T12:00:00.000Z"
}
GET/v1/quotes/:id

Retrieve a quote by ID to check its current status.

Get a quote

Path parameters

ParameterTypeDescription
idstringThe quote_id returned when the quote was created.
bash
"color:#ff7b72">curl https://api-sandbox.settlra.com/v1/quotes/q_01j3ab4cd5ef6gh7ij8kl9mn0p \
  "color:#79c0ff">-H "Authorization: Bearer sk_sandbox_your_key"

Quote lifecycle

Quotes transition through these states:

StatusDescription
ACTIVERate is locked and the quote can be used to create a payout.
LOCKEDA payout has been created with this quote; it is no longer available.
USEDThe payout was successfully initiated using this quote.
EXPIREDThe 5-minute TTL elapsed. Create a new quote.

Error responses

Error codeHTTP statusCause
VALIDATION_ERROR400Missing or invalid request fields.
QUOTE_NOT_FOUND404No quote with the given ID exists for your account.
DUPLICATE_IDEMPOTENCY_KEY409Same idempotency key used with different parameters.
RATE_LIMIT_EXCEEDED429Too many quote requests.