corridor-in-a-box

HTTP API

@corridor/service turns the engine library into a service (zero runtime deps, Node http).

POST /payments

Body is a PaymentIntent:

{
  "idempotencyKey": "demo-0001",
  "corridorId": "mx-example",
  "sender": { "id": "sender-1" },
  "recipient": { "id": "recipient-1" },
  "sourceAmount": { "asset": "USDC", "amount": "100.00" }
}

Status code mapping

StatusError / ConditionDescription
200—Payment completed successfully, run state returned, health check ok, or metrics rendered
400invalid payment body, invalid JSONMalformed JSON or invalid PaymentIntent body structure
401unauthorizedMissing or invalid Bearer API key
403KYC_REJECTEDReceiving anchor rejected customer KYC
404unknown corridor, not foundUnknown corridor ID, run key not found (or foreign tenant key), or unmatched route
409IDEMPOTENCY_CONFLICTReplay with conflicting parameters or in-flight payment with same key
409QUOTE_EXPIREDAnchor quote expired before settlement could begin
409KYC_REQUIREDCustomer KYC incomplete or customer action required
409MANIFEST_CHANGEDCorridor manifest changed since the run started; resume refused before settle
409DRY_RUN_COMPLETEA dryRun: true run passed the pre-settle gate and stopped before settling; nothing was sent. The HTTP API never starts dry runs, so this code only appears from the engine or CLI
413payload too largeRequest body exceeds maxBodyBytes cap (default 64 KiB)
422AMOUNT_INVALIDAmount is not a positive decimal or cannot be settled
422CAPABILITY_MISMATCHAdapter capabilities do not match corridor manifest or settlement strategies
422MANIFEST_INVALIDCorridor manifest validation failed
429rate_limitedToken-bucket rate limit exceeded for client IP or API key
500SETTLEMENT_FAILEDOn-chain Stellar payment transaction failed
500RECONCILE_MISMATCHSettled amounts or assets do not match anchor transaction record
500internalUnexpected server error or unhandled failure fallback
501REFUND_UNSUPPORTEDPayment failed and anchor does not support refund
502QUOTE_UNAVAILABLEOrigin or destination anchor failed to provide a quote
502ANCHOR_UNAVAILABLEUpstream anchor service unreachable or returned an upstream error
503CORRIDOR_HALTEDCircuit breaker is open for this corridor: too many consecutive lane failures. No run was created and nothing was sent to the anchor. Retry is pointless until the lane is reset — see docs/operations.md §7. Non-retryable
504SETTLEMENT_TIMEOUTStellar network submission timed out
504RECONCILE_STALLEDAnchor transaction polling timed out

Other endpoints

  • GET /payments/:key — current run state (scoped to authenticated tenant).
  • GET /healthz — liveness (public, unmetered).
  • GET /metrics — Prometheus text exposition format (public, unmetered; served when metricsText is configured).

Optional bearer API-key auth and an in-memory token-bucket rate limiter are configured on the service context.