Docs
llms.txt for AI agents Download OpenAPI spec

API Endpoints

Every HTTP route your platform needs to integrate Crebit Lock, with full request & response schemas, allowed-value dropdowns, and clickable sample payloads. Sandbox base URL: https://lock-apis-sandbox.crebitpay.com.

The flow, every HTTP call
YouRegister Customer

Register an opaque customer id before quoting.

You POST your stable customer_reference_id (unique per partner, no PII). Crebit stores the mapping so quotes and contracts can reference the same customer.
POST /fx/customer-references
YouQuote

Price a rate lock for your customer over a time window.

You POST the trade (notional_currency, direction, notional_amount), a market_rate benchmark, the lock window, settlement rail, and a strike_mode (cip_fair / live_spot / custom). Crebit returns the priced quote with the locked_rate and strike_advantage_bps vs market.
POST /fx/quotes
YouLock

Turn the accepted quote into a binding contract.

You POST the quote_id the customer accepted. Crebit creates an immutable contract carrying the lock window, chain, settlement currency, and locked rate. The response includes the funding_wallet_address - send your deposit/premium there to activate the lock.
POST /fx/contracts
CustomerTransact

Customer transacts on your platform at the live spot rate.

No HTTP call on Crebit's side. You execute the trade at your live rate; the contract stays in active waiting for the next webhook.
YouTrigger Payout

Webhook tells Crebit the live rate and the customer's payout wallet.

You POST event_type=contract_exercised with live_execution_rate and payout_wallet_address. Crebit uses these to compute the FX delta owed.
POST /fx/webhooks/inbound
CrebitPay Out

Crebit sends the FX delta on-chain, then posts payout_success and contract_settled.

Crebit computes FX delta = notional × (live_execution_rate − locked_rate) (sign depends on direction), converts to settlement_currency, and transfers it on chain to the customer's wallet. You receive an outbound payout_success and contract_settled webhook with the on-chain transaction_hash.
Webhook → your URL

All Routes

MethodPathPurpose
GET/api/v1/partners/meVerify API credentials
POST/api/v1/fx/customer-referencesRegister a customer id
GET/api/v1/fx/customer-referencesList customer references
GET/api/v1/fx/customer-references/{customer_reference_id}Get one customer reference
POST/api/v1/fx/quotesRequest a rate-lock quote
GET/api/v1/fx/quotesList quotes (paginated)
GET/api/v1/fx/quotes/{quote_id}Fetch one quote
GET/api/v1/fx/supported-chainsList live/planned settlement chains
POST/api/v1/fx/contractsLock the quote (create contract)
GET/api/v1/fx/contractsList all FX contracts (paginated)
GET/api/v1/fx/contracts/{contract_id}Get full contract detail
PUT/api/v1/fx/contracts/{contract_id}/payout-destinationSave payout wallet before maturity
POST/api/v1/fx/contracts/{contract_id}/retryRecover a failed contract
GET/api/v1/fx/contracts/by-reference/{crebit_contract_reference}Poll contract status by human reference
GET/api/v1/fx/contracts/{contract_id}/statusPoll contract status by UUID
GET/api/v1/fx/contracts/{contract_id}/paymentsList premium/deposit payment legs
GET/api/v1/fx/contracts/{contract_id}/depositsList deposit movement history
GET/api/v1/fx/contracts/{contract_id}/payoutsList settlement payouts for a contract
POST/api/v1/fx/contracts/{contract_id}/settlement-previewPreview payout math before exercise
GET/api/v1/fx/customers/{customer_reference_id}/locksList FX locks for a customer
POST/api/v1/fx/webhooks/inboundNotify Crebit (funds, exercise)
GET/api/v1/fx/webhook-eventsAudit inbound + outbound webhook deliveries
GET/api/v1/fiat/profileFiat partner profile & readiness flags
GET/api/v1/fiat/bank-directoryUS bank routing directory
GET/api/v1/fiat/bank-accountsList payout bank accounts
POST/api/v1/fiat/bank-accountsCreate payout bank (PIX / ACH / wire / SWIFT / SEPA)
PUT/api/v1/fiat/bank-accounts/{bank_account_id}/swift-documentAttach/replace SWIFT relationship document
GET/api/v1/fiat/ordersCombined spot + forward orders list
POST/api/v1/fiat/spot/quote-previewLive spot rate preview
POST/api/v1/fiat/spot/quotesLock live spot quote & fees
POST/api/v1/fiat/spot/ordersCreate fiat spot order
GET/api/v1/fiat/spot/ordersList fiat spot orders
GET/api/v1/fiat/spot/orders/{order_id}Get fiat spot order detail
GET/api/v1/fiat/spot/orders/{order_id}/receiptDownload spot receipt PDF
GET/api/v1/fiat/spot/orders/{order_id}/shareGet spot shareable payment link
POST/api/v1/fiat/spot/orders/{order_id}/compliance-documentsSubmit SWIFT compliance docs
POST/api/v1/fiat/forward/quote-previewDeliverable forward details preview
POST/api/v1/fiat/forward/quotesLock deliverable forward quote
POST/api/v1/fiat/forward/ordersCreate deliverable forward order
GET/api/v1/fiat/forward/ordersList deliverable forward orders
GET/api/v1/fiat/forward/orders/{order_id}Get forward order detail
POST/api/v1/fiat/forward/orders/{order_id}/executeOpen remaining notional payin
POST/api/v1/fiat/forward/orders/{order_id}/confirm-payoutConfirm payout
GET/api/v1/fiat/forward/orders/{order_id}/receiptDownload forward receipt PDF
GET/api/v1/fiat/forward/orders/{order_id}/shareGet forward shareable payment link
POST/api/v1/fiat/forward/orders/{order_id}/compliance-documentsSubmit forward SWIFT docs

Supported Values

Enum fields below render as real dropdowns on each schema, never have to guess what to send.

FieldAllowed valuesNotes
chainsolana, tron, ethereum, polygonSettlement blockchain. Picked at quote time; immutable on the contract. Call GET /fx/supported-chains for live vs planned.
settlement_currencyUSDC, USDTStablecoin (margin token) used for BOTH the upfront fee (you pay in) AND the FX delta payout (we pay out). USDC or USDT; your choice selects the live oracle pair.
oracleredstone, binance, stable_coordinates, crebit_ngn, chainlinkSettlement price oracle at quote time. BRL/MXN: redstone (default) or binance. NGN: stable_coordinates (default) or crebit_ngn. CHF: chainlink.
contract_typeforward, optionforward = obligation; option = right but not obligation.
directionBRL_TO_USD, USD_TO_BRL, MXN_TO_USD, USD_TO_MXN, NGN_TO_USD, USD_TO_NGNFX corridor as FROM_TO_TO (e.g. USD_TO_BRL). Six values — BRL/USD, MXN/USD, and NGN/USD, both directions; see Concepts for notional_currency rules per pair.

Account · GET /api/v1/partners/me

Confirm your API key, environment, and partner id after onboarding. No request body.

Response body, 200 OK
  • partner_iduuidRequired

    Stable Crebit partner identifier. Echo on support tickets.

    Example11111111-…
  • partner_namestringRequired

    Display name configured at onboarding.

    ExampleAcme FX (sandbox)
  • api_key_iduuidRequired

    Public id of the API key used for this call.

    Example55555555-…
  • environmentstring (enum)Required

    Must match the X-Crebit-Environment header you sent.

    2 options
json, example response code sample
json, example response
{
  "partner_id": "11111111-1111-4111-8111-111111111111",
  "partner_name": "Acme FX (sandbox)",
  "api_key_id": "55555555-5555-4555-8555-555555555555",
  "environment": "sandbox"
}
HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/partners/me" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"

Customer References · POST /api/v1/fx/customer-references

Register an opaque customer_reference_id for each end customer before creating quotes. Unique per partner; no PII. Idempotent — re-posting the same id returns HTTP 200 with the existing row.

POST /api/v1/fx/customer-references, request
  • customer_reference_idstring (1–256)Required

    Your stable opaque id for the end customer. Unique per partner. Register once, then reuse on every quote and contract for that customer.

    Examplepartner-cust-ref-2026-0042
json, example request code sample
json, example request
{
  "customer_reference_id": "partner-cust-ref-2026-0042"
}
HTTP code sample
curl -sS -X POST "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/customer-references" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -d '{"customer_reference_id":"partner-cust-ref-2026-0042"}'

Response Body

POST /api/v1/fx/customer-references, response (201 Created or 200 OK)
  • iduuidRequired

    Crebit internal id for this customer reference row.

    Example66666666-…
  • customer_reference_idstringRequired

    Echo of the partner-supplied id from the request.

    Examplepartner-cust-ref-2026-0042
  • created_atdatetime (ISO-8601 UTC)Required

    When the id was first registered.

    Example2026-05-24T16:00:00Z

GET /api/v1/fx/customer-references lists registered ids (cursor pagination). GET /api/v1/fx/customer-references/{customer_reference_id} fetches one by your external id.

json, example response code sample
json, example response
{
  "id": "66666666-6666-4666-8666-666666666666",
  "customer_reference_id": "partner-cust-ref-2026-0042",
  "created_at": "2026-05-24T16:00:00Z"
}
json, list response code sample
json, list response
{
  "items": [
    {
      "id": "66666666-6666-4666-8666-666666666666",
      "customer_reference_id": "partner-cust-ref-2026-0042",
      "created_at": "2026-05-24T16:00:00Z"
    }
  ],
  "next_cursor": null
}

Quotes · POST /api/v1/fx/quotes

Price a rate lock for a customer. The customer_reference_id must already be registered (see above). The lock window is a calendar range - the customer may execute on ANY day from window_start through window_end (inclusive). Send Idempotency-Key (8–128 ASCII printable chars) on POST /fx/webhooks/inbound (required). Recommended on POST /fx/quotes and POST /fx/contracts.

Request Body, Every Field

Pricing: Quote economics come from crebit-pricer (amount_due, collateral + upfront fee for forwards, premium for options). The locked rate uses live_spot_pricer TWAP when strike_mode=live_spot.
POST /api/v1/fx/quotes, request
  • customer_reference_idstring (1–256)Required

    Your stable id for the customer. Must be registered first via POST /api/v1/fx/customer-references. Crebit treats it as opaque and echoes it back; unknown ids return 404 not_found.

    Examplepartner-cust-ref-2026-0042
  • customer_namestring (1–256)Required

    Human-readable customer / business name. Used in audit logs and contract documents.

    ExampleAcme Imports Pvt Ltd
  • contract_typestring (enum)Required

    forward = obligation (refundable deposit). option = right but not obligation (upfront premium).

    2 options
  • directionstring (enum)Required

    FX corridor as BASE_TO_QUOTE. Six supported values — BRL/USD, MXN/USD, and NGN/USD, both directions (see SUPPORTED_DIRECTIONS).

    6 options
  • notional_currencystring (enum)Required

    Which side of the FX pair the notional_amount is denominated in. EITHER currency in the direction is valid, partner picks whichever the customer is fixing (the amount they're sending or the amount they want to receive). For direction=USD_TO_BRL, this can be USD or BRL; for direction=USD_TO_NGN, this can be USD or NGN.

    4 options
  • notional_amountdecimal stringRequired

    Trade size, denominated in notional_currency. Decimal string to preserve precision.

    Example50000.00
  • provider_ratedecimal stringOptional

    Your live FX rate at quote time. Required unless strike_mode=live_spot (server fetches live TWAP for the strike).

    Example5.42
  • market_ratedecimal stringOptional

    Benchmark mid-market FX rate you observed at quote time — interbank feed or equivalent stablecoin pair. Required with market_rate_timestamp unless strike_mode=live_spot (server fetches live TWAP).

    Example5.4180
  • market_rate_timestampdatetime (ISO-8601 UTC)Optional

    UTC time when market_rate was observed. Required with market_rate unless strike_mode=live_spot. Must be within ~5 min of the request when sent.

    Example2026-05-24T16:00:00Z
  • provider_extra_spreaddecimal stringOptional

    OPTIONAL partner spread (in rate units). Persisted and echoed on the response; pricing math currently ignores this field.

    Example0.0030
  • strike_modestring (enum)Optional

    How Crebit picks the strike. cip_fair (default) = CIP-fair forward rate from market_rate + interest differential. live_spot = locked_rate from live_spot_pricer TWAP at quote time (provider_rate and market_rate optional). custom = uses target_strike you supply.

    3 options
  • target_strikedecimal stringOptional

    Required ONLY when strike_mode=custom. The exact strike you want the lock to execute at, e.g. an option struck ATM/OTM/ITM, or a forward matching an externally-quoted rate. Ignored if strike_mode is anything else.

    Example5.50
  • window_startdatetime (ISO-8601 UTC)Required

    First moment the customer may execute the locked rate. Must be now or in the future (UTC). Must be strictly before window_end.

    Example2026-08-04T00:00:00Z
  • window_enddatetime (ISO-8601 UTC)Required

    Last moment the customer may execute. Must be strictly after window_start and after the current time (UTC). Equal start/end values return validation_error. Short locks: 1–24 hour span between start and end. Long locks: window_end calendar date up to 180 days ahead. Out-of-range durations return duration_out_of_range.

    Example2026-08-11T00:00:00Z
  • chainstring (enum)Required

    Blockchain Crebit settles on, same chain you fund on and same chain Crebit pays out on. Set at quote time; immutable for the life of the contract. Call GET /fx/supported-chains for live vs planned status.

    4 options
  • settlement_currencystring (enum)Required

    Stablecoin Crebit and the partner settle in (margin token). Partner sends the upfront fee in this stablecoin to funding_wallet_address; Crebit pays out any FX delta in this stablecoin. USDC or USDT only. Also called margin token in the dashboard — your choice selects the live oracle pair (e.g. BRL/USDC vs BRL/USDT, NGN/USDT). Set at quote time; immutable on the contract.

    2 options
  • payout_wallet_addressstringRequired

    Destination wallet for settlement payout on the contract chain (e.g. Solana address for USDC, Tron address for USDT). Stored on the quote and copied to the contract.

    Example0xEndUserWalletForSettlement
  • source_chainstring (1–64)Optional

    Optional funding origin chain when bridging stablecoins (Bridge Kit flows). Settlement chain is still `chain`.

    Examplebase
  • oraclestring (enum)Optional

    Settlement price oracle for exercise and maturity. BRL/MXN: redstone (default) or binance. NGN: stable_coordinates (default) or crebit_ngn. CHF: chainlink.

    5 options

Sample Requests

Pick a variant

Most common shape. Omit strike_mode (or set cip_fair) and Crebit derives the forward strike from market_rate + the USD/BRL interest-rate differential. For USD→BRL, this lifts the strike above spot, customer gets MORE BRL per USD.

json code sample
json
{
  "customer_reference_id": "partner-cust-ref-2026-0042",
  "customer_name": "Acme Imports Pvt Ltd",
  "contract_type": "forward",
  "direction": "USD_TO_BRL",
  "notional_currency": "USD",
  "notional_amount": "50000.00",
  "provider_rate": "5.42",
  "provider_extra_spread": "0.0030",
  "market_rate": "5.4180",
  "market_rate_timestamp": "2026-05-24T16:00:00Z",
  "strike_mode": "cip_fair",
  "window_start": "2026-08-04T00:00:00Z",
  "window_end": "2026-08-11T00:00:00Z",
  "chain": "solana",
  "settlement_currency": "USDC",
  "payout_wallet_address": "EndUserSolanaWalletForSettlement",
  "oracle": "redstone"
}

How to Call (BRL Corridor Example)

Copy-paste example below uses USD_TO_BRL with settlement_currency=USDC on Solana.

HTTP code sample
curl -sS -X POST "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/quotes" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"customer_reference_id":"partner-cust-ref-2026-0042","customer_name":"Acme Imports Pvt Ltd","contract_type":"forward","direction":"USD_TO_BRL","notional_currency":"USD","notional_amount":"50000.00","provider_rate":"5.42","market_rate":"5.4180","market_rate_timestamp":"2026-05-24T16:00:00Z","provider_extra_spread":"0.0005","strike_mode":"cip_fair","window_start":"2026-08-04T00:00:00Z","window_end":"2026-08-11T00:00:00Z","chain":"solana","settlement_currency":"USDC","payout_wallet_address":"EndUserSolanaWalletForSettlement","oracle":"redstone"}'

