{ "error": { "code": "WITHDRAWAL_NOT_FOUND", "message": "Withdrawal not found" }}Per-endpoint reference for creating, listing, retrieving, committing, and refreshing withdrawals with request fields, response schemas, errors, idempotency, and examples.
The withdrawals API supports crypto transfers to Stellar addresses and asynchronous AirTM payouts. The routes below are implemented by WithdrawalsController and WithdrawalsService in the Orchestrator.
Paths include the global /api/v1 prefix. Every route requires an API key or short-lived token with the listed scope. Send it in the Authorization header; see Authentication & Scopes.
The controller identifies the acting user from userId in the create body, or from ?userId= on each other route. The API key itself does not identify the user.
POST /withdrawals is validated against CreateWithdrawalDto. The global validation pipe rejects unknown body fields and returns 400 VALIDATION_ERROR when required fields or validators fail. The other routes bind query and path values directly in the controller rather than through a DTO.
Errors use the Orchestrator's standard envelope:
All endpoints are guarded by the API-key and scope guards. Missing or invalid credentials return 401 UNAUTHORIZED; a key without the required scope returns 403 INSUFFICIENT_SCOPE. The global rate limiter may return 429 RATE_LIMITED.
Withdrawal service responses are wrapped by the global ResponseInterceptor. A single withdrawal is returned as { "data": { ... }, "meta": { "requestId", "timestamp" } }. A list is nested as { "data": { "data": [...], "hasMore": ..., "nextCursor"?: ... }, "meta": ... }. X-Request-ID is also returned as a response header.
All three POST routes support the optional Idempotency-Key header through the global idempotency guard. Use a UUID v4. A matching retry replays the stored response; a malformed key returns 400 VALIDATION_ERROR. GET routes do not use idempotency keys. See API overview: common headers.
The status field is a WithdrawalStatus value:
WITHDRAWAL_CREATED | WITHDRAWAL_COMMITTED | WITHDRAWAL_PENDING | WITHDRAWAL_PENDING_USER_ACTION | WITHDRAWAL_COMPLETED | WITHDRAWAL_FAILED | WITHDRAWAL_CANCELED
POST /api/v1/withdrawals · write · 201 Created
Creates a withdrawal. For destinationType: "crypto", the Orchestrator sends USDC on Stellar synchronously and returns a completed withdrawal. For bank and airtm_balance, it creates an AirTM payout; by default it is a two-step flow and requires a later commit. Set commit: true to request one-step AirTM processing.
Fields and validation are from CreateWithdrawalDto in apps/api/src/modules/withdrawals/dto/create-withdrawal.dto.ts.
The create response follows CreateWithdrawalResponse in apps/api/src/modules/withdrawals/withdrawals.service.ts. The service returns fewer fields than the get/list response.
GET /api/v1/withdrawals · read · 200 OK
Lists a user's withdrawals, newest first. userId is required to scope the result to the acting user.
Each item uses the WithdrawalResponse schema described under Get a withdrawal. Pagination fields are inside the nested data object.
GET /api/v1/withdrawals/{id} · read · 200 OK
Returns one withdrawal, scoped to the combination of withdrawal ID and userId. A withdrawal owned by another user is treated as not found.
This is the WithdrawalResponse returned by the service for get, list, commit, and refresh.
POST /api/v1/withdrawals/{id}/commit · write · 200 OK
Commits an AirTM withdrawal created in two-step mode and returns its updated withdrawal. The withdrawal must be in a committable status and have an associated AirTM payout.
There is no request body.
Returns the updated WithdrawalResponse described under Get a withdrawal.
POST /api/v1/withdrawals/{id}/refresh · read · 200 OK
Fetches the latest status from AirTM and applies it locally when the transition is valid. Use this when an AirTM status-change webhook may have been missed. If the withdrawal has no AirTM payout ID, the current withdrawal is returned unchanged.
There is no request body.
Returns the updated WithdrawalResponse described under Get a withdrawal.
The current @offerhub/sdk resource methods for list, get, commit, and refresh do not send the required userId query parameter. The REST examples above include it and match the controller contract. Use these requests until the SDK exposes the parameter; see the Withdrawals SDK reference.
Verified against the Orchestrator source (OFFER-HUB/OFFER-HUB), not inferred:
userId query parametersdk.withdrawals methods