Conventions:
- Versioning:
/v1/...- Auth:
Admin(console/service-to-service) orInternal(private ops).- Headers:
X-Request-Id(required),Idempotency-Key(for POST/PUT that create resources),If-Match(ETag on updates).- Pagination: cursor (
limit,cursor), fallbackoffsetwhere noted.
/v1/health — liveness check (no deps). Done: returns 200 with build info./v1/ready — readiness (DB ping, migrations table present). Done: 200 only if DB ok./v1/metrics — Prometheus metrics. Done: histograms for request/DB timings./v1/version — service + schema versions. Done: commit SHA, semver, schema hash./v1/docs — OpenAPI UI (swagger/rapidoc). Done: reflects all routes./v1/admin/rotate-keys (Internal) — rotate service secrets (if applicable)./v1/countries — list (cursor+search+sort). Auth: Admin (read)./v1/countries — create country (uses Zod validation; idempotent via Idempotency-Key). Auth: Admin./v1/countries/:code — fetch by ISO2. Auth: Admin./v1/countries/:code — update (ETag/If-Match support). Auth: Admin./v1/countries/:code — remove (if detach-clean). Auth: Admin./v1/countries/:code/config — view effective country config. Auth: Admin./v1/countries/:code/config — replace config (version bump). Auth: Admin./v1/countries/:code/history — audit events for country (paginated). Auth: Admin./v1/countries:reference — helper lists: regions, timezones, locale examples. Public/Admin./v1/currencies — list all currencies (iso4217). Public/Admin./v1/currencies — add/override local currency metadata. Admin./v1/currencies/:code — fetch./v1/currencies/:code — update metadata/format./v1/currencies/:code — remove (if not in use)./v1/countries/:code/currencies — list allowed + base./v1/countries/:code/currencies/base — set base currency./v1/countries/:code/currencies/allowed — set allowed array (must include base)./v1/tenants — list/search. Admin./v1/tenants — create (country, baseCurrency, status). Admin./v1/tenants/:tenantId — get./v1/tenants/:tenantId — update (name, status)./v1/tenants/:tenantId:suspend — change status to SUSPENDED./v1/tenants/:tenantId:activate — change status to ACTIVE./v1/tenants/:tenantId/environments — list./v1/tenants/:tenantId/environments — create env (name, envType=STG|PRD|DEV)./v1/tenants/:tenantId/environments/:envId — get env./v1/tenants/:tenantId/environments/:envId — update (flags)./v1/tenants/:tenantId/environments:promote — promote configs/schedules STG→PRD (keys/products filters)./v1/tenants/:tenantId/environments/:envId/audit — env audit trail./v1/products — list products (WALLET, TRANSFER, CASHIN, …)./v1/products — create/enable product./v1/products/:code — get product./v1/products/:code — update metadata/category/status./v1/products/:code — soft-delete/deprecate.Scopes: GLOBAL | COUNTRY | TENANT | ENVIRONMENT
/v1/configs/effective — resolve effective config by context (tenantId, envId, country)./v1/configs — list by scope/key (history aware)./v1/configs — create new key version {scope, scopeRef, key, value} (idempotent key)./v1/configs/:configId — deactivate/activate or supersede./v1/configs/:configId — view specific version./v1/configs:promote — STG→PRD for keys (tenant-scoped)./v1/configs:dry-run — simulate effective config for a context (debug tool).Kinds: FEE, LIMIT (each is a “schedule” with items)
/v1/schedules — list by {kind, product, scope, scopeRef, active?}./v1/schedules — create schedule (inactive by default)./v1/schedules/:scheduleId — get schedule + items./v1/schedules/:scheduleId — update metadata/active window./v1/schedules/:scheduleId — archive schedule (if not active)./v1/schedules/:scheduleId/fees — add fee items (tiers)./v1/schedules/:scheduleId/limits — add limit items./v1/schedules:effective — resolve active schedule for context (tenant/env/country)./v1/schedules:promote — STG→PRD (tenant, products filter)./v1/schedules:validate — static validation for overlaps/gaps, currency precision./v1/fees:quote — input {product, amount, currency, tenant/env/country} → fee tier resolved./v1/limits:check — input {product, action, period[, currency]} → applicable limit row./v1/flags — list all flags with scope & rollout % (if you do gradual)./v1/flags/:flagKey — set {enabled, scopes[]}./v1/flags/effective — resolve for context (tenant/env/country + userId optional). GET /v1/idempotency — search by key/method/path/date (ops-only).
GET /v1/idempotency/:key — show cached response metadata (no body unless internal).
DELETE /v1/idempotency/:key — purge (admin/ops only; usually avoid).
GET /v1/outbox — list unprocessed (filters by aggregate/event).
POST /v1/outbox/:id:retry — force retry now.
POST /v1/outbox:retry-batch — retry with filter (time window, attempts<).
GET /v1/outbox/:id — view message payload/headers.
/v1/audit — query by actor, action, resource, time (cursor)./v1/audit/:id — detail./v1/webhooks — list endpoints per tenant./v1/webhooks — create endpoint (url, secret, events[])./v1/webhooks/:id — get./v1/webhooks/:id — rotate secret, pause/resume./v1/webhooks/:id — delete./v1/webhooks/:id:test — send test event now./v1/reference/timezones — IANA TZ list (cached)./v1/reference/regions — region/subregion map./v1/reference/locales — locale hints (BCP47 samples)./v1/validate/country — server-side validate a payload without persisting (for UI).Security
Admin, Ops, ReadOnly).Idempotency
Idempotency-Key required for POST that creates resources and PUT upserts.(method, path, hash) with response snapshot.ETag / Concurrency
ETag on GET; require If-Match on PATCH for write-heavy resources (countries, configs, schedules).Observability
reqId, traceId, tenantId, ip, and redact PII.Pagination
cursor (limit, cursor) with stable ordering; support offset for legacy UIs.Errors
{ type, title, status, detail, instance }.COUNTRY_NOT_FOUND, CONFIG_INVALID, SCHEDULE_OVERLAP, etc.