How to Call (NGN Corridor Example)

Copy-paste example below uses NGN_TO_USD with settlement_currency=USDT on Solana. Pick MXN and other variants in Sample requests above.

NGN rules: forwards only (options return 400 contract_type_unsupported). window_end must be within 72 hours of the quote unless your account has the CIP forward feature (then up to 180 days). The oracle is stablecoin_rates (default) or crebit_ngn. With strike_mode=live_spotthe server fetches the rate, so you don't send provider_rate.
HTTP code sample
curl -sS -X POST "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/quotes" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"customer_reference_id":"partner-cust-ref-2026-0405","customer_name":"Lagos Exports Ltd","contract_type":"forward","direction":"NGN_TO_USD","notional_currency":"NGN","notional_amount":"50000000.00","strike_mode":"live_spot","window_start":"2026-08-05T15:45:00Z","window_end":"2026-08-05T16:00:00Z","chain":"solana","settlement_currency":"USDT","payout_wallet_address":"So11111111111111111111111111111111111111112","oracle":"stablecoin_rates"}'

Response Body, 201 Created

POST /api/v1/fx/quotes, response
  • iduuidRequired

    Quote id. Pass to POST /api/v1/fx/contracts.

    Example22222222-…
  • statusstring (enum)Required

    Quote outcome: created when pricing succeeded, failed otherwise.

    2 options
  • locked_ratedecimal stringRequired

    The strike, the FX rate Crebit will honor if the customer exercises. For forwards, this is the CIP-fair forward rate (or your target_strike if you supplied one). For options, this is the option strike price.

    Example5.42
  • strike_modestring (enum)Optional

    Echoes how the strike was chosen. cip_fair = Crebit derived it from covered-interest-parity. live_spot = strike from live_spot_pricer TWAP at quote time. custom = you supplied target_strike.

    3 options
  • target_strikedecimal string | nullOptional

    Echos the strike from the request, if strike_mode=custom and target_strike was provided.

    Examplenull
  • strike_advantage_bpsintegerRequired

    Non-negative basis points: absolute difference between locked_rate and market_rate (direction-aware customer messaging is planned; today the API returns magnitude only). Use with strike_mode and locked_rate to explain the quote to your customer.

    Example12
  • provider_extra_spreaddecimal string | nullOptional

    Your spread from the request (zero if you didn't send provider_extra_spread).

    Example0.0005
  • premium_amountdecimal stringRequired

    All-in premium (option) or quoted fee (forward) the partner pays upfront. Denominated in settlement_currency.

    Example1565.00
  • deposit_amountdecimal string | nullOptional

    Security deposit (forwards only; null for options). Typically 5-10% of notional, denominated in settlement_currency. Collateral against the customer's obligation to transact, released back to the partner on successful exercise, FORFEITED if the customer fails to transact within the window.

    Example5000.00
  • total_amountdecimal stringRequired

    The total amount that would be due to Crebit to activate the lock. Adds premium_amount and deposit_amount.

    Example6565.00
  • amount_duedecimal string | nullOptional

    Total stablecoin due now from crebit-pricer (premium + deposit for forwards, premium only for options). Denominated in settlement_currency.

    Example6565.00
  • collateral_amountdecimal string | nullOptional

    Forward refundable collateral from crebit-pricer (forwards only; null for options). Typically aligns with deposit_amount.

    Example5000.00
  • upfront_feedecimal string | nullOptional

    Forward only — non-refundable platform fee from crebit-pricer. Omitted for options (use premium_amount and amount_due only).

    Example565.00
  • pricing_tierstring | nullOptional

    crebit-pricer tier (e.g. ml_full, gk_*) for ML validation and audit.

    Exampleml_full
  • pricing_greeksobject | nullOptional

    crebit-pricer delta/gamma when available. Shape: { delta, gamma } decimal strings.

    Example{ "delta": "0.42", "gamma": "0.01" }
  • window_startdatetime (ISO-8601 UTC)Required

    Echoes the lock-window start you sent.

    Example2026-08-04T00:00:00Z
  • window_enddatetime (ISO-8601 UTC)Required

    Echoes the lock-window end you sent.

    Example2026-08-11T00:00:00Z
  • chainstring (enum)Required

    Blockchain Crebit settles on, same chain you fund on and same chain Crebit pays out on. Set at quote time; immutable for the life of the contract. Call GET /fx/supported-chains for live vs planned status.

    4 options
  • settlement_currencystring (enum)Required

    Stablecoin Crebit and the partner settle in (margin token). Partner sends the upfront fee in this stablecoin to funding_wallet_address; Crebit pays out any FX delta in this stablecoin. USDC or USDT only. Also called margin token in the dashboard — your choice selects the live oracle pair (e.g. BRL/USDC vs BRL/USDT, NGN/USDT). Set at quote time; immutable on the contract.

    2 options
  • payout_wallet_addressstring | nullOptional

    Echo of the destination wallet from the quote request.

    Example0xEndUserWalletForSettlement
  • source_chainstring | nullOptional

    Echo of the optional funding origin chain from the request.

    Examplebase
  • oraclestring (enum)Required

    Settlement price oracle selected at quote time.

    5 options
  • expires_atdatetime (ISO-8601 UTC)Required

    Quote validity cutoff. POST the id to /contracts before this time. Default TTL is 15 minutes (server-configured via quote_expiry_minutes). Quotes are short-lived because FX moves; show the customer the quote with a countdown if you don't lock immediately.

    Example2026-05-24T16:16:30Z
  • created_atdatetime (ISO-8601 UTC)Required

    UTC timestamp the quote was issued.

    Example2026-05-24T16:15:00Z
json, example response code sample
json, example response
{
  "id": "22222222-2222-4222-8222-222222222222",
  "status": "created",
  "locked_rate": "5.42",
  "strike_mode": "cip_fair",
  "target_strike": null,
  "strike_advantage_bps": 12,
  "provider_extra_spread": "0.0005",
  "premium_amount": "1565.00",
  "deposit_amount": "5000.00",
  "total_amount": "6565.00",
  "amount_due": "6565.00",
  "collateral_amount": "5000.00",
  "upfront_fee": "565.00",
  "pricing_tier": "ml_full",
  "pricing_greeks": {
    "delta": "0.42",
    "gamma": "0.01"
  },
  "window_start": "2026-08-04T00:00:00Z",
  "window_end": "2026-08-11T00:00:00Z",
  "chain": "solana",
  "settlement_currency": "USDC",
  "payout_wallet_address": "EndUserSolanaWalletForSettlement",
  "oracle": "redstone",
  "expires_at": "2026-05-24T16:30:00Z",
  "created_at": "2026-05-24T16:15:00Z"
}

List / Get

GET /api/v1/fx/quotes, cursor pagination. Optional filters: status (created includes accepted quotes; failed includes expired), customer_reference_id, limit, cursor.

GET /api/v1/fx/quotes, query parameters
  • statusstring (enum)Optional

    Optional filter. created includes quotes still open and quotes already accepted into a contract. failed includes pricing failures and expired quotes.

    2 options
  • customer_reference_idstringOptional

    Optional filter to quotes for one customer.

    Examplepartner-cust-ref-2026-0042
  • limitintegerOptional

    Page size (1–100). Default 25.

    Example25
  • cursorstringOptional

    Opaque pagination cursor from a previous response's next_cursor.

    ExampleeyJpZCI6IjIyMj…

GET /api/v1/fx/quotes/{quote_id}, fetch a single quote by id.

HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/quotes?status=created&limit=25" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"
json, list response code sample
json, list response
{
  "items": [
    {
      "id": "22222222-2222-4222-8222-222222222222",
      "status": "created",
      "locked_rate": "5.42",
      "strike_mode": "cip_fair",
      "target_strike": null,
      "strike_advantage_bps": 12,
      "provider_extra_spread": "0.0005",
      "premium_amount": "1565.00",
      "deposit_amount": "5000.00",
      "total_amount": "6565.00",
      "amount_due": "6565.00",
      "collateral_amount": "5000.00",
      "upfront_fee": "565.00",
      "pricing_tier": "ml_full",
      "pricing_greeks": {
        "delta": "0.42",
        "gamma": "0.01"
      },
      "window_start": "2026-08-04T00:00:00Z",
      "window_end": "2026-08-11T00:00:00Z",
      "chain": "solana",
      "settlement_currency": "USDC",
      "payout_wallet_address": "EndUserSolanaWalletForSettlement",
      "oracle": "redstone",
      "expires_at": "2026-05-24T16:30:00Z",
      "created_at": "2026-05-24T16:15:00Z"
    }
  ],
  "next_cursor": null
}

Supported Chains · GET /api/v1/fx/supported-chains

Returns the settlement chain catalog with allowed stablecoins per chain. enabledis this partner's entitlement (solana + tron by default; polygon is opt-in). In production it is also false when payout-hot float is below the floor, andsettlement_currencies lists only funded tokens.funded_settlement_pairs is null in sandbox. Tron supports USDT only.

GET /api/v1/fx/supported-chains, response
  • chainsarray<object>Required

    Catalog of supported settlement chains.

    Show 5 nested fields
    • chainstring (enum)Required

      Settlement chain identifier.

      4 options
    • settlement_currenciesarray<string>Required

      Stablecoins currently bookable on this chain. In production this list is payout-hot inventory at or above the floor; unfunded tokens are omitted.

      Example["USDC", "USDT"]
    • statusstring (enum)Required

      live = production-ready. planned = schema reserved, not yet live.

      2 options
    • address_format_hintstringRequired

      Human-readable wallet address format for this chain.

      Examplebase58 pubkey (~32–44 chars)
    • enabledbooleanRequired

      True when this partner may book the chain and, in production, at least one listed settlement currency is funded on payout-hot. Polygon is opt-in. False chains stay in the catalog for discovery.

      Exampletrue
  • funded_settlement_pairsarray<object> | nullOptional

    Production payout-hot (chain, currency) pairs at or above the floor. Null in sandbox/test (gate off). Empty array means nothing is currently bookable.

    Example[{"chain":"tron","currency":"USDT"}]
json, example response code sample
json, example response
{
  "chains": [
    {
      "chain": "solana",
      "settlement_currencies": [
        "USDC",
        "USDT"
      ],
      "status": "live",
      "address_format_hint": "base58 pubkey (~32–44 chars)",
      "enabled": true
    },
    {
      "chain": "tron",
      "settlement_currencies": [
        "USDT"
      ],
      "status": "live",
      "address_format_hint": "Base58Check address starting with T (~34 chars)",
      "enabled": true
    },
    {
      "chain": "ethereum",
      "settlement_currencies": [
        "USDC",
        "USDT"
      ],
      "status": "planned",
      "address_format_hint": "0x-prefixed 20-byte hex address",
      "enabled": false
    },
    {
      "chain": "polygon",
      "settlement_currencies": [
        "USDC",
        "USDT"
      ],
      "status": "planned",
      "address_format_hint": "0x-prefixed 20-byte hex address (EVM)",
      "enabled": false
    }
  ],
  "funded_settlement_pairs": null
}
HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/supported-chains" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"

Contracts · POST /api/v1/fx/contracts

Converts an accepted quote into a binding rate lock. The contract inherits the quote's lock window, chain, and payout currency - those terms are immutable once the contract exists.

Request Body

POST /api/v1/fx/contracts, request
  • quote_iduuidRequired

    id returned by POST /api/v1/fx/quotes.

    Example22222222-…
  • partner_transaction_referencestringOptional

    Optional platform transaction id. When omitted, Crebit assigns a UUID automatically. Echoed in webhooks for reconciliation.

    Exampleplatform-tx-9901
  • payout_wallet_addressstringOptional

    Optional settlement destination at lock time (CA-745). May also be set later via PUT .../payout-destination before maturity.

    Example0xEndUserWalletForSettlement
  • payout_currencystring (enum)Optional

    Optional payout stablecoin. Defaults from the quote settlement_currency when payout_wallet_address is set.

    3 options
  • payout_chainstring (enum)Optional

    Optional payout chain. Defaults from the quote chain when payout_wallet_address is set.

    4 options
Sample requests

Quote id from POST /api/v1/fx/quotes is the only required field.

json code sample
json
{
  "quote_id": "22222222-2222-4222-8222-222222222222"
}
HTTP code sample
curl -sS -X POST "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/contracts" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"quote_id":"22222222-2222-4222-8222-222222222222","partner_transaction_reference":"platform-tx-9901"}'

