0Bit Documentation

0Gate API

Server-side 0Gate session, capability, transaction, embed, webhook, quote, and entitled rail operations.

0Gate is the primary public integration path for hosted payment, ramp, and swap experiences. Partners create server-owned sessions, hand browser-safe values to the widget, verify webhook events, and reconcile final state from server records.

This page is the curated partner reference. It uses the OpenAPI contract as source material, but removes generated-tool noise and keeps the public boundary clear.

OpenAPI-backed, public-safe reference

The machine-readable OpenAPI 3.1 contract for 0Gate is available at /openapi/gate-v1.yaml. Use it for client generation and schema checks. Use these pages for production rules, lifecycle decisions, and support-safe implementation guidance.

Contract snapshot

ItemCurrent shape
OpenAPI titleGate API
OpenAPI version2026-05-25
Published operations31 partner-facing operations
Published webhook events20 event contracts
Main production hosthttps://gate-api.0bit.app/v1
Main sandbox hosthttps://gate-api-sandbox.0bit.app/v1
Primary public pathHosted 0Gate session and widget integration
Account-gated pathLocked quotes and server-to-server rail operations

The API is product-scoped and partner-scoped. A credential only sees resources owned by the partner account and environment that issued it. Examples use fake ids, fake keys, fake domains, fake wallets, and fake users.

What this API covers

  • Hosted session creation, retrieval, listing, and cancellation.
  • Capability and eligibility reads before showing a flow.
  • Indicative quote previews and account-gated locked quotes.
  • Partner transaction reads for support and reconciliation.
  • Customer records where the account is entitled to use the customer resource.
  • Browser-safe embed bootstrap and approved co-branding controls.
  • Webhook delivery diagnostics, replay, and test delivery.
  • Account-gated pay-in and pay-out rail operations for approved partners.

Public boundary

This reference covers endpoint behavior, authentication, idempotency, webhook verification, request/response objects, status models, and support-safe record joins. It does not expose private operational credentials, payout-instruction details, treasury balances, internal route logic, reserve allocation, operational worker names, or unsupported availability claims.

Authentication map

Credential or tokenWhere it belongsAllowed useNever use it for
sk_test_* / sk_live_*Your serverSession writes, protected reads, quote/rail writes, webhook tools, branding, customer recordsBrowser or mobile client code
pk_test_* / pk_live_*Browser/mobile where documentedEmbed bootstrap onlyMoney movement, protected reads, customer data, rail operations
client_secretBrowser-safe but session-scopedBinds a hosted widget/bootstrap call to one server-created sessionLong-term storage, cross-session reuse
X-Embed-TokenWidget/runtime request headerShort-lived widget context after bootstrapPartner-server authorization
Gate-Signature secretYour serverRaw-body webhook verificationFrontend code or logs
Idempotency-KeyYour server-generated request headerCollapse duplicate writes into one logical operationReusing across unrelated user actions

Server-owned state is the source of truth

Browser callbacks and redirect URLs are UX signals. Final state must come from webhook events, transaction reads, session reads, and your own durable records.

Operation map

