Docs
llms.txt for AI agents Download OpenAPI spec

Concepts

Five concepts every Crebit Lock integration depends on. Read these once, then refer back to the schemas on API endpoints.

Lock Window

The lock window is the time range during which your customer may execute at the locked rate. Two ISO-8601 UTC datetimes define it:

  • window_start, the first moment the customer is allowed to transact at the locked rate.
  • window_end, the last moment the customer is allowed to transact at the locked rate.

The customer may transact at any moment in [window_start, window_end]. The locked rate is identical at every moment in the window , only the moment the customer picks varies. You set both fields on the quote; the contract inherits them and they're immutable for the life of the lock. Short windows span 1–24 hours; long windows may extend up to 180 days (by window_end calendar date).

How Long Can a Window Be?

Two pricing buckets apply:

  • Short locks, span between window_start and window_end is 1–24 hours.
  • Long locks, window_end calendar date is 1–180 days ahead of the quote date.

In all cases, window_end must be strictly after window_start. Out-of-range durations return duration_out_of_range.

Use caseTypical window
Customer wants to transact within hoursShort · 1–6 hours (minimum 1h)
Customer expects to transact in the next day or twoShort · 24–72 hours
Customer expects to transact within the weekShort · 5–7 days
B2B treasury hedging a known upcoming wireMedium · 2–4 weeks
Quarterly settlement, longer-tenor hedgingLong · 30–180 days
Maximum allowedUp to 180 days (window_end calendar date)

Longer windows cost more premium because the customer holds more optionality (more days to pick a favourable market move).

Fields & Rules

Lock window

Every quote defines a calendar window during which the customer can execute the locked rate. Always send window_start and window_end:

FieldTypeDescription
window_startDatetime (ISO-8601 UTC, e.g. 2026-08-04T13:00:00Z)First moment the customer may execute the locked rate. Must be strictly before window_end.
window_endDatetime (ISO-8601 UTC, e.g. 2026-08-11T13:00:00Z)Last moment the customer may execute. Must be STRICTLY AFTER window_start (equal values return validation_error). Pricing accepts short windows (1–24 hours between start and end) or long windows (window_end calendar date up to 180 days ahead); out-of-range values return duration_out_of_range.
  • Both window_start and window_end are required on every quote.
  • window_end must be STRICTLY AFTER window_start; equal values are rejected with validation_error.
  • Short locks: span between window_start and window_end is 1–24 hours (inclusive).
  • Long locks: window_end calendar date must be 1–180 days ahead of the quote date.
  • The customer may execute at any moment within [window_start, window_end]; the locked rate is identical at every moment in the window.
  • Window length affects pricing — longer windows cost more premium (the customer holds more optionality).
  • Both contract_type values (forward, option) accept the same window fields.
Short windows span 1–24 hours between window_start and window_end. Long windows may extend up to 180 days (by window_end calendar date). window_end must be strictly after window_start; equal values return validation_error. Out-of-range durations return duration_out_of_range.

Concrete Examples

Scenariowindow_startwindow_endWindow length
Short lock (minimum span)2026-08-04T09:00:00Z2026-08-04T10:00:00Z1 hour
3-hour intra-day window2026-08-04T09:00:00Z2026-08-04T12:00:00Z3 hours
48-hour window2026-08-04T13:00:00Z2026-08-06T13:00:00Z48 hours
One-week forward2026-08-04T00:00:00Z2026-08-11T00:00:00Z7 days
30-day option2026-09-01T00:00:00Z2026-10-01T00:00:00Z30 days
Quarterly hedge2026-08-04T00:00:00Z2026-11-04T00:00:00Z92 days
Maximum window2026-08-04T00:00:00Z2027-02-01T00:00:00Z180 days
Common reject conditions:
  • validation_error, window_end equal to or before window_start.
  • duration_out_of_range, window span or execution date outside the 1–24 hour (short) or 1–180 day (long) pricing limits.

Currencies in a Quote

Every quote has two currency-related decisions: which pair (and which side of it the customer is fixing) and which Crebit settles in with you.

Supported Directions

Supported FX corridors match the lock API direction enum — six values across three corridors (BRL/USD, MXN/USD, and NGN/USD, both directions each):

BRL_TO_USD · USD_TO_BRL · MXN_TO_USD · USD_TO_MXN · NGN_TO_USD · USD_TO_NGN

direction only fixes the FX pair AND which side the trade flows from. Which side of the pair the customer is fixing their amounton, the amount they're sending or the amount they want to receive, is set independently via notional_currency below.

The Three Fields You Send for the Currency Setup