Response Body, 201 Created

POST /api/v1/fx/contracts, response
  • iduuidRequired

    Crebit contract id. Use this in API calls, pass as fx_contract_id on inbound webhooks. NOT for showing humans (use crebit_contract_reference instead).

    Example33333333-…
  • crebit_contract_referencestringRequired

    Human-readable contract reference (format CREBIT-YYYYMMDD-XXXXXXXXXX), suitable for receipts, customer-facing emails, and support tickets. Don't use it as an API identifier — id is the canonical key.

    ExampleCREBIT-20260524-7F3A9C2B1D
  • contract_typestring (enum)Required

    Protection instrument from the originating quote (forward or option).

    2 options
  • directionstring (enum)Required

    FX corridor as FROM_TO_TO (e.g. USD_TO_BRL, MXN_TO_USD, NGN_TO_USD).

    6 options
  • notional_currencystring (enum)Required

    Currency of notional_amount / max_transaction_amount on this lock.

    4 options
  • locked_ratedecimal stringRequired

    Rate Crebit will honor if exercised.

    Example5.42
  • provider_rate_at_lockdecimal stringRequired

    The FX rate you provided at quote time.

    Example5.42
  • market_rate_at_lockdecimal stringRequired

    The market FX rate you provided at quote time.

    Example5.4180
  • premium_amountdecimal stringRequired

    Premium / quoted fee due upfront, in settlement_currency.

    Example1565.00
  • deposit_amountdecimal string | nullOptional

    Refundable deposit held until execution (forwards only). In settlement_currency.

    Example5000.00
  • total_amountdecimal stringRequired

    The total amount due to Crebit to activate the lock. Adds premium_amount and deposit_amount.

    Example6565.00
  • window_startdatetime (ISO-8601 UTC) | nullOptional

    Inherited from the quote.

    Example2026-08-04T00:00:00Z
  • window_enddatetime (ISO-8601 UTC) | nullOptional

    Inherited from the quote.

    Example2026-08-11T00:00:00Z
  • chainstring (enum)Required

    Blockchain Crebit settles on, same chain you fund on and same chain Crebit pays out on. Set at quote time; immutable for the life of the contract. Call GET /fx/supported-chains for live vs planned status.

    4 options
  • settlement_currencystring (enum)Required

    Stablecoin Crebit and the partner settle in (margin token). Partner sends the upfront fee in this stablecoin to funding_wallet_address; Crebit pays out any FX delta in this stablecoin. USDC or USDT only. Also called margin token in the dashboard — your choice selects the live oracle pair (e.g. BRL/USDC vs BRL/USDT, NGN/USDT). Set at quote time; immutable on the contract.

    2 options
  • funding_wallet_addressstringRequired

    Crebit-controlled wallet address on `chain`. Send the deposit / premium here in `settlement_currency`. Poll GET …/status until `active` after funding is complete.

    Example0xCrebitFundingWalletForThisContract
  • payout_wallet_addressstring | nullOptional

    Partner-saved settlement destination (CA-745). Used for forward maturity force-exercise; contract_exercised may override at exercise time.

    Example0xEndUserWalletForSettlement
  • payout_currencystring (enum) | nullOptional

    Saved payout stablecoin when payout_wallet_address is set.

    3 options
  • payout_chainstring (enum) | nullOptional

    Saved payout chain when payout_wallet_address is set.

    4 options
  • oraclestring (enum)Required

    Settlement price oracle copied from the originating quote.

    5 options
  • source_chainstring | nullOptional

    Funding origin chain from the originating quote (Bridge Kit), when provided.

    Examplebase
  • created_atdatetime (ISO-8601 UTC)Required

    UTC timestamp the contract was created.

    Example2026-05-24T16:20:00Z
  • max_transaction_amountdecimal stringRequired

    The maximum amount of money (in notional_currency) able to be processed.

    Example50000.00
  • settlement_rate_useddecimal string | nullOptional

    Oracle settlement rate used at exercise (including maturity force-exercise). Null until the contract is exercised/settled.

    Example5.5100
  • oracle_clamp_appliedboolean | nullOptional

    Whether the conservative oracle clamp was applied at settlement. Null until exercised/settled.

    Examplefalse
json, example response code sample
json, example response
{
  "id": "33333333-3333-4333-8333-333333333333",
  "crebit_contract_reference": "CREBIT-20260524-7F3A9C2B1D",
  "contract_type": "forward",
  "direction": "USD_TO_BRL",
  "notional_currency": "USD",
  "locked_rate": "5.42",
  "provider_rate_at_lock": "5.42",
  "market_rate_at_lock": "5.4180",
  "premium_amount": "1565.00",
  "deposit_amount": "5000.00",
  "total_amount": "6565.00",
  "window_start": "2026-08-04T00:00:00Z",
  "window_end": "2026-08-11T00:00:00Z",
  "chain": "solana",
  "settlement_currency": "USDC",
  "funding_wallet_address": "CrebitSolanaFundingWalletForThisContract",
  "payout_wallet_address": "EndUserSolanaWalletForSettlement",
  "payout_currency": "USDC",
  "payout_chain": "solana",
  "oracle": "redstone",
  "created_at": "2026-05-24T16:20:00Z",
  "max_transaction_amount": "50000.00",
  "partner_transaction_reference": "platform-tx-9901"
}

Contract Lifecycle

Lifecycle is driven by webhooks and outbound events, not returned on POST /api/v1/fx/contracts. Typical states:

statusSet byWhat it means
quote_createdCrebit (on create)Contract exists; awaiting funds at funding_wallet_address.
funds_in_routePartner webhook (funds_in_route)You've dispatched premium / deposit on-chain to funding_wallet_address.
activeCrebit (after funding complete)Lock is live — poll GET …/status until status=active. No outbound funding webhook.
exercisedPartner webhook (contract_exercised)Customer transacted. Crebit is computing & dispatching the payout.
settledCrebit (after payout confirms)Payout confirmed on-chain. Outbound contract_settled webhook fires.
expiredCrebit (window_end passed, options)Customer did not transact within the window (options). Forwards may force-exercise at maturity instead.
failedCrebitRecoverable failure — retry via POST /fx/contracts/{id}/retry or resend funds_in_route webhook (validation/payment). Not terminal.
defaultedCrebitForward obligation not met; deposit consumed.
deposit_forfeitedCrebitDeposit forfeited after expiry without exercise.

Poll / Payments / Deposits

Lightweight read APIs for status polling and funding audit. Poll routes return ETag — send If-None-Match to get 304 Not Modified when nothing changed.

GET …/status or …/by-reference/{crebit_contract_reference}, 200 OK
  • fx_contract_iduuidRequired

    Contract UUID.

    Example33333333-…
  • crebit_contract_referencestringRequired

    Human-readable contract reference.

    ExampleCREBIT-20260524-7F3A9C2B1D
  • statusstringRequired

    Current lifecycle status.

    9 options
  • partner_transaction_referencestring | nullOptional

    Your platform transaction id from contract creation.

    Exampleplatform-tx-9901
  • activated_atdatetime (ISO-8601 UTC) | nullOptional

    When the lock became active (funding confirmed).

    Example2026-05-24T16:35:08Z
  • exercised_atdatetime (ISO-8601 UTC) | nullOptional

    When contract_exercised was processed.

    Examplenull
  • settled_atdatetime (ISO-8601 UTC) | nullOptional

    When payout settled on-chain.

    Examplenull
  • expired_atdatetime (ISO-8601 UTC) | nullOptional

    When the lock window ended without exercise.

    Examplenull
  • failed_atdatetime (ISO-8601 UTC) | nullOptional

    When the contract entered a terminal failed state.

    Examplenull
  • failure_reasonstring (enum) | nullOptional

    Machine-readable failure category when status is failed. validation = business-rule rejection (e.g. exercise webhook); payment = funding leg failure; payout = settlement failure; system = internal error.

    4 options
  • updated_atdatetime (ISO-8601 UTC)Required

    Last status change. Use with If-None-Match for polling.

    Example2026-05-24T16:35:08Z
  • settlement_rate_useddecimal string | nullOptional

    Oracle settlement rate used at exercise (including maturity force-exercise). Null until exercised/settled. Same field as contract_settled / payout_success.

    Examplenull
  • oracle_clamp_appliedboolean | nullOptional

    Whether the conservative oracle clamp was applied at settlement. Null until exercised/settled.

    Examplenull
GET …/contracts/{contract_id}/payments, 200 OK
  • fx_contract_iduuidRequired

    Contract these legs belong to.

    Example33333333-…
  • contract_typestring (enum)Required

    forward or option.

    2 options
  • premium_amountdecimal stringRequired

    Quoted premium from lock-in.

    Example1565.00
  • deposit_amountdecimal string | nullOptional

    Quoted deposit (forwards only).

    Example5000.00
  • paymentsarray<object>Required

    Premium then deposit legs, ordered.

    Show 12 nested fields
    • iduuidRequired

      Payment leg id.

      Example66666666-…
    • fx_contract_iduuidRequired

      Parent contract.

      Example33333333-…
    • payment_typestring (enum)Required

      Which funding leg.

      2 options
    • amountdecimal stringRequired

      Leg amount in currency.

      Example5000.00
    • currencystringRequired

      Stablecoin of this leg.

      ExampleUSDC
    • chainstringRequired

      Blockchain.

      Exampleethereum
    • statusstring (enum)Required

      Leg lifecycle status.

      4 options
    • webhook_event_iduuid | nullOptional

      Inbound webhook that advanced this leg, if any.

      Example44444444-…
    • wallet_addressstring | nullOptional

      Source wallet observed on-chain.

      Example0xPartnerTreasury…
    • transaction_hashstring | nullOptional

      On-chain tx hash when confirmed.

      Example0xabc123…
    • created_atdatetime (ISO-8601 UTC)Required

      When the expected leg was created at lock-in.

      Example2026-05-24T16:20:00Z
    • confirmed_atdatetime (ISO-8601 UTC) | nullOptional

      When Crebit confirmed this leg on-chain.

      Example2026-05-24T16:35:08Z
GET …/contracts/{contract_id}/deposits, 200 OK
  • fx_contract_iduuidRequired

    Contract these movements belong to.

    Example33333333-…
  • contract_typestring (enum)Required

    forward or option (options return an empty movements list).

    2 options
  • deposit_amountdecimal string | nullOptional

    Quoted deposit at lock-in.

    Example5000.00
  • movementsarray<object>Required

    Deposit history, oldest first.

    Show 11 nested fields
    • iduuidRequired

      Movement id.

      Example88888888-…
    • fx_contract_iduuidRequired

      Parent contract.

      Example33333333-…
    • movement_typestring (enum)Required

      What happened to deposit collateral.

      3 options
    • amountdecimal stringRequired

      Movement amount.

      Example5000.00
    • currencystringRequired

      Stablecoin.

      ExampleUSDC
    • sourcestring (enum)Required

      What triggered this movement.

      5 options
    • reasonstring | nullOptional

      Optional operator note.

      Examplenull
    • contract_payment_iduuid | nullOptional

      Related payment leg, if any.

      Example77777777-…
    • webhook_event_iduuid | nullOptional

      Related webhook event, if any.

      Example44444444-…
    • payout_iduuid | nullOptional

      Related payout, if any.

      Examplenull
    • recorded_atdatetime (ISO-8601 UTC)Required

      When Crebit recorded the movement.

      Example2026-05-24T16:35:08Z
GET …/contracts/{contract_id}/payouts, 200 OK
  • fx_contract_iduuidRequired

    Contract these payouts belong to.

    Example33333333-…
  • payoutsarray<object>Required

    Payout rows, oldest first.

    Show 13 nested fields
    • iduuidRequired

      Payout row id.

      Example99999999-…
    • fx_contract_iduuidRequired

      Parent contract id.

      Example33333333-…
    • amountdecimal stringRequired

      Payout amount in currency.

      Example4500.00
    • currencystringRequired

      Stablecoin paid out.

      ExampleUSDC
    • chainstring (enum)Required

      Blockchain Crebit settles on, same chain you fund on and same chain Crebit pays out on. Set at quote time; immutable for the life of the contract. Call GET /fx/supported-chains for live vs planned status.

      4 options
    • statusstring (enum)Required

      Payout lifecycle status.

      5 options
    • transaction_hashstring | nullOptional

      On-chain tx hash when submitted or confirmed.

      Example0xf3a1...e29c
    • payout_wallet_addressstringRequired

      Destination wallet.

      Example0xEndUserWallet…
    • failure_reasonstring | nullOptional

      Set when status=failed.

      Examplenull
    • created_atdatetime (ISO-8601 UTC)Required

      When the payout row was created.

      Example2026-08-07T13:42:30Z
    • submitted_atdatetime (ISO-8601 UTC) | nullOptional

      When the payout was broadcast on-chain.

      Example2026-08-07T13:42:45Z
    • confirmed_atdatetime (ISO-8601 UTC) | nullOptional

      When the payout was confirmed on-chain.

      Example2026-08-07T13:43:08Z
    • failed_atdatetime (ISO-8601 UTC) | nullOptional

      When the payout failed terminally.

      Examplenull

GET /api/v1/fx/contracts/{contract_id} returns the full contract body (same fields as create response).