AreaOperationMethod and pathAuth boundaryUse it for
SessionslistSessionsGET /gate_sessionsSecret keyBack-office session list and support lookup.
SessionscreateSessionPOST /gate_sessionsSecret key + idempotencyCreate a hosted flow and receive a one-time client_secret.
SessionsretrieveSessionGET /gate_sessions/{id}Secret keyRead current server session state without exposing client secret.
SessionscancelSessionPOST /gate_sessions/{id}/cancelSecret keyStop an open session before completion.
CapabilitieslistCountriesGET /capabilities/countriesSecret keyDiscover supported country options for the account.
CapabilitieslistCurrenciesGET /capabilities/currenciesSecret keyDiscover fiat currency options.
CapabilitieslistAssetsGET /capabilities/assetsSecret keyList crypto assets the account can surface.
CapabilitiesgetAssetGET /capabilities/assets/{symbol}Secret keyInspect one asset and its supported networks.
CapabilitieslistPaymentMethodsGET /capabilities/payment-methodsSecret keyDiscover methods for pay-in/on-ramp flows.
CapabilitieslistPayoutMethodsGET /capabilities/payout-methodsSecret keyDiscover methods for pay-out/off-ramp flows.
CapabilitiescheckEligibilityGET /capabilities/eligibilitySecret keyCheck a region/user context before creating a session.
QuotespreviewQuotesPOST /quotes/previewSecret keyReturn indicative options before the user chooses a method.
TransactionslistTransactionsGET /transactionsSecret keyCursor-style support and reconciliation list.
TransactionsretrieveTransactionGET /transactions/{refid}Secret keyRetrieve one partner transaction by support-safe reference.
EmbedcreateEmbedTokenPOST /embed/bootstrapPublishable key + optional client secretBootstrap the widget with browser-safe context.
BrandinggetBrandingGET /brandingSecret keyRead approved widget brand settings.
BrandingupdateBrandingPATCH /brandingSecret keyUpdate approved widget brand settings.
WebhookslistPartnerWebhookDeliveriesGET /webhooks/deliveriesSecret keyInspect delivery history for debugging.
WebhooksreplayWebhookDeliveryPOST /webhooks/deliveries/{id}/replaySecret keyReplay a delivery after fixing your endpoint.
WebhookssendTestWebhookPOST /webhooks/testSecret keySend a synthetic event to validate your receiver.
CustomerscreateCustomerPOST /customersSecret key + idempotencyCreate a partner-scoped customer record where enabled.
CustomerslistCustomersGET /customersSecret keyList partner customer records where enabled.
CustomersgetCustomerGET /customers/{id}Secret keyRetrieve one customer record where enabled.
CustomersupdateCustomerPATCH /customers/{id}Secret keyUpdate allowed partner-owned customer fields.
CustomersdeleteCustomerDELETE /customers/{id}Secret keyDelete a partner customer record where enabled.
RailslockQuotePOST /quotesSecret key + rail entitlementLock a signed, one-time quote.
RailsretrieveSignedQuoteGET /quotes/{id}Secret key + rail entitlementInspect quote status without redeeming it.
RailscreatePayInPOST /rails/pay_insSecret key + idempotency + rail entitlementRedeem a signed quote into a pay-in.
RailsretrievePayInGET /rails/pay_ins/{id}Secret key + rail entitlementRead one pay-in record.
RailscreatePayOutPOST /rails/pay_outsSecret key + idempotency + rail entitlementRedeem a signed quote into a pay-out.
RailsretrievePayOutGET /rails/pay_outs/{id}Secret key + rail entitlementRead one pay-out record.

Hosted session lifecycle

Store the session id, your own order id, the idempotency key, the client_secret delivery time, webhook event ids, request ids, and final transaction reference. Do not rely on a redirect URL alone.

Start with capabilities

Capability endpoints stop you from hard-coding promises that can change by account, region, asset, payment method, payout method, and compliance state.

Before showingReadDecision
Region selectorGET /capabilities/countriesWhich countries can appear in your UI.
Fiat selectorGET /capabilities/currenciesWhich currencies can be requested.
Asset selectorGET /capabilities/assetsWhich symbols and networks can be offered.
Method pickerGET /capabilities/payment-methods / payout-methodsWhich methods are available for the flow.
PreflightGET /capabilities/eligibilityWhether the requested context is eligible before creating a session.

If a capability disappears, your integration should hide or disable that option and show a retry-safe unavailable state. Do not convert a missing capability into an unsupported marketing claim.

Example: create a hosted session

curl -X POST https://gate-api-sandbox.0bit.app/v1/gate_sessions \
  -H "Authorization: Bearer sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 00000000-0000-4000-8000-000000000123" \
  -d '{
    "amount": "100.00",
    "currency": "EUR",
    "return_url": "https://partner.example/complete",
    "cancel_url": "https://partner.example/cancel",
    "flow": "on_ramp",
    "target_token": "USDC",
    "metadata": {
      "order_id": "order_test_123"
    }
  }'
