https://{your-orchestrator-domain}/api/v1Complete REST API reference for OFFER-HUB — endpoints, parameters, and response schemas.
The OFFER-HUB Orchestrator exposes a RESTful JSON API. All endpoints are prefixed with /api/v1.
For local development:
The API uses Bearer tokens for authentication, supporting Master Keys, API Keys, and temporary 1-hour tokens.
For full details on credential types, key lifecycle, and per-endpoint scopes, see the Authentication & Scopes guide.
A long-lived API key can be exchanged for a short-lived bearer token (valid for 1 hour). This is useful for clients, such as a browser, that should not hold the long-lived key. The exchange endpoint requires the write scope.
Every JSON response passes through two global layers registered in apps/api/src/main.ts:
ResponseInterceptor (apps/api/src/common/interceptors/response.interceptor.ts) wraps what the controller returns.GlobalExceptionFilter (apps/api/src/common/filters/global-exception.filter.ts) writes the error envelope.The interceptor does not normalize every endpoint to one shape. It applies three rules to the controller's return value, in this order:
data key and either has a meta key or has no other keys. A controller that returns { data: X } is sent exactly as { "data": X }, with no meta.error key.{ "data": <value>, "meta": { "requestId", "timestamp" } }. That includes controllers that return { success, data }, which therefore arrive nested one level deeper.The interceptor can also lift a page-based block into meta.pagination (page, limit, total, totalPages). It only does this for a return value shaped { items, pagination: { page, limit, total } }, and no current endpoint returns that shape, so meta.pagination never appears today. Pagination lives inside data. See Pagination.
Verified against each controller in apps/api/src/modules and against the Orchestrator e2e helpers (tests/e2e/orders.e2e.ts, tests/e2e/wallet.e2e.ts, tests/e2e/disputes.e2e.ts), which unwrap body.data.data for the { success, data } controllers.
Check the HTTP client in your installed @offerhub/sdk version before assuming it unwraps these layers. The pinned Balance SDK source returns JSON unchanged despite declaring a bare resource type; see Balance SDK compatibility. The shapes above also apply when calling REST directly or through a proxy.
Double-wrapped ({ success, data } controllers: orders, resolution, disputes). Here, POST /orders/{id}/reserve:
Wrapped once (controllers that return the resource itself). Here, GET /users/{userId}/balance:
Passed through (controllers that already return { data }). Here, GET /users/{userId}/wallet/deposit. It has no meta, so read the correlation ID from the X-Request-ID header:
Error, from GlobalExceptionFilter. Here, a 400 from the validation pipe:
The full error catalog, and the extra keys some codes add to details, are in Error Codes.
CorrelationIdMiddleware (apps/api/src/common/middleware/correlation-id.middleware.ts) runs on every route (app.module.ts, forRoutes('*')):
X-Request-ID header, its value is used as is. Any string is accepted. It isn't validated or reformatted.crypto.randomUUID().X-Request-ID response header on every response, success or error.Where you can read it back:
Send your own X-Request-ID (for example, your upstream request or trace ID) so the same value appears in your logs and the Orchestrator's. Quote it when reporting a 500 INTERNAL_ERROR.
The Orchestrator defines 40+ domain-specific error codes categorized across authentication, validation, users, funds, orders, escrow, disputes, top-ups, withdrawals, external providers, idempotency, rate limiting, and internal system errors.
For the exhaustive catalog of all 40+ codes with causes, fixes, citations, and @offerhub/sdk class mappings, see the dedicated Error Codes Reference.
The summaries on this page cover the API surface at a glance. The endpoint groups below have dedicated pages with real DTO fields, signer roles, valid state transitions, error codes, and cURL plus TypeScript SDK examples:
Escrow contracts hold funds securely between buyers and sellers until project completion. The two creation and funding calls are documented end to end in Escrow Endpoints; the three settlement calls are in Resolution Endpoints.
POST /api/v1/orders/{id}/escrow
Deploys the Trustless Work escrow contract for an order in FUNDS_RESERVED. The request has no body: the amount and parties come from the order (OrdersController.createEscrow). See Escrow Endpoints for contract roles and the full response schema.
Response (201, double-wrapped; order and escrow fields trimmed)
POST /api/v1/orders/{id}/escrow/fund
Funds an existing escrow contract. See Escrow Endpoints for the reserved-balance debit, contract-type selection, and error codes.
Returns 422 INSUFFICIENT_FUNDS if the buyer has insufficient balance.
POST /api/v1/orders/{id}/resolution/release
Releases held funds from an escrow to the seller upon project completion. See Resolution Endpoints for the three on-chain steps and their signer roles.
Response (200, double-wrapped; fields trimmed). The handler returns the order, already CLOSED:
POST /api/v1/orders/{id}/resolution/refund
Refunds escrowed funds back to the buyer. See Resolution Endpoints for the two-step dispute-then-resolve flow.
POST /api/v1/orders/{id}/resolution/dispute
Opens a dispute on an escrow for resolution. See Resolution Endpoints for the OpenDisputeDto fields and how a dispute is later resolved.
Retrieve user transaction and balance history.
GET /api/v1/users/{id}/balance
Returns the user's ledger balance (BalanceService.getBalance).
Response (wrapped once)
GET /api/v1/users/{id}/wallet/deposit
Returns a Stellar deposit address and asset for the user. This endpoint passes { data } through without meta; see the passed-through example.
Subscribers consume real-time domain events over the SSE event stream at GET /api/v1/events. Separately, the Orchestrator receives inbound webhooks from external providers (Airtm, Trustless Work) to process payment and escrow lifecycle events — see the Inbound Webhooks reference for signature verification and deduplication behavior.
POST /api/v1/withdrawals
Initiate a withdrawal from user balance.
Request Body
Fields are validated by CreateWithdrawalDto (apps/api/src/modules/withdrawals/dto/create-withdrawal.dto.ts). The created withdrawal comes back wrapped once, as { data, meta }.
GET /api/v1/withdrawals/{id}
Returns withdrawal status and details.
This is the single reference for list pagination. Endpoint pages link here instead of repeating it.
List endpoints use cursor pagination over the resource ID, newest first. There is no page, offset, total or sort parameter.
The cursor is the ID of the last item on the previous page. It is exclusive: that item isn't repeated (Prisma cursor: { id } with skip: 1, results ordered by createdAt desc).
Pagination fields are camelCase and sit inside data. Their exact position varies by endpoint:
When there is no next page, hasMore is false. nextCursor is then omitted, except on GET /auth/api-keys, which returns null.
GET /orders:
GET /topups and GET /withdrawals have the same shape, without success.
GET /audit/logs:
Keep requesting with cursor set to the last nextCursor until hasMore is false:
With the SDK, list methods already return { data, hasMore, nextCursor }.
Filters are per endpoint. Query keys follow each controller exactly: GET /orders uses snake_case, the others use camelCase. Date-range filters exist only on audit logs.
Idempotency-Key is optional and is processed on POST, PUT, and PATCH
requests. When supplied, it must be a UUID v4 and is scoped to the API key and
request body. The guard and response lifecycle are implemented in the
orchestrator IdempotencyGuard
and
IdempotencyInterceptor.
Use a real UUID v4 for every request key:
400 VALIDATION_ERROR; the key must be a UUID v4.Idempotency-Replay: true.409 IDEMPOTENCY_KEY_REUSED.409 IDEMPOTENCY_KEY_IN_PROGRESS.Example for a reused key:
Example while the original request is still running:
Keys are retained for 24 hours. Reuse after that period is treated as a new request.
In the current orchestrator, idempotency entries are stored for 24 hours by default (idempotency.service.ts, ttlHours = 24) regardless of resource. The per-resource windows above are the intended targets — see Disputes API · Idempotency for the behavior actually enforced today.
The API applies one global limit of 100 requests per 60-second window. The
counter is keyed by API key when authenticated, or by client IP when no API key
is available. There are no additional per-endpoint limits documented here.
The headers and error payload are implemented in the orchestrator
RateLimitGuard.
Every response includes:
Every entry below was verified against the real controllers in apps/api/src/modules. All paths are relative to the /api/v1 prefix.
All balance endpoints are scoped to a user: /users/{userId}/balance. See Balance Endpoints for exact DTOs, response envelopes, errors, and tabbed examples.
Wallet endpoints are scoped to a user: /users/{userId}/wallet. Full reference in Wallet & Top-ups.
Full reference with request/response schemas in Wallet & Top-ups.
The order lifecycle up to funding, plus milestone bookkeeping, is documented endpoint by endpoint in Orders & Milestones Endpoints — real DTO fields, preconditions, error codes, and cURL plus SDK examples for each route.
The API uses path versioning:
v1 is the current stable version