json, poll response example code sample
json, poll response example
{
  "fx_contract_id": "33333333-3333-4333-8333-333333333333",
  "crebit_contract_reference": "CREBIT-20260524-7F3A9C2B1D",
  "status": "active",
  "partner_transaction_reference": "platform-tx-9901",
  "activated_at": "2026-05-24T16:35:08Z",
  "exercised_at": null,
  "settled_at": null,
  "expired_at": null,
  "failed_at": null,
  "failure_reason": null,
  "updated_at": "2026-05-24T16:35:08Z",
  "settlement_rate_used": null,
  "oracle_clamp_applied": null
}
HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/contracts/by-reference/CREBIT-20260524-7F3A9C2B1D" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"
json, payments example code sample
json, payments example
{
  "fx_contract_id": "33333333-3333-4333-8333-333333333333",
  "contract_type": "forward",
  "premium_amount": "1565.00",
  "deposit_amount": "5000.00",
  "payments": [
    {
      "id": "66666666-6666-4666-8666-666666666666",
      "fx_contract_id": "33333333-3333-4333-8333-333333333333",
      "payment_type": "premium",
      "amount": "1565.00",
      "currency": "USDC",
      "chain": "solana",
      "status": "confirmed",
      "webhook_event_id": "44444444-4444-4444-8444-444444444444",
      "wallet_address": "PartnerSolanaTreasury…",
      "transaction_hash": "5Kq3abc123…",
      "created_at": "2026-05-24T16:20:00Z",
      "confirmed_at": "2026-05-24T16:35:08Z"
    },
    {
      "id": "77777777-7777-4777-8777-777777777777",
      "fx_contract_id": "33333333-3333-4333-8333-333333333333",
      "payment_type": "deposit",
      "amount": "5000.00",
      "currency": "USDC",
      "chain": "solana",
      "status": "confirmed",
      "webhook_event_id": "44444444-4444-4444-8444-444444444444",
      "wallet_address": "PartnerSolanaTreasury…",
      "transaction_hash": "5Kq3abc123…",
      "created_at": "2026-05-24T16:20:00Z",
      "confirmed_at": "2026-05-24T16:35:08Z"
    }
  ]
}
json, deposits example code sample
json, deposits example
{
  "fx_contract_id": "33333333-3333-4333-8333-333333333333",
  "contract_type": "forward",
  "deposit_amount": "5000.00",
  "movements": [
    {
      "id": "88888888-8888-4888-8888-888888888888",
      "fx_contract_id": "33333333-3333-4333-8333-333333333333",
      "movement_type": "collected",
      "amount": "5000.00",
      "currency": "USDC",
      "source": "deposit_payment",
      "reason": null,
      "contract_payment_id": "77777777-7777-4777-8777-777777777777",
      "webhook_event_id": "44444444-4444-4444-8444-444444444444",
      "payout_id": null,
      "recorded_at": "2026-05-24T16:35:08Z"
    }
  ]
}
json, payouts example code sample
json, payouts example
{
  "fx_contract_id": "33333333-3333-4333-8333-333333333333",
  "payouts": [
    {
      "id": "99999999-9999-4999-8999-999999999999",
      "fx_contract_id": "33333333-3333-4333-8333-333333333333",
      "amount": "4183.30",
      "currency": "USDC",
      "chain": "solana",
      "status": "confirmed",
      "transaction_hash": "4f3a1...e29c",
      "payout_wallet_address": "EndUserSolanaWallet…",
      "failure_reason": null,
      "created_at": "2026-08-07T13:42:30Z",
      "submitted_at": "2026-08-07T13:42:45Z",
      "confirmed_at": "2026-08-07T13:43:08Z",
      "failed_at": null
    }
  ]
}

Payout Destination

PUT /api/v1/fx/contracts/{contract_id}/payout-destination saves the customer's settlement wallet anytime before window_end. Required for forward maturity force-exercise when not set at quote/contract create. You may also pass optional payout fields on POST /api/v1/fx/contracts.

PUT …/payout-destination, request body
  • payout_wallet_addressstringRequired

    Settlement destination wallet. Required for forward maturity force-exercise; may be set anytime before window_end.

    Example0xEndUserWalletForSettlement
  • payout_currencystring (enum)Optional

    Defaults to the quote settlement_currency when omitted.

    3 options
  • payout_chainstring (enum)Optional

    Defaults to the quote chain when omitted.

    4 options
json, example request code sample
json, example request
{
  "payout_wallet_address": "EndUserSolanaWalletForSettlement",
  "payout_currency": "USDC",
  "payout_chain": "solana"
}
HTTP code sample
curl -sS -X PUT "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/contracts/33333333-3333-4333-8333-333333333333/payout-destination" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -d '{"payout_wallet_address":"EndUserSolanaWalletForSettlement","payout_currency":"USDC","payout_chain":"solana"}'

Forward Maturity (CA-745 / CA-747)

For forward contracts at window_end: if a payout destination is saved, Crebit force-exercises at the oracle rate and settles. If no wallet is saved, the contract stays active — expiry does not forfeit the deposit. Set the wallet via PUT payout-destination before maturity. After the window closes, partner contract_exercised is rejected (execution_window_closed).

Settlement Preview

POST /api/v1/fx/contracts/{contract_id}/settlement-preview returns read-only payout math for a hypothetical live_execution_rate. Uses the same settlement engine as the contract_exercised inbound webhook — it does not trigger a payout. Call this before exercise to show the customer their expected FX delta.

This endpoint is safe to call repeatedly. To actually pay out, send contract_exercised via POST /api/v1/fx/webhooks/inbound.
Request body
  • live_execution_ratedecimal stringRequired

    Live mid-market FX rate at the moment the customer transacted (or will transact). Same field as contract_exercised inbound webhook.

    Example5.51
  • transaction_amountdecimal string | nullOptional

    Optional partial notional exercised. Defaults to the contract max_transaction_amount when omitted.

    Example50000.00
  • payout_currencystring (enum) | nullOptional

    Optional payout stablecoin override. Defaults to the contract settlement_currency.

    2 options
Response body, 200 OK
  • fx_contract_iduuidRequired

    Contract this preview applies to.

    Example33333333-…
  • payout_amountdecimal stringRequired

    Stablecoin amount Crebit would pay out (or zero if unfavorable).

    Example4500.00
  • payout_currencystringRequired

    Stablecoin denomination of payout_amount.

    ExampleUSDC
  • is_favorablebooleanRequired

    True when the customer benefits from exercising at live_execution_rate vs locked_rate (Crebit owes a payout).

    Exampletrue
  • partner_live_execution_ratedecimal stringRequired

    Echo of live_execution_rate from the request.

    Example5.51
  • oracle_live_execution_ratedecimal string | nullOptional

    Independent oracle rate used for clamping, when applicable.

    Example5.5080
  • oracle_sourcestring | nullOptional

    Oracle feed identifier: redstone, binance, stable_coordinates, crebit_ngn or chainlink.

    Exampleredstone
  • settlement_rate_useddecimal stringRequired

    Effective rate used in the payout formula after any oracle clamp.

    Example5.51
  • oracle_clamp_appliedbooleanRequired

    True when partner live_execution_rate was adjusted toward the oracle bound before computing payout.

    Examplefalse
  • formulastringRequired

    Human-readable description of the settlement math applied.

    Examplefx_delta = notional × (locked_rate - settlement_rate_used)
  • calculation_versionstringRequired

    Settlement engine version for audit and support.

    Example2026.05.1
HTTP code sample
curl -sS -X POST "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/contracts/33333333-3333-4333-8333-333333333333/settlement-preview" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -d '{"live_execution_rate":"5.51"}'
json, example response code sample
json, example response
{
  "fx_contract_id": "33333333-3333-4333-8333-333333333333",
  "payout_amount": "4183.30",
  "payout_currency": "USDC",
  "is_favorable": false,
  "partner_live_execution_rate": "5.51",
  "oracle_live_execution_rate": "5.5080",
  "oracle_source": "redstone",
  "settlement_rate_used": "5.51",
  "oracle_clamp_applied": false,
  "formula": "max(0, deposit + (transaction_amount * (locked_rate - live_rate) / live_rate))",
  "calculation_version": "2026.05.1"
}

List All Contracts

GET /api/v1/fx/contracts returns paginated FX contracts for your partner account, newest first. Optional status and customer_reference_id filters match the customer-scoped locks list.

HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/contracts?status=active&limit=25" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"

Retry a Failed Contract

When a contract is failed with reason validation or payment, call POST /api/v1/fx/contracts/{contract_id}/retry to resume the lifecycle on the same contract (premium legs already confirmed are preserved). Alternatively, send a new funds_in_route inbound webhook with a fresh Idempotency-Key — Crebit auto-recovers then processes the payment. Use a new quote + contract only when recovery is not possible (execution window closed, system failure, exhausted payout retries).

HTTP code sample
curl -sS -X POST "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/contracts/00000000-0000-4000-8000-000000000001/retry" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -d '{}'

List Customer Locks

GET /api/v1/fx/customers/{customer_reference_id}/locks returns paginated FX contracts (locks) for your opaque customer_reference_id, newest first. Use optional status to filter by lifecycle state.

Query & path parameters
  • customer_reference_idstringRequired

    Path parameter. Your opaque customer id from quote/contract creation.

    Examplepartner-cust-ref-2026-0042
  • statusstring (enum)Optional

    Optional filter. Return only locks in this lifecycle status.

    9 options
  • limitintegerOptional

    Page size (1–100). Default 25.

    Example25
  • cursorstringOptional

    Opaque pagination cursor from a previous response's next_cursor.

    ExampleeyJpZCI6IjMzMz…
Response body, 200 OK
  • itemsarray<object>Required

    FX locks (contracts) for this customer, newest first.

    Show 24 nested fields
    • iduuidRequired

      Crebit contract id. Pass as fx_contract_id on inbound webhooks.

      Example33333333-…
    • crebit_contract_referencestringRequired

      Human-readable contract reference for receipts and support.

      ExampleCREBIT-20260524-7F3A9C2B1D
    • contract_typestring (enum)Required

      forward or option from the originating quote.

      2 options
    • directionstring (enum)Required

      FX corridor as FROM_TO_TO (e.g. USD_TO_BRL, MXN_TO_USD, NGN_TO_USD).

      6 options
    • notional_currencystring (enum)Required

      Currency of max_transaction_amount on this lock.

      4 options
    • locked_ratedecimal stringRequired

      Rate Crebit will honor if exercised.

      Example5.42
    • provider_rate_at_lockdecimal stringRequired

      The FX rate you provided at quote time.

      Example5.42
    • market_rate_at_lockdecimal stringRequired

      The market FX rate you provided at quote time.

      Example5.4180
    • premium_amountdecimal stringRequired

      Premium / quoted fee due upfront, in settlement_currency.

      Example1565.00
    • deposit_amountdecimal string | nullOptional

      Refundable deposit held until execution (forwards only). In settlement_currency.

      Example5000.00
    • total_amountdecimal stringRequired

      Total amount due to Crebit to activate the lock.

      Example6565.00
    • window_startdatetime (ISO-8601 UTC) | nullOptional

      First moment the customer may execute the locked rate.

      Example2026-08-04T00:00:00Z
    • window_enddatetime (ISO-8601 UTC) | nullOptional

      Last moment the customer may execute the locked rate.

      Example2026-08-11T00:00:00Z
    • chainstring (enum)Required

      Blockchain Crebit settles on, same chain you fund on and same chain Crebit pays out on. Set at quote time; immutable for the life of the contract. Call GET /fx/supported-chains for live vs planned status.

      4 options
    • settlement_currencystring (enum)Required

      Stablecoin Crebit and the partner settle in (margin token). Partner sends the upfront fee in this stablecoin to funding_wallet_address; Crebit pays out any FX delta in this stablecoin. USDC or USDT only. Also called margin token in the dashboard — your choice selects the live oracle pair (e.g. BRL/USDC vs BRL/USDT, NGN/USDT). Set at quote time; immutable on the contract.

      2 options
    • funding_wallet_addressstringRequired

      Send premium and deposit here in settlement_currency on chain.

      Example0xCrebitFundingWalletForThisContract
    • created_atdatetime (ISO-8601 UTC)Required

      UTC timestamp the contract was created.

      Example2026-05-24T16:20:00Z
    • max_transaction_amountdecimal stringRequired

      Maximum notional amount processable under this lock.

      Example50000.00
    • statusstring (enum)Required

      Current lifecycle status of the lock.

      9 options
    • quote_iduuidRequired

      Quote this lock was created from.

      Example22222222-…
    • customer_reference_idstringRequired

      Your opaque customer id (same value you sent at quote time).

      Examplepartner-cust-ref-2026-0042
    • partner_transaction_referencestring | nullOptional

      Your platform transaction id, echoed from the contract.

      Exampleplatform-tx-9901
    • settlement_rate_useddecimal string | nullOptional

      Oracle settlement rate used at exercise (including maturity force-exercise). Null until exercised/settled.

      Example5.5100
    • oracle_clamp_appliedboolean | nullOptional

      Whether the conservative oracle clamp was applied at settlement. Null until exercised/settled.

      Examplefalse
  • next_cursorstring | nullOptional

    Pass as cursor on the next page. null when there are no more results.

    Examplenull
HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/customers/partner-cust-ref-2026-0042/locks?status=active&limit=25" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"
json, example response code sample
json, example response
{
  "items": [
    {
      "id": "33333333-3333-4333-8333-333333333333",
      "crebit_contract_reference": "CREBIT-20260524-7F3A9C2B1D",
      "contract_type": "forward",
      "direction": "USD_TO_BRL",
      "notional_currency": "USD",
      "locked_rate": "5.42",
      "provider_rate_at_lock": "5.42",
      "market_rate_at_lock": "5.4180",
      "premium_amount": "1565.00",
      "deposit_amount": "5000.00",
      "total_amount": "6565.00",
      "window_start": "2026-08-04T00:00:00Z",
      "window_end": "2026-08-11T00:00:00Z",
      "chain": "solana",
      "settlement_currency": "USDC",
      "funding_wallet_address": "CrebitSolanaFundingWalletForThisContract",
      "created_at": "2026-05-24T16:20:00Z",
      "max_transaction_amount": "50000.00",
      "status": "active",
      "quote_id": "22222222-2222-4222-8222-222222222222",
      "customer_reference_id": "partner-cust-ref-2026-0042",
      "partner_transaction_reference": "platform-tx-9901"
    }
  ],
  "next_cursor": null
}

