Authorization: Bearer ohk_live_xxxxxxxxxxxxxxxxxxxxxxxxPer-endpoint reference for wallet info, crypto deposits, transaction history, and AirTM top-ups.
Wallet endpoints expose a user's Stellar wallet (balance, deposit address, and transaction history). Top-up endpoints handle the AirTM pay-in flow that credits a user's balance when PAYMENT_PROVIDER=airtm. The two groups are split by provider: with PAYMENT_PROVIDER=crypto you use GET /users/{userId}/wallet/deposit and point the user to send USDC; with PAYMENT_PROVIDER=airtm you create a top-up and redirect the user to the returned confirmationUri.
This reference is generated from the real controllers and DTOs in the Orchestrator:
apps/api/src/modules/topups/topups.controller.ts and apps/api/src/modules/topups/topups.service.tsapps/api/src/modules/topups/dto/create-topup.dto.tsapps/api/src/modules/wallet/wallet.controller.ts and apps/api/src/modules/wallet/wallet.service.tsapps/api/src/modules/wallet/dto/wallet-response.dto.tspackages/shared/src/enums/topup-status.enum.ts and packages/shared/src/constants/error-codes.tsAll paths are relative to the global /api/v1 prefix (for example, the full URL of GET /users/{userId}/wallet is /api/v1/users/{userId}/wallet).
Every endpoint except the callback is protected by ApiKeyGuard + ScopeGuard and requires a Bearer API key:
The required scope is enforced per endpoint via @Scopes('read') / @Scopes('write') (see Scopes in apps/api/src/common/decorators/scopes.decorator.ts). The bootstrap master key is accepted by ApiKeyGuard with read and write scopes, so it satisfies every endpoint in this reference.
Wallet handlers already return { "data": ... }, so the global response interceptor (apps/api/src/common/interceptors/response.interceptor.ts) passes them through unchanged. Top-up handlers return bare resources, and the list handler also returns pagination fields beside data; those responses are wrapped as { "data": ..., "meta": ... }. The public callback bypasses the interceptor because it writes the redirect directly.
meta.requestId appears only when the request supplies an X-Request-ID header. The interceptor adds meta.timestamp to every response it wraps.
These examples reflect the live controller return values. List top-ups is a nested envelope: the outer data contains the list's own data, hasMore, and nextCursor fields.
Errors use a uniform { "error": ... } shape produced by the global exception filter (apps/api/src/common/filters/global-exception.filter.ts):
POST /topups accepts an optional Idempotency-Key header (UUID v4) enforced by the global idempotency guard/interceptor (apps/api/src/common/guards/idempotency.guard.ts). Behavior:
Idempotency-Replay: true header.409 IDEMPOTENCY_KEY_REUSED.400 VALIDATION_ERROR.Idempotency records for top-ups are retained for 24 hours (see the idempotency windows in the API overview).
All endpoints are behind the global RateLimitGuard (apps/api/src/common/guards/rate-limit.guard.ts). No per-endpoint overrides exist for wallet or top-up routes, so the default applies: 100 requests per minute per API key (identified by the authenticated key; otherwise by IP). Responses include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. Exceeding the limit returns 429 RATE_LIMITED.
GET /api/v1/users/{userId}/wallet
Returns the user's primary Stellar wallet with the current on-chain USDC and XLM balances.
The wallet object follows the WalletResponseDto in apps/api/src/modules/wallet/dto/wallet-response.dto.ts.
Not applicable (GET).
GET /api/v1/users/{userId}/wallet/deposit
Returns deposit instructions: the Stellar address a buyer should send USDC to, plus asset and network details. Deposits to this address are detected automatically by BlockchainMonitorService and credited within seconds.
Follows the DepositInfoDto in apps/api/src/modules/wallet/dto/wallet-response.dto.ts.
Not applicable (GET).
GET /api/v1/users/{userId}/wallet/transactions
Returns recent USDC/XLM activity for the user's wallet, read from the Stellar Horizon API. Filtering keeps only payment and create_account operations.
data is an array of transaction objects matching TransactionDto in apps/api/src/modules/wallet/dto/wallet-response.dto.ts.
Not applicable (GET).
POST /api/v1/topups
Creates an AirTM pay-in for the authenticated user and returns a confirmationUri the user must open to complete the payment. The endpoint returns HTTP 201 Created. The user is resolved from the request auth context (see @CurrentUser('userId') in topups.controller.ts), not from the request body.
Validated by CreateTopUpDto in apps/api/src/modules/topups/dto/create-topup.dto.ts.
Matching CreateTopUpResponse in apps/api/src/modules/topups/topups.service.ts.
Supported. Send an Idempotency-Key: {uuid-v4} header to safely retry; duplicates for 24 hours return the original response. See Idempotency.
GET /api/v1/topups
Lists the authenticated user's top-ups, newest first. Uses cursor-based pagination.
The controller returns a list object beside data, so the global interceptor wraps the whole object. The array contains TopUpResponse objects (see GET /topups/{id}); pagination fields support the next page.
Not applicable (GET).
GET /api/v1/topups/{id}
Returns a single top-up owned by the authenticated user.
Matching TopUpResponse in apps/api/src/modules/topups/topups.service.ts.
Not applicable (GET).
POST /api/v1/topups/{id}/refresh
Re-checks the top-up status with AirTM and returns the fresh state. Use this when a webhook may have been missed. Refreshing a top-up already in a terminal state (TOPUP_SUCCEEDED, TOPUP_FAILED, TOPUP_CANCELED) is a no-op. On transition to TOPUP_SUCCEEDED the user's available balance is credited automatically.
Same TopUpResponse shape as GET /topups/{id}.
Supported (the global guard applies to all POST requests). The operation is naturally idempotent — it only re-reads status from AirTM — so a replayed key just returns the cached result.
POST /api/v1/topups/{id}/cancel
Cancels a top-up that is still awaiting user confirmation. Cancellation only works while status is TOPUP_AWAITING_USER_CONFIRMATION; any other state returns 409 INVALID_STATE. The AirTM pay-in is cancelled first when one exists, and the local status is set to TOPUP_CANCELED regardless of the AirTM result.
The Top-up state machine shows where cancellation sits among the other transitions.
Same TopUpResponse shape as GET /topups/{id}, with status set to TOPUP_CANCELED.
Supported (the global guard applies to all POST requests). Cancellation moves the top-up into the terminal TOPUP_CANCELED state, so a retry with the same Idempotency-Key replays the original response.
GET PUBLIC /api/v1/topups/{id}/callback
Public endpoint — no authentication or scope required (@Public() in topups.controller.ts). This is the URL AirTM redirects the buyer's browser to after they confirm or cancel a payment. The Orchestrator looks up the top-up, refreshes its status from AirTM when a pay-in ID exists, and issues an HTTP redirect (302) to either the success or cancel redirect URL configured in AirtmConfig.
You never call this endpoint from your integration. Configure TOPUP_CALLBACK_BASE_URL to the public base ending in /api/v1/topups; TopUpsService.createTopUp appends /{id}/callback when it creates the AirTM pay-in.
No domain error codes are returned on the normal path; the endpoint always redirects. The global rate limiter can return 429 RATE_LIMITED, and an unexpected database failure can return 500 INTERNAL_ERROR.
Not applicable (redirect).
Source: packages/shared/src/enums/topup-status.enum.ts in the Orchestrator.
Allowed transitions:
topup.created, topup.succeeded, and related events