Preview 0Gate quotes
POST /quotes/preview - Return indicative quote options across applicable methods without moving funds.
0Gate is the primary public integration path for hosted payment, ramp, and swap experiences. Keep secret-key operations on your server and hand only browser-safe values to the widget.
Endpoint
| Field | Value |
|---|---|
| Method | POST |
| Path | /v1/quotes/preview |
| Area | Quotes |
| Operation id | previewQuotes |
| Auth boundary | Secret key from your server. |
Use it for
Return indicative quote options across every applicable payment or payout method in one call, without moving funds. This is the quote/all analog: it prices a conversion so you can render an option list, but it does not lock a rate. To lock an executable rate for a server-side rail flow, use POST /quotes.
Use this endpoint only for the partner-scoped resource it describes. Store your own reference id, the returned 0Bit object id, the request id, timestamps, and the current status so support and reconciliation do not depend on browser callbacks alone.
Production rules
- Keep secret keys on your server. This endpoint requires a
sk_*key. Publishablepk_*keys are browser-only (embed bootstrap) and cannot call it. - Validate environment, mode, entitlement, asset, network, and amount before the call.
- Treat the preview as indicative only. Quotes here are not locked or signed and must not be redeemed in a rail flow.
- Branch on machine-readable status, error code, object id, and request id.
- Treat examples and placeholder ids as fake data only.
Request body
| Field | Required | Type | Use it for |
|---|---|---|---|
currency | Yes | string (ISO 4217) | Three-letter fiat code, for example EUR. Pattern ^[A-Za-z]{3}$. |
asset | Yes | string | Crypto asset symbol, for example USDC. |
amount | Yes | decimal string | Positive amount, up to 8 decimal places. Always a string, never a float. |
side | Yes | on_ramp/off_ramp | Direction of the conversion. on_ramp buys crypto with fiat; off_ramp sells crypto for fiat. |
country_code | No | string (ISO 3166-1) | Two-letter region used to resolve corridor support. Pattern ^[A-Z]{2}$. When omitted, the region is resolved from the edge geo header. |
Money and rate values are strings
Every monetary value in the request and response is a decimal string, never a float. Basis-point fields are integers.
Response
200 returns a QuotePreview (object: quote_preview_list). The top-level object echoes the priced conversion and carries the per-method options in quotes.
| Field | Type | Use it for |
|---|---|---|
object | string | Always quote_preview_list. Discriminator for client-side type narrowing. |
currency | string | Echoes the requested fiat code. |
asset | string | Echoes the requested crypto asset. |
side | on_ramp/off_ramp | Echoes the requested direction. |
amount | decimal string | Echoes the requested amount. |
market_rate | decimal string | Reference market rate for the pair before per-method margin. |
margin_bps | number | Margin applied over the market rate, in basis points. |
expires_at | string (date-time) | When this indicative pricing should be re-fetched. It is not a lock. |
quotes | array of objects | Per-payment-method indicative options. Each entry carries the method and its indicative economics (no lock, no signature). Empty when unavailable_reason is set. |
quote_preview_id | string | null | Opaque 24-hex id of the persisted preview lock. Pass it back as quote_preview_id on POST /gate_sessions to bind the session to the previewed amount, currency, asset, and side. null when preview locks are disabled on the deployment. |
unavailable_reason | string | null | country_not_supported when the ramp is not offered for the resolved region. When set, quotes is empty and quote_preview_id is null. null in normal responses. |
Preview vs lock
A preview is indicative and unsigned — never redeem a preview entry directly in a rail. When you need an executable, one-time-redeemable rate, call POST /quotes to obtain a signed LockedQuote, then pass its id as quote_id to the pay-in or pay-out.
Examples
curl -X POST https://gate-api.0bit.app/v1/quotes/preview \
-H "Authorization: Bearer sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"currency": "EUR",
"asset": "USDC",
"amount": "100.00",
"side": "on_ramp",
"country_code": "DE"
}'{
"object": "quote_preview_list",
"currency": "EUR",
"asset": "USDC",
"side": "on_ramp",
"amount": "100.00",
"market_rate": "1.0731",
"margin_bps": 55,
"expires_at": "2026-01-01T00:00:30Z",
"quote_preview_id": "5f3c0000000000000000a1b2",
"unavailable_reason": null,
"quotes": [
{
"payment_method": "sepa_credit_transfer",
"fiat_amount": "100.00",
"crypto_amount": "106.74",
"exchange_rate": "1.0674"
},
{
"payment_method": "card",
"fiat_amount": "100.00",
"crypto_amount": "104.10",
"exchange_rate": "1.0410"
}
]
}Indicative only. Show the per-method options, then lock the one the user picks with POST /quotes. Optionally pass quote_preview_id to POST /gate_sessions to bind the hosted session to this preview.
{
"object": "quote_preview_list",
"currency": "EUR",
"asset": "USDC",
"side": "on_ramp",
"amount": "100.00",
"market_rate": "1.0731",
"margin_bps": 55,
"expires_at": "2026-01-01T00:00:30Z",
"quote_preview_id": null,
"unavailable_reason": "country_not_supported",
"quotes": []
}HTTP 200. The ramp is not offered for the resolved region — quotes is empty and no preview lock is issued. Show an unavailable state; this is not an error to retry.
Errors
All errors use the unified envelope and carry an X-Request-Id response header. Branch on code/type/statusCode, not on the free-form message.
{
"type": "invalid_request",
"code": "invalid_request",
"message": "Example validation error using fake data.",
"request_id": "req_test_000000000123",
"doc_url": null,
"statusCode": 400
}| Status | type | When it happens |
|---|---|---|
400 | invalid_request | Bad body — missing currency/asset/amount/side, a malformed amount, or an unknown currency/asset. |
401 | unauthorized | Missing or invalid secret key. |
403 | forbidden | Credential rejected — revoked key or mode mismatch. |
429 | rate_limited | Request throttled. Back off and retry. |
5xx | server_error | Transient server or upstream failure. Retry with bounded backoff. |
An unsupported corridor is not an error
A region with no corridor returns 200 with unavailable_reason: country_not_supported and an empty quotes array — not a 4xx/5xx. Reserve error handling for the statuses above.
Public boundary
This reference covers partner-scoped endpoint behavior, authentication, idempotency, webhook verification, and support-safe records. Internal operations, settlement venues, provider details, administrative routes, and unsupported availability claims are outside the public API contract.