Fiat Spot & Deliverable Forwards

In addition to crypto rate locks, Crebit provides programmatic API-key access for BRL↔USD Fiat Spot conversions and Deliverable Forwards (DF) under /api/v1/fiat/.... Payouts and pay-ins are executed across local bank rails (PIX in Brazil; ACH, wire, and SWIFT in the US) through your dedicated virtual accounts.

Product distinction: Fiat Spot (/api/v1/fiat/spot/...) is a physical currency exchange product between BRL and USD executed via banking rails (PIX, ACH, wire, SWIFT). This is distinct from crypto rate-lock quotes with strike_mode="live_spot" under /api/v1/fx/quotes, which lock a live TWAP exchange rate for hedging on-chain crypto/stablecoin payments.

Overview & Authentication

Fiat endpoints authenticate with the exact same three headers as all other partner API routes:

  • X-Crebit-Key-Id: Your partner key ID (cbk_sbx_... or cbk_live_...)
  • X-Crebit-Key-Secret: Your API secret
  • X-Crebit-Environment: sandbox or production
Product Mode Gating: Fiat trading requires your partner account to have product_mode set to fiat or both (Crebit enables this in admin).GET /api/v1/fiat/profile still returns 200 when fiat is off — check spot_trading_enabled / product_mode. Quote, order, and other trading writes return 403 Forbidden with code fiat_spot_not_enabled.

Profile & Bank Accounts

Check your fiat readiness flags and supported rails via GET /api/v1/fiat/profile. Payout banks are shared by Spot and Deliverable Forward — list existing ones with GET /api/v1/fiat/bank-accounts, then create new ones with POST /api/v1/fiat/bank-accounts (rails pix, ach, wire, swift / international_swift, and sepa for Spot USD→EUR).

GET /api/v1/fiat/profile, response
  • partner_iduuidRequired

    Partner ID.

    Example00000000-0000-4000-8000-000000000001
  • product_modestringRequired

    Configured partner product mode: fiat, crypto_lock, or both.

    Exampleboth
  • virtual_account_statusstring | nullOptional

    USD virtual account onboarding status (approved, pending, etc.).

    Exampleapproved
  • usd_virtual_account_readybooleanRequired

    True when the partner USD virtual account is ready for funding pay-ins.

    Exampletrue
  • spot_trading_enabledbooleanRequired

    True when fiat trading is enabled for this partner.

    Exampletrue
  • supported_directionsarray<string>Required

    Allowed trading directions for fiat operations.

    Example["BRL_TO_USD", "USD_TO_BRL"]
GET /api/v1/fiat/bank-accounts, response
  • bank_accountsarray<object>Required

    Payout bank accounts for this partner customer (shared by Spot and DF).

    Show 8 nested fields
    • idstringRequired

      Payout bank account id (ba_…). Pass as payout_destination.bank_account_id on Spot/DF orders.

      Exampleba_pix_01
    • namestring | nullOptional

      Display name from create.

      ExampleTreasury PIX
    • typestring | nullOptional

      Rail type: pix, ach, wire, swift, sepa, etc.

      Examplepix
    • currencystring | nullOptional

      Account currency when known (BRL, USD, EUR).

      ExampleBRL
    • last4string | nullOptional

      Last four of account / key when available.

      Example8900
    • labelstringRequired

      UI-friendly label (name + masked last4).

      ExampleTreasury PIX ••••8900
    • recipient_relationshipstring | nullOptional

      SWIFT originator–recipient relationship when set.

      Examplevendor_or_supplier
    • has_swift_documentbooleanRequired

      True when a SWIFT relationship document is stored for this ba_….

      Examplefalse
POST /api/v1/fiat/bank-accounts, request body
  • typestring (enum)Required

    Payout rail. pix for USD→BRL; ach/wire for US USD; swift (or international_swift) for international SWIFT; sepa for Spot USD→EUR.

    6 options
  • namestringRequired

    Display label for this bank account.

    ExampleTreasury PIX
  • pix_keystring | nullOptional

    Required when type=pix. PIX key (CPF/CNPJ, email, phone, or EVP).

    Example12345678900
  • beneficiary_namestring | nullOptional

    Required for ACH/wire. Legal name on the USD bank account.

    ExampleAcme Treasury LLC
  • routing_numberstring | nullOptional

    9-digit ABA routing transit number for US ACH / wire.

    Example021000021
  • account_numberstring | nullOptional

    Bank account number for ACH / wire.

    Example1234567890
  • account_typestring (enum)Optional

    Required for ACH/wire.

    2 options
  • account_classstring (enum)Optional

    Required for ACH/wire/SWIFT/SEPA.

    2 options
  • address_line_1string | nullOptional

    Beneficiary street address (ACH/wire).

    Example1 Market St
  • citystring | nullOptional

    Beneficiary city (ACH/wire).

    ExampleSan Francisco
  • state_province_regionstring | nullOptional

    Beneficiary state/region (ACH/wire).

    ExampleCA
  • countrystring | nullOptional

    Beneficiary country code (ACH/wire), e.g. US.

    ExampleUS
  • postal_codestring | nullOptional

    Beneficiary postal code (ACH/wire).

    Example94105
  • recipient_relationshipstring (enum)Optional

    Required for SWIFT. first_party needs no supporting file; other values require transaction_document_file (at create or via PUT …/swift-document).

    10 options
  • swift_code_bicstring | nullOptional

    Required for SWIFT. Beneficiary bank BIC.

    ExampleCHASUS33
  • swift_account_holder_namestring | nullOptional

    Required for SWIFT. Account holder legal name.

    ExampleAcme International Ltd
  • swift_account_number_ibanstring | nullOptional

    Required for SWIFT. Account number or IBAN.

    ExampleGB29NWBK60161331926819
  • transaction_document_typestring (enum)Optional

    SWIFT relationship document type when not first_party.

    8 options
  • transaction_document_filestring | nullOptional

    PDF / JPEG / PNG data-URL or HTTPS URL. Required for SWIFT when recipient_relationship is not first_party.

    Examplehttps://example.com/invoice.pdf
  • sepa_ibanstring | nullOptional

    Required when type=sepa (Spot USD→EUR).

    ExampleDE89370400440532013000
  • sepa_beneficiary_bicstring | nullOptional

    Required when type=sepa.

    ExampleCOBADEFFXXX
  • sepa_beneficiary_legal_namestring | nullOptional

    Required when type=sepa.

    ExampleAcme Europe GmbH
json, example response code sample
json, example response
{
  "partner_id": "00000000-0000-4000-8000-000000000001",
  "product_mode": "both",
  "spot_trading_enabled": true,
  "forward_trading_enabled": true,
  "virtual_account_id": "va_000000000001",
  "virtual_account_status": "approved",
  "usd_virtual_account_ready": true,
  "virtual_account_credentials": {
    "ach": {
      "routing_number": "021000021",
      "account_number": "1234567890"
    },
    "wire": {
      "routing_number": "021000021",
      "account_number": "1234567890"
    },
    "swift": {
      "swift_code": "CHASUS33",
      "account_number": "1234567890"
    }
  },
  "supported_directions": [
    "BRL_TO_USD",
    "USD_TO_BRL",
    "BRL_TO_EUR"
  ],
  "usd_receive_methods": [
    "ach",
    "wire",
    "swift"
  ],
  "supported_products": [
    "spot",
    "deliverable_forward"
  ],
  "gbp_offramp_enabled": false,
  "enabled_settlement_chains": [
    "solana",
    "tron"
  ]
}
json, example response code sample
json, example response
{
  "bank_accounts": [
    {
      "id": "ba_pix_01",
      "name": "Treasury PIX",
      "type": "pix",
      "currency": "BRL",
      "last4": "8900",
      "label": "Treasury PIX ••••8900",
      "recipient_relationship": null,
      "has_swift_document": false
    },
    {
      "id": "ba_ach_01",
      "name": "US Treasury ACH",
      "type": "ach",
      "currency": "USD",
      "last4": "7890",
      "label": "US Treasury ACH ••••7890",
      "recipient_relationship": null,
      "has_swift_document": false
    },
    {
      "id": "ba_swift_01",
      "name": "Vendor SWIFT",
      "type": "swift",
      "currency": "USD",
      "last4": "6819",
      "label": "Vendor SWIFT ••••6819",
      "recipient_relationship": "vendor_or_supplier",
      "has_swift_document": true
    }
  ]
}
Bank create examples by rail

USD→BRL payout destination

json code sample
json
{
  "type": "pix",
  "name": "Treasury PIX",
  "pix_key": "12345678900"
}
json, example create response code sample
json, example create response
{
  "id": "ba_pix_01",
  "name": "Treasury PIX",
  "type": "pix",
  "currency": "BRL",
  "last4": "8900",
  "label": "Treasury PIX ••••8900",
  "recipient_relationship": null,
  "has_swift_document": false
}

SWIFT Relationship Documents

Third-party SWIFT payouts need an originator–recipient supporting file. Attach it when creating the bank (recipient_relationship + transaction_document_* on POST /api/v1/fiat/bank-accounts), or later via:

  • PUT /api/v1/fiat/bank-accounts/{bank_account_id}/swift-document — attach or replace the file on an existing ba_…
  • POST /api/v1/fiat/spot/orders/{order_id}/compliance-documents and the DF equivalent — order-level retry if the payout still needs documents
recipient_relationship=first_party does not require a supporting file. Files must be PDF, JPEG, or PNG (HTTPS URL or data-URL).
PUT /api/v1/fiat/bank-accounts/{bank_account_id}/swift-document, request body
  • transaction_document_typestring (enum)Required

    Originator–recipient supporting document type.

    7 options
  • transaction_document_idstring | nullOptional

    Optional partner document reference id (max 128 chars).

    ExampleINV-2026-0042
  • transaction_document_filestringRequired

    PDF / JPEG / PNG data-URL or HTTPS URL.

    Examplehttps://example.com/invoice.pdf
json, example request code sample
json, example request
{
  "transaction_document_type": "invoice",
  "transaction_document_id": "INV-2026-0042",
  "transaction_document_file": "https://example.com/invoice.pdf"
}

Payout Bank Rails

Spot and Deliverable Forward orders both require payout_destination.bank_account_id (ba_…). Register the bank first with POST /api/v1/fiat/bank-accounts. Inline PIX fields are not accepted on order create.

Directionusd_receive_methodRequired payout bank type
USD→BRLVA pay-in rail (ach / wire / swift)pix
BRL→USDUSD payout rail (must match bank type)ach, wire, or swift
USD→EUR (Spot only)VA pay-in railsepa
Wrong bank type returns 400 with fiat_payout_bank_rail_mismatch (see expected_bank_type or usd_receive_method in details). Missing / non-ba_… ids return fiat_payout_bank_account_required; unknown ids return fiat_payout_bank_account_not_found.

Fiat Spot Flow

The Spot flow allows immediate conversion between BRL and USD (and Spot USD→EUR):

  • 1. Preview Rate: Call POST /api/v1/fiat/spot/quote-preview to fetch the current live corridor rate.
  • 2. Lock Spot Quote: Call POST /api/v1/fiat/spot/quotes with your chosen amount and usd_receive_method (ach, wire, or swift) to lock the rate, cover fee, and total pay-in amount for about 10 minutes (quote_expires_at).
  • 3. Create Order: Call POST /api/v1/fiat/spot/orders with amount / amount_side, rail, and a matching ba_… payout bank. The server re-prices live FX (do not send locked_rate). Returns deposit payment instructions (PIX string or US VA details) and a customer payment link (share_url).
  • 4. Download Receipt: Once settled, fetch a certified PDF receipt via GET /api/v1/fiat/spot/orders/{order_id}/receipt.
Prerequisites for creating spot orders:
  • Customer Reference: The customer_reference_id must be an opaque identifier registered first via POST /api/v1/fx/customer-references. Unregistered customer IDs return 404.
  • Payout Destination: Always pass payout_destination.bank_account_id. See Payout bank rails for direction rules.
POST /api/v1/fiat/spot/quotes, request body
  • directionstring (enum)Required

    Corridor direction.

    3 options
  • amountdecimal stringRequired

    Fixed payin or payout amount.

    Example1000.00
  • amount_sidestring (enum)Optional

    Whether amount specifies payin or payout. Default payin.

    2 options
  • usd_receive_methodstring (enum)Required

    ACH, wire, or SWIFT — payout rail for BRL→USD; VA pay-in rail for USD→BRL / USD→EUR.

    3 options
json, example request code sample
json, example request
{
  "direction": "USD_TO_BRL",
  "amount": "1000.00",
  "amount_side": "payin",
  "usd_receive_method": "ach"
}
json, example response code sample
json, example response
{
  "direction": "USD_TO_BRL",
  "payin_amount": "1000.00",
  "payin_currency": "USD",
  "payout_amount": "5420.00",
  "payout_currency": "BRL",
  "locked_rate": "5.4200",
  "market_rate": "5.4200",
  "spread_bps": 30,
  "quote_expires_at": "2026-09-08T12:15:00Z",
  "usd_receive_method": "ach",
  "cover_fee_usd": "0.50",
  "cover_fee_payin_amount": "0.50",
  "cover_fee_payin_currency": "USD",
  "total_payin_amount": "1000.50"
}
POST /api/v1/fiat/spot/orders, request body
  • directionstring (enum)Required

    Corridor direction.

    3 options
  • amountdecimal stringRequired

    Fixed payin or payout amount (see amount_side). Server re-prices live FX — do not send locked_rate.

    Example1000.00
  • amount_sidestring (enum)Optional

    Whether amount is the pay-in or payout leg. Default payin.

    2 options
  • usd_receive_methodstring (enum)Required

    ACH, wire, or SWIFT — payout rail for BRL→USD; VA pay-in rail for USD→BRL / USD→EUR.

    3 options
  • customer_reference_idstringRequired

    Partner customer reference identifier (register first).

    Examplepartner-cust-2026-001
  • payout_destinationobjectRequired

    Payout bank: { bank_account_id: "ba_…" }. USD→BRL requires a PIX ba_…; BRL→USD requires a bank whose type matches usd_receive_method; USD→EUR requires SEPA. Create banks via POST /api/v1/fiat/bank-accounts.

    Example{ "bank_account_id": "ba_pix_01" }
