Getting Started

Client SDK

We do not ship a hand-written SDK. The API description is public, and the two generators below turn it into typed client code that matches the current contract — every endpoint, request body, response and error code included.

Use the spec published at https://docs.stablegate.com/openapi.json. It is the same document the API Reference is built from, so generated code cannot drift from the pages.

Pin the generator version. A newer generator can emit different names for the same schema, and that is a breaking change for your code, not for the API.

TypeScript

Generate the types with openapi-typescript, then call the API with openapi-fetch:

npm install --save-dev [email protected]
npm install [email protected]

npx openapi-typescript https://docs.stablegate.com/openapi.json -o stablegate-api.d.ts
import createClient from 'openapi-fetch'

import type { paths } from './stablegate-api'

const api = createClient<paths>({
  baseUrl: 'https://api.stablegate.com',
  headers: { 'X-Api-Key': process.env.STABLEGATE_API_KEY! },
})

const customers = await api.GET('/v1/customers/', { params: { query: { limit: 50 } } })
if (customers.data) {
  for (const customer of customers.data) console.log(customer.uuid)
} else {
  // error_code is one of the devapi_* values from the Errors page.
  console.error(customers.error?.error_code, customers.response.status)
}

const order = await api.POST('/v1/customers/{customer_uuid}/orders/', {
  params: { path: { customer_uuid: 'c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f' } },
  body: {
    source: { rail: 'sepa', asset: 'EUR', amount: '1000.00' },
    destination: { rail: 'ethereum', asset: 'USDC' },
  },
})

Path and query parameters, bodies and responses are checked at compile time: a misspelled field or a rail outside the enum fails tsc, not production.

Python

Generate pydantic v2 models with datamodel-code-generator, then send requests with any HTTP client:

curl -s https://docs.stablegate.com/openapi.json -o stablegate-openapi.json

uvx --from datamodel-code-generator==0.100.0 datamodel-codegen \
  --input stablegate-openapi.json \
  --input-file-type openapi \
  --output stablegate_api_models.py \
  --output-model-type pydantic_v2.BaseModel \
  --target-python-version 3.12

The generator reads a local file only, so download the spec first.

import httpx

from stablegate_api_models import CreateOrder

order = CreateOrder(
    source={"rail": "sepa", "asset": "EUR", "amount": "1000.00"},
    destination={"rail": "ethereum", "asset": "USDC"},
)

response = httpx.post(
    "https://api.stablegate.com/v1/customers/c1d2e3f4-a5b6-7c8d-9e0f-1a2b3c4d5e6f/orders/",
    headers={"X-Api-Key": "your-api-key", "Idempotency-Key": "ord_2025-01-15_abc123"},
    content=order.model_dump_json(by_alias=True),
    timeout=30,
)
response.raise_for_status()

The models cover the request and response bodies. They describe the contract; they do not retry, sign requests or validate business rules — that stays in your integration code.

What the generated code covers

  • Every operation of the public API: path, method, parameters, request body, response and error envelope.
  • Enumerations as literal unions, so an unknown rail or asset is a compile-time or validation error.
  • The error body (error_code, message, trace_id, details), the same on every failure — see Errors.

Sandbox operations of the test stand are not in the public spec and do not appear in generated code.

Regenerate after the API changes: the changelog says what changed, and the spec is republished with every release.

Ready to integrate?

Tell us about your use case and we will enable Partner API access for your account.
Copyright © 2026