{"openapi":"3.1.0","info":{"title":"Alignment Processor API","version":"1.0.0","description":"Commerce Infrastructure Platform (CIP) by Alignment Digital Limited: merchants, Express Checkout (basket, TRX Ref, payment, exit verification), settlement, and Merchant Case Management.\n\nPostman collection: `/docs/postman.json`. Error catalogue: `/docs/errors`.\n\n## Authentication\n\nEvery endpoint except `/health`, the sign-up and sign-in routes under\n`/api/v1/auth`, and provider webhooks needs a bearer token:\n\n    Authorization: Bearer <token>\n\nGet one by signing in:\n\n    POST /api/v1/auth/login\n    { \"email\": \"owner@lekkifoods.ng\", \"password\": \"...\" }\n    -> { \"token\": \"eyJ...\", ... }\n\nTokens last 8 hours. A token stops working at once if its user is suspended\nor its actor deactivated, even before it expires.\n\n### Who you are, and which tenant\n\nA token says who you are. What you may do comes from your actor's\n**scopes**: each one is either over one tenant (TENANT) or over all\ntenants (GLOBAL), and is READ_WRITE or READ_ONLY.\n\n- One TENANT scope: nothing more to send.\n- A GLOBAL scope, or several scopes: send the tenant you are acting on.\n\n      X-Tenant-Id: 00000000-0000-0000-0000-000000000001\n\n  Without it you get `400 tenant_selection_required`; with a tenant you\n  hold no scope over, `403 tenant_access_denied`.\n- READ_ONLY (regulators, auditors) can call every GET and nothing else\n  (`403 read_only_scope`).\n\nMerchant accounts (merchant users, cashiers, security officers) are pinned\nto one merchant. Anything belonging to another merchant answers `404`,\nexactly as if it did not exist.\n\n### Tracing a request\n\nSend `X-Correlation-Id` (a UUID) to tie several requests and the events\nthey cause together; send `X-Request-Id` to name one request. Both come\nback as response headers, and both are stored on every audit event the\nrequest causes. Quote `X-Request-Id` when reporting a problem.\n\n### Errors\n\nEvery error is JSON with a stable `error` code:\n\n    { \"error\": \"basket_not_open\", \"status\": \"LOCKED\" }\n\nThe full list, with what each means, is at `/docs/errors`.\n\n## Webhooks\n\n### Paystack -> Alignment Processor\n\nEach tenant uses its own Paystack account. In that account's Paystack\ndashboard, set the webhook URL to\n\n    https://<your AP host>/api/v1/webhooks/paystack/<tenant id>\n\nThe tenant id in the path tells AP whose key to check the signature\nagainst, before it reads anything else in the request.\n\nWhat AP does with each event:\n\n| Event | Effect |\n|---|---|\n| `charge.success` | Re-confirms the payment with Paystack's own API (status, amount, currency). Only if all three match is the payment marked SUCCESSFUL, posted to the ledger, and the transaction moved to SUCCESSFUL. |\n| `charge.failed` | The payment, and its transaction, are marked FAILED. |\n| `transfer.success` / `transfer.failed` / `transfer.reversed` | Settlement payouts: the batch is completed or failed. |\n| anything else | Acknowledged and ignored. |\n\nRules AP keeps, so you never have to worry about Paystack retrying:\n\n- **Signature first.** `x-paystack-signature` must be the HMAC-SHA512 of the\n  raw body under the tenant's secret key, or the answer is `401` and\n  nothing is read.\n- **Duplicates are no-ops.** Every Paystack event id is recorded; the same\n  event delivered twice changes nothing the second time. A payment that is\n  already final is never changed by a later event.\n- **Always 200** once the signature is good, even if AP couldn't act on the\n  event (it logs why), because a retry can't fix those cases.\n\n### Events AP publishes\n\nEvery state change in AP is an event, written in the same database commit\nas the change itself (the transactional outbox) and kept for ever in the\naudit log. The ones integrators ask about most:\n\n| Event | When |\n|---|---|\n| `TRXRefGenerated` | A basket became a payable TRX Ref. |\n| `PaymentInitiated`, `PaymentSucceeded`, `PaymentFailed`, `PaymentReversed` | The payment's own lifecycle. |\n| `TransactionSuccessful`, `TransactionExitVerified`, `TransactionClosed` | The TRX Ref's lifecycle (§18). |\n| `ExitPassIssued`, `ExitVerified`, `ExitScanRefused`, `ExitRandomAuditRequired`, `ExitAuditFailed` | Express Checkout exit. |\n| `CaseCreated`, `CaseAssigned`, `TaskApproved`, `TaskRejected`, `SLAWarning`, `SLABreached`, `CaseClosed` | Merchant Case Management. |\n\nDelivering these to merchant systems as outbound webhooks is on the §13\n\"future\" list and not part of V1.\n"},"servers":[{"url":"/"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"System"},{"name":"Identity"},{"name":"Merchants"},{"name":"Catalogue"},{"name":"Documents"},{"name":"Express Checkout"},{"name":"Exit Verification"},{"name":"Shopper"},{"name":"Settlement"},{"name":"Cases"},{"name":"Reporting"},{"name":"Operations"},{"name":"Compliance"},{"name":"Notifications"},{"name":"Work Inbox"},{"name":"Admin"},{"name":"Webhooks"}],"paths":{"/health":{"get":{"tags":["System"],"summary":"Liveness check","operationId":"getHealth","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/ready":{"get":{"tags":["System"],"summary":"Readiness: the database is reachable","operationId":"getReady","security":[],"responses":{"200":{"description":"Ready","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"ready"}},"required":["status"],"additionalProperties":false}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Database unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/metrics":{"get":{"tags":["System"],"summary":"Prometheus metrics","description":"Authorization: Bearer <METRICS_TOKEN>. Without a token configured, not served in production.","operationId":"getMetrics","security":[],"responses":{"200":{"description":"Prometheus text format"},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"tags":["System"],"summary":"This OpenAPI document","operationId":"getOpenapiJson","security":[],"responses":{"200":{"description":"OpenAPI 3.1"},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/docs":{"get":{"tags":["System"],"summary":"Swagger UI","operationId":"getDocs","security":[],"responses":{"200":{"description":"HTML"},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/docs/postman.json":{"get":{"tags":["System"],"summary":"Postman collection","operationId":"getDocsPostmanJson","security":[],"responses":{"200":{"description":"Postman v2.1 collection"},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/docs/errors":{"get":{"tags":["System"],"summary":"Error catalogue","operationId":"getDocsErrors","security":[],"responses":{"200":{"description":"JSON list, or an HTML page for a browser"},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/register":{"post":{"tags":["Identity"],"summary":"Self-serve merchant registration","description":"Creates the login, the merchant and its merchant_user scope together, then sends a verification email.","operationId":"postApiV1AuthRegister","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"password":{"type":"string","minLength":10},"legalName":{"type":"string","minLength":2},"tradingName":{"type":"string","minLength":2}},"required":["email","password","legalName","tradingName"]},"example":{"email":"owner@lekkifoods.ng","password":"a-long-passphrase","legalName":"Lekki Foods Ltd","tradingName":"Lekki Foods"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/verify-email":{"post":{"tags":["Identity"],"summary":"Confirm an email address with the emailed token","operationId":"postApiV1AuthVerifyEmail","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/login":{"post":{"tags":["Identity"],"summary":"Exchange email and password for a token","operationId":"postApiV1AuthLogin","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"password":{"type":"string","minLength":1}},"required":["email","password"]},"example":{"email":"owner@lekkifoods.ng","password":"a-long-passphrase"}}}},"responses":{"200":{"description":"{ token, user }","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/me":{"get":{"tags":["Identity"],"summary":"The signed-in user, actor and scopes","operationId":"getApiV1AuthMe","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/logout":{"post":{"tags":["Identity"],"summary":"Sign out","operationId":"postApiV1AuthLogout","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/password-reset/request":{"post":{"tags":["Identity"],"summary":"Email a password reset link","description":"Always answers the same way, whether or not the address is registered.","operationId":"postApiV1AuthPasswordResetRequest","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["email"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/password-reset/confirm":{"post":{"tags":["Identity"],"summary":"Set a new password with the emailed token","operationId":"postApiV1AuthPasswordResetConfirm","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1},"newPassword":{"type":"string","minLength":10}},"required":["token","newPassword"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/change-password":{"post":{"tags":["Identity"],"summary":"Change your own password","operationId":"postApiV1AuthChangePassword","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currentPassword":{"type":"string","minLength":1},"newPassword":{"type":"string","minLength":10}},"required":["currentPassword","newPassword"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants":{"post":{"tags":["Merchants"],"summary":"Create a merchant in the caller's tenant","operationId":"postApiV1Merchants","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"legalName":{"type":"string","minLength":2},"tradingName":{"type":"string","minLength":2}},"required":["legalName","tradingName"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Merchants"],"summary":"The tenant's merchants (a merchant account sees only itself)","operationId":"getApiV1Merchants","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Matches trading or legal name"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by status"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}":{"get":{"tags":["Merchants"],"summary":"A merchant's profile","operationId":"getApiV1MerchantsById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/dashboard":{"get":{"tags":["Merchants"],"summary":"Merchant Portal overview figures","operationId":"getApiV1MerchantsByIdDashboard","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/transactions":{"get":{"tags":["Merchants"],"summary":"The merchant's transactions","operationId":"getApiV1MerchantsByIdTransactions","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by transaction status"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Up to 200 (default 50)"},{"name":"offset","in":"query","required":false,"schema":{"type":"string"},"description":"For paging"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/timeline":{"get":{"tags":["Merchants"],"summary":"The merchant's timeline, newest first","description":"Merchant users see their own account's events; back-office staff see every event about the merchant.","operationId":"getApiV1MerchantsByIdTimeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"before","in":"query","required":false,"schema":{"type":"string"},"description":"Only events before this time (for paging)"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Up to 200 (default 50)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/readiness":{"get":{"tags":["Merchants"],"summary":"The merchant's onboarding checklist and readiness score","operationId":"getApiV1MerchantsByIdReadiness","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/stores":{"post":{"tags":["Merchants"],"summary":"Propose a store (STORE_CREATION case)","operationId":"postApiV1MerchantsByIdStores","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"merchantId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"name":{"type":"string","minLength":2}},"required":["merchantId","name"]}}}},"responses":{"202":{"description":"Proposed; happens once its case is approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Merchants"],"summary":"The merchant's stores","operationId":"getApiV1MerchantsByIdStores","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/branches":{"post":{"tags":["Merchants"],"summary":"Propose a branch (BRANCH_CREATION case: RM -> Operations)","operationId":"postApiV1MerchantsByIdBranches","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"storeId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"name":{"type":"string","minLength":2,"maxLength":120},"address":{"type":"string","maxLength":300}},"required":["storeId","name"]},"example":{"storeId":"8f1c2a8e-6a3b-4c39-9a51-2f7d1d0f4b11","name":"Admiralty Way","address":"12 Admiralty Way, Lekki Phase 1"}}}},"responses":{"202":{"description":"Proposed; happens once its case is approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Merchants"],"summary":"The merchant's branches","operationId":"getApiV1MerchantsByIdBranches","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/cashiers":{"post":{"tags":["Merchants"],"summary":"Propose a cashier or security officer (CASHIER_REQUEST case)","description":"Once approved, the new staff member is emailed a temporary password.","operationId":"postApiV1MerchantsByIdCashiers","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"displayName":{"type":"string","minLength":1},"role":{"default":"cashier","type":"string","enum":["cashier","security_officer"]}},"required":["email","displayName"]},"example":{"email":"guard@lekkifoods.ng","displayName":"Musa Bello","role":"security_officer"}}}},"responses":{"202":{"description":"Proposed; happens once its case is approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Merchants"],"summary":"The merchant's cashiers","operationId":"getApiV1MerchantsByIdCashiers","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/settlement-accounts":{"post":{"tags":["Merchants"],"summary":"Propose a new settlement account (SETTLEMENT_ACCOUNT_CHANGE: RM -> Compliance -> Treasury)","description":"The account name is resolved with the bank, never typed. Payouts move to it only once all three approve.","operationId":"postApiV1MerchantsByIdSettlementAccounts","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bankCode":{"type":"string","minLength":1},"bankName":{"type":"string","minLength":1},"accountNumber":{"type":"string","minLength":1}},"required":["bankCode","bankName","accountNumber"]}}}},"responses":{"202":{"description":"Proposed; happens once its case is approved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/entry-codes":{"get":{"tags":["Merchants"],"summary":"The store entrance QRs","operationId":"getApiV1MerchantsByIdEntryCodes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EntryCode"}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Merchants"],"summary":"Create a store entrance QR for shoppers","description":"Print it at the entrance; scanning it starts Express Checkout. Store staff can't.","operationId":"postApiV1MerchantsByIdEntryCodes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"storeId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"branchId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"label":{"type":"string","maxLength":80}},"required":["storeId"]},"example":{"storeId":"8f1c2a8e-6a3b-4c39-9a51-2f7d1d0f4b11","label":"Main entrance"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntryCode"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/entry-codes/{codeId}/revoke":{"post":{"tags":["Merchants"],"summary":"Revoke an entrance QR (it stops working at once)","operationId":"postApiV1MerchantsByIdEntryCodesByCodeIdRevoke","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"codeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"REVOKED"}},"required":["status"],"additionalProperties":false}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{id}/catalogue":{"post":{"tags":["Catalogue"],"summary":"Add or update catalogue items (by SKU)","description":"Basket prices come only from here. Every price change is audited with the old and new price. Store staff can't change prices.","operationId":"postApiV1MerchantsByIdCatalogue","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":100},"barcode":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":200},"unitPriceMinor":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"currency":{"default":"NGN","type":"string","minLength":3,"maxLength":3},"status":{"default":"ACTIVE","type":"string","enum":["ACTIVE","INACTIVE"]}},"required":["sku","description","unitPriceMinor"]}}},"required":["items"]},"example":{"items":[{"sku":"RICE-5KG","barcode":"6151100000011","description":"Rice 5kg","unitPriceMinor":850000}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CatalogueItem"}}},"required":["items"],"additionalProperties":false}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Catalogue"],"summary":"Search the catalogue","operationId":"getApiV1MerchantsByIdCatalogue","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Matches SKU, barcode or description"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CatalogueItem"}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{merchantId}/documents/upload-url":{"post":{"tags":["Documents"],"summary":"A signed URL to upload a document file","operationId":"postApiV1MerchantsByMerchantIdDocumentsUploadUrl","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["application/pdf","image/jpeg","image/png"]},"sizeBytes":{"type":"integer","exclusiveMinimum":0,"maximum":10485760}},"required":["fileName","contentType","sizeBytes"]},"example":{"fileName":"cac-certificate.pdf","contentType":"application/pdf","sizeBytes":182400}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignedUpload"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{merchantId}/documents":{"post":{"tags":["Documents"],"summary":"Record an uploaded file as a document, or as its next version","operationId":"postApiV1MerchantsByMerchantIdDocuments","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentType":{"type":"string","enum":["CAC","TIN","CERTIFICATE_OF_INCORPORATION","DIRECTOR_ID","UTILITY_BILL","BANK_LETTER","BOARD_RESOLUTION","AML_DECLARATION","CUSTOM"]},"label":{"default":"","type":"string","maxLength":120},"storageRef":{"type":"string","minLength":1,"maxLength":500},"expiresAt":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"fileName":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["application/pdf","image/jpeg","image/png"]},"sizeBytes":{"type":"integer","exclusiveMinimum":0,"maximum":10485760}},"required":["documentType","storageRef","fileName","contentType","sizeBytes"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantDocumentUploaded"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Documents"],"summary":"The document library, current version of each","operationId":"getApiV1MerchantsByMerchantIdDocuments","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MerchantDocumentListItem"}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{merchantId}/documents/{documentId}":{"get":{"tags":["Documents"],"summary":"A document with its version history","operationId":"getApiV1MerchantsByMerchantIdDocumentsByDocumentId","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}},{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantDocument"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{merchantId}/documents/{documentId}/versions/{versionId}/preview":{"get":{"tags":["Documents"],"summary":"A short-lived link that opens the file in the browser","operationId":"getApiV1MerchantsByMerchantIdDocumentsByDocumentIdVersionsByVersionIdPreview","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}},{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignedLink"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{merchantId}/documents/{documentId}/versions/{versionId}/download":{"get":{"tags":["Documents"],"summary":"A short-lived link that saves the file","operationId":"getApiV1MerchantsByMerchantIdDocumentsByDocumentIdVersionsByVersionIdDownload","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}},{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignedLink"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/merchants/{merchantId}/documents/{documentId}/versions/{versionId}/verification":{"post":{"tags":["Documents"],"summary":"Verify or reject a version (compliance only)","description":"Final once made. Never by the person who uploaded it. A rejection needs a note.","operationId":"postApiV1MerchantsByMerchantIdDocumentsByDocumentIdVersionsByVersionIdVerification","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}},{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["VERIFIED","REJECTED"]},"note":{"type":"string","maxLength":1000}},"required":["decision"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentVersion"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/documents/verification-queue":{"get":{"tags":["Documents"],"summary":"Compliance queue: pending versions and documents expiring within 30 days","operationId":"getApiV1DocumentsVerificationQueue","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/baskets":{"post":{"tags":["Express Checkout"],"summary":"Start a basket in a store (and branch)","operationId":"postApiV1Baskets","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"storeId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"branchId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"currency":{"default":"NGN","type":"string","minLength":3,"maxLength":3}},"required":["storeId"]},"example":{"storeId":"8f1c2a8e-6a3b-4c39-9a51-2f7d1d0f4b11","branchId":"1d9e3c3a-0c55-4c8e-8f5e-2b7b5d7e9a01","currency":"NGN"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/baskets/{id}/items":{"post":{"tags":["Express Checkout"],"summary":"Add a scanned item","description":"Name the item by SKU or barcode; its price comes from the merchant's catalogue.","operationId":"postApiV1BasketsByIdItems","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":100},"barcode":{"type":"string","minLength":1,"maxLength":100},"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":999}},"required":["quantity"]},"example":{"barcode":"6151100000011","quantity":1}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketItemAdded"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/baskets/{id}":{"get":{"tags":["Express Checkout"],"summary":"A basket and its items","operationId":"getApiV1BasketsById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/transactions":{"post":{"tags":["Express Checkout"],"summary":"Issue a TRX Ref for a basket (locks the basket)","description":"For a locked basket whose earlier TRX Refs all failed or expired, issues a new one for the same items.","operationId":"postApiV1Transactions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"basketId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"expiresInSeconds":{"default":900,"type":"integer","exclusiveMinimum":0,"maximum":3600}},"required":["basketId"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/transactions/{trxRef}":{"get":{"tags":["Express Checkout"],"summary":"A transaction by its TRX Ref","operationId":"getApiV1TransactionsByTrxRef","parameters":[{"name":"trxRef","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/transactions/{id}/ready":{"post":{"tags":["Express Checkout"],"summary":"Mark a transaction ready for payment","operationId":"postApiV1TransactionsByIdReady","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"READY_FOR_PAYMENT"}},"required":["status"],"additionalProperties":false}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/payments":{"post":{"tags":["Express Checkout"],"summary":"Pay a ready transaction","description":"One payment attempt per TRX Ref; repeat the same idempotencyKey to retry safely. For Paystack, send the customer to authorizationUrl.","operationId":"postApiV1Payments","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"transactionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"idempotencyKey":{"type":"string","minLength":8},"provider":{"type":"string","minLength":2},"method":{"type":"string","minLength":2},"customerEmail":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["transactionId","idempotencyKey","provider","method"]},"example":{"transactionId":"0b6f2a4e-1c3d-4e5f-8a9b-0c1d2e3f4a5b","idempotencyKey":"checkout-7f3a9c1e","provider":"paystack","method":"card","customerEmail":"ada@example.com"}}}},"responses":{"200":{"description":"Same idempotency key again: the existing payment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/payments/{id}":{"get":{"tags":["Express Checkout"],"summary":"A payment","operationId":"getApiV1PaymentsById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/payments/{id}/provider-callback":{"post":{"tags":["Express Checkout"],"summary":"Test hook: settle an internal_test payment","description":"Not available in production, and never for a real provider (their outcome comes only from their signed webhook).","operationId":"postApiV1PaymentsByIdProviderCallback","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/exit/passes":{"post":{"tags":["Exit Verification"],"summary":"Issue the exit QR for a paid transaction","description":"One-time, signed, bound to the TRX Ref, basket manifest, merchant, branch and an expiry. Issuing again replaces the earlier pass.","operationId":"postApiV1ExitPasses","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"transactionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},"required":["transactionId"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExitPass"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/exit/verifications":{"post":{"tags":["Exit Verification"],"summary":"Security scans an exit QR","description":"Answers PAID, NOT_PAID, EXPIRED, ALREADY_EXITED or RANDOM_AUDIT_REQUIRED. Only PAID lets the customer leave. For the merchant's store staff only.","operationId":"postApiV1ExitVerifications","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"qr":{"type":"string","minLength":10,"maxLength":2000},"branchId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},"required":["qr"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExitScan"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Exit Verification"],"summary":"The scan log","operationId":"getApiV1ExitVerifications","parameters":[{"name":"result","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by result"},{"name":"branchId","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by branch"},{"name":"merchantId","in":"query","required":false,"schema":{"type":"string"},"description":"Internal staff: filter by merchant"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Up to 200 (default 50)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/exit/verifications/{id}/audit":{"post":{"tags":["Exit Verification"],"summary":"Record a random audit's outcome","operationId":"postApiV1ExitVerificationsByIdAudit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"outcome":{"type":"string","enum":["PASSED","FAILED"]},"notes":{"type":"string","maxLength":1000}},"required":["outcome"]},"example":{"outcome":"FAILED","notes":"Two tins of milk in the bag not on the receipt"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExitAuditOutcome"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/stores":{"get":{"tags":["Shopper"],"summary":"The stores a customer can shop in","operationId":"getApiV1ShopperStores","security":[],"parameters":[{"name":"tenant","in":"query","required":false,"schema":{"type":"string"},"description":"The retail group's slug"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/entry/{code}":{"get":{"tags":["Shopper"],"summary":"What a store's entrance QR opens","operationId":"getApiV1ShopperEntryByCode","security":[],"parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntryPreview"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/sessions":{"post":{"tags":["Shopper"],"summary":"Start a shopping session from a store's entrance QR","description":"No login: the signed entrance code is the proof. Scanning again on the same phone in the same store resumes the open session. Send X-Customer-Token to put the session on a customer account.","operationId":"postApiV1ShopperSessions","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entryCode":{"type":"string","minLength":10,"maxLength":500},"deviceId":{"type":"string","minLength":8,"maxLength":100}},"required":["entryCode","deviceId"]},"example":{"entryCode":"AP1E.eyJ2IjoxLCJjIjoiLi4uIn0.signature","deviceId":"d-5c1f9a2e7b3d"}}}},"responses":{"200":{"description":"Resumed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperSessionStarted"}}}},"201":{"description":"Started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperSessionStarted"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session":{"get":{"tags":["Shopper"],"summary":"The live basket and where checkout is","operationId":"getApiV1ShopperSession","security":[{"shopperSession":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperSession"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session/items":{"post":{"tags":["Shopper"],"summary":"Scan an item into the basket","description":"Price from the merchant's catalogue, never the phone.","operationId":"postApiV1ShopperSessionItems","security":[{"shopperSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"barcode":{"type":"string","minLength":1,"maxLength":100},"sku":{"type":"string","minLength":1,"maxLength":100},"quantity":{"default":1,"type":"integer","exclusiveMinimum":0,"maximum":99}}},"example":{"barcode":"6151100000011","quantity":1}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperItemAdded"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session/items/{itemId}":{"patch":{"tags":["Shopper"],"summary":"Change an item's quantity (0 removes it)","operationId":"patchApiV1ShopperSessionItemsByItemId","security":[{"shopperSession":[]}],"parameters":[{"name":"itemId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer","minimum":0,"maximum":99}},"required":["quantity"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperSession"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session/checkout":{"post":{"tags":["Shopper"],"summary":"Proceed to Pay: issue the TRX Ref and lock the basket","operationId":"postApiV1ShopperSessionCheckout","security":[{"shopperSession":[]}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperSession"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session/pay":{"post":{"tags":["Shopper"],"summary":"Pay by card, bank transfer or USSD","description":"The email is typed twice and must match; the receipt goes there. Paying twice returns the same payment.","operationId":"postApiV1ShopperSessionPay","security":[{"shopperSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"method":{"type":"string","enum":["card","bank_transfer","ussd"]},"email":{"type":"string","maxLength":200,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"emailConfirm":{"type":"string"}},"required":["method","email","emailConfirm"]},"example":{"method":"card","email":"ada@example.com","emailConfirm":"ada@example.com"}}}},"responses":{"200":{"description":"Already started: the same payment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperPayment"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShopperPayment"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session/test-payment":{"post":{"tags":["Shopper"],"summary":"Test only: settle the session's internal_test payment","description":"Not available in production.","operationId":"postApiV1ShopperSessionTestPayment","security":[{"shopperSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"outcome":{"type":"string","enum":["SUCCESSFUL","FAILED"]}},"required":["outcome"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session/exit-pass":{"post":{"tags":["Shopper"],"summary":"The exit QR, once paid","operationId":"postApiV1ShopperSessionExitPass","security":[{"shopperSession":[]}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExitPass"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/session/abandon":{"post":{"tags":["Shopper"],"summary":"Stop shopping without paying","operationId":"postApiV1ShopperSessionAbandon","security":[{"shopperSession":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"ABANDONED"}},"required":["status"],"additionalProperties":false}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/receipts/{transactionId}":{"get":{"tags":["Shopper"],"summary":"A digital receipt","description":"Opened by its signed link (from the email or the app), no login.","operationId":"getApiV1ShopperReceiptsByTransactionId","security":[],"parameters":[{"name":"transactionId","in":"path","required":true,"schema":{"type":"string"}},{"name":"key","in":"query","required":false,"schema":{"type":"string"},"description":"The receipt link's key"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Receipt"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/customers":{"post":{"tags":["Shopper"],"summary":"Optional sign-up","description":"Email twice and a password. Attaches the sessions whose tokens are sent. A confirmation email follows.","operationId":"postApiV1ShopperCustomers","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tenant":{"type":"string","minLength":1,"maxLength":100},"password":{"type":"string","minLength":10,"maxLength":200},"sessionTokens":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"email":{"type":"string","maxLength":200,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"emailConfirm":{"type":"string"}},"required":["tenant","password","email","emailConfirm"]},"example":{"tenant":"demo-retail","email":"ada@example.com","emailConfirm":"ada@example.com","password":"a-long-passphrase","sessionTokens":[]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/customers/verify-email":{"post":{"tags":["Shopper"],"summary":"Confirm a customer's email; returns their login","operationId":"postApiV1ShopperCustomersVerifyEmail","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1,"maxLength":200}},"required":["token"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}},"required":["token"],"additionalProperties":false}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/customers/login":{"post":{"tags":["Shopper"],"summary":"Customer login","operationId":"postApiV1ShopperCustomersLogin","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tenant":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"password":{"type":"string","minLength":1,"maxLength":200},"sessionTokens":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}}},"required":["tenant","email","password"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"sessionsClaimed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["token","sessionsClaimed"],"additionalProperties":false}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/me":{"get":{"tags":["Shopper"],"summary":"The signed-in customer","operationId":"getApiV1ShopperMe","security":[{"customerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"email":{"type":"string"}},"required":["id","email"],"additionalProperties":false}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/me/receipts":{"get":{"tags":["Shopper"],"summary":"Every receipt on the customer's account","operationId":"getApiV1ShopperMeReceipts","security":[{"customerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/shopper/me/claim":{"post":{"tags":["Shopper"],"summary":"Attach this phone's sessions to the account","operationId":"postApiV1ShopperMeClaim","security":[{"customerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sessionTokens":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"sessionsClaimed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["sessionsClaimed"],"additionalProperties":false}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/settlements":{"get":{"tags":["Settlement"],"summary":"Settlement batches","operationId":"getApiV1Settlements","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by status"},{"name":"merchantId","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by merchant"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Up to 200"},{"name":"offset","in":"query","required":false,"schema":{"type":"string"},"description":"For paging"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/settlements/banks":{"get":{"tags":["Settlement"],"summary":"Nigerian banks (for settlement accounts)","operationId":"getApiV1SettlementsBanks","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/settlements/{id}":{"get":{"tags":["Settlement"],"summary":"A settlement batch and its entries","operationId":"getApiV1SettlementsById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases":{"get":{"tags":["Cases"],"summary":"Cases, newest first","operationId":"getApiV1Cases","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by status"},{"name":"caseType","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by case type"},{"name":"merchantId","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by merchant"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Up to 200"},{"name":"offset","in":"query","required":false,"schema":{"type":"string"},"description":"For paging"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CaseSummary"}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Cases"],"summary":"Open a case","description":"Case types that make a change (store, branch, cashier, settlement account) are opened through their own merchant endpoints instead.","operationId":"postApiV1Cases","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"merchantId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"caseType":{"type":"string","minLength":2},"source":{"type":"string","enum":["merchant_portal","rm_portal","customer_service","compliance","aml","risk","fraud","treasury","operations","executive","system_generated"]},"priority":{"default":"NORMAL","type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"title":{"type":"string","minLength":3},"description":{"type":"string"}},"required":["caseType","source","title"]},"example":{"merchantId":"3c6a1f0e-9d2b-4f7a-8e5c-1b2d3e4f5a6b","caseType":"GENERAL_SUPPORT","source":"customer_service","priority":"NORMAL","title":"POS terminal offline since morning"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseSummary"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/search":{"get":{"tags":["Cases"],"summary":"Search by ticket number, title or merchant name","operationId":"getApiV1CasesSearch","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Text to find"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by status"},{"name":"caseType","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by case type"},{"name":"merchantId","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by merchant"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CaseSummary"}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{ticketId}":{"get":{"tags":["Cases"],"summary":"A case, as the caller's role may see it","description":"One aggregate endpoint: comments, documents and tasks are filtered by the caller's audience (§8).","operationId":"getApiV1CasesByTicketId","parameters":[{"name":"ticketId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}":{"patch":{"tags":["Cases"],"summary":"Change title, description or priority","description":"A priority change re-times the SLA timers.","operationId":"patchApiV1CasesById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":200},"description":{"type":"string","maxLength":5000},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseSummary"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/assign":{"post":{"tags":["Cases"],"summary":"Assign to an owner and department","operationId":"postApiV1CasesByIdAssign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ownerId":{"type":"string","minLength":1},"department":{"type":"string","minLength":2},"reason":{"type":"string"}},"required":["ownerId","department"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/transition":{"post":{"tags":["Cases"],"summary":"Move the case to another stage","description":"Guarded by the case graph and the case type's template. APPROVED and IMPLEMENTED come only from the approval chain. A merchant may only respond (AWAITING_MERCHANT -> MERCHANT_RESPONDED).","operationId":"postApiV1CasesByIdTransition","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","minLength":2},"reason":{"type":"string"}},"required":["to"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/approve":{"post":{"tags":["Cases"],"summary":"Decide the open approval for your role","operationId":"postApiV1CasesByIdApprove","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["APPROVED","REJECTED"]},"reason":{"type":"string","minLength":3}},"required":["decision","reason"]},"example":{"decision":"APPROVED","reason":"Account name matches the CAC certificate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/tasks":{"post":{"tags":["Cases"],"summary":"Add a task","operationId":"postApiV1CasesByIdTasks","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"taskType":{"type":"string","enum":["REVIEW","APPROVAL","DOCUMENT_REQUEST","VERIFICATION","GENERIC"]},"title":{"type":"string","minLength":3},"description":{"type":"string"},"assignedDepartment":{"type":"string","minLength":2},"assignedTo":{"type":"string"},"slaHours":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]}},"required":["taskType","title","assignedDepartment"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/tasks/{taskId}/status":{"post":{"tags":["Cases"],"summary":"Update a task's status","operationId":"postApiV1CasesByIdTasksByTaskIdStatus","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"taskId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["IN_PROGRESS","BLOCKED","COMPLETED","CANCELLED"]},"reason":{"type":"string"}},"required":["status"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/tasks/{taskId}/decision":{"post":{"tags":["Cases"],"summary":"Decide an approval task","description":"Only the task's department, never whoever filed the case. A rejection closes the case.","operationId":"postApiV1CasesByIdTasksByTaskIdDecision","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"taskId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["APPROVED","REJECTED"]},"reason":{"type":"string","minLength":3}},"required":["decision","reason"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/escalate":{"post":{"tags":["Cases"],"summary":"Escalate one level","operationId":"postApiV1CasesByIdEscalate","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/comments":{"post":{"tags":["Cases"],"summary":"Comment","operationId":"postApiV1CasesByIdComments","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"taskId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"body":{"type":"string","minLength":1},"visibleToMerchant":{"default":false,"type":"boolean"},"mentions":{"default":[],"type":"array","items":{"type":"string"}}},"required":["body"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/documents/upload-url":{"post":{"tags":["Cases"],"summary":"A signed URL to upload a case attachment","operationId":"postApiV1CasesByIdDocumentsUploadUrl","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentType":{"type":"string","minLength":2},"fileName":{"type":"string","minLength":1},"contentType":{"type":"string"}},"required":["documentType","fileName"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignedUpload"}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/documents":{"post":{"tags":["Cases"],"summary":"Record an uploaded attachment","operationId":"postApiV1CasesByIdDocuments","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"taskId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"documentType":{"type":"string","minLength":2},"fileName":{"type":"string","minLength":1},"storageRef":{"type":"string","minLength":1},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"visibleToMerchant":{"default":false,"type":"boolean"}},"required":["documentType","fileName","storageRef"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/attachments":{"post":{"tags":["Cases"],"summary":"Record an uploaded attachment (same as /documents)","operationId":"postApiV1CasesByIdAttachments","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"taskId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"documentType":{"type":"string","minLength":2},"fileName":{"type":"string","minLength":1},"storageRef":{"type":"string","minLength":1},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"},"visibleToMerchant":{"default":false,"type":"boolean"}},"required":["documentType","fileName","storageRef"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/{id}/documents/{documentId}/download-url":{"get":{"tags":["Cases"],"summary":"A short-lived download link for an attachment","operationId":"getApiV1CasesByIdDocumentsByDocumentIdDownloadUrl","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/reports/executive":{"get":{"tags":["Reporting"],"summary":"Executive Dashboard (§24)","description":"Revenue, Express Checkout adoption, queue reduction, settlement health, fraud trend, compliance health, merchant health, store comparison, SLA performance and platform health for a period. ?merchantId= drills down to one merchant. Executives, operations, regulators and auditors only.","operationId":"getApiV1ReportsExecutive","parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string"},"description":"Start (ISO date); default 30 days before to"},{"name":"to","in":"query","required":false,"schema":{"type":"string"},"description":"End (ISO date); default now"},{"name":"merchantId","in":"query","required":false,"schema":{"type":"string"},"description":"Drill down to one merchant"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/analytics/overview":{"get":{"tags":["Reporting"],"summary":"MCM reporting: volume, SLA, resolution time, productivity","operationId":"getApiV1CasesAnalyticsOverview","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/cases/analytics/merchant/{merchantId}":{"get":{"tags":["Reporting"],"summary":"MCM reporting: one merchant's case history","operationId":"getApiV1CasesAnalyticsMerchantByMerchantId","parameters":[{"name":"merchantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/operations/live-transactions":{"get":{"tags":["Operations"],"summary":"Latest transactions across the tenant","operationId":"getApiV1OperationsLiveTransactions","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by transaction status"},{"name":"limit","in":"query","required":false,"schema":{"type":"string"},"description":"Up to 200 (default 50)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/operations/provider-health":{"get":{"tags":["Operations"],"summary":"Each payment provider's recent success, failures and stuck payments","operationId":"getApiV1OperationsProviderHealth","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"string"},"description":"Look-back window, 1 to 720 (default 24)"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/operations/incidents":{"get":{"tags":["Operations"],"summary":"Open problems that need a person, most severe first","operationId":"getApiV1OperationsIncidents","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/operations/reconciliation":{"get":{"tags":["Operations"],"summary":"Ledger retries, unposted payments, stale settlements, payments on dead TRX Refs","operationId":"getApiV1OperationsReconciliation","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/compliance/merchant-readiness":{"get":{"tags":["Compliance"],"summary":"Every merchant's onboarding checklist","description":"Required documents are the tenant's tenant_settings.requiredMerchantDocuments, or a default set.","operationId":"getApiV1ComplianceMerchantReadiness","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/notifications":{"get":{"tags":["Notifications"],"summary":"Your notifications","operationId":"getApiV1Notifications","parameters":[{"name":"unread","in":"query","required":false,"schema":{"type":"string"},"description":"true for unread only"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/notifications/{id}/read":{"post":{"tags":["Notifications"],"summary":"Mark one read","operationId":"postApiV1NotificationsByIdRead","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/work-inbox":{"get":{"tags":["Work Inbox"],"summary":"Your operational workload (§12)","operationId":"getApiV1WorkInbox","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/actors":{"post":{"tags":["Admin"],"summary":"Provision an actor for an existing identity","operationId":"postApiV1AdminActors","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"vaultrixSubjectId":{"type":"string","minLength":1},"actorType":{"type":"string","enum":["merchant_user","cashier","security_officer","relationship_manager","customer_service_officer","compliance_officer","aml_officer","risk_officer","treasury_officer","executive","alignment_operations","external_auditor","regulator","payment_provider"]},"displayName":{"type":"string"}},"required":["vaultrixSubjectId","actorType"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Admin"],"summary":"Actors and their scopes","operationId":"getApiV1AdminActors","parameters":[{"name":"actorType","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by actor type"},{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by tenant"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/actors/{id}":{"get":{"tags":["Admin"],"summary":"An actor and its scopes","operationId":"getApiV1AdminActorsById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/actors/{id}/scopes":{"post":{"tags":["Admin"],"summary":"Grant a scope (never broader than your own)","operationId":"postApiV1AdminActorsByIdScopes","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scopeType":{"type":"string","enum":["TENANT","GLOBAL"]},"tenantId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"role":{"type":"string","minLength":2},"accessLevel":{"default":"READ_WRITE","type":"string","enum":["READ_WRITE","READ_ONLY"]}},"required":["scopeType","role"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/actors/{id}/scopes/{scopeId}":{"delete":{"tags":["Admin"],"summary":"Revoke a scope (kept in history)","operationId":"deleteApiV1AdminActorsByIdScopesByScopeId","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"scopeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/users":{"post":{"tags":["Admin"],"summary":"Create a staff user (emailed a temporary password)","operationId":"postApiV1AdminUsers","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"actorType":{"type":"string","enum":["merchant_user","cashier","security_officer","relationship_manager","customer_service_officer","compliance_officer","aml_officer","risk_officer","treasury_officer","executive","alignment_operations","external_auditor","regulator","payment_provider"]},"scopeType":{"type":"string","enum":["TENANT","GLOBAL"]},"tenantId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"accessLevel":{"default":"READ_WRITE","type":"string","enum":["READ_WRITE","READ_ONLY"]},"displayName":{"type":"string"}},"required":["email","actorType","scopeType"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/tenant-keys":{"post":{"tags":["Admin"],"summary":"Store a tenant's provider key (encrypted)","operationId":"postApiV1AdminTenantKeys","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","minLength":2},"keyType":{"type":"string","minLength":2},"keyValue":{"type":"string","minLength":1},"tenantId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"}},"required":["provider","keyType","keyValue"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"tags":["Admin"],"summary":"A tenant's keys (never the key itself)","operationId":"getApiV1AdminTenantKeys","parameters":[{"name":"tenantId","in":"query","required":false,"schema":{"type":"string"},"description":"GLOBAL admins: which tenant"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}}}},"400":{"description":"Invalid request (validation_error, tenant_selection_required, ...)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/tenant-keys/{id}":{"delete":{"tags":["Admin"],"summary":"Revoke a key","operationId":"deleteApiV1AdminTenantKeysById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/admin/settlement-batches/{id}/execute":{"post":{"tags":["Admin"],"summary":"Pay out a settlement batch now","operationId":"postApiV1AdminSettlementBatchesByIdExecute","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/webhooks/paystack/{tenantId}":{"post":{"tags":["Webhooks"],"summary":"Paystack events for one tenant","description":"Configure this URL, with your tenant id, as the webhook URL in that tenant's Paystack dashboard. See the Webhooks guide.","operationId":"postApiV1WebhooksPaystackByTenantId","security":[{"paystackSignature":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Always 200 once the signature is valid, so Paystack doesn't retry what a retry can't fix","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"Missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not allowed for this actor, scope or tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not yours to see","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected failure; quote X-Request-Id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string","description":"A stable code; see the error catalogue at /docs/errors"},"message":{"type":"string"},"details":{}},"required":["error"],"additionalProperties":{}},"Health":{"type":"object","properties":{"status":{"type":"string","const":"ok"},"service":{"type":"string"}},"required":["status","service"],"additionalProperties":false},"PendingApproval":{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"ticketId":{"type":"string"},"case":{"$ref":"#/components/schemas/CaseSummary"}},"required":["status","ticketId","case"],"additionalProperties":{},"description":"The change was proposed as a case and happens only once its approval chain approves it."},"CaseSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"ticket_id":{"type":"string","description":"TKT-YYYY-NNNNNNNNN, immutable and searchable"},"merchant_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"case_type":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"title":{"type":"string"},"created_at":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","ticket_id","merchant_id","case_type","status","priority","title","created_at"],"additionalProperties":{}},"Branch":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"merchant_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"store_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"name":{"type":"string"},"address":{"type":["string","null"]},"status":{"type":"string"},"store_name":{"type":"string"}},"required":["id","merchant_id","store_id","name","address","status"],"additionalProperties":{}},"EntryCode":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"storeId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"store":{"type":"string"},"branchId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"branch":{"type":["string","null"]},"label":{"type":["string","null"]},"status":{"type":"string","enum":["ACTIVE","REVOKED"]},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"revokedAt":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp"},{"type":"null"}]},"code":{"description":"The signed entrance code (active codes only)","type":"string"},"url":{"description":"Encode this URL as the entrance QR","type":"string"}},"required":["id","storeId","store","branchId","branch","label","status","createdAt","revokedAt"],"additionalProperties":false},"CatalogueItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"merchant_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"sku":{"type":"string"},"barcode":{"type":["string","null"]},"description":{"type":"string"},"unit_price_minor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string","pattern":"^-?\\d+$"}],"description":"Amount in minor units (kobo). An integer, or an integer string where read from the database."},"currency":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE"]}},"required":["id","merchant_id","sku","barcode","description","unit_price_minor","currency","status"],"additionalProperties":{}},"SignedUpload":{"type":"object","properties":{"uploadUrl":{"type":"string"},"storageRef":{"type":"string"},"expiresInSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["uploadUrl","storageRef","expiresInSeconds"],"additionalProperties":false,"description":"PUT the file to uploadUrl with the same Content-Type (and size), then record it with storageRef."},"MerchantDocumentUploaded":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"documentType":{"type":"string"},"label":{"type":"string"},"currentVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"version":{"$ref":"#/components/schemas/DocumentVersion"}},"required":["id","documentType","label","currentVersion","version"],"additionalProperties":false},"DocumentVersion":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"fileName":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"expiresAt":{"type":["string","null"]},"expired":{"type":"boolean"},"uploadedBy":{"type":"string"},"uploadedAt":{"type":"string","description":"ISO 8601 timestamp"},"verificationStatus":{"type":"string","enum":["PENDING","VERIFIED","REJECTED"]},"verifiedBy":{"type":["string","null"]},"verifiedAt":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp"},{"type":"null"}]},"verificationNote":{"type":["string","null"]}},"required":["id","version","fileName","contentType","sizeBytes","expiresAt","expired","uploadedBy","uploadedAt","verificationStatus","verifiedBy","verifiedAt","verificationNote"],"additionalProperties":false},"MerchantDocumentListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"documentType":{"type":"string"},"label":{"type":"string"},"currentVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"current":{"$ref":"#/components/schemas/DocumentVersion"}},"required":["id","documentType","label","currentVersion","current"],"additionalProperties":false},"MerchantDocument":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"documentType":{"type":"string"},"label":{"type":"string"},"currentVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"versions":{"type":"array","items":{"$ref":"#/components/schemas/DocumentVersion"}}},"required":["id","documentType","label","currentVersion","versions"],"additionalProperties":false},"SignedLink":{"type":"object","properties":{"url":{"type":"string"},"expiresInSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["url","expiresInSeconds"],"additionalProperties":false},"Basket":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"tenant_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"store_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"branch_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},{"type":"null"}]},"status":{"type":"string","enum":["OPEN","LOCKED","ABANDONED","CONVERTED"]},"currency":{"type":"string"},"subtotal_minor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string","pattern":"^-?\\d+$"}],"description":"Amount in minor units (kobo). An integer, or an integer string where read from the database."},"tax_minor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string","pattern":"^-?\\d+$"}],"description":"Amount in minor units (kobo). An integer, or an integer string where read from the database."},"total_minor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string","pattern":"^-?\\d+$"}],"description":"Amount in minor units (kobo). An integer, or an integer string where read from the database."},"created_at":{"type":"string","description":"ISO 8601 timestamp"},"updated_at":{"type":"string","description":"ISO 8601 timestamp"},"items":{"type":"array","items":{"$ref":"#/components/schemas/BasketItem"}}},"required":["id","tenant_id","store_id","branch_id","status","currency","subtotal_minor","tax_minor","total_minor","created_at","updated_at"],"additionalProperties":{}},"BasketItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"basket_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"sku":{"type":"string"},"description":{"type":"string"},"unit_price_minor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string","pattern":"^-?\\d+$"}],"description":"Amount in minor units (kobo). An integer, or an integer string where read from the database."},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"line_total_minor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string","pattern":"^-?\\d+$"}],"description":"Amount in minor units (kobo). An integer, or an integer string where read from the database."}},"required":["id","basket_id","sku","description","unit_price_minor","quantity","line_total_minor"],"additionalProperties":{}},"BasketItemAdded":{"type":"object","properties":{"item":{"$ref":"#/components/schemas/BasketItem"},"subtotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["item","subtotalMinor","totalMinor"],"additionalProperties":false},"Transaction":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"tenant_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"trx_ref":{"type":"string","description":"AP-YYYYMMDD-XXXXXXXXXX, immutable"},"basket_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"merchant_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"status":{"$ref":"#/components/schemas/TransactionStatus"},"manifest":{"$ref":"#/components/schemas/BasketManifest"},"expires_at":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 timestamp"},"updated_at":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","tenant_id","trx_ref","basket_id","merchant_id","status","manifest","expires_at","created_at","updated_at"],"additionalProperties":{}},"TransactionStatus":{"type":"string","enum":["CREATED","READY_FOR_PAYMENT","PAYMENT_INITIATED","PAYMENT_PROCESSING","SUCCESSFUL","EXIT_VERIFIED","CLOSED","FAILED","CANCELLED","EXPIRED","REVERSED"]},"BasketManifest":{"type":"object","properties":{"basketId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"currency":{"type":"string"},"subtotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"taxMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"items":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"description":{"type":"string"},"unitPriceMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lineTotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["sku","description","unitPriceMinor","quantity","lineTotalMinor"],"additionalProperties":false}}},"required":["basketId","currency","subtotalMinor","taxMinor","totalMinor","items"],"additionalProperties":false,"description":"The basket as frozen when its TRX Ref was issued. Never changes."},"Payment":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"tenant_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"transaction_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"idempotency_key":{"type":"string"},"provider":{"type":"string"},"provider_ref":{"type":["string","null"]},"method":{"type":"string"},"amount_minor":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"string","pattern":"^-?\\d+$"}],"description":"Amount in minor units (kobo). An integer, or an integer string where read from the database."},"currency":{"type":"string"},"status":{"type":"string"},"authorizationUrl":{"description":"Paystack only: send the customer here to pay","type":"string"}},"required":["id","tenant_id","transaction_id","idempotency_key","provider","provider_ref","method","amount_minor","currency","status"],"additionalProperties":{}},"ExitPass":{"type":"object","properties":{"passId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"qr":{"type":"string","description":"Encode this as the QR the customer shows at the exit. Signed; any edit makes it invalid."},"trxRef":{"type":"string"},"itemCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"expiresAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["passId","qr","trxRef","itemCount","expiresAt"],"additionalProperties":false},"ExitScan":{"type":"object","properties":{"result":{"$ref":"#/components/schemas/ExitResult"},"reason":{"description":"Why, when the result is not PAID: invalid_qr, wrong_branch, wrong_merchant, replaced_by_newer_pass, manifest_mismatch, audit_failed, transaction_<status>","type":["string","null"]},"verificationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"receipt":{"$ref":"#/components/schemas/ExitReceipt"}},"required":["result","reason","verificationId"],"additionalProperties":false},"ExitResult":{"type":"string","enum":["PAID","NOT_PAID","EXPIRED","ALREADY_EXITED","RANDOM_AUDIT_REQUIRED"]},"ExitReceipt":{"type":"object","properties":{"trxRef":{"type":"string"},"itemCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"currency":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["sku","description","quantity"],"additionalProperties":false}}},"required":["trxRef","itemCount","totalMinor","currency","items"],"additionalProperties":false,"description":"What was paid for, to compare with the bag. Only shown to the merchant's own staff."},"ExitAuditOutcome":{"type":"object","properties":{"result":{"$ref":"#/components/schemas/ExitResult"},"verificationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"auditStatus":{"type":"string","enum":["PASSED","FAILED"]},"receipt":{"$ref":"#/components/schemas/ExitReceipt"}},"required":["result","verificationId","auditStatus"],"additionalProperties":false},"EntryPreview":{"type":"object","properties":{"store":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"name":{"type":"string"},"merchant":{"type":"string"},"branch":{"type":["string","null"]}},"required":["id","name","merchant","branch"],"additionalProperties":false},"tenant":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"}},"required":["slug","name"],"additionalProperties":false},"canStart":{"type":"boolean"},"reason":{"type":["string","null"]}},"required":["store","tenant","canStart","reason"],"additionalProperties":false},"ShopperSessionStarted":{"allOf":[{"$ref":"#/components/schemas/ShopperSession"},{"type":"object","properties":{"token":{"type":"string","description":"Send as Authorization: Bearer for the session's calls"},"resumed":{"type":"boolean"}},"required":["token","resumed"],"additionalProperties":false}]},"ShopperSession":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"status":{"type":"string","enum":["ACTIVE","COMPLETED","ABANDONED"]},"startedAt":{"type":"string","description":"ISO 8601 timestamp"},"expiresAt":{"type":"string","description":"ISO 8601 timestamp"},"receiptEmail":{"type":["string","null"]},"signedIn":{"type":"boolean"},"emailReceipts":{"type":"boolean","description":"Whether this shop emails the receipt"}},"required":["id","status","startedAt","expiresAt","receiptEmail","signedIn","emailReceipts"],"additionalProperties":false},"store":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"name":{"type":"string"},"merchant":{"type":"string"},"branch":{"type":["string","null"]}},"required":["id","name","merchant","branch"],"additionalProperties":false},"basket":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"status":{"type":"string","enum":["OPEN","LOCKED","ABANDONED","CONVERTED"]},"currency":{"type":"string"},"subtotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"taxMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"itemCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"sku":{"type":"string"},"description":{"type":"string"},"unitPriceMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lineTotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","sku","description","unitPriceMinor","quantity","lineTotalMinor"],"additionalProperties":false}}},"required":["id","status","currency","subtotalMinor","taxMinor","totalMinor","itemCount","items"],"additionalProperties":false},"transaction":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"trxRef":{"type":"string"},"status":{"type":"string"},"expiresAt":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp"},{"type":"null"}]},"totalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"payment":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"status":{"type":"string"},"method":{"type":"string"},"provider":{"type":"string"}},"required":["id","status","method","provider"],"additionalProperties":false},{"type":"null"}]},"receipt":{"anyOf":[{"type":"object","properties":{"transactionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"key":{"type":"string"},"url":{"type":"string","description":"The receipt page in the customer app; also sent by email"}},"required":["transactionId","key","url"],"additionalProperties":false},{"type":"null"}]}},"required":["id","trxRef","status","expiresAt","totalMinor","payment","receipt"],"additionalProperties":false},{"type":"null"}]}},"required":["session","store","basket","transaction"],"additionalProperties":false},"ShopperItemAdded":{"allOf":[{"$ref":"#/components/schemas/ShopperSession"},{"type":"object","properties":{"added":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"sku":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lineTotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","sku","description","quantity","lineTotalMinor"],"additionalProperties":false}},"required":["added"],"additionalProperties":false}]},"ShopperPayment":{"type":"object","properties":{"payment":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"status":{"type":"string"},"method":{"type":"string"},"provider":{"type":"string"}},"required":["id","status","method","provider"],"additionalProperties":false},"authorizationUrl":{"description":"Paystack's checkout page, to send the customer to; null for the test provider","type":["string","null"]}},"required":["payment","authorizationUrl"],"additionalProperties":false},"Receipt":{"type":"object","properties":{"transactionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},"trxRef":{"type":"string"},"status":{"type":"string"},"paidAt":{"anyOf":[{"type":"string","description":"ISO 8601 timestamp"},{"type":"null"}]},"merchant":{"type":"string"},"store":{"type":"string"},"branch":{"type":["string","null"]},"address":{"type":["string","null"]},"currency":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"description":{"type":"string"},"unitPriceMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"quantity":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lineTotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["sku","description","unitPriceMinor","quantity","lineTotalMinor"],"additionalProperties":false}},"subtotalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"taxMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalMinor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"payment":{"type":"object","properties":{"method":{"type":["string","null"]},"provider":{"type":["string","null"]},"status":{"type":["string","null"]}},"required":["method","provider","status"],"additionalProperties":false},"exited":{"type":"boolean"}},"required":["transactionId","trxRef","status","paidAt","merchant","store","branch","address","currency","items","subtotalMinor","taxMinor","totalMinor","payment","exited"],"additionalProperties":false}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"From POST /api/v1/auth/login"},"shopperSession":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"A shopping session's token, from POST /api/v1/shopper/sessions. Reaches only that session's own basket."},"customerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"An optional customer account's token, from POST /api/v1/shopper/customers/login"},"paystackSignature":{"type":"apiKey","in":"header","name":"x-paystack-signature","description":"HMAC-SHA512 of the raw body under the tenant's Paystack secret key"}}}}