json, example request code sample
json, example request
{
  "direction": "USD_TO_BRL",
  "amount": "1000.00",
  "amount_side": "payin",
  "usd_receive_method": "ach",
  "customer_reference_id": "partner-cust-2026-001",
  "payout_destination": {
    "bank_account_id": "ba_pix_01"
  }
}
json, example response code sample
json, example response
{
  "id": "44444444-4444-4444-8444-444444444444",
  "direction": "USD_TO_BRL",
  "status": "awaiting_payin",
  "payer_role": "self",
  "customer_reference_id": "partner-cust-2026-001",
  "payin_amount": "1000.00",
  "payin_currency": "USD",
  "payout_amount": "5420.00",
  "payout_currency": "BRL",
  "locked_rate": "5.4200",
  "usd_receive_method": "ach",
  "share_token": "share_spot_abc123",
  "share_url": "https://lock-apis.crebitpay.com/api/v1/fiat/pay/share_spot_abc123",
  "payment_instructions": [
    {
      "id": "55555555-5555-4555-8555-555555555555",
      "instruction_kind": "ach",
      "rail": "ach",
      "credentials": {
        "routing_number": "021000021",
        "account_number": "1234567890"
      },
      "display_text": "Send USD via ACH to Chase routing 021000021 account 1234567890",
      "expires_at": "2026-09-08T14:15:00Z"
    }
  ],
  "created_at": "2026-09-08T12:00:00Z",
  "updated_at": "2026-09-08T12:00:00Z"
}

Deliverable Forwards

Deliverable Forwards lock a future BRL↔USD conversion. The server normalizes the execution window to exactly 24 hours from execution_window_start (a longer client execution_window_end is ignored). Locked DF quotes expire in about 4–5 minutes (quote_expires_at).

  • 1. Quote Forward: Optionally call POST /api/v1/fiat/forward/quote-preview (amount + window only — no usd_receive_method), then POST /api/v1/fiat/forward/quotes with execution_window_start, execution_window_end, and usd_receive_method. The response specifies the upfront premium, deposit, and locked forward rate.
  • 2. Book Order: Call POST /api/v1/fiat/forward/orders with the same ba_… payout rules as Spot. Payer funds the upfront deposit + premium leg.
  • 3. Execute: During the execution window, call POST /api/v1/fiat/forward/orders/{order_id}/execute to open the remaining notional payment instructions.
  • 4. Payout: Payout is automatically triggered or confirmed via POST /api/v1/fiat/forward/orders/{order_id}/confirm-payout, delivering the full guaranteed amount. Confirm-payout re-checks the payout bank rail for the order direction.
POST /api/v1/fiat/forward/quotes, request body
  • directionstring (enum)Required

    Corridor direction.

    2 options
  • amountdecimal stringRequired

    Notional amount for the deliverable forward.

    Example10000.00
  • amount_sidestring (enum)Optional

    Whether amount specifies payin or payout. Default payin.

    2 options
  • execution_window_startdatetime (ISO-8601 UTC)Required

    Execution window start datetime.

    Example2026-10-01T00:00:00Z
  • execution_window_enddatetime (ISO-8601 UTC)Required

    Execution window close. Server forces end = start + 24h (longer client values are ignored).

    Example2026-10-02T00:00:00Z
  • usd_receive_methodstring (enum)Required

    ACH, wire, or SWIFT — payout rail for BRL→USD; VA pay-in rail for USD→BRL.

    3 options
json, example request code sample
json, example request
{
  "direction": "USD_TO_BRL",
  "amount": "10000.00",
  "amount_side": "payin",
  "execution_window_start": "2026-10-01T00:00:00Z",
  "execution_window_end": "2026-10-02T00:00:00Z",
  "usd_receive_method": "ach"
}
json, example response code sample
json, example response
{
  "direction": "USD_TO_BRL",
  "notional_amount": "10000.00",
  "notional_currency": "USD",
  "payin_currency": "USD",
  "payout_currency": "BRL",
  "locked_rate": "5.4500",
  "market_rate": "5.4200",
  "premium_amount": "200.00",
  "deposit_amount": "1000.00",
  "upfront_amount": "1200.00",
  "remaining_notional": "9000.00",
  "guaranteed_payout_amount": "54500.00",
  "execution_window_start": "2026-10-01T00:00:00Z",
  "execution_window_end": "2026-10-02T00:00:00Z",
  "quote_expires_at": "2026-09-08T12:04:45Z",
  "usd_receive_method": "ach"
}
POST /api/v1/fiat/forward/orders, request body
  • directionstring (enum)Required

    Corridor direction matching the accepted quote.

    2 options
  • amountdecimal stringRequired

    Notional amount for the deliverable forward.

    Example10000.00
  • amount_sidestring (enum)Optional

    Whether amount specifies payin or payout. Default payin.

    2 options
  • execution_window_startdatetime (ISO-8601 UTC)Required

    Execution window start datetime.

    Example2026-10-01T00:00:00Z
  • execution_window_enddatetime (ISO-8601 UTC)Required

    Execution window close. Server forces end = start + 24h (longer client values are ignored).

    Example2026-10-02T00:00:00Z
  • usd_receive_methodstring (enum)Required

    ACH, wire, or SWIFT — payout rail for BRL→USD; VA pay-in rail for USD→BRL.

    3 options
  • customer_reference_idstringRequired

    Partner customer reference identifier (must be registered first).

    Examplepartner-cust-2026-001
  • payout_destinationobjectRequired

    Payout bank: { bank_account_id: "ba_…" }. Same direction rules as Spot (PIX for USD→BRL; rail match for BRL→USD).

    Example{ "bank_account_id": "ba_pix_01" }
json, example request code sample
json, example request
{
  "direction": "USD_TO_BRL",
  "amount": "10000.00",
  "amount_side": "payin",
  "execution_window_start": "2026-10-01T00:00:00Z",
  "execution_window_end": "2026-10-02T00:00:00Z",
  "usd_receive_method": "ach",
  "customer_reference_id": "partner-cust-2026-001",
  "payout_destination": {
    "bank_account_id": "ba_pix_01"
  }
}
json, example response code sample
json, example response
{
  "id": "66666666-6666-4666-8666-666666666666",
  "direction": "USD_TO_BRL",
  "status": "awaiting_upfront",
  "payer_role": "self",
  "customer_reference_id": "partner-cust-2026-001",
  "notional_amount": "10000.00",
  "notional_currency": "USD",
  "payin_currency": "USD",
  "payout_currency": "BRL",
  "locked_rate": "5.4500",
  "market_rate": "5.4200",
  "premium_amount": "200.00",
  "deposit_amount": "1000.00",
  "upfront_amount": "1200.00",
  "remaining_notional": "9000.00",
  "guaranteed_payout_amount": "54500.00",
  "execution_window_start": "2026-10-01T00:00:00Z",
  "execution_window_end": "2026-10-02T00:00:00Z",
  "upfront_share_token": "df_upfront_xyz789",
  "upfront_share_url": "https://lock-apis.crebitpay.com/api/v1/fiat/pay/df_upfront_xyz789",
  "created_at": "2026-09-08T12:00:00Z",
  "updated_at": "2026-09-08T12:00:00Z"
}

Idempotency & Retries

All fiat write endpoints accept an optional Idempotency-Key header. If a network timeout occurs, re-sending the same request with the same header and payload safely replays the original response:

  • POST /api/v1/fiat/bank-accounts
  • POST /api/v1/fiat/spot/quotes
  • POST /api/v1/fiat/spot/orders
  • POST /api/v1/fiat/forward/quotes
  • POST /api/v1/fiat/forward/orders
  • POST /api/v1/fiat/forward/orders/{order_id}/execute
  • POST /api/v1/fiat/forward/orders/{order_id}/confirm-payout

Webhooks (In + Out)

Contract lifecycle and BRL→USDC collection events. Same envelope shape on both sides: event_type at the top discriminates which schema applies. Contract activation after funding is visible via polling — Crebit does not emit a funding confirmation outbound webhook.

Directionevent_typeWho calls whoTrigger
Inboundfunds_in_routePartner → CrebitPartner announces an on-chain deposit/premium dispatch.
Inboundcontract_exercisedPartner → CrebitCustomer transacted within the lock window, Crebit pays out the FX delta.
Outboundpayout_successCrebit → PartnerOn-chain payout to customer confirmed.
Outboundcontract_settledCrebit → PartnerContract moved exercised → settled (usually follows payout_success).
Outboundpayout_failedCrebit → PartnerPayout could not complete (inspect retry_planned).
Outboundcontract_expiredCrebit → PartnerOption expired without exercise. Forwards may force-exercise at maturity instead.
Outboundfiat_collection_settledCrebit → PartnerBRL→USDC collection newly settled (USDC on Base).
Outboundfiat_collection_failedCrebit → PartnerBRL→USDC collection newly failed.

Inbound, Partner → Crebit

Single endpoint, single envelope: POST /api/v1/fx/webhooks/inbound. The first field is always event_type, Crebit uses it to pick the right schema. POST /api/v1/fx/webhooks/inbound requires Idempotency-Key (8–128 ASCII printable chars). Recommended on quote and contract POSTs.

Inbound event variants

Notify Crebit you've dispatched the deposit on-chain to funding_wallet_address. Optional but recommended, Crebit can pre-stage processing.

json code sample
json
{
  "event_type": "funds_in_route",
  "fx_contract_id": "33333333-3333-4333-8333-333333333333",
  "payment_type": "deposit",
  "amount": "5000.00",
  "currency": "USDC",
  "chain": "solana",
  "transaction_hash": "5Kq3abc123…",
  "source_wallet_address": "PartnerSolanaTreasury…"
}

funds_in_route, Schema

Notify Crebit that premium or deposit is on the way (or already on-chain). Crebit advances the contract from quote_created → funds_in_route, then to active once funding is complete. Poll GET …/status until status=active. When chain=solana and payment_type and transaction_hash are all set, Crebit verifies the funding transaction on-chain.

Only fire this once funds are actually in motion. We understand USD→stablecoin onramps can take time, fire funds_in_routethe moment you've initiated the on-chain transfer (or queued the onramp that will produce it), NOT just because the customer has clicked "accept". Pre-firing puts Crebit's lock state out of sync with the on-chain reality and will trigger reconciliation alerts on our side. Accurate reporting keeps the hedge tight.
event_type = funds_in_route
  • event_typestring (const)Required

    Discriminator. Must be the literal string funds_in_route.

    1 option
  • fx_contract_iduuidRequired

    Contract id returned by POST /api/v1/fx/contracts.

    Example33333333-…
  • payment_typestring (enum)Optional

    Which leg you're funding. If you send any payment detail, you must send payment_type, amount, currency, and chain together (all four or none).

    2 options
  • amountdecimal stringOptional

    Amount dispatched on-chain to funding_wallet_address. Required together with payment_type, currency, and chain.

    Example5000.00
  • currencystring (enum)Optional

    Stablecoin you sent. Required together with payment_type, amount, and chain. Must match the contract's settlement_currency (USDC or USDT) unless you use BRLA on a BRL corridor.

    3 options
  • chainstring (enum)Optional

    Chain you sent on. Required together with payment_type, amount, and currency. Must match the contract's chain.

    4 options
  • transaction_hashstringOptional

    On-chain tx hash. When chain=solana and payment_type are also set, Crebit verifies the funding transaction on-chain before accepting.

    Example0xabc123…
  • source_wallet_addressstringOptional

    Wallet the funds were sent from.

    Example0xPartnerTreasury…

contract_exercised, Schema (Triggers Payout)

This is the call that triggers Crebit to pay out. Fire it the moment the customer transacts on your platform within the lock window. Crebit reads locked_rate from the contract, compares against live_execution_rate, converts the delta to settlement_currency, and transfers it to payout_wallet_address on chain. Send the same chain and payout_currencyas the contract's locked rail. Fire the webhook while the lock window is open — Crebit checks receipt time (server clock), not executed_at. Rejections return 400 INVALID_ARGUMENT.
event_type = contract_exercised
  • event_typestring (const)Required

    Discriminator. Must be the literal string contract_exercised. THIS IS THE CALL THAT TRIGGERS CREBIT TO PAY OUT.

    1 option
  • fx_contract_iduuidRequired

    Contract the customer just transacted against.

    Example33333333-…
  • executed_atdatetime (ISO-8601 UTC)Required

    UTC timestamp of the customer's underlying transaction (audit / support). Crebit validates the lock window using webhook receipt time (server clock), not this field. Poll response exercised_at is stamped when Crebit processes the webhook.

    Example2026-08-07T13:42:00Z
  • live_execution_ratedecimal stringRequired

    Live mid-market FX rate the moment the customer transacted. Crebit compares against locked_rate to compute the FX delta.

    Example5.51
  • transaction_amountdecimal stringOptional

    Partner-reported base-currency amount executed. Defaults to the contract notional when omitted.

    Example50000.00
  • payout_wallet_addressstringOptional

    On-chain destination for the FX delta payout. Optional when a payout destination is already saved on the contract (via create or PUT .../payout-destination).

    Example0xEndUserWallet…
  • payout_currencystring (enum)Required

    Stablecoin Crebit pays out in (USDC, USDT, or BRLA). Must match the contract's settlement_currency. Tron payouts require USDT.

    3 options
  • chainstring (enum)Required

    Blockchain Crebit pays out on. Send the same chain locked at quote time.

    4 options

