Docs
llms.txt for AI agents Download OpenAPI spec

Quickstart (sandbox)

End-to-end copy-paste flow on https://lock-apis-sandbox.crebitpay.com. Replace ids after each step. Full per-field schemas live on API endpoints , this page is the fastest path to a working integration.

0. Get API Keys

Crebit provisions sandbox and production API keys during a short onboarding call. Book a slot and we'll get you live on sandbox the same day:

Book onboarding call →

Once you have keys, verify them any time with GET /api/v1/partners/me:

HTTP code sample
curl -sS -X GET "https://lock-apis-sandbox.crebitpay.com/api/v1/partners/me" \
  -H "X-Crebit-Key-Id: YOUR_KEY_ID" \
  -H "X-Crebit-Key-Secret: YOUR_KEY_SECRET" \
  -H "X-Crebit-Environment: sandbox"

0b. Register a Customer Reference

Before quoting, register your opaque customer id once per end customer. Re-posting the same id is safe (HTTP 200).

json code sample
json
{
  "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 (201 Created or 200 OK)

json code sample
json
{
  "id": "66666666-6666-4666-8666-666666666666",
  "customer_reference_id": "partner-cust-ref-2026-0042",
  "created_at": "2026-05-24T16:00:00Z"
}

1. Quote

Price a rate lock for your customer. Use a customer_reference_id Crebit has already provisioned for your partner account (during onboarding). Set the corridor, notional, lock window, settlement chain, and settlement currency. With strike_mode=live_spot you can omit provider_rate, market_rate, and market_rate_timestamp — see Concepts → strike modes.

Request Body (BRL Corridor)

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",
  "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 (BRL Corridor)

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"}'

Request Body (NGN Corridor, USDT on Solana)

Nigerian partners hedging NGN receivables typically use direction=NGN_TO_USD with settlement_currency=USDT on Solana.

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.
json code sample
json
{
  "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"
}

How to Call (NGN Corridor)

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 (201 Created)

Same shape for every corridor. The example below is the BRL quote from the first request; for NGN, locked_rate is NGN per 1 USD (around 1,450).

json code sample
json
{
  "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"
}

2. Lock (Create the Contract)

Customer accepts the quote → convert it into a binding contract by POSTing the quote_id.

Request Body

json code sample
json
{
  "quote_id": "22222222-2222-4222-8222-222222222222",
  "partner_transaction_reference": "platform-tx-9901"
}

How to Call

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 (201 Created)

json code sample
json
{
  "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"
}

3. Notify Funds in Route

Once you've dispatched the upfront fee (deposit for forward, premium for option) on-chain, post the inbound webhook so Crebit advances the contract to active.

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…"
}
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":"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…"}'

3b. Preview Settlement (Optional)

Before triggering payout, you can preview the FX delta Crebit would pay out for a given live_execution_rate. This is read-only — it does not move money.

json code sample
json
{
  "live_execution_rate": "5.51"
}
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"}'

Response (200 OK)

json code sample
json
{
  "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"
}

4. Trigger Payout (Customer Transacts)

The moment the customer transacts within the lock window, post contract_exercisedwith the live rate and the customer's payout wallet. This is the call that triggers Crebit to pay out the FX delta on-chain.

json code sample
json
{
  "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"
}
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"}'

5. Receive payout_success and contract_settled Webhooks

Crebit sends the on-chain payout to payout_wallet_address, then POSTs payout_success (on-chain confirmation) and contract_settled (contract exercised → settled) to your configured webhook_url with the on-chain transaction_hash. That's the authoritative "paid" signal — update your records and you're done.

Full outbound webhook schema, signature verification, and retry rules are on API endpoints → Outbound webhooks.