const response = await fetch('https://gate-api-sandbox.0bit.app/v1/gate_sessions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.OBIT_SECRET_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    amount: '100.00',
    currency: 'EUR',
    return_url: 'https://partner.example/complete',
    cancel_url: 'https://partner.example/cancel',
    flow: 'on_ramp',
    target_token: 'USDC',
    metadata: { order_id: 'order_test_123' },
  }),
});

const session = await response.json();
import os
import uuid
import requests

response = requests.post(
    "https://gate-api-sandbox.0bit.app/v1/gate_sessions",
    headers={
        "Authorization": f"Bearer {os.environ['OBIT_SECRET_KEY']}",
        "Content-Type": "application/json",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "amount": "100.00",
        "currency": "EUR",
        "return_url": "https://partner.example/complete",
        "cancel_url": "https://partner.example/cancel",
        "flow": "on_ramp",
        "target_token": "USDC",
        "metadata": {"order_id": "order_test_123"},
    },
)

session = response.json()

The response includes a client_secret once. Hand it to the browser for widget bootstrap, but keep the session id and your own order id in your database.

Example: bootstrap the widget

const response = await fetch('https://gate-api-sandbox.0bit.app/v1/embed/bootstrap', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${publishableKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    clientSecret: sessionClientSecret,
  }),
});

const bootstrap = await response.json();

Only publishable keys belong in browser code. If bootstrap fails, do not fall back to a secret key in the client. Return to your server and create or recover the session.

Object model

Status and reconciliation joins

RecordPrimary idJoin it withWhy it matters
Your orderYour order_idSession metadata and your databaseKeeps your business workflow independent of provider ids.
Gate sessiongate_session.idWebhooks, transaction records, widget bootstrapMain hosted-flow record.
Transactiontransaction.refid or returned idSession, webhook events, support logsSupport and reconciliation view of completed/failed movement.
Webhook eventevent.idYour dedupe tablePrevents double-processing at-least-once delivery.
RequestX-Request-IdLogs and support ticketsLets support investigate without exposing secrets or PII.
Idempotency keyYour generated UUIDThe write request and your orderLets retries collapse safely.

Webhook event families

FamilyEventsIntegration rule
Session lifecyclegate_session.created, .processing, .completed, .failed, .cancelled, .expiredPersist state transitions and dedupe by event id.
Verificationkyc.required, gate_session.kyc_package_acceptedShow hosted verification states without storing raw verification payloads.
Railsrail.pay_in.*, rail.pay_out.*, quote.consumedOnly for accounts with rail entitlement. Treat as server truth.
Webhook diagnosticswebhook.testUse for endpoint validation only.
Customerscustomer.created, .updated, .deletedOnly for accounts using customer records.

Verify the raw body before parsing, reject stale timestamps, dedupe by event id, persist the state transition, and return 2xx only after durable handling.

Error and retry model

OutcomeWhat to do
400 validation errorFix the request; do not retry the same body.
401 auth errorCheck key type, environment, and token placement.
403 entitlement or permission errorConfirm account/product access; do not loop.
404 missing scoped objectTreat as not found for this partner/environment; do not infer other accounts.
409 state conflictRetrieve current state and branch from it.
429 rate limitBack off with jitter and preserve request ids.
5xx or network timeoutRetry with bounded backoff. Writes must use idempotency keys.

Every production integration should log the HTTP status, machine-readable error code, request id, endpoint, environment, idempotency key for writes, and your own order id.

Production checklist

  • Product access and environment are approved.
  • Secret keys are server-only.
  • Publishable keys are client-only and cannot call protected routes.
  • Webhook receiver verifies raw-body signatures.
  • Writes use Idempotency-Key.
  • Browser callbacks are not treated as settlement truth.
  • Capability checks drive UI availability.
  • Customer endpoints are used only where enabled.
  • Rail endpoints are used only where enabled.
  • Logs include request ids and your own correlation ids.
  • Support tooling can retrieve sessions, transactions, webhook deliveries, and relevant internal order state without secrets.

On this page