How to Call (Either Variant)

HTTP code sample
curl -sS -X POST "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/webhooks/inbound" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"event_type":"contract_exercised","fx_contract_id":"33333333-3333-4333-8333-333333333333","executed_at":"2026-08-07T13:42:00Z","live_execution_rate":"5.51","payout_wallet_address":"EndUserSolanaWallet…","payout_currency":"USDC","chain":"solana"}'

Inbound ACK Response, 200 OK

Crebit's response to your inbound POST
  • webhook_event_iduuidRequired

    Crebit's id for the event. Echo in support tickets.

    Example44444444-…
  • statusstring (enum)Required

    received = accepted, async work pending. processed = handled. failed = business rule rejected the payload. retrying = outbound delivery in progress. Idempotent replays echo the stored status.

    4 options
json, example response code sample
json, example response
{
  "webhook_event_id": "44444444-4444-4444-8444-444444444444",
  "status": "processed"
}

Outbound, Crebit → Partner

Crebit POSTs JSON to the webhook_url you configured during onboarding (one URL per environment). The first field is again event_type, switch on it. Every outbound event also has a top-level subjectthat says whether it is about your own account or one of your organization's members (see Who is this event for?).

No outbound webhook URL configured yet? Send Crebit support the URL and environment. Until then, poll GET /api/v1/fx/webhook-events?direction=outgoing to learn payout state on demand.
Outbound event variants

On-chain payout confirmed. Arrives when the FX delta transfer is confirmed on-chain.

json code sample
json
{
  "event_type": "payout_success",
  "fx_contract_id": "33333333-3333-4333-8333-333333333333",
  "payout_id": "99999999-9999-4999-8999-999999999999",
  "amount": "4183.30",
  "currency": "USDC",
  "chain": "solana",
  "transaction_hash": "4f3a1...e29c",
  "status": "confirmed",
  "timestamp": "2026-08-07T13:43:08Z",
  "crebit_contract_reference": "CREBIT-20260524-7F3A9C2B1D",
  "partner_transaction_reference": "platform-tx-9901",
  "payout_wallet_address": "EndUserSolanaWallet…",
  "transaction_explorer_url": "https://solscan.io/tx/4f3a1...e29c",
  "settlement_rate_used": "5.5100",
  "oracle_clamp_applied": false,
  "subject": {
    "relationship": "self",
    "partner_id": "11111111-1111-4111-8111-111111111111",
    "partner_name": "Acme FX (sandbox)",
    "organisation_id": null,
    "organisation_name": null
  }
}

payout_success, Schema

Delivered when the on-chain FX delta payout is confirmed. Includes transaction_hash and optional transaction_explorer_url.

event_type = payout_success
  • event_typestring (const)Required

    Always the literal string payout_success.

    1 option
  • fx_contract_iduuidRequired

    Contract whose payout was confirmed.

    Example33333333-…
  • payout_iduuidRequired

    Crebit payout row id.

    Example99999999-…
  • amountdecimal stringRequired

    FX delta amount paid out.

    Example4500.00
  • currencystring (enum)Required

    Stablecoin Crebit paid out.

    3 options
  • chainstring (enum)Required

    Blockchain where the payout was sent.

    4 options
  • transaction_hashstringRequired

    On-chain transaction hash for the payout transfer.

    Example0xf3a1...e29c
  • statusstring (const)Required

    Always confirmed on this event.

    1 option
  • timestampdatetime (ISO-8601 UTC)Required

    UTC timestamp when the payout was confirmed on-chain.

    Example2026-08-07T13:43:08Z
  • crebit_contract_referencestringRequired

    Human-readable contract reference.

    ExampleCREBIT-20260524-7F3A9C2B1D
  • partner_transaction_referencestring | nullOptional

    Echoed from the contract, your reconciliation id.

    Exampleplatform-tx-9901
  • payout_wallet_addressstringRequired

    Wallet that received the payout.

    Example0xEndUserWallet…
  • transaction_explorer_urlstring | nullOptional

    Block explorer URL for the payout transaction (e.g. Solana).

    Examplehttps://etherscan.io/tx/0xf3a1...e29c
  • settlement_rate_useddecimal stringOptional

    Oracle settlement rate used at exercise (including maturity force-exercise). Present when a payout settlement audit trace exists.

    Example5.5100
  • oracle_clamp_appliedbooleanOptional

    Whether the conservative oracle clamp was applied at settlement.

    Examplefalse
  • subjectobjectRequired

    Who the event is for. Part of the signed body; use it (not the delivery headers) to decide whether the event is yours or a member's.

    Show 5 nested fields
    • relationshipstring (enum)Required

      self = the event is about your own partner account. organisation_member = a copy of an event that belongs to one of your organization's member partners.

      2 options
    • partner_iduuidRequired

      Partner the event belongs to: your own partner id for self, the member's partner id for organisation_member.

      Example11111111-…
    • partner_namestringRequired

      Display name of that partner.

      ExampleAcme FX (sandbox)
    • organisation_iduuid | nullRequired

      Organization the member belongs to. null for self.

      Examplenull
    • organisation_namestring | nullRequired

      Name of that organization. null for self.

      Examplenull

contract_settled, Schema

Delivered when the contract moves exercised → settled. Usually follows payout_success on the same contract.

event_type = contract_settled
  • event_typestring (const)Required

    Always the literal string contract_settled.

    1 option
  • fx_contract_iduuidRequired

    Contract that settled.

    Example33333333-…
  • crebit_contract_referencestringRequired

    Human-readable contract reference.

    ExampleCREBIT-20260524-7F3A9C2B1D
  • partner_transaction_referencestring | nullOptional

    Echoed from the contract.

    Exampleplatform-tx-9901
  • settled_atdatetime (ISO-8601 UTC)Required

    UTC timestamp when the contract moved to settled.

    Example2026-08-07T13:43:12Z
  • settlement_statusstring (const)Required

    Always the literal string settled.

    1 option
  • payout_iduuidOptional

    Latest confirmed payout id used as settlement proof.

    Example99999999-…
  • payout_amountdecimal stringOptional

    Amount from the confirming payout.

    Example4500.00
  • payout_currencystring (enum)Optional

    Stablecoin from the confirming payout.

    3 options
  • chainstring (enum)Optional

    Chain from the confirming payout.

    4 options
  • transaction_hashstringOptional

    On-chain proof from the confirming payout.

    Example0xf3a1...e29c
  • settlement_rate_useddecimal stringOptional

    Oracle settlement rate used at exercise (including maturity force-exercise). Present when a payout settlement audit trace exists.

    Example5.5100
  • oracle_clamp_appliedbooleanOptional

    Whether the conservative oracle clamp was applied at settlement.

    Examplefalse
  • subjectobjectRequired

    Who the event is for. Part of the signed body; use it (not the delivery headers) to decide whether the event is yours or a member's.

    Show 5 nested fields
    • relationshipstring (enum)Required

      self = the event is about your own partner account. organisation_member = a copy of an event that belongs to one of your organization's member partners.

      2 options
    • partner_iduuidRequired

      Partner the event belongs to: your own partner id for self, the member's partner id for organisation_member.

      Example11111111-…
    • partner_namestringRequired

      Display name of that partner.

      ExampleAcme FX (sandbox)
    • organisation_iduuid | nullRequired

      Organization the member belongs to. null for self.

      Examplenull
    • organisation_namestring | nullRequired

      Name of that organization. null for self.

      Examplenull

payout_failed, Schema

event_type = payout_failed
  • event_typestring (const)Required

    Always the literal string payout_failed.

    1 option
  • fx_contract_iduuidRequired

    Contract whose payout failed.

    Example33333333-…
  • payout_iduuidRequired

    Crebit payout row id.

    Example99999999-…
  • reasonstringRequired

    Human-readable failure reason.

    Exampledestination_wallet_unreachable
  • crebit_contract_referencestringRequired

    Human-readable contract reference.

    ExampleCREBIT-20260524-7F3A9C2B1D
  • partner_transaction_referencestring | nullOptional

    Echoed from the contract.

    Exampleplatform-tx-9901
  • retry_plannedboolean | nullOptional

    Whether Crebit plans to retry the payout.

    Exampletrue
  • retry_countinteger | nullOptional

    Number of retry attempts so far.

    Example1
  • timestampdatetime (ISO-8601 UTC) | nullOptional

    UTC timestamp when the failure was recorded.

    Example2026-08-07T13:44:05Z
  • subjectobjectRequired

    Who the event is for. Part of the signed body; use it (not the delivery headers) to decide whether the event is yours or a member's.

    Show 5 nested fields
    • relationshipstring (enum)Required

      self = the event is about your own partner account. organisation_member = a copy of an event that belongs to one of your organization's member partners.

      2 options
    • partner_iduuidRequired

      Partner the event belongs to: your own partner id for self, the member's partner id for organisation_member.

      Example11111111-…
    • partner_namestringRequired

      Display name of that partner.

      ExampleAcme FX (sandbox)
    • organisation_iduuid | nullRequired

      Organization the member belongs to. null for self.

      Examplenull
    • organisation_namestring | nullRequired

      Name of that organization. null for self.

      Examplenull

contract_expired, Schema

Lock window passed and the customer never exercised.

  • For forwards, the customer was obligated to transact and didn't, so the security deposit is forfeitedto cover Crebit's hedge cost. Payload carries deposit_outcome.status="forfeited" with the amount, currency, chain, and forfeit timestamp.
  • For options, the premium was non-refundable anyway, so deposit_outcome is null and this delivery is purely a terminal status notification.
event_type = contract_expired
  • event_idstringRequired

    Use as your idempotency key.

    Exampleevt_7c1d3e8b4a9f2d6c
  • event_typestring (const)Required

    Always the literal string contract_expired.

    1 option
  • delivered_atdatetimeRequired

    UTC timestamp Crebit emitted this delivery attempt.

    Example2026-08-11T00:01:30Z
  • fx_contract_iduuidRequired

    Contract that expired.

    Example33333333-…
  • crebit_contract_referencestringRequired

    Human-readable contract reference.

    ExampleCREBIT-20260524-7F3A9C2B1D
  • partner_transaction_referencestring | nullOptional

    Echoed from the contract.

    Exampleplatform-tx-9901
  • contractobjectRequired

    Snapshot of the expired contract.

    Show 2 nested fields
    • contract_typestring (enum)Required

      forward or option.

      2 options
    • expired_atdatetime (ISO-8601 UTC)Required

      UTC timestamp when the lock window ended.

      Example2026-08-11T00:00:00Z
  • deposit_outcomeobject | nullOptional

    Forwards only (null for options). Reports what happened to the security deposit.

    Show 5 nested fields
    • statusstring (const)Required

      Always forfeited on contract_expired for forwards.

      1 option
    • amountdecimal stringRequired

      Deposit amount forfeited.

      Example5000.00
    • currencystring (enum)Required

      Stablecoin of the forfeited deposit.

      2 options
    • chainstring (enum)Required

      Blockchain where the deposit was held.

      4 options
    • forfeited_atdatetime (ISO-8601 UTC)Required

      UTC timestamp when Crebit marked the deposit forfeited.

      Example2026-08-11T00:01:25Z
  • subjectobjectRequired

    Who the event is for. Part of the signed body; use it (not the delivery headers) to decide whether the event is yours or a member's.

    Show 5 nested fields
    • relationshipstring (enum)Required

      self = the event is about your own partner account. organisation_member = a copy of an event that belongs to one of your organization's member partners.

      2 options
    • partner_iduuidRequired

      Partner the event belongs to: your own partner id for self, the member's partner id for organisation_member.

      Example11111111-…
    • partner_namestringRequired

      Display name of that partner.

      ExampleAcme FX (sandbox)
    • organisation_iduuid | nullRequired

      Organization the member belongs to. null for self.

      Examplenull
    • organisation_namestring | nullRequired

      Name of that organization. null for self.

      Examplenull

fiat_collection_settled, Schema

Delivered when a BRL→USDC collection newly reaches settled (USDC on the beneficiary Base wallet). See Pix Automático.

event_type = fiat_collection_settled
  • event_typestring (const)Required

    Always the literal string fiat_collection_settled.

    1 option
  • fiat_collection_iduuidRequired

    Crebit collection id.

    Examplea7b8c9d0-…
  • partner_iduuidRequired

    Partner that owns the collection.

    Example11111111-…
  • beneficiary_iduuidRequired

    Beneficiary whose Base wallet receives USDC.

    Example9c1e2a3b-…
  • collection_typestring (enum)Required

    Collection rail. va_deposit is created from permanent BRL VA activity (no create endpoint).

    4 options
  • statusstring (enum)Required

    Collection status at delivery time.

    6 options
  • amount_brldecimal string | nullOptional

    BRL amount on the collection, when known.

    Example49.90
  • amount_usdcdecimal string | nullOptional

    USDC settled to the beneficiary wallet, when known.

    Example9.12
  • client_reference_idstring | nullOptional

    Your client reference on the collection.

    ExampleSUB-1048-001
  • bridge_transfer_idstring | nullOptional

    Opaque Bridge transfer id when present.

    Exampletransfer_01JX7K2M9Q
  • bridge_deposit_idstring | nullOptional

    Opaque Bridge deposit id when present.

    Exampledep_01JX7K2M9Q
  • bridge_event_idstring | nullOptional

    Opaque Bridge event id that drove settlement, when present.

    Exampleevt_bridge_01
  • destination_wallet_addressstringOptional

    Beneficiary Base USDC wallet.

    Example0x1111…1111
  • destination_chainstringOptional

    Always base for BRL→USDC collections.

    Examplebase
  • destination_currencystringOptional

    Always usdc for BRL→USDC collections.

    Exampleusdc
  • beneficiary_display_namestringOptional

    Beneficiary display name.

    ExampleAcme Pay treasury
  • beneficiary_external_referencestringOptional

    Your external_reference on the beneficiary, when set.

    Exampleacme-treasury-01
  • timestampdatetime (ISO-8601 UTC)Required

    UTC timestamp when Crebit enqueued the webhook.

    Example2026-11-10T12:20:01+00:00
  • subjectobjectRequired

    Who the event is for. Part of the signed body; use it (not the delivery headers) to decide whether the event is yours or a member's.

    Show 5 nested fields
    • relationshipstring (enum)Required

      self = the event is about your own partner account. organisation_member = a copy of an event that belongs to one of your organization's member partners.

      2 options
    • partner_iduuidRequired

      Partner the event belongs to: your own partner id for self, the member's partner id for organisation_member.

      Example11111111-…
    • partner_namestringRequired

      Display name of that partner.

      ExampleAcme FX (sandbox)
    • organisation_iduuid | nullRequired

      Organization the member belongs to. null for self.

      Examplenull
    • organisation_namestring | nullRequired

      Name of that organization. null for self.

      Examplenull
  • settled_atdatetime (ISO-8601 UTC)Optional

    UTC timestamp when the collection settled.

    Example2026-11-10T12:20:00+00:00