FieldWhat it isExample
directionWhich corridor the customer is hedging, and which way the trade flows. One of the SUPPORTED_DIRECTIONS values above.BRL_TO_USD — Brazilian exporter selling BRL to receive USD. NGN_TO_USD — Nigerian exporter selling NGN to receive USD stablecoin.
notional_currencyWhich side of the pair the notional_amount is denominated in. EITHER leg of direction is valid — the customer might be locking the amount they're sending OR the amount they want to receive. Must match a currency in direction (USD, BRL, MXN, or NGN).For direction=USD_TO_BRL: USD (lock 50,000 USD-worth) or BRL (lock 250,000 BRL-worth). For direction=USD_TO_NGN: USD (lock 50,000 USD-worth) or NGN (lock 79,000,000 NGN-worth). Either leg of direction is valid.
settlement_currencyMargin token — stablecoin Crebit and the partner settle in. Partner sends the upfront fee in this stablecoin to funding_wallet_address; Crebit pays out any FX delta in this stablecoin too. USDC or USDT; your choice selects the live oracle pair (e.g. BRL/USDC vs BRL/USDT, NGN/USDT). The end customer never sees stablecoins.USDC · USDT

Supported Chains

Call GET /api/v1/fx/supported-chains for the authoritative catalog. Book a chain only when enabledis true (partner entitlement, and in production funded payout-hot inventory). Summary:

chainstatussettlement_currenciesNotes
solanaliveUSDCUSDTFast settlement. Primary production rail.
tronliveUSDT onlyTron address (starts with T). USDT payouts.
ethereumplannedUSDCUSDTEVM. Schema reserved for future launch.
polygonplannedUSDCUSDTEVM L2. Schema reserved for future launch.

Margin Tokens (settlement_currency)

The API field is settlement_currency; the Crebit dashboard calls it . Your choice fixes which stablecoin you fund with and which live oracle pair prices the rate.

CorridormarginTokenLive oracle pair
BRL/USDUSDCBRL/USDC
BRL/USDUSDTBRL/USDT
MXN/USDUSDCMXN/USDC
MXN/USDUSDTMXN/USDT
NGN/USDUSDCNGN/USDC
NGN/USDUSDTNGN/USDT
stablecoinAvailable on
USDCsolanaethereum (planned)polygon (planned)
USDTsolanatronethereum (planned)polygon (planned)

Rules

  • One stablecoin per contract - settlement_currency covers both the partner funding leg and the customer payout leg.
  • Webhook values should match the contract — send the same chain and settlement_currency locked at quote time on funds_in_route and contract_exercised. Business-rule rejections on inbound webhooks return 400 INVALID_ARGUMENT (see message for detail).
  • Pricing reflects on-chain settlement cost, Ethereum quotes are higher than Polygon all else equal.

Strike, Spot, and Market Rate

Every quote response carries three rates that a partner often confuses. Knowing the difference lets you message your customer accurately, and tells you whether a forward gives them a better than today's market (which happens more often than people think).

Three Rates That Matter

FieldWhat it isSource
provider_rateYour live retail FX rate at quote time, what you'd quote the customer with no protection.You send it on the request.
market_rateThe benchmark mid-market FX rate from an independent reference (your data feed or CoinGecko stablecoin pair).You send it on the request (required unless strike_mode=live_spot).
locked_rateTHE STRIKE, the rate the customer actually locks at. For forwards, the CIP-fair forward rate; for options, the option strike.Crebit returns it.

Three Strike Modes

On every quote you choose strike_mode. Omit it and Crebit defaults to cip_fair.

strike_modeWhat Crebit doesUse when
cip_fair (default)Derives the CIP-fair forward strike from market_rate + the currency-pair interest-rate differential. When that strike is better than spot for the customer, Crebit funds the difference, paying out the extra settlement_currency (USDC or USDT) on-chain at exercise so the customer actually receives the better-than-spot rate.Most quotes. For high-interest-rate corridors (e.g. USD→BRL), the CIP-fair strike sits above spot and Crebit covers the gap in stablecoin, a real selling point for your customer.
live_spotSets locked_rate from live_spot_pricer TWAP at quote time. Omit provider_rate, market_rate, and market_rate_timestamp on the request.Customer wants to lock at today's live spot. Common for short windows where forward points are minimal anyway.
customUses the target_strike value you send. Required field when mode=custom.Customer specified an exact rate (e.g. ATM/OTM option strike, or matching an external quote).

How CIP-Fair Works

says a rate equals adjusted by the interest-rate differential between the two currencies, so the no-arbitrage forward is F = S × (1 + r_quote × t) / (1 + r_notional × t). Crebit applies this from for the length of the lock window.

