{ "data": { "id": "key_V1StGXR8Z5jdHi6B3mEv0", "key": "ohk_live_key_V1StGXR8Z5jdHi6B3mEv0_9f2c1a7e5b3d8f6041c2a9e7b5d3f1a08c6e4b2d7f9a1c3e", "name": "Marketplace backend", "scopes": [ "read", "write" ] }, "meta": { "requestId": "req_1ab90c", "timestamp": "2026-09-30T10:00:00.000Z" }}Interactive API Explorer
Every endpoint below is generated from the real OFFER-HUB Orchestrator OpenAPI spec (public/openapi.json) — fill in parameters, set a bearer token, and send a real request straight from your browser.
Try-it setup
Requests go straight from your browser to the base URL above when you click Try it on an endpoint below. Nothing here is stored or sent anywhere else.
Auth
Create and list API keys, exchange a key for a short-lived token, and read the current auth context.
Creates an API key. The plain-text key is in this response only; the database stores a salted hash.
application/json
Request URL
Example Response
Lists API keys, newest first. Key values are never returned, only their metadata.
Query Parameters
Keys per page; capped at 100, default 20.
The nextCursor from the previous page.
Request URL
Example Response
Exchanges an API key ID for a short-lived token (ohk_tok_...) valid for 1 hour, carrying the scopes of the key with that ID. No request body.
Path Parameters
The API key ID, not the key secret.
Request URL
Example Response
Returns the identity behind the credential sent. Any valid API key, token, or master key works; no specific scope is needed.
Request URL
Example Response
Config & Health
Public endpoints needing no credential: platform configuration and basic/detailed health checks.
Returns platform configuration (limits, currencies, feature flags). Limits/currencies/provider names are hardcoded string literals in the controller, not read from the environment.
Request URL
Example Response
Does no I/O and answers immediately; tells you only that the API process is up.
Request URL
Example Response
Tests database, Redis, Airtm, and Trustless Work in parallel, each capped at 5 seconds. Always returns HTTP 200; read data.status for the real result.
Request URL
Example Response
Orders
Order lifecycle up to escrow funding, plus milestone bookkeeping inside IN_PROGRESS.
Creates the order row and, optionally, its milestones. No funds move and no contract is deployed by this call.
application/json
Request URL
Example Response
Lists orders newest first, with cursor pagination and role/status filters.
Query Parameters
Return orders where this user is the buyer.
Return orders where this user is the seller.
Filter by one status. Unknown values are ignored.
Items per page; capped at 100, default 20.
The nextCursor from the previous page.
Request URL
Example Response
Fetches one order, including its escrow and milestones relations.
Path Parameters
Order ID with the ord_ prefix.
Request URL
Example Response
Moves order.amount from the buyer's available balance to reserved. Mandatory step before escrow creation. Sends no request body.
Path Parameters
Order ID with the ord_ prefix.
Request URL
Example Response
Cancels an order that has not reached escrow. Moves to CLOSED; reserved funds (if any) return to the buyer's available balance.
Path Parameters
Order ID with the ord_ prefix.
application/json
Request URL
Example Response
Lists the milestones of one order, ordered by creation time.
Path Parameters
Order ID with the ord_ prefix.
Request URL
Example Response
Marks one milestone COMPLETED. Bookkeeping write only; moves no money and makes no on-chain call. No request body.
Path Parameters
Order ID with the ord_ prefix.
The ref supplied when the order was created.
Request URL
Example Response
Escrow
Smart contract creation and funding for a funded order, deployed through Trustless Work.
Deploys the Trustless Work escrow contract for an order in FUNDS_RESERVED and links it to the order. No request body.
Path Parameters
Order ID with the ord_ prefix.
Request URL
Example Response
Moves the buyer's reserved balance into the on-chain contract and moves the order to IN_PROGRESS. No request body.
Path Parameters
Order ID with the ord_ prefix.
Request URL
Example Response
Resolution
Settles a funded escrow: release to seller, refund to buyer, or open a dispute.
Releases the escrowed funds to the seller. Requires every milestone COMPLETED. Completes synchronously; the returned order is already CLOSED.
Path Parameters
Order ID with the ord_ prefix.
application/json
Request URL
Example Response
Returns the escrowed funds to the buyer via a dispute-then-resolve flow against Trustless Work. Completes synchronously; the returned order is already CLOSED.
Path Parameters
Order ID with the ord_ prefix.
application/json
Request URL
Example Response
Freezes the escrow and opens a dispute. No on-chain transaction is sent.
Path Parameters
Order ID with the ord_ prefix.
application/json
Request URL
Example Response
Disputes
List, inspect, assign, and resolve disputes raised on escrowed orders.
Returns all disputes for the caller's marketplace, newest first. Not paginated — returns every match.
Query Parameters
Filter to disputes of a single order
Dispute status filter
Who opened the dispute
Request URL
Example Response
Returns a single dispute including the related order (with escrow, dispute, and milestones relations).
Path Parameters
Dispute identifier
Request URL
Example Response
Moves an OPEN dispute to UNDER_REVIEW and records the assigned support agent. Requires the dispute to be in OPEN state; writes a DISPUTE_ASSIGNED audit entry and emits dispute.under_review on the event bus. Supports an optional Idempotency-Key header.
Path Parameters
Dispute identifier
application/json
Request URL
Example Response
Closes a dispute that is UNDER_REVIEW by executing a financial decision (FULL_RELEASE, FULL_REFUND, or SPLIT) and setting status to RESOLVED. Writes a DISPUTE_RESOLVED audit entry and emits dispute.resolved. Supports an optional Idempotency-Key header.
Path Parameters
Dispute identifier
application/json
Request URL
Example Response
Users
Create users with an automatic balance, and link a user's Airtm account.
Creates a user and their balance in one transaction. If a user with the same externalUserId already exists, the existing user is returned instead of an error.
application/json
Request URL
Example Response
Verifies a user's email against Airtm and stores the link. If already linked, the stored link is returned without re-verifying.
Path Parameters
The internal user ID (usr_ prefix), not externalUserId.
application/json
Request URL
Example Response
Wallet & Top-ups
Stellar wallet info, crypto deposit instructions, transaction history, and AirTM top-up flow.
Returns the user's primary Stellar wallet with current on-chain USDC and XLM balances.
Path Parameters
Internal OFFER-HUB user ID (prefix usr_).
Request URL
Example Response
Returns deposit instructions: the Stellar address to send USDC to, plus asset and network details.
Path Parameters
Internal OFFER-HUB user ID (prefix usr_).
Request URL
Example Response
Returns recent USDC/XLM activity for the user's wallet, read from the Stellar Horizon API, filtered to payment and create_account operations.
Path Parameters
Internal OFFER-HUB user ID (prefix usr_).
Query Parameters
Number of transactions to return, capped at 100, default 20.
Request URL
Example Response
Creates an AirTM pay-in for the authenticated user and returns a confirmationUri to redirect the user to. User is resolved from the auth context, not the body.
application/json
Request URL
Example Response
Lists the authenticated user's top-ups, newest first, with cursor pagination.
Query Parameters
Items per page, capped at 100, default 20.
ID of the last top-up from the previous page.
Request URL
Example Response
Returns a single top-up owned by the authenticated user.
Path Parameters
Top-up ID (prefix topup_).
Request URL
Example Response
Re-checks the top-up status with AirTM. No-op if already terminal. On transition to TOPUP_SUCCEEDED the user's available balance is credited automatically.
Path Parameters
Top-up ID (prefix topup_).
Request URL
Example Response
Cancels a top-up still awaiting user confirmation; any other state returns 409 INVALID_STATE.
Path Parameters
Top-up ID (prefix topup_).
Request URL
Example Response
Public endpoint (@Public()), no authentication. The URL AirTM redirects the buyer's browser to after payment confirmation/cancellation. Refreshes status and issues a 302 redirect; never called directly by integrators.
Path Parameters
Top-up ID (prefix topup_).
Query Parameters
Optional status echoed by AirTM; ignored, final status re-read from AirTM.
Optional code echoed by AirTM; ignored.
Request URL
Example Response
Balance
Atomic ledger balance operations scoped to a user, backed by Prisma transactions and audit logging.
Returns the user's current available and reserved ledger balance. Returns a zero balance object if no balance record exists yet for the user.
Path Parameters
Internal user ID.
Request URL
Example Response
Credits funds to the user's available balance (e.g. top-up success, escrow refund). Validated and executed atomically via BalanceService.creditAvailable.
Path Parameters
Internal user ID.
application/json
Request URL
Example Response
Debits funds from the user's available balance (e.g. manual deduction, fee collection). Fails if available balance is less than the requested amount.
Path Parameters
Internal user ID.
application/json
Request URL
Example Response
Moves funds from available to reserved balance for a specific order, locking them ahead of escrow funding.
Path Parameters
Internal user ID (buyer).
application/json
Request URL
Example Response
Two-party operation: deducts from the buyer's reserved balance and credits the seller's available balance in a single serializable transaction. Writes an audit log entry for both parties.
Path Parameters
Internal user ID of the buyer whose reserved funds are released.
application/json
Request URL
Example Response
Returns previously reserved funds back to the user's available balance (e.g. order cancelled before escrow funding).
Path Parameters
Internal user ID.
application/json
Request URL
Example Response
Removes funds directly from the user's reserved balance without crediting another party (e.g. platform penalty on a disputed reservation).
Path Parameters
Internal user ID.
application/json
Request URL
Example Response
Compares the local ledger balance against the active payment provider (Stellar Horizon for crypto, AirTM otherwise) and flags any discrepancy found. Writes a BALANCE_SYNC audit log entry.
Path Parameters
Internal user ID.
Request URL
Example Response
Returns the local balance plus a providerVerified flag, after running the same provider-sync check as the sync endpoint. Throws if a significant (> $1.00) discrepancy is detected against the payment provider.
Path Parameters
Internal user ID.
Request URL
Example Response
Withdrawals
Payout operations from a user's ledger balance to a bank account, crypto address, or AirTM balance, via AirTM payouts or direct Stellar transfers.
Creates a withdrawal. For destinationType "crypto" it executes a synchronous Stellar USDC transfer and completes immediately; for "bank"/"airtm_balance" it reserves funds and creates an asynchronous AirTM payout (two-step unless commit=true). userId is a required body field, not a path parameter — this is a server-to-server API where the caller's API key does not identify the acting user.
application/json
Request URL
Example Response
Lists withdrawals for a user, newest first, with cursor pagination.
Query Parameters
User whose withdrawals to list.
Items per page. Default 20, capped at 100.
The nextCursor value from the previous page; omit for the first page.
Request URL
Example Response
Returns a single withdrawal's status and details, scoped to the owning user.
Path Parameters
Withdrawal ID.
Query Parameters
Owning user ID — the lookup is scoped to (id, userId) together.
Request URL
Example Response
Commits a withdrawal that was created in two-step mode (commit=false). Only valid while the withdrawal is still in a committable status; commits the associated Airtm payout and returns the refreshed withdrawal.
Path Parameters
Withdrawal ID.
Query Parameters
Owning user ID.
Request URL
Example Response
Re-fetches the withdrawal's payout status from Airtm and applies the state transition locally if the orchestrator's WithdrawalStateMachine allows it. Use when a status-change webhook may have been missed. If the withdrawal has no Airtm payout yet, returns its current state unchanged.
Path Parameters
Withdrawal ID.
Query Parameters
Owning user ID.
Request URL
Example Response
Audit Logs
Query the marketplace audit trail with filters and cursor pagination. Requires the support scope.
Returns audit entries for the caller's marketplace, ordered by occurredAt descending then id descending. Cursor-paginated; the controller fetches limit+1 rows to compute hasMore. payloadBefore/payloadAfter are redacted (sensitive keys replaced with ***REDACTED***) by RedactionService before storage.
Query Parameters
Filter by resource type, e.g. dispute, order, withdrawal
Filter to one resource instance
Action performed on the resource
Filter by the acting user
ISO date string; include entries at/after this time (occurredAt >= from); ignored if unparseable
ISO date string; include entries at/before this time (occurredAt <= to); ignored if unparseable
Page size; default 20, capped at 100 (@IsInt @Min(1) @Max(100) — over 100 returns 400, unlike other list endpoints which just clamp)
Audit log id from pagination.nextCursor of the previous page
Request URL
Example Response
Events
Real-time domain event stream over Server-Sent Events (SSE).
Server-Sent Events stream of domain events (DomainEvent envelope: eventId, eventType, occurredAt, aggregateId, aggregateType, payload, metadata), scoped to the marketplace bound to the caller's API key. Sends a 'ping' heartbeat every 30 seconds. Supports reconnection via the Last-Event-ID header (exclusive replay from Redis, capped at the last 1000 events) or the since query param. This is NOT a JSON response — it is a text/event-stream, unlike every other endpoint in this API.
Query Parameters
Repeatable. Exact event type(s) to include (e.g. order.created). Exact match only — wildcards like order.* are not valid on this public stream.
Repeatable. Exact aggregate type(s) to include (e.g. Order, Balance).
ISO 8601 timestamp. Replays buffered events after this time when no Last-Event-ID header is supplied; the header takes precedence over this param.
Request URL
Example Response
Webhooks
Inbound webhook receivers that external providers (AirTM, Trustless Work) call to notify the Orchestrator. Not an outbound subscription API — integrators use the SSE event stream instead.
Receives pay-in (topup.*) and pay-out (withdrawal.*) status updates from AirTM. Signature verification runs first (Svix headers + AIRTM_WEBHOOK_SECRET); an invalid signature is rejected with 401 before any processing. Duplicate deliveries (same provider+eventId) are acknowledged and skipped. Responses are always 200 after a valid signature, even for business-logic failures, to avoid provider retry storms.
application/json
Request URL
Example Response
Receives escrow lifecycle events from Trustless Work (escrow.created, escrow.funding_started, escrow.funded, escrow.milestone_completed, escrow.released, escrow.refunded, escrow.disputed) and flips the escrow/order state machines, re-emitting the corresponding domain events on the SSE stream. Events carrying a transaction_hash are verified against the Stellar network before the state change is applied.
application/json