json, fiat_collection_settled code sample
json, fiat_collection_settled
{
  "event_type": "fiat_collection_settled",
  "fiat_collection_id": "a7b8c9d0-1e2f-4a3b-9c8d-0e1f2a3b4c5d",
  "partner_id": "11111111-1111-4111-8111-111111111111",
  "beneficiary_id": "9c1e2a3b-4d5f-4e6a-8b7c-1d2e3f4a5b6c",
  "collection_type": "pix_automatico",
  "status": "settled",
  "amount_brl": "49.90",
  "amount_usdc": "9.12",
  "client_reference_id": "SUB-1048-001",
  "bridge_transfer_id": "transfer_01JX7K2M9Q",
  "bridge_deposit_id": null,
  "bridge_event_id": "evt_bridge_01",
  "destination_wallet_address": "0x1111111111111111111111111111111111111111",
  "destination_chain": "base",
  "destination_currency": "usdc",
  "beneficiary_display_name": "Acme Pay treasury",
  "beneficiary_external_reference": "acme-treasury-01",
  "settled_at": "2026-11-10T12:20:00+00:00",
  "timestamp": "2026-11-10T12:20:01+00:00",
  "subject": {
    "relationship": "self",
    "partner_id": "11111111-1111-4111-8111-111111111111",
    "partner_name": "Acme FX (sandbox)",
    "organisation_id": null,
    "organisation_name": null
  }
}

fiat_collection_failed, Schema

Delivered when a BRL→USDC collection newly reaches failed. Idempotency key: fiat_collection_failed:{collection_id}.

event_type = fiat_collection_failed
  • event_typestring (const)Required

    Always the literal string fiat_collection_failed.

    1 option
  • fiat_collection_iduuidRequired

    Crebit collection id.

    Examplea7b8c9d0-…
  • partner_iduuidRequired

    Partner that owns the collection.

    Example11111111-…
  • beneficiary_iduuidRequired

    Beneficiary whose Base wallet receives USDC.

    Example9c1e2a3b-…
  • collection_typestring (enum)Required

    Collection rail. va_deposit is created from permanent BRL VA activity (no create endpoint).

    4 options
  • statusstring (enum)Required

    Collection status at delivery time.

    6 options
  • amount_brldecimal string | nullOptional

    BRL amount on the collection, when known.

    Example49.90
  • amount_usdcdecimal string | nullOptional

    USDC settled to the beneficiary wallet, when known.

    Example9.12
  • client_reference_idstring | nullOptional

    Your client reference on the collection.

    ExampleSUB-1048-001
  • bridge_transfer_idstring | nullOptional

    Opaque Bridge transfer id when present.

    Exampletransfer_01JX7K2M9Q
  • bridge_deposit_idstring | nullOptional

    Opaque Bridge deposit id when present.

    Exampledep_01JX7K2M9Q
  • bridge_event_idstring | nullOptional

    Opaque Bridge event id that drove settlement, when present.

    Exampleevt_bridge_01
  • destination_wallet_addressstringOptional

    Beneficiary Base USDC wallet.

    Example0x1111…1111
  • destination_chainstringOptional

    Always base for BRL→USDC collections.

    Examplebase
  • destination_currencystringOptional

    Always usdc for BRL→USDC collections.

    Exampleusdc
  • beneficiary_display_namestringOptional

    Beneficiary display name.

    ExampleAcme Pay treasury
  • beneficiary_external_referencestringOptional

    Your external_reference on the beneficiary, when set.

    Exampleacme-treasury-01
  • timestampdatetime (ISO-8601 UTC)Required

    UTC timestamp when Crebit enqueued the webhook.

    Example2026-11-10T12:20:01+00:00
  • subjectobjectRequired

    Who the event is for. Part of the signed body; use it (not the delivery headers) to decide whether the event is yours or a member's.

    Show 5 nested fields
    • relationshipstring (enum)Required

      self = the event is about your own partner account. organisation_member = a copy of an event that belongs to one of your organization's member partners.

      2 options
    • partner_iduuidRequired

      Partner the event belongs to: your own partner id for self, the member's partner id for organisation_member.

      Example11111111-…
    • partner_namestringRequired

      Display name of that partner.

      ExampleAcme FX (sandbox)
    • organisation_iduuid | nullRequired

      Organization the member belongs to. null for self.

      Examplenull
    • organisation_namestring | nullRequired

      Name of that organization. null for self.

      Examplenull
  • failure_reasonstringOptional

    Opaque failure reason when present.

    Examplepix_automatic.authorization.refused
json, fiat_collection_failed code sample
json, fiat_collection_failed
{
  "event_type": "fiat_collection_failed",
  "fiat_collection_id": "a7b8c9d0-1e2f-4a3b-9c8d-0e1f2a3b4c5d",
  "partner_id": "11111111-1111-4111-8111-111111111111",
  "beneficiary_id": "9c1e2a3b-4d5f-4e6a-8b7c-1d2e3f4a5b6c",
  "collection_type": "pix_automatico",
  "status": "failed",
  "amount_brl": "49.90",
  "amount_usdc": null,
  "client_reference_id": "SUB-1048-001",
  "bridge_transfer_id": null,
  "bridge_deposit_id": null,
  "bridge_event_id": null,
  "failure_reason": "pix_automatic.authorization.refused",
  "destination_wallet_address": "0x1111111111111111111111111111111111111111",
  "destination_chain": "base",
  "destination_currency": "usdc",
  "beneficiary_display_name": "Acme Pay treasury",
  "beneficiary_external_reference": "acme-treasury-01",
  "timestamp": "2026-11-10T12:12:00+00:00",
  "subject": {
    "relationship": "self",
    "partner_id": "11111111-1111-4111-8111-111111111111",
    "partner_name": "Acme FX (sandbox)",
    "organisation_id": null,
    "organisation_name": null
  }
}

Signature, Retries, Ordering

  • Inbound signature. When a webhook endpoint is configured (or WEBHOOK_INBOUND_REQUIRE_SIGNATURE is enabled), inbound POSTs must include X-Crebit-Signature (t=<unix>,v1=<hex>) and X-Crebit-Timestamp. Signed payload is {timestamp}.{canonical JSON body}.
  • Outbound signature. Outbound deliveries include X-Crebit-Signature (t=<unix>,v1=<hex>), X-Crebit-Timestamp, X-Crebit-Event-Id, and X-Crebit-Idempotency-Key. Signature is a hex HMAC-SHA256 of {timestamp}.{raw body bytes} with your webhook signing secret. Verify with your webhook signing secret before trusting the payload.
  • Subject headers. Outbound deliveries also include X-Crebit-Subject-Relationship (self or organisation_member) and X-Crebit-Subject-Partner-Id. They mirror the body's subject for quick routing but are not signed; the signed body subject is canonical.
  • Idempotency. Use event_id as your idempotency key, Crebit may retry an identical delivery.
  • Retries. Reply 2xx within 15s. Crebit retries other responses and timeouts with exponential backoff (30s doubling, capped at 1h, with jitter) up to 8 attempts.
  • Ordering. Not guaranteed across contracts. Within a single contract, Crebit serialises deliveries.

Audit Endpoints

GET /api/v1/fx/webhook-events returns both directions: every inbound POST you sent and every outbound delivery Crebit attempted to your webhook_url. Filter with direction and optional fx_contract_id.

GET /api/v1/fx/webhook-events, query parameters
  • directionstring (enum)Optional

    Filter by webhook direction. incoming = partner → Crebit. outgoing = Crebit → partner (payout_success, contract_settled, etc.).

    2 options
  • fx_contract_iduuidOptional

    Optional filter to events for one contract.

    Example33333333-…
  • limitintegerOptional

    Page size (1–100). Default 25.

    Example25
  • cursorstringOptional

    Opaque pagination cursor from a previous response's next_cursor.

    ExampleeyJpZCI6IjMzMz…

To backfill outbound payout events when your endpoint was down, poll GET /api/v1/fx/webhook-events?direction=outgoing (optionally scoped with fx_contract_id).

HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/webhook-events?direction=incoming&limit=25" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"
json, example response (mixed directions) code sample
json, example response (mixed directions)
{
  "items": [
    {
      "id": "44444444-4444-4444-8444-444444444444",
      "partner_id": "11111111-1111-4111-8111-111111111111",
      "fx_contract_id": "33333333-3333-4333-8333-333333333333",
      "direction": "incoming",
      "event_type": "funds_in_route",
      "idempotency_key": "idem-funds-2026-05-24-001",
      "status": "processed",
      "retry_count": 0,
      "last_error": null,
      "payload": {
        "event_type": "funds_in_route",
        "fx_contract_id": "33333333-3333-4333-8333-333333333333",
        "payment_type": "deposit",
        "amount": "5000.00",
        "currency": "USDC",
        "chain": "solana",
        "transaction_hash": "5Kq3abc123…",
        "source_wallet_address": "PartnerSolanaTreasury…"
      },
      "created_at": "2026-05-24T17:00:00Z",
      "processed_at": "2026-05-24T17:00:01Z"
    },
    {
      "id": "55555555-5555-4555-8555-555555555556",
      "partner_id": "11111111-1111-4111-8111-111111111111",
      "fx_contract_id": "33333333-3333-4333-8333-333333333333",
      "direction": "outgoing",
      "event_type": "payout_success",
      "idempotency_key": "payout_success:99999999-9999-4999-8999-999999999999",
      "status": "processed",
      "retry_count": 0,
      "last_error": null,
      "payload": {
        "event_type": "payout_success",
        "fx_contract_id": "33333333-3333-4333-8333-333333333333",
        "payout_id": "99999999-9999-4999-8999-999999999999",
        "amount": "4183.30",
        "currency": "USDC",
        "chain": "solana",
        "transaction_hash": "4f3a1...e29c",
        "status": "confirmed",
        "timestamp": "2026-08-07T13:43:08Z",
        "crebit_contract_reference": "CREBIT-20260524-7F3A9C2B1D",
        "partner_transaction_reference": "platform-tx-9901",
        "payout_wallet_address": "EndUserSolanaWallet…",
        "transaction_explorer_url": "https://solscan.io/tx/4f3a1...e29c",
        "settlement_rate_used": "5.5100",
        "oracle_clamp_applied": false,
        "subject": {
          "relationship": "self",
          "partner_id": "11111111-1111-4111-8111-111111111111",
          "partner_name": "Acme FX (sandbox)",
          "organisation_id": null,
          "organisation_name": null
        }
      },
      "created_at": "2026-08-07T13:43:08Z",
      "processed_at": "2026-08-07T13:43:08Z"
    },
    {
      "id": "55555555-5555-4555-8555-555555555557",
      "partner_id": "11111111-1111-4111-8111-111111111111",
      "fx_contract_id": "33333333-3333-4333-8333-333333333333",
      "direction": "outgoing",
      "event_type": "contract_settled",
      "idempotency_key": "contract_settled:33333333-3333-4333-8333-333333333333",
      "status": "processed",
      "retry_count": 0,
      "last_error": null,
      "payload": {
        "event_type": "contract_settled",
        "fx_contract_id": "33333333-3333-4333-8333-333333333333",
        "crebit_contract_reference": "CREBIT-20260524-7F3A9C2B1D",
        "partner_transaction_reference": "platform-tx-9901",
        "settled_at": "2026-08-07T13:43:12Z",
        "settlement_status": "settled",
        "payout_id": "99999999-9999-4999-8999-999999999999",
        "payout_amount": "4183.30",
        "payout_currency": "USDC",
        "chain": "solana",
        "transaction_hash": "4f3a1...e29c",
        "settlement_rate_used": "5.5100",
        "oracle_clamp_applied": false,
        "subject": {
          "relationship": "self",
          "partner_id": "11111111-1111-4111-8111-111111111111",
          "partner_name": "Acme FX (sandbox)",
          "organisation_id": null,
          "organisation_name": null
        }
      },
      "created_at": "2026-08-07T13:43:12Z",
      "processed_at": "2026-08-07T13:43:12Z"
    }
  ],
  "next_cursor": null
}
HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/fx/webhook-events?direction=outgoing&limit=25" \
  -H "Content-Type: application/json" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"

OpenAPI Spec

Every field, enum, and example documented above is also published as a standard OpenAPI 3.1 document, the same source of truth this docs site renders from. Use it for codegen (openapi-generator, swagger-typescript-api, etc.) or import it into Postman / Insomnia / Bruno to get an instant collection with the enum dropdowns and sample-payload pickers baked in.

  • Partner spec (sandbox + production servers): /openapi-partner.json , only the routes your platform actually calls.
  • Postman: File → Import → paste the URL above. Postman will surface every enum as a dropdown and the multi-example payloads as a request-body picker.
  • Insomnia / Bruno: Same flow, import as OpenAPI 3.x.
  • SDK codegen: openapi-generator generate -i /openapi-partner.json -g typescript-fetch -o ./crebit-lock-sdk
Crebit runs custody, pricing engines, and operator tooling behind the scenes, none of that is part of your integration. The partner spec is the only surface you should hit.