Why this often helps your customer: when the quote-currency leg of the pair has higher interest rates than the notional_currency leg (e.g. USD→BRL where BRL rates ≫ USD rates), the CIP-fair forward sits above spot - meaning your customer gets more BRL per USD on the forward than on the live spot today. Use strike_advantage_bps (below) to message how much better.
Response fieldTells you
strike_modeEchoes request: cip_fair · live_spot · custom.
target_strikeif strike_mode=custom, the exact target_strike value you sent.
strike_advantage_bpsNon-negative basis points (magnitude vs market_rate). Signed customer-perspective semantics planned.
premium_amountAll-in premium (option) or quoted fee (forward), in settlement_currency.
deposit_amountSecurity deposit (forwards only; null for options).
total_amountThe total amount due to Crebit. Adds premium_amount and deposit_amount.
amount_duecrebit-pricer total stablecoin due now (premium + deposit for forwards).
collateral_amountForward refundable collateral from crebit-pricer (forwards only).
upfront_feeForward non-refundable platform fee from crebit-pricer (omitted for options).

Quote Economics (crebit-pricer)

Every successful quote response includes economics from crebit-pricer alongside the legacy summary fields:

FieldWhat it isRelationship
premium_amountAll-in premium (option) or quoted fee component (forward).Partner-facing summary; aligns with crebit-pricer premium.
deposit_amountSecurity deposit (forwards only).Typically matches collateral_amount.
total_amountpremium_amount + deposit_amount.Quick total before locking.
amount_dueTotal stablecoin due now to activate the lock.Authoritative funding total from crebit-pricer.
collateral_amountRefundable forward collateral.Released on exercise; forfeited on forward expiry without exercise.
upfront_feeNon-refundable forward platform fee.Omitted for options — use premium_amount and amount_due only.
pricing_tier / pricing_greekscrebit-pricer audit metadata.Optional; useful for ML validation and support tickets.

strike_advantage_bps Explained

A non-negative integer: the magnitude (in basis points) by which locked_rate differs from market_rate. Use it alongside strike_mode and locked_rate to message the quote. Direction-aware signed semantics (positive = customer wins) are planned; today the API returns abs(locked_rate − market_rate) in bps.

Example valueInterpretationCustomer messaging
220Strike is 2.20% away from mid-market (magnitude)."Your locked rate differs from today's mid-market by 220 bps."
30Small difference from market."Your locked rate is 30 bps from today's spot."
0At market (typical for live_spot mode)."Lock at today's rate."

Which Mode to Pick

Scenariocontract_typestrike_modeWhy
Standard forward booking, customer trusts your platform's pricingforwardcip_fairDefault. Customer usually gets a strike above spot on high-rate corridors.
Short window (< 24h) where forward points are negligibleforwardlive_spotSimpler to communicate, "lock today's spot", and indistinguishable from CIP on tiny windows.
Forward priced to match a specific invoice / external quoteforwardcustomSend target_strike = the external rate.
ATM option, classic vol playoptionlive_spotStrike = market_rate gives a symmetric ATM option.
OTM option, cheap insuranceoptioncustomSend target_strike past spot in the customer's unfavored direction. Lower premium.
ITM option, high-conviction directional betoptioncustomSend target_strike past spot in the customer's favored direction. Higher premium.

Crebit prices to whatever mode + strike you specify. Aggressive strikes flow through to a higher premium_amount.

Settlement Preview

POST /api/v1/fx/contracts/{contract_id}/settlement-preview lets you preview the FX delta Crebit would pay out if the customer exercises at a given live_execution_rate. It uses the same settlement engine as the contract_exercised inbound webhook but does not trigger a payout.

FieldMeaning
is_favorableTrue when locked_rate vs live_execution_rate means Crebit owes the customer a payout.
payout_amountStablecoin amount Crebit would transfer. Options: zero when unfavorable. Forwards: max(0, deposit + FX delta).
oracle_clamp_appliedTrue when your live_execution_rate was adjusted toward an independent oracle bound before computing payout.
settlement_rate_usedEffective rate used in the formula after any oracle clamp.
formula / calculation_versionAudit trail for support — describes the math and engine version.
Call settlement-preview to show the customer their expected payout before sending contract_exercised. Only contract_exercised actually moves money on-chain.

Forward vs Option

contract_type picks one of two shapes: or . It's orthogonal to strike_mode, you can combine forwards or options with any of the three strike modes.

forwardoption
Upfront cash flowPremium plus a security deposit (typically 5-10% of notional)Non-refundable premium
Nature of the upfrontCollateral against the obligation, not a feeCost of buying the optionality
Customer obligationObligated to transact within the windowRight but not obligation
If customer DOES exerciseDeposit released back to partner as part of the payout_success / contract_settled flowCustomer pays nothing more; Crebit pays the FX delta if owed
If customer doesn't exerciseDeposit FORFEITED, Crebit keeps it to cover the hedge cost (contract_expired webhook signals this)Premium was already kept by Crebit; nothing else happens
Pricing driverTime-value over the windowVolatility + time + how aggressive the strike is
Best forKnown upcoming transactions, treasury hedgingOptional exposure, FX insurance, uncertain timing

The two dimensions combine cleanly. Six common combinations:

cip_fairlive_spotcustom
forwardDefault booking. Strike sits above/below spot depending on rate differential.Lock at today's spot. Thin premium for delivery certainty.Forward priced to a specific external rate (e.g. invoice match).
optionOption struck at the forward fair. Premium = pure vol.Classic ATM option struck at today's spot.ATM / OTM / ITM option, partner picks the strike for the customer's risk appetite.

Forward Maturity

For forward contracts at window_end:

  • With a saved payout destination (PUT /fx/contracts/{id}/payout-destinationor at quote/contract create), Crebit force-exercises at the oracle rate and settles.
  • Without a payout wallet, the contract stays active — expiry does not forfeit the deposit.
  • After the window closes, partner contract_exercised is rejected with execution_window_closed.

Also set oracle on quote create (BRL/MXN: redstone or binance; NGN: stable_coordinates or crebit_ngn; CHF: chainlink) to pick the settlement price feed used at exercise and maturity.

Idempotency

Send Idempotency-Key (UUID recommended) on every write. Same key + same body returns the original response within TTL, so retries are safe.

  • POST /api/v1/fx/quotes, recommended.
  • POST /api/v1/fx/contracts, recommended.
  • POST /api/v1/fx/webhooks/inbound, required (8–128 ASCII printable chars). Reusing a key with a different body returns 409 IDEMPOTENCY_CONFLICT.
  • On POST /fx/quotes and POST /fx/contracts, the same conflict returns 409 idempotency_mismatch (lowercase).
  • Outbound webhooks (Crebit → you): use the event_id field as your idempotency key. Crebit may retry the same delivery if your endpoint returns a non-2xx within 10s.

Errors

All errors return a JSON envelope:

json code sample
json
{
  "code": "validation_error",
  "message": "window_end must be after window_start",
  "details": {}
}

Common code values on quote/contract APIs (lowercase snake_case):

codeMeaning
validation_errorRequest body failed schema or business-rule validation. See message + details.
not_foundUnknown customer_reference_id, quote_id, or contract for your partner.
market_rate_staleSent market_rate is older than PRICING_MARKET_RATE_MAX_AGE_SECONDS (~5 min).
market_rate_unavailableBenchmark rate could not be validated for pricing.
notional_limit_exceededRequested notional is above your account's per-quote ceiling.
provider_spread_exceededprovider_rate is too far from market_rate (bps cap).
duration_out_of_rangeLock window span or execution date is outside pricing limits (short 1–24h, long 1–180d).
chain_settlement_pair_unsupportedInvalid chain + settlement_currency combo (e.g. USDC on Tron).
payout_wallet_missingExercise or settlement attempted without a payout destination.
payout_destination_incompletePayout destination fields are partially set.
payout_destination_not_editablePUT payout-destination rejected for this contract state.
execution_window_closedcontract_exercised sent after window_end.
binance_oracle_unavailableBinance oracle selected but rate fetch failed.
funding_tx_not_foundSolana funding tx verification could not find the transaction.
quote_not_eligibleQuote status is not created when POST /fx/contracts.
quote_expiredQuote is past expires_at.
quote_already_usedA contract already exists for this quote_id.
partner_transaction_reference_already_usedThe same partner_transaction_reference is already on another in-flight contract for your partner.
idempotency_mismatchSame Idempotency-Key on POST /fx/quotes or /fx/contracts with a different body (409).
idempotency_in_progressConcurrent request with the same Idempotency-Key still processing (409).

Inbound webhook errors (POST /fx/webhooks/inbound) use uppercase code values:

codeHTTPMeaning
INVALID_ARGUMENT400Business rule rejected the payload (window, status, rate, amount, etc.). See message.
NOT_FOUND404fx_contract_id unknown for your partner.
IDEMPOTENCY_CONFLICT409Same Idempotency-Key with a different webhook body.
INVALID_SIGNATURE401Webhook signature verification failed.
Ready to call the API? API endpoints has the full schema tables, sample pickers, and cURL snippets.