{"openapi":"3.1.0","info":{"title":"Benji Pays Merchant API","description":"The Benji Pays Merchant API is a JSON over HTTPS API. All endpoints live under `/v2`. Errors follow [RFC 7807](https://www.rfc-editor.org/rfc/rfc7807) and are served as `application/problem+json`.\n\nThis overview describes the cross-cutting behavior shared by every merchant endpoint. Endpoint-specific schemas live with each operation.\n\n## Authentication\n\nMerchant endpoints authenticate with an organization-scoped `x-api-key` header issued from the merchant app:\n\n```\nx-api-key: <api-key>\n```\n\nThe key is scoped to one organization and inherits the permissions of the login that created it.\n\nFailures return `401 Unauthorized` (missing/expired/invalid credentials) or `403 Forbidden` (insufficient mapping permission or organization lifecycle restrictions).\n\n## Request and Correlation IDs\n\nTwo header pairs help with tracing:\n\n| Header | Direction | Purpose |\n| --- | --- | --- |\n| `X-Request-ID` | request (optional) / response (always) | Unique identifier for one request. Generated as a UUID v4 when the client omits it. |\n| `X-Correlation-ID` | request (optional) / response (always) | Identifier that flows across service boundaries for distributed tracing. Generated as a UUID v4 when omitted. |\n\nBoth IDs are echoed on success and included as `requestId` / `correlationId` extensions on `application/problem+json` error responses.\n\nThese headers are auto-injected on every operation in this spec — do not redeclare them per route.\n\n## Idempotency\n\nPOST, PATCH, and PUT endpoints accept an `Idempotency-Key` header to make retries safe.\n\n- Format: 1–255 characters, alphanumeric only (`[a-zA-Z0-9]+`).\n- Scope: keys are scoped per actor (no cross-tenant collisions).\n- Cache: the first response for a given key is cached for 24 hours.\n- Replay: a duplicate request with the same key and the same body returns the cached response with `X-Idempotency-Replayed: true` only after credentials were resolved by the global authenticate middleware (API key or Auth0 JWT signature check) before the idempotency cache lookup.\n- Conflict: same key with a different body returns `409 Conflict`.\n- In-flight: a second request with the same key while the first is still being processed returns `429 Too Many Requests` with `Retry-After` and problem `type` `https://api.benjipays.com/problems/idempotency-processing` (distinct from rate-limit `…/rate-limit-exceeded`).\n\n`Idempotency-Key` is auto-injected on every POST/PATCH/PUT operation in this spec — do not redeclare it per route. Routes that intentionally opt out set `x-bp-skip-idempotency: true`.\n\nThe middleware fails open: if the cache layer is unavailable the request proceeds without idempotency protection.\n\nMost write routes treat the header as optional. Routes that require it set `x-bp-require-idempotency: true` and return `400 Bad Request` when it is missing — currently `POST /v2/transactions`, `POST /v2/transactions/deposits`, and `POST /v2/transactions/{transactionId}/retry-accounting`. Those routes are also the exception to the fail-open rule above: when the cache layer is unavailable they return `503 Service Unavailable` with `Retry-After` and problem `type` `https://api.benjipays.com/problems/idempotency-unavailable`, and the request is not processed. Retry with the same key.\n\nThe two charge routes (`POST /v2/transactions` and `POST /v2/transactions/deposits`) also save the key on the charge. Recover a charge with `GET /v2/transactions?idempotencyKey={key}` (empty `data` when the key was never used). After the 24-hour replay window, the same key creates a new charge.\n\n## Pagination\n\nList endpoints use offset-based pagination with two query parameters:\n\n| Parameter | Type | Default | Bounds |\n| --- | --- | --- | --- |\n| `limit` | integer | `20` | `1`–`1000` |\n| `offset` | integer | `0` | `≥ 0` |\n\nSome endpoints use different bounds (for example usage/billing and autoprocessing forecast). Check the per-operation schema.\n\nResponses follow this envelope:\n\n```json\n{\n  \"data\": [ /* items */ ],\n  \"pagination\": {\n    \"limit\": 20,\n    \"offset\": 0,\n    \"hasMore\": true,\n    \"nextOffset\": 20,\n    \"prevOffset\": null\n  }\n}\n```\n\nMany list endpoints also include `pagination.total` (count of matching items across all pages). Per-operation response schemas are authoritative.\n\nUse `hasMore` to decide whether to fetch another page and `nextOffset` for the next request rather than computing it on the client.\n\n## Dates and Times\n\nAll **response** timestamps are ISO-8601 strings in UTC (for example `2024-01-01T12:00:00.000Z`).\n\nDate-range **query** parameters support two input modes where the endpoint accepts them:\n\n| Input format | Interpretation |\n| --- | --- |\n| `YYYY-MM-DD` (calendar day) | Full day in **UTC**. Start = `00:00:00.000Z`, end = `23:59:59.999Z` on that date. Same start and end day returns the full UTC day. |\n| ISO-8601 UTC timestamp (e.g. `2024-07-02T07:00:00.000Z`) | Exact UTC bounds — for precise or reconciliation queries. |\n\nSome endpoints accept only one mode or a different shape (for example invoice `invoiceDateStart` / `dueDateStart` are calendar-day fields compared as dates; usage/billing use month rules). Timestamp range filters such as transactions `startDate`/`endDate` and emails `sentStart`/`sentEnd` support both modes above; each bound is optional. Check each parameter's OpenAPI description.\n\n## Rate Limits\n\nRate limits are sliding-window and run before authentication. A well-formed `x-api-key` (format peek) or a JWT with a decodable actor claim uses the authenticated limit; otherwise the IP limit applies:\n\n| Caller | Limit |\n| --- | --- |\n| Authenticated actor (distributor / partner / organization), or peek of well-formed `x-api-key` / JWT actor claim | 5 requests / second |\n| Unauthenticated (per IP) | 1 request / second |\n\nExcluded paths: `/healthz`, `/readiness`, and `/docs/*`.\n\nEvery response carries the current usage:\n\n| Header | Meaning |\n| --- | --- |\n| `X-RateLimit-Limit` | Maximum requests allowed in the window. |\n| `X-RateLimit-Remaining` | Requests remaining in the current window. |\n| `X-RateLimit-Reset` | Unix timestamp (seconds) when the window resets. |\n\nOn `429 Too Many Requests` the response also includes `Retry-After` (seconds to wait before retrying) and an RFC 7807 problem body.\n\n## Errors\n\nAll non-2xx responses use `application/problem+json` and follow RFC 7807:\n\n```json\n{\n  \"type\": \"https://api.benjipays.com/problems/<slug>\",\n  \"title\": \"<short title>\",\n  \"status\": 401,\n  \"detail\": \"<human-readable explanation>\",\n  \"instance\": \"/v2/<path>\",\n  \"requestId\": \"…\",\n  \"correlationId\": \"…\"\n}\n```\n\nCommon statuses:\n\n| Status | When |\n| --- | --- |\n| `400 Bad Request` | Validation error (see `errors[]` extension when present). |\n| `401 Unauthorized` | Missing, invalid, or expired credentials. |\n| `403 Forbidden` | Wrong actor type, missing OAuth scope, or insufficient mapping permission. |\n| `404 Not Found` | Unknown route or tenant-scoped resource not visible to caller. |\n| `409 Conflict` | Idempotency-key body conflict, or domain conflict. |\n| `429 Too Many Requests` | Rate limit exceeded, or idempotency in-flight (with `Retry-After`). |\n| `500 Internal Server Error` | Unexpected failure. Safe to retry idempotent requests. |\n\n`requestId` and `correlationId` are included in the body whenever the middleware has set them, so a single value identifies the failure across logs and support tickets.\n","version":"2.0.0","contact":{"name":"Benji Pays API Support","email":"benji@benjipays.com"}},"servers":[{"url":"https://api.benjipays.com","description":"Development server"}],"tags":[{"name":"Whoami","description":"Authentication verification and testing endpoints"},{"name":"Gateways","description":"Payment gateway discovery for authenticated organizations"},{"name":"Invoices","description":"Accounting invoices for authenticated organizations"},{"name":"Customers","description":"Accounting customers for authenticated organizations"},{"name":"Accounting Accounts","description":"Live Xero chart accounts for deposit charges"},{"name":"Notes","description":"Merchant-internal customer notes, categories, and statuses for authenticated organizations"},{"name":"Payment Methods","description":"Saved payment methods (profiles) for authenticated organizations"},{"name":"Payment Links","description":"Unapplied (no-invoice) and applied (invoice-tied) payment links for authenticated organizations"},{"name":"Payment Method Requests","description":"Customer payment-method-on-file requests for authenticated organizations"},{"name":"Webhooks","description":"Webhook URL registrations for authenticated organizations"},{"name":"Transactions","description":"Payment transactions for authenticated organizations"},{"name":"Organization","description":"Profile (company details) for the authenticated organization"},{"name":"Users","description":"Login accounts for authenticated organizations"},{"name":"Emails","description":"Sent emails for authenticated organizations"},{"name":"Autoprocessing","description":"Auto-processing forecast for authenticated organizations"}],"security":[{"ApiKeyAuth":[]}],"x-speakeasy-retries":{"strategy":"backoff","backoff":{"initialInterval":500,"maxInterval":60000,"maxElapsedTime":3600000,"exponent":1.5},"statusCodes":["5XX"],"retryConnectionErrors":true},"paths":{"/v2/whoami":{"get":{"summary":"Get current actor information","description":"**Access:** Requires any authenticated actor (Auth0 JWT or organization API key)\n\nReturns authenticated actor details and permissions. Accepts either an Auth0 Bearer token or an organization-scoped `x-api-key`.","tags":["Whoami"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"includeDetails","schema":{"description":"When \"true\", includes additional diagnostic information","example":"false","type":"string","enum":["true","false"]},"description":"When \"true\", includes additional diagnostic information"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhoamiResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing authentication credentials","content":{"application/problem+json":{"schema":{"example":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/whoami"},"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too Many Requests - Rate limit exceeded","content":{"application/problem+json":{"schema":{"example":{"type":"https://api.benjipays.com/problems/rate-limit-exceeded","title":"Too Many Requests","status":429,"detail":"Rate limit exceeded. Please retry after the specified time.","instance":"/v2/whoami","retryAfterSeconds":1,"limit":5},"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v2/gateways":{"get":{"summary":"List payment gateways for an Organization","description":"Returns enabled payment gateways for the organization associated with the authenticated API key.","tags":["Gateways"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Successful response with enabled gateways","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOrganizationGatewaysResponse"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/gateways","type":"string"},"retryAfterSeconds":{"description":"Seconds to wait before retrying (present on 429 responses)","example":1,"type":"number"},"limit":{"description":"Rate limit that was exceeded (present on 429 responses)","example":5,"type":"number"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/gateways"}},"organizationNotActive":{"summary":"Organization API access is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/gateways"}}}}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:gateways:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/gateways","type":"string"},"retryAfterSeconds":{"description":"Seconds to wait before retrying (present on 429 responses)","example":1,"type":"number"},"limit":{"description":"Rate limit that was exceeded (present on 429 responses)","example":5,"type":"number"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:gateways:read","instance":"/v2/gateways"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/gateways"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/gateways"}}}}}}},"429":{"description":"Too Many Requests - Rate limit exceeded","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/gateways","type":"string"},"retryAfterSeconds":{"description":"Seconds to wait before retrying (present on 429 responses)","example":1,"type":"number"},"limit":{"description":"Rate limit that was exceeded (present on 429 responses)","example":5,"type":"number"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","example":{"type":"https://api.benjipays.com/problems/rate-limit-exceeded","title":"Too Many Requests","status":429,"detail":"Rate limit exceeded. Please retry after the specified time.","instance":"/v2/gateways","retryAfterSeconds":1,"limit":5}}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"}]}},"/v2/gateways/capabilities":{"get":{"summary":"List gateway capabilities for an Organization","description":"Returns gateway capabilities (`data`) and company default hashes by currency (`defaults`) for the organization.","tags":["Gateways"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"currency","schema":{"description":"3-letter ISO currency. Keep hashes (and defaults) that support this currency.","example":"USD","type":"string","maxLength":3,"pattern":"^[A-Za-z]{3}$"},"description":"3-letter ISO currency. Keep hashes (and defaults) that support this currency."},{"in":"query","name":"paymentType","schema":{"description":"Keep hashes that can collect this payment type.","example":"cc","type":"string","enum":["cc","ach","eft","sepa","bacs"]},"description":"Keep hashes that can collect this payment type."}],"responses":{"200":{"description":"Successful response with selectable gateway hashes and company defaults","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOrganizationGatewayCapabilitiesResponse"}}}},"400":{"description":"Bad Request — invalid `currency` or `paymentType` query","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/gateways","type":"string"},"retryAfterSeconds":{"description":"Seconds to wait before retrying (present on 429 responses)","example":1,"type":"number"},"limit":{"description":"Rate limit that was exceeded (present on 429 responses)","example":5,"type":"number"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"invalidCurrency":{"summary":"Invalid currency query","value":{"type":"https://api.benjipays.com/problems/validation-error","title":"Validation Error","status":400,"detail":"currency must be a 3-letter code","instance":"/v2/gateways/capabilities"}},"invalidPaymentType":{"summary":"Unknown paymentType query","value":{"type":"https://api.benjipays.com/problems/validation-error","title":"Validation Error","status":400,"detail":"Invalid enum value. Expected 'cc' | 'ach' | 'eft' | 'bacs' | 'sepa'","instance":"/v2/gateways/capabilities"}}}}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/gateways","type":"string"},"retryAfterSeconds":{"description":"Seconds to wait before retrying (present on 429 responses)","example":1,"type":"number"},"limit":{"description":"Rate limit that was exceeded (present on 429 responses)","example":5,"type":"number"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/gateways/capabilities"}},"organizationNotActive":{"summary":"Organization API access is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/gateways/capabilities"}}}}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:gateways:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/gateways","type":"string"},"retryAfterSeconds":{"description":"Seconds to wait before retrying (present on 429 responses)","example":1,"type":"number"},"limit":{"description":"Rate limit that was exceeded (present on 429 responses)","example":5,"type":"number"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:gateways:read","instance":"/v2/gateways/capabilities"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/gateways/capabilities"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/gateways/capabilities"}}}}}}},"429":{"description":"Too Many Requests - Rate limit exceeded","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/gateways","type":"string"},"retryAfterSeconds":{"description":"Seconds to wait before retrying (present on 429 responses)","example":1,"type":"number"},"limit":{"description":"Rate limit that was exceeded (present on 429 responses)","example":5,"type":"number"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","example":{"type":"https://api.benjipays.com/problems/rate-limit-exceeded","title":"Too Many Requests","status":429,"detail":"Rate limit exceeded. Please retry after the specified time.","instance":"/v2/gateways/capabilities","retryAfterSeconds":1,"limit":5}}}}}}}},"/v2/settings":{"get":{"summary":"Get settings for an Organization","description":"Returns the normalized settings for the organization associated with the authenticated API key.","tags":["Settings"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Successful response with organization settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationSettingsResponse"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or organization is not active.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/settings"}},"organizationNotActive":{"summary":"Organization is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/settings"}}}}}}},"403":{"description":"Forbidden — missing required scope (`organizations:settings:read`), insufficient mapping permission (`companyAdmin` required), or free trial ended without billing.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:settings:read","instance":"/v2/settings"}},"insufficientPermission":{"summary":"Insufficient mapping permission","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/settings"}}}}}}},"429":{"description":"Too Many Requests — rate limit exceeded.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"}]}},"/v2/organization":{"get":{"summary":"Get profile for an Organization","description":"Returns the normalized profile for the organization associated with the authenticated API key.","tags":["Organization"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Successful response with organization profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationProfileResponse"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or organization is not active.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/organization"}},"organizationNotActive":{"summary":"Organization is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/organization"}}}}}}},"403":{"description":"Forbidden — missing required scope (`organizations:profile:read`), insufficient mapping permission (`companyAdmin` required), or free trial ended without billing.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:profile:read","instance":"/v2/organization"}},"insufficientPermission":{"summary":"Insufficient mapping permission","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/organization"}}}}}}},"429":{"description":"Too Many Requests — rate limit exceeded.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"}]}},"/v2/users":{"get":{"summary":"List users for an Organization","description":"Returns a paginated list of login accounts for the organization associated with the authenticated API key, including MFA enabled status.","tags":["Users"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Successful response with organization users","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOrganizationUsersResponse"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or organization is not active.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/users"}},"organizationNotActive":{"summary":"Organization is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/users"}}}}}}},"403":{"description":"Forbidden — missing required scope (`organizations:users:read`), insufficient mapping permission (`companyAdmin` required), or free trial ended without billing.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:users:read","instance":"/v2/users"}},"insufficientPermission":{"summary":"Insufficient mapping permission","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/users"}},"freeTrialOver":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/users"}}}}}}},"429":{"description":"Too Many Requests — rate limit exceeded.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)"}}}}}}},"/v2/invoices":{"get":{"summary":"List invoices for an Organization","description":"Returns paginated Benji-controlled camelCase invoice summaries for the authenticated organization. Field names match filter/query params (`invoiceNumber`, `dueDate`, `customerId` → `customer.id`). List responses never include the stored invoice object — use GET /invoices/:invoiceId?include=accounting for that.","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"status","schema":{"description":"`open` returns every unpaid invoice regardless of due date (so it also includes invoices that are past due — their `status` field in the response may read `overdue`). `overdue` narrows that same set to unpaid invoices whose due date has passed. `paid` returns invoices with a zero balance.","type":"string","enum":["open","paid","overdue"]},"description":"`open` returns every unpaid invoice regardless of due date (so it also includes invoices that are past due — their `status` field in the response may read `overdue`). `overdue` narrows that same set to unpaid invoices whose due date has passed. `paid` returns invoices with a zero balance."},{"in":"query","name":"customerId","schema":{"description":"Filter to invoices for a single customer. Use the accounting system customer ID (QuickBooks `Id`, Xero `ContactID`, Business Central `id`, QBD `ListID`).","type":"string","maxLength":100},"description":"Filter to invoices for a single customer. Use the accounting system customer ID (QuickBooks `Id`, Xero `ContactID`, Business Central `id`, QBD `ListID`)."},{"in":"query","name":"invoiceDateStart","schema":{"description":"Start of invoice-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-02`). Compared as a calendar date string to stored `invoiceDate` / `TxnDate` (not expanded to UTC day bounds). Optional independently of `invoiceDateEnd`. Same start and end day is valid.","example":"2024-07-02","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":"Start of invoice-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-02`). Compared as a calendar date string to stored `invoiceDate` / `TxnDate` (not expanded to UTC day bounds). Optional independently of `invoiceDateEnd`. Same start and end day is valid."},{"in":"query","name":"invoiceDateEnd","schema":{"description":"End of invoice-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-31`). Compared as a calendar date string to stored `invoiceDate` / `TxnDate` (not expanded to UTC day bounds). Optional independently of `invoiceDateStart`. Same start and end day is valid.","example":"2024-07-31","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":"End of invoice-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-31`). Compared as a calendar date string to stored `invoiceDate` / `TxnDate` (not expanded to UTC day bounds). Optional independently of `invoiceDateStart`. Same start and end day is valid."},{"in":"query","name":"dueDateStart","schema":{"description":"Start of due-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-02`). Compared as a calendar date string to stored `dueDate` / `DueDate` (not expanded to UTC day bounds). Optional independently of `dueDateEnd`. Same start and end day is valid.","example":"2024-07-02","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":"Start of due-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-02`). Compared as a calendar date string to stored `dueDate` / `DueDate` (not expanded to UTC day bounds). Optional independently of `dueDateEnd`. Same start and end day is valid."},{"in":"query","name":"dueDateEnd","schema":{"description":"End of due-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-31`). Compared as a calendar date string to stored `dueDate` / `DueDate` (not expanded to UTC day bounds). Optional independently of `dueDateStart`. Same start and end day is valid.","example":"2024-07-31","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":"End of due-date range (inclusive). Format: `YYYY-MM-DD` (e.g. `2024-07-31`). Compared as a calendar date string to stored `dueDate` / `DueDate` (not expanded to UTC day bounds). Optional independently of `dueDateStart`. Same start and end day is valid."},{"in":"query","name":"totalMin","schema":{"type":"number","minimum":0}},{"in":"query","name":"totalMax","schema":{"type":"number","minimum":0}},{"in":"query","name":"balanceMin","schema":{"type":"number","minimum":0}},{"in":"query","name":"balanceMax","schema":{"type":"number","minimum":0}},{"in":"query","name":"invoiceNumber","schema":{"description":"Filter by invoice number (the human-readable invoice number from the accounting system, e.g. `INV-1001`).","type":"string","maxLength":50},"description":"Filter by invoice number (the human-readable invoice number from the accounting system, e.g. `INV-1001`)."},{"in":"query","name":"currency","schema":{"type":"string","pattern":"^[A-Z]{3}$"}},{"in":"query","name":"termsId","schema":{"description":"Filter by payment terms ID from the accounting system (e.g. QuickBooks `SalesTermRef.value`).","type":"string","maxLength":100},"description":"Filter by payment terms ID from the accounting system (e.g. QuickBooks `SalesTermRef.value`)."},{"in":"query","name":"emailed","schema":{"type":"string","enum":["true","false"]}},{"in":"query","name":"sort","schema":{"description":"Sort field (`dueDate`, `invoiceDate`, `invoiceNumber`, `total`, `balance`, `customerName`). `customerName` sorts by `customer.name`.","example":"dueDate","type":"string","enum":["dueDate","invoiceDate","invoiceNumber","total","balance","customerName"]},"description":"Sort field (`dueDate`, `invoiceDate`, `invoiceNumber`, `total`, `balance`, `customerName`). `customerName` sorts by `customer.name`."},{"in":"query","name":"order","schema":{"description":"Sort direction. Accepted values: `asc`, `desc`. Defaults to `desc` when omitted.","type":"string","enum":["asc","desc"]},"description":"Sort direction. Accepted values: `asc`, `desc`. Defaults to `desc` when omitted."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated invoice list (summary DTO only)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListInvoicesResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query/path parameters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/invoices"}},"organizationNotActive":{"summary":"Organization API access is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/invoices"}}}}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:invoices:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:invoices:read","instance":"/v2/invoices"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/invoices"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/invoices"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/invoices/{invoiceId}":{"get":{"summary":"Get a single invoice by accounting ID","description":"Returns the Benji summary DTO for an invoice by its accounting system ID (`id` on the invoice object). Pass `?include=accounting` to nest the full stored invoice under `data.accounting` (fields from the accounting system plus our own).","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"invoiceId","schema":{"type":"string","minLength":1,"maxLength":200,"description":"The accounting system invoice ID (e.g. the QuickBooks Id, Xero InvoiceID, or Business Central id). This is the value exposed as `id` on the invoice object.","example":"1042"},"required":true,"description":"The accounting system invoice ID (e.g. the QuickBooks Id, Xero InvoiceID, or Business Central id). This is the value exposed as `id` on the invoice object."},{"in":"query","name":"include","schema":{"description":"When `accounting`, nests the full stored invoice under `data.accounting` (fields from the accounting system plus our own). Only available on the detail route.","type":"string","enum":["accounting"]},"description":"When `accounting`, nests the full stored invoice under `data.accounting` (fields from the accounting system plus our own). Only available on the detail route."}],"responses":{"200":{"description":"Invoice detail (summary DTO; optional nested accounting)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInvoiceResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query/path parameters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/invoices"}},"organizationNotActive":{"summary":"Organization API access is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/invoices"}}}}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:invoices:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:invoices:read","instance":"/v2/invoices"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/invoices"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/invoices"}}}}}}},"404":{"description":"Invoice not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/invoices/{invoiceId}/pdf":{"get":{"summary":"Download an invoice PDF","description":"Returns the official invoice PDF from the organization accounting system (QBO / Xero / BC / integration priority). The caller downloads and attaches it — this endpoint does not email the PDF.","tags":["Invoices"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"invoiceId","schema":{"type":"string","minLength":1,"maxLength":200,"description":"The accounting system invoice ID (e.g. the QuickBooks Id, Xero InvoiceID, or Business Central id). This is the value exposed as `id` on the invoice object.","example":"1042"},"required":true,"description":"The accounting system invoice ID (e.g. the QuickBooks Id, Xero InvoiceID, or Business Central id). This is the value exposed as `id` on the invoice object."}],"responses":{"200":{"description":"Official invoice PDF. `Content-Disposition` is `attachment; filename=\"Invoice-{DocNumber}.pdf\"` (or the best available name).","content":{"application/pdf":{"schema":{"type":"string","description":"Raw official invoice PDF bytes from the organization accounting system (QBO / Xero / BC / integration priority).","format":"binary"}}}},"400":{"description":"Bad request — invalid/missing invoiceId, organization has no accounting integration configured, and/or the official invoice PDF cannot be retrieved.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"invalidToken":{"summary":"Invalid or missing authentication","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"Invalid or missing authentication token","instance":"/v2/invoices"}},"organizationNotActive":{"summary":"Organization API access is not active","value":{"type":"https://api.benjipays.com/problems/unauthorized","title":"Unauthorized","status":401,"detail":"API access is not active for this organization","instance":"/v2/invoices"}}}}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:invoices:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:invoices:read","instance":"/v2/invoices"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/invoices"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/invoices"}}}}}}},"404":{"description":"Invoice or organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/customers":{"get":{"summary":"List customers for an Organization","description":"Returns paginated Benji-controlled camelCase customer summaries for the organization associated with the authenticated API key. Mirrors the data set shown in the merchant-app customers table. List responses never include the stored customer object — use GET /customers/:customerId?include=accounting for that.","tags":["Customers"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"search","schema":{"description":"Free-text search across customer fields (name, email, etc.).","type":"string","maxLength":200},"description":"Free-text search across customer fields (name, email, etc.)."},{"in":"query","name":"includeDeleted","schema":{"description":"Include customers that have been soft-deleted in the accounting system. Defaults to `false` to match the merchant-app customers table.","type":"string","enum":["true","false"]},"description":"Include customers that have been soft-deleted in the accounting system. Defaults to `false` to match the merchant-app customers table."},{"in":"query","name":"sort","schema":{"description":"Field to sort by (uses the same field names returned in the response). Accepted values: `name` (default).","type":"string","maxLength":50},"description":"Field to sort by (uses the same field names returned in the response). Accepted values: `name` (default)."},{"in":"query","name":"order","schema":{"description":"Sort direction. Accepted values: `asc` (default), `desc`.","type":"string","enum":["asc","desc"]},"description":"Sort direction. Accepted values: `asc` (default), `desc`."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated customer list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCustomersResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query/path parameters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:customers:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:customers:read","instance":"/v2/customers"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/customers"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/customers"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/accounting-accounts":{"get":{"summary":"List Xero accounts for deposits","description":"Returns live Xero chart accounts for the organization on the API key. `purpose=prepayment` returns the revenue-account set. The `id` is the value accepted as `revenueAccountId` on the deposit charge. `purpose=overpayment` returns bank accounts only. The `id` is the value accepted as `bankAccountId` on the deposit charge. QuickBooks and Business Central return 400. These are not gateway deposit or refund accounts.","tags":["Accounting Accounts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"purpose","schema":{"type":"string","enum":["prepayment","overpayment"],"description":"Which deposit the account is for. `prepayment` returns Xero revenue accounts (the id accepted as `revenueAccountId`). `overpayment` returns Xero bank accounts only (the id accepted as `bankAccountId`)."},"required":true,"description":"Which deposit the account is for. `prepayment` returns Xero revenue accounts (the id accepted as `revenueAccountId`). `overpayment` returns Xero bank accounts only (the id accepted as `bankAccountId`)."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated Xero chart-account list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListAccountingAccountsResponse"}}}},"400":{"description":"Bad request — missing or unknown purpose, or the organization is not Xero.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing scope `organizations:accounting-accounts:read` or the API key owner is not `companyAdmin`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/customers/{customerId}":{"get":{"summary":"Get a single customer by accounting ID","description":"Returns the Benji summary DTO for a customer by its accounting system ID (`id` on the customer object). Pass `?include=accounting` to nest the full stored customer under `data.accounting` (fields from the accounting system plus our own).","tags":["Customers"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200,"description":"The accounting system customer ID (e.g. the QuickBooks Id, Xero ContactID, Business Central id, or QBD ListID). This is the value exposed as `id` on the customer object.","example":"42"},"required":true,"description":"The accounting system customer ID (e.g. the QuickBooks Id, Xero ContactID, Business Central id, or QBD ListID). This is the value exposed as `id` on the customer object."},{"in":"query","name":"include","schema":{"description":"When `accounting`, nests the full stored customer under `data.accounting` (fields from the accounting system plus our own). Only available on the detail route.","type":"string","enum":["accounting"]},"description":"When `accounting`, nests the full stored customer under `data.accounting` (fields from the accounting system plus our own). Only available on the detail route."}],"responses":{"200":{"description":"Customer detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCustomerResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query/path parameters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:customers:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:customers:read","instance":"/v2/customers"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/customers"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/customers"}}}}}}},"404":{"description":"Customer not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}},"patch":{"summary":"Update a customer's settings","description":"Updates the settings of a customer by its accounting system ID (`id` on the customer object). Accepts only the settings defined in the request schema, using the same field names and nesting that GET returns. Every field is optional and only the fields sent are changed; nested objects are merged, not replaced. An empty body, an empty nested object, or an unknown field is rejected.\n\nSome settings are not available to every organization (for example Invoice Rover depends on the plan). Sending any value for a setting that is unavailable to the organisation returns 400 and the `detail` names the setting and the reason. Returns the updated customer in the same shape as GET.","tags":["Customers"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200,"description":"The accounting system customer ID (e.g. the QuickBooks Id, Xero ContactID, Business Central id, or QBD ListID). This is the value exposed as `id` on the customer object.","example":"42"},"required":true,"description":"The accounting system customer ID (e.g. the QuickBooks Id, Xero ContactID, Business Central id, or QBD ListID). This is the value exposed as `id` on the customer object."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomerSettingsBody"}}}},"responses":{"200":{"description":"Updated customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCustomerResponse"}}}},"400":{"description":"Bad request — validation failed (empty body, unknown field, or out-of-range value; `type` `…/validation-error` with `errors[]`), a setting is not available to this organization (`type` `…/bad-request`, `detail` names the setting), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:customers:update`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"404":{"description":"Customer or organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/notes/categories":{"get":{"tags":["Notes"],"summary":"List note categories","description":"Returns enabled system categories plus custom categories for the authenticated organization only.","responses":{"200":{"description":"Category catalog","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NoteCategory"}}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"}],"security":[{"ApiKeyAuth":[]}]}},"/v2/notes/statuses":{"get":{"tags":["Notes"],"summary":"List note statuses","description":"Returns enabled system statuses plus custom statuses for the authenticated organization only.","responses":{"200":{"description":"Status catalog","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NoteStatus"}}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"}],"security":[{"ApiKeyAuth":[]}]}},"/v2/customers/{customerId}/notes":{"get":{"tags":["Notes"],"summary":"List customer note threads","description":"Lists paginated root note threads with reply counts and latest activity for a customer.","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true}],"responses":{"200":{"description":"Paginated notes","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerNoteSummary"}},"pagination":{"type":"object","properties":{"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"}},"required":["nextOffset","prevOffset","limit","offset","hasMore"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]},"post":{"tags":["Notes"],"summary":"Create a customer note thread","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":1000},"categorySlug":{"type":"string","minLength":1,"maxLength":100},"statusSlug":{"type":"string","maxLength":100},"pinned":{"type":"boolean"}},"required":["content","categorySlug"]}}}},"responses":{"200":{"description":"Created note","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNote"}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]}},"/v2/customers/{customerId}/notes/{noteId}":{"get":{"tags":["Notes"],"summary":"Get a customer note thread","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true},{"in":"path","name":"noteId","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"required":true}],"responses":{"200":{"description":"Root note with chronological comments","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CustomerNoteThread"}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]},"patch":{"tags":["Notes"],"summary":"Update a root note or comment","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true},{"in":"path","name":"noteId","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":1000},"categorySlug":{"type":"string","maxLength":100}},"required":["content"]}}}},"responses":{"200":{"description":"Updated note","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CustomerNote"},{"$ref":"#/components/schemas/CustomerNoteComment"}]}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]},"delete":{"tags":["Notes"],"summary":"Soft-delete a root note or comment","description":"Comments may be deleted only by their author or a full admin, and only before a later reply exists.","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true},{"in":"path","name":"noteId","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"required":true}],"responses":{"200":{"description":"Soft-deleted note","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CustomerNote"},{"$ref":"#/components/schemas/CustomerNoteComment"}]}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]}},"/v2/customers/{customerId}/notes/{noteId}/replies":{"post":{"tags":["Notes"],"summary":"Add a comment to a customer note thread","description":"Adds a one-level comment to a root note. Replying to another comment is rejected.","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true},{"in":"path","name":"noteId","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":1000}},"required":["content"]}}}},"responses":{"200":{"description":"Reply note","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNoteComment"}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]}},"/v2/customers/{customerId}/notes/{noteId}/status":{"post":{"tags":["Notes"],"summary":"Set root note status","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true},{"in":"path","name":"noteId","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"statusSlug":{"type":"string","minLength":1,"maxLength":100}},"required":["statusSlug"]}}}},"responses":{"200":{"description":"Updated note","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNote"}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]}},"/v2/customers/{customerId}/alert":{"post":{"tags":["Notes"],"summary":"Pin a root note as customer alert","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"noteId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$"}},"required":["noteId"]}}}},"responses":{"200":{"description":"Pinned note","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNote"}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]},"delete":{"tags":["Notes"],"summary":"Remove customer alert","description":"Unpins the standing customer alert without deleting the note.","parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"customerId","schema":{"type":"string","minLength":1,"maxLength":200},"required":true}],"responses":{"200":{"description":"Unpinned note or { pinned: false }","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CustomerNote"},{"type":"object","properties":{"pinned":{"type":"boolean","const":false}},"required":["pinned"],"additionalProperties":false}]}}}},"400":{"description":"Bad request","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","maxLength":2048},"title":{"type":"string","maxLength":200},"status":{"type":"number"},"detail":{"type":"string","maxLength":2048},"instance":{"type":"string","maxLength":2048}},"required":["type","title","status","detail"],"additionalProperties":false}}}}},"security":[{"ApiKeyAuth":[]}]}},"/v2/payment-methods":{"get":{"summary":"List payment methods for an Organization","description":"Returns paginated saved payment methods (profiles) for the organization associated with the authenticated API key. Filter by accounting `customerId` (QuickBooks Id, Xero ContactID, etc.) to list methods for one customer — the same pattern as the legacy `/api/profiles/list` route. Each item includes an internal Benji Pays profile `id`; use it with `GET /v2/payment-methods/{id}` to fetch a single resource (list rows do not include `mandate`).","tags":["Payment Methods"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"search","schema":{"description":"Free-text search across payment method fields (customer name, masked card/account number, etc.).","type":"string","maxLength":200},"description":"Free-text search across payment method fields (customer name, masked card/account number, etc.)."},{"in":"query","name":"customerId","schema":{"description":"Filter to a single accounting customer ID (QuickBooks `Id`, Xero `ContactID`, Business Central `id`, QBD `ListID`).","type":"string","maxLength":200},"description":"Filter to a single accounting customer ID (QuickBooks `Id`, Xero `ContactID`, Business Central `id`, QBD `ListID`)."},{"in":"query","name":"gatewayId","schema":{"description":"Filter to a gateway store identifier (`gatewayId`).","type":"string","maxLength":200},"description":"Filter to a gateway store identifier (`gatewayId`)."},{"in":"query","name":"status","schema":{"description":"Filter by payment method status. Matches the merchant-app profiles table filters.","type":"string","enum":["enabled","disabled","error"]},"description":"Filter by payment method status. Matches the merchant-app profiles table filters."},{"in":"query","name":"sort","schema":{"description":"Field to sort by (uses the same field names returned in the response). Accepted values: `customerName`, `createdDate`, `lastModifiedDate`, `lastDeclineDate`, `declineCount`, `autoPayPriority`, `gatewayId`, `gatewayProcessor`. Defaults to `customerName` (accounting customer display name denormalized on the profile).","type":"string","maxLength":50},"description":"Field to sort by (uses the same field names returned in the response). Accepted values: `customerName`, `createdDate`, `lastModifiedDate`, `lastDeclineDate`, `declineCount`, `autoPayPriority`, `gatewayId`, `gatewayProcessor`. Defaults to `customerName` (accounting customer display name denormalized on the profile)."},{"in":"query","name":"order","schema":{"description":"Sort direction. Accepted values: `asc` (default), `desc`.","type":"string","enum":["asc","desc"]},"description":"Sort direction. Accepted values: `asc` (default), `desc`."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated payment method list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPaymentMethodsResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query parameters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:payment-methods:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin` or `manageProfiles`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:payment-methods:read","instance":"/v2/payment-methods"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/payment-methods"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/payment-methods"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/payment-methods/{id}":{"get":{"summary":"Get a payment method for an Organization","description":"Returns a single saved payment method (profile) by its `id` (from `GET /v2/payment-methods`), scoped to the organization associated with the authenticated API key. Includes the nested `mandate` — the customer's recorded off-session billing authorization (e.g. Stripe accepted-at date, IP, and agreement text) — or `null` when no authorization was captured for this payment method. Use this to produce chargeback defense evidence for off-session charges.","tags":["Payment Methods"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"id","schema":{"type":"string","minLength":1,"maxLength":200,"description":"Payment method id (profile `_id`). Same id returned by GET /v2/payment-methods.","example":"66f1a2b3c4d5e6f789012345"},"required":true,"description":"Payment method id (profile `_id`). Same id returned by GET /v2/payment-methods."}],"responses":{"200":{"description":"Payment method, including its mandate (or null)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodWithMandate"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:payment-methods:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin` or `manageProfiles`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:payment-methods:read","instance":"/v2/payment-methods/{id}"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/payment-methods/{id}"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/payment-methods/{id}"}}}}}}},"404":{"description":"Organization not found, payment method not found, or payment method belongs to a different organization","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/installment-plans":{"get":{"summary":"List installment plans","description":"Returns installment plans. Omit `customerId` and `invoiceId` to list the company. Send `customerId` for one customer, or `invoiceId` for one invoice. Sending both returns that invoice only when every plan customer matches `customerId`. An invoice with no plans returns an empty list. Requires `organizations:installment-plans:read`.","tags":["Installment Plans"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"customerId","schema":{"description":"Accounting customer id. Do not send this with `invoiceId` unless that invoice belongs to this customer.","type":"string","maxLength":200},"description":"Accounting customer id. Do not send this with `invoiceId` unless that invoice belongs to this customer."},{"in":"query","name":"invoiceId","schema":{"description":"Accounting invoice id. Returns the plans for that invoice.","type":"string","maxLength":200},"description":"Accounting invoice id. Returns the plans for that invoice."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated installment plan list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListInstallmentPlansResponse"}}}},"400":{"description":"Bad request — `customerId` does not match the invoice.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing scope `organizations:installment-plans:read`, or the API key owner is not `companyAdmin` or `installments`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}},"post":{"summary":"Create an installment plan","description":"Creates an installment plan for one invoice on the organization. `customerId` must match the invoice customer. Each date is YYYY-MM-DD and on or after the invoice due date. The amounts must add up to the invoice balance. An invoice that already has a plan returns 400. Requires `organizations:installment-plans:create`.","tags":["Installment Plans"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInstallmentPlanRequest"}}}},"responses":{"201":{"description":"The created installment plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallmentPlan"}}}},"400":{"description":"Bad request — invoice, customer, dates, total, or an existing plan.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing scope `organizations:installment-plans:create`, the API key owner is not `companyAdmin` or `installments`, or installment plans are not on the company billing plan.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"}]}},"/v2/payment-links/unapplied":{"post":{"summary":"Create an unapplied (no-invoice) payment link","description":"Creates a no-invoice payment link for the organization associated with the authenticated API key. The payment will be added to the payment to apply table. Does not create/attach an accounting invoice and does not email the link — the caller sends `url` to the payer. Requires `organizations:payment-links:create`.","tags":["Payment Links"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["default","quoter"],"description":"Who the link is for. Controls allowed returnUrl domains when returnUrl is sent."},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999.99,"description":"Amount to charge. Must be > 0, max 999999.99, up to 2 decimal places."},"currency":{"description":"3-letter currency code (e.g. USD). Used to pick the gateway.","type":"string","minLength":3,"maxLength":3,"pattern":"^[A-Za-z]{3}$"},"gatewayId":{"description":"Optional gateway selector. Accepts a gateway store identifier or a hash from GET /v2/gateways/capabilities. If omitted, gateway is chosen from currency / defaults.","type":"string","minLength":1,"maxLength":100},"name":{"type":"string","minLength":1,"maxLength":200,"description":"Payer / customer display name on the pay page."},"reference":{"type":"string","minLength":1,"maxLength":100,"description":"Human-readable label (e.g. quote number). Shown in UI / emails."},"dataId":{"description":"Machine id from the partner (e.g. Quoter quote id). Not an accounting invoice id.","type":"string","maxLength":100},"returnUrl":{"description":"Optional. Where to send the customer after a successful payment. Omit for no post-pay redirect. When set: must be https. For integration partners, only the expected return URL hosts for that `source` are accepted; otherwise open-redirect hardening still applies.","type":"string","maxLength":2048,"format":"uri"},"savePaymentMethod":{"description":"Optional override for the save-card checkbox. Omit = normal form. true = force save on. false = force save off.","type":"boolean"},"disableSurcharging":{"description":"Optional. When true, disable Benji Pays managed surcharging for this link. Does not affect surcharging managed by your payment gateway. When omitted: falls back to the integration configuration for that `source`, then to payment gateway settings (`source=default` leaves surcharge enabled / `false`).","type":"boolean"},"customerEmail":{"description":"Prefills receipt email(s) on the pay page. Does not send the payment link.","type":"string","maxLength":500}},"required":["source","amount","currency","name","reference"]}}}},"responses":{"200":{"description":"Payment link created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUnappliedPaymentLinkResponse"}}}},"400":{"description":"Bad Request — invalid body or gateway/currency/returnUrl configuration","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:payment-links:create`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:payment-links:create","instance":"/v2/payment-links/unapplied"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/payment-links/unapplied"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"}]}},"/v2/payment-links/applied/{invoiceId}":{"post":{"summary":"Create an applied (invoice-tied) payment link","description":"Creates a tokenized payment link tied to an existing accounting invoice for the organization associated with the authenticated API key. After pay, the payment applies to that invoice. For security, we recommend passing `allowSavedPaymentMethods: false` unless you have independently authenticated the user and are certain they are authorized to use the invoice customer’s saved payment methods. Setting it to `true` may display existing on-file payment methods and allows the user to pay with them. Does not email the link — the caller sends `url`. Requires `organizations:payment-links:create`.","tags":["Payment Links"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"invoiceId","schema":{"type":"string","minLength":1,"maxLength":200,"description":"The accounting system invoice ID (e.g. the QuickBooks Id, Xero InvoiceID, or Business Central id). This is the value exposed as `id` on the invoice object.","example":"1042"},"required":true,"description":"The accounting system invoice ID (e.g. the QuickBooks Id, Xero InvoiceID, or Business Central id). This is the value exposed as `id` on the invoice object."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"gatewayId":{"description":"Optional gateway selector. Accepts a gateway store identifier or a hash from GET /v2/gateways/capabilities. If omitted, gateway is chosen from the invoice currency / defaults (same as unapplied).","type":"string","minLength":1,"maxLength":100},"allowSavedPaymentMethods":{"description":"Security recommendation: pass false to create a guest checkout unless you have independently authenticated the user and are certain they are authorized to use the invoice customer’s saved payment methods. When true, the pay-now page may display existing on-file payment methods and allow the user to pay with them. When omitted or false (default), saved payment methods are not shown or available.","type":"boolean"}}}}}},"responses":{"200":{"description":"Payment link created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAppliedPaymentLinkResponse"}}}},"400":{"description":"Bad Request — invalid body/params, missing invoice customer/currency, or gateway/currency configuration","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:payment-links:create`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:payment-links:create","instance":"/v2/payment-links/applied/{invoiceId}"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/payment-links/applied/{invoiceId}"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/payment-method-requests":{"get":{"summary":"List payment-method-on-file requests","description":"Returns paginated customer payment-method-on-file requests for the organization associated with the authenticated API key. Excludes generic (no-customer) portal-link submissions. Filter by customer, gateway, and status. Requires `organizations:payment-method-requests:read`.","tags":["Payment Method Requests"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"customerId","schema":{"description":"Filter to a single accounting customer ID.","type":"string","minLength":1,"maxLength":200},"description":"Filter to a single accounting customer ID."},{"in":"query","name":"gatewayId","schema":{"description":"Filter to a gateway store identifier (or default-currency hash).","type":"string","minLength":1,"maxLength":100},"description":"Filter to a gateway store identifier (or default-currency hash)."},{"in":"query","name":"status","schema":{"description":"Filter by request status (`pending` or `completed`).","type":"string","enum":["pending","completed"]},"description":"Filter by request status (`pending` or `completed`)."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated payment-method-request list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPaymentMethodRequestsResponse"}}}},"400":{"description":"Bad Request — invalid query or portal/accounting configuration","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:payment-method-requests:read`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:payment-method-requests:read","instance":"/v2/payment-method-requests"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/payment-method-requests"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}},"post":{"summary":"Create a payment-method-on-file request","description":"Creates a customer payment-method-on-file request for the organization associated with the authenticated API key. Returns a portal URL. Does not email or SMS — the caller sends `url` to the customer. Requires `organizations:payment-method-requests:create`.","tags":["Payment Method Requests"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1,"maxLength":200,"description":"The accounting system customer ID (e.g. the QuickBooks Id, Xero ContactID, Business Central id, or QBD ListID). Same value as `id` on GET /customers/:customerId.","example":"42"},"currency":{"description":"3-letter currency code (e.g. USD). Used to pick the gateway.","type":"string","minLength":3,"maxLength":3,"pattern":"^[A-Za-z]{3}$"},"gatewayId":{"description":"Optional gateway selector. Accepts a gateway store identifier or a hash from GET /v2/gateways/capabilities. If omitted, gateway is chosen from currency / defaults.","type":"string","minLength":1,"maxLength":100}},"required":["customerId","currency"]}}}},"responses":{"200":{"description":"Payment method request created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodRequest"}}}},"400":{"description":"Bad Request — invalid body or portal/gateway/currency configuration","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:payment-method-requests:create`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:payment-method-requests:create","instance":"/v2/payment-method-requests"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/payment-method-requests"}}}}}}},"404":{"description":"Organization or customer not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"}]}},"/v2/payment-method-requests/{paymentMethodRequestId}":{"get":{"summary":"Get a payment-method-on-file request","description":"Returns a single customer payment-method-on-file request by its `id` (from create or list). Scoped to the organization associated with the authenticated API key. Generic (no-customer) portal-link submissions are treated as not found. Requires `organizations:payment-method-requests:read`.","tags":["Payment Method Requests"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"paymentMethodRequestId","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"Payment method request Mongo id (`id` from create or list).","example":"507f1f77bcf86cd7994390cc"},"required":true,"description":"Payment method request Mongo id (`id` from create or list)."}],"responses":{"200":{"description":"Payment method request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodRequest"}}}},"400":{"description":"Bad Request — invalid id or portal/accounting configuration","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:payment-method-requests:read`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:payment-method-requests:read","instance":"/v2/payment-method-requests/{paymentMethodRequestId}"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/payment-method-requests/{paymentMethodRequestId}"}}}}}}},"404":{"description":"Organization or payment method request not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/webhooks":{"get":{"summary":"List webhook URLs","description":"Returns one page of webhook registrations for the organization associated with the authenticated API key, newest first. The signing secret is never returned. Requires `organizations:webhooks:read`.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Webhook registrations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListWebhooksResponse"}}}},"400":{"description":"Bad Request — invalid limit or offset","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:webhooks:read`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:webhooks:read","instance":"/v2/webhooks"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/webhooks"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}},"post":{"summary":"Register a webhook URL","description":"Registers an HTTPS URL to receive event notifications for the organization associated with the authenticated API key. Returns a signing `secret` once; it cannot be retrieved later. Up to 16 URLs per organization. Requires `organizations:webhooks:create`.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2048,"format":"uri","description":"Public HTTPS URL that receives event POSTs. Localhost, private, and link-local addresses are rejected. Must be unique per organization.","example":"https://example.com/benji/webhooks","pattern":"^https://"},"enabled_events":{"minItems":1,"type":"array","items":{"type":"string","enum":["payment.succeeded","payment.failed"]},"description":"Event types to send to this URL. At least one.","example":["payment.succeeded","payment.failed"]}},"required":["url","enabled_events"]}}}},"responses":{"201":{"description":"Webhook registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRegistration"}}}},"400":{"description":"Bad Request — invalid body, URL not public HTTPS, URL already registered, or 16 URL limit reached","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:webhooks:create`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:webhooks:create","instance":"/v2/webhooks"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/webhooks"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"}]}},"/v2/webhooks/deliveries":{"get":{"summary":"List webhook deliveries","description":"Returns one page of webhook deliveries for the organization associated with the authenticated API key, newest first. Filter by registration id, status, and created time. The signing secret and raw request body are never returned. Requires `organizations:webhooks:read`.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"webhook_id","schema":{"description":"Only deliveries for this webhook registration id. An unknown id returns an empty page.","example":"507f1f77bcf86cd7994390cc","type":"string","pattern":"^[a-f\\d]{24}$"},"description":"Only deliveries for this webhook registration id. An unknown id returns an empty page."},{"in":"query","name":"status","schema":{"description":"Delivery status. Accepted values: `pending`, `sent`, `failed`.","type":"string","enum":["pending","sent","failed"]},"description":"Delivery status. Accepted values: `pending`, `sent`, `failed`."},{"in":"query","name":"startDate","schema":{"description":"Start of the created range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — start of that day in UTC (`00:00:00.000Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-02T07:00:00.000Z`) — exact UTC bound. Optional independently of `endDate`.","examples":["2024-07-02","2024-07-02T07:00:00.000Z"],"type":"string","maxLength":40},"description":"Start of the created range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — start of that day in UTC (`00:00:00.000Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-02T07:00:00.000Z`) — exact UTC bound. Optional independently of `endDate`."},{"in":"query","name":"endDate","schema":{"description":"End of the created range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — end of that day in UTC (`23:59:59.999Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-03T06:59:59.999Z`) — exact UTC bound. Optional independently of `startDate`.","examples":["2024-07-02","2024-07-03T06:59:59.999Z"],"type":"string","maxLength":40},"description":"End of the created range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — end of that day in UTC (`23:59:59.999Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-03T06:59:59.999Z`) — exact UTC bound. Optional independently of `startDate`."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Webhook deliveries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListWebhookDeliveriesResponse"}}}},"400":{"description":"Bad Request — invalid webhook id, status, date, limit, or offset","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:webhooks:read`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:webhooks:read","instance":"/v2/webhooks/deliveries"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/webhooks/deliveries"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/webhooks/{webhookId}":{"get":{"summary":"Get a webhook URL","description":"Returns one webhook registration for the organization associated with the authenticated API key. The `id` is the one returned by create or list. Unknown ids and other organizations' registrations return 404. The signing secret is never returned. Requires `organizations:webhooks:read`.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"webhookId","schema":{"type":"string","pattern":"^[a-f\\d]{24}$","description":"Webhook registration id from create or list.","example":"507f1f77bcf86cd7994390cc"},"required":true,"description":"Webhook registration id from create or list."}],"responses":{"200":{"description":"Webhook registration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRegistrationSummary"}}}},"400":{"description":"Bad Request — invalid webhook id","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:webhooks:read`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:webhooks:read","instance":"/v2/webhooks"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/webhooks"}}}}}}},"404":{"description":"Organization not found, or the webhook id is unknown or belongs to another organization","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}},"patch":{"summary":"Update a webhook URL","description":"Changes the URL and/or event list on one webhook registration for the organization associated with the authenticated API key. At least one of `url` or `enabled_events` is required. The signing secret stays the same and is not returned. Unknown ids and other organizations' registrations return 404. Requires `organizations:webhooks:update`.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"webhookId","schema":{"type":"string","pattern":"^[a-f\\d]{24}$","description":"Webhook registration id from create or list.","example":"507f1f77bcf86cd7994390cc"},"required":true,"description":"Webhook registration id from create or list."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhookRegistration"}}}},"responses":{"200":{"description":"Updated webhook registration. The signing secret is not included.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRegistrationSummary"}}}},"400":{"description":"Bad Request — empty body, invalid or non-public URL, empty or unknown events, or the URL is already registered for this organization","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:webhooks:update`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:webhooks:update","instance":"/v2/webhooks/{webhookId}"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/webhooks/{webhookId}"}}}}}}},"404":{"description":"Organization not found, or the webhook id is unknown or belongs to another organization","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}},"delete":{"summary":"Delete a webhook URL","description":"Removes one webhook registration for the organization associated with the authenticated API key. Unknown ids and other organizations' registrations return 404. The signing secret is not returned. Deliveries already queued for this registration still send. Requires `organizations:webhooks:delete`.","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"webhookId","schema":{"type":"string","pattern":"^[a-f\\d]{24}$","description":"Webhook registration id from create or list.","example":"507f1f77bcf86cd7994390cc"},"required":true,"description":"Webhook registration id from create or list."}],"responses":{"204":{"description":"The registration was deleted. The body is empty. The signing secret is not returned."},"400":{"description":"Bad Request — invalid webhook id","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized — invalid or missing authentication, or API access is not active for this organization (disabled or missing).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:webhooks:delete`) and/or insufficient live mapping permission on the API key owner (e.g. `companyAdmin`). Scope and mapping are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:webhooks:delete","instance":"/v2/webhooks/{webhookId}"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/webhooks/{webhookId}"}}}}}}},"404":{"description":"Organization not found, or the webhook id is unknown or belongs to another organization","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/transactions":{"get":{"summary":"List transactions for an Organization","description":"Returns paginated payment transactions for the organization associated with the authenticated API key. Matches the data visible in the merchant-app transaction reporting table, including enriched settlement fields. Filter by date range, transaction type/status, accounting customer, gateway, and more. Use this list to poll an in-progress transaction after `POST /v2/transactions` (save `data.id`, then filter `invoiceId` or `status=inprocess`). See the Charge an invoice guide for bank `queued`/`pending` and Benji Payments void/refund polling.\n\nSend `idempotencyKey` to recover a charge after a crash or lost response: it lists charges created by `POST /v2/transactions` or `POST /v2/transactions/deposits` with that `Idempotency-Key` in this organization. An empty `data` means no charge used the key. Keys are matched per organization, so a charge made by another API key or user in the same organization is found. Only charges made through the API carry a key.","tags":["Transactions"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"startDate","schema":{"description":"Start of the date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — start of that day in UTC (`00:00:00.000Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-02T07:00:00.000Z`) — exact UTC bound. Optional independently of `endDate`. Ignored when `status=inprocess`.","examples":["2024-07-02","2024-07-02T07:00:00.000Z"],"type":"string","maxLength":40},"description":"Start of the date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — start of that day in UTC (`00:00:00.000Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-02T07:00:00.000Z`) — exact UTC bound. Optional independently of `endDate`. Ignored when `status=inprocess`."},{"in":"query","name":"endDate","schema":{"description":"End of the date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — end of that day in UTC (`23:59:59.999Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-03T06:59:59.999Z`) — exact UTC bound. Optional independently of `startDate`. Ignored when `status=inprocess`.","examples":["2024-07-02","2024-07-03T06:59:59.999Z"],"type":"string","maxLength":40},"description":"End of the date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — end of that day in UTC (`23:59:59.999Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-03T06:59:59.999Z`) — exact UTC bound. Optional independently of `startDate`. Ignored when `status=inprocess`."},{"in":"query","name":"type","schema":{"description":"Filter by transaction type. Accepted values: `payment`, `void`, `refund`, `deposit`.","type":"string","maxLength":50},"description":"Filter by transaction type. Accepted values: `payment`, `void`, `refund`, `deposit`."},{"in":"query","name":"status","schema":{"description":"Filter by transaction status. Accepted values: `approved`, `declined`, `inprocess`. `inprocess` is queued / pending / pending_account_validation / notified (date filters ignored). Use it to poll bank charges that are not final yet.","type":"string","maxLength":50},"description":"Filter by transaction status. Accepted values: `approved`, `declined`, `inprocess`. `inprocess` is queued / pending / pending_account_validation / notified (date filters ignored). Use it to poll bank charges that are not final yet."},{"in":"query","name":"customerId","schema":{"description":"Filter to a single customer by their accounting system ID (QuickBooks `Id`, Xero `ContactID`, Business Central `id`, QBD `ListID`).","type":"string","maxLength":200},"description":"Filter to a single customer by their accounting system ID (QuickBooks `Id`, Xero `ContactID`, Business Central `id`, QBD `ListID`)."},{"in":"query","name":"search","schema":{"description":"Free-text search across transaction fields (customer name, invoice number, reference, etc.).","type":"string","maxLength":200},"description":"Free-text search across transaction fields (customer name, invoice number, reference, etc.)."},{"in":"query","name":"gatewayId","schema":{"description":"Filter to a specific gateway store/terminal identifier.","type":"string","maxLength":200},"description":"Filter to a specific gateway store/terminal identifier."},{"in":"query","name":"gatewayProcessor","schema":{"description":"Filter by payment processor. Accepted values: `benjipayments`, `bambora`, `moneris`, `helcim`, `globalpayments`, `epg`, `elavon`, `stripe`, `clover` (same public keys returned in the response; storage `adyen` is exposed as `benjipayments`).","type":"string","maxLength":50},"description":"Filter by payment processor. Accepted values: `benjipayments`, `bambora`, `moneris`, `helcim`, `globalpayments`, `epg`, `elavon`, `stripe`, `clover` (same public keys returned in the response; storage `adyen` is exposed as `benjipayments`)."},{"in":"query","name":"currency","schema":{"description":"Filter by currency code (e.g. `USD`, `CAD`).","type":"string","maxLength":10},"description":"Filter by currency code (e.g. `USD`, `CAD`)."},{"in":"query","name":"cardType","schema":{"description":"Filter by card brand (e.g. `Visa`, `Mastercard`, `Amex`).","type":"string","maxLength":50},"description":"Filter by card brand (e.g. `Visa`, `Mastercard`, `Amex`)."},{"in":"query","name":"amountMin","schema":{"description":"Minimum transaction amount filter (inclusive). Use a decimal string, e.g. `10.00`.","type":"string","maxLength":20},"description":"Minimum transaction amount filter (inclusive). Use a decimal string, e.g. `10.00`."},{"in":"query","name":"amountMax","schema":{"description":"Maximum transaction amount filter (inclusive). Use a decimal string, e.g. `500.00`.","type":"string","maxLength":20},"description":"Maximum transaction amount filter (inclusive). Use a decimal string, e.g. `500.00`."},{"in":"query","name":"invoiceId","schema":{"description":"Filter to transactions associated with a specific invoice. Use the invoice ID from your accounting system (QuickBooks `Id`, Xero `InvoiceID`, Business Central `id`, etc.).","type":"string","maxLength":200},"description":"Filter to transactions associated with a specific invoice. Use the invoice ID from your accounting system (QuickBooks `Id`, Xero `InvoiceID`, Business Central `id`, etc.)."},{"in":"query","name":"hasSurcharge","schema":{"description":"Filter to transactions that have (`true`) or do not have (`false`) a surcharge.","type":"string","enum":["true","false"]},"description":"Filter to transactions that have (`true`) or do not have (`false`) a surcharge."},{"in":"query","name":"paymentLocation","schema":{"description":"Where the payment was made. Exact match on the stored `paymentLocation`. Known values: `web-app` (merchant app), `customer-portal` (customer portal), `payment-portal` (pay link / payment portal), `api` (API charge, including `POST /v2/transactions`). Rows with no stored `paymentLocation` are left out when this filter is set.","type":"string","enum":["web-app","payment-portal","customer-portal","api"]},"description":"Where the payment was made. Exact match on the stored `paymentLocation`. Known values: `web-app` (merchant app), `customer-portal` (customer portal), `payment-portal` (pay link / payment portal), `api` (API charge, including `POST /v2/transactions`). Rows with no stored `paymentLocation` are left out when this filter is set."},{"in":"query","name":"sort","schema":{"description":"Field to sort by. Accepted values: `transactionDate` (default), `invoiceNumber`, `customerName`, `result`, `status`.","type":"string","maxLength":50},"description":"Field to sort by. Accepted values: `transactionDate` (default), `invoiceNumber`, `customerName`, `result`, `status`."},{"in":"query","name":"order","schema":{"description":"Sort direction. Accepted values: `asc` (default), `desc`.","type":"string","enum":["asc","desc"]},"description":"Sort direction. Accepted values: `asc` (default), `desc`."},{"in":"query","name":"idempotencyKey","schema":{"description":"Only charges created by `POST /v2/transactions` or `POST /v2/transactions/deposits` with this `Idempotency-Key`. Works with the other filters, sort, and pagination.","type":"string","maxLength":255},"description":"Only charges created by `POST /v2/transactions` or `POST /v2/transactions/deposits` with this `Idempotency-Key`. Works with the other filters, sort, and pagination."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated transaction list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTransactionsResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query parameters, including an `idempotencyKey` that is not 1–255 alphanumeric characters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:transactions:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:transactions:read","instance":"/v2/transactions"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/transactions"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/transactions"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}},"post":{"summary":"Charge an invoice (create transaction)","description":"Charges a stored payment method against an accounting invoice for the organization associated with the authenticated API key (off-session AR collection). The charge is attempted once against the supplied `paymentMethodId`. HTTP 200 means the charge was attempted — read `data` and `meta.effects` (a decline is still 200). Setup failures return RFC 7807. Requires `organizations:transactions:create` and a required `Idempotency-Key` header.\n\nOmit `amount` to charge the invoice open balance. Credit memos are not applied. If the invoice has installments, you still choose the amount; installment rows are not closed.\n\nCard charges are usually final on this response. Bank charges may return `queued` then `pending` — save `data.id` and poll `GET /v2/transactions`. See the Charge an invoice guide.","tags":["Transactions"],"security":[{"ApiKeyAuth":[]}],"x-bp-require-idempotency":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoiceId":{"type":"string","minLength":1,"maxLength":200,"description":"The accounting system invoice ID (e.g. the QuickBooks Id, Xero InvoiceID, or Business Central id). This is the value exposed as `id` on the invoice object.","example":"1042"},"paymentMethodId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"Stored payment method id to charge. Must belong to the invoice customer and a gateway that supports the invoice currency. Pending-verification methods and methods disabled after a past error return 400 and cannot be charged."},"amount":{"description":"Optional charge amount. Omit to charge the invoice open balance. Must be > 0, ≤ open balance, max 999999.99, up to 2 decimal places.","type":"number","exclusiveMinimum":0,"maximum":999999.99},"sendReceipt":{"description":"Whether to send a receipt email after a successful charge. Omit or `true` sends a receipt. `false` skips it.","type":"boolean"},"attachPdf":{"description":"Whether to attach the invoice PDF (`Invoice-{number}.pdf`) to the receipt. Omit to use the organization `attachInvoice` setting. This attaches the invoice PDF only, not the accounting payment PDF. Extra files already stored on the invoice still follow the organization `sendInvoiceAttachments` setting.","type":"boolean"}},"required":["invoiceId","paymentMethodId"]}}}},"responses":{"200":{"description":"Charge attempted. Inspect `meta.effects` for charge/accounting/receipt outcomes. Declines and other soft failures still return 200. If `meta.effects.charge.detail` says the transaction was not saved successfully, the charge ran: do not retry it, and expect `GET /v2/transactions` to show an outdated status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTransactionResponse"}}}},"400":{"description":"Bad request — missing/invalid `Idempotency-Key`, body validation failed (`type` `…/validation-error`), and/or charge setup failed (invalid invoice, a Business Central invoice that is not yet posted or has not reached its posting date, no open balance, payment method not usable for this invoice, etc.). Soft declines return 200 with `meta.effects.charge.status=failed`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:transactions:create`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:transactions:create","instance":"/v2/transactions"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/transactions"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/transactions"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"409":{"description":"Idempotency key conflict (`…/idempotency-key-conflict`: same key, different body — use a new key), or invoice already being charged.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests (rate limit or idempotency in-flight)","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"503":{"description":"Idempotency protection is temporarily unavailable, so the charge was not attempted. Retry the same request with the same `Idempotency-Key` after `Retry-After` seconds.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeaderRequired"}]}},"/v2/transactions/deposits":{"post":{"summary":"Charge a deposit","description":"Charges a stored payment method with **no invoice** (unallocated deposit) for the organization associated with the authenticated API key. The charge is attempted once against the supplied `paymentMethodId`. Accounting posts an unallocated payment; apply it to invoices later in QuickBooks / Xero / Business Central.\n\nOrganizations using the Xero accounting system must send `depositType`. `depositType=prepayment` creates a Xero prepayment: send `revenueAccountId` (the prepayment line account) from GET /v2/accounting-accounts?purpose=prepayment. The bank account still comes from the gateway, and the charge must be in the home currency. `depositType=overpayment` creates a Xero overpayment: send `bankAccountId` (the Xero bank account) from GET /v2/accounting-accounts?purpose=overpayment. Its currency must match the charge currency. `depositType`, `revenueAccountId`, and `bankAccountId` must be omitted when the accounting system is not Xero.\n\nHTTP 200 means the charge was attempted — read `data` and `meta.effects` (a decline is still 200). Setup failures return RFC 7807. Requires `organizations:transactions:create` and a required `Idempotency-Key` header.\n\nOmit `currency` to use the organization home currency. Card charges are usually final on this response. Bank charges may return `queued` then `pending` — save `data.id` and poll `GET /v2/transactions`.","tags":["Transactions"],"security":[{"ApiKeyAuth":[]}],"x-bp-require-idempotency":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"paymentMethodId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"Stored payment method id to charge. Must belong to this organization and a gateway that supports the charge currency. Pending-verification methods and methods disabled after a past error return 400 and cannot be charged."},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999.99,"description":"Charge amount. Must be > 0, max 999999.99, up to 2 decimal places."},"currency":{"description":"Charge currency (ISO 4217). Omit to use the organization home currency. For Xero prepayments, must be the home currency. For Xero overpayments, must match the `bankAccountId` currency.","type":"string","pattern":"^[A-Za-z]{3}$"},"sendReceipt":{"description":"Whether to send a receipt email after a successful charge. Omit or `true` sends a receipt. `false` skips it.","type":"boolean"},"attachPdf":{"description":"Whether to attach the accounting payment PDF to the receipt (`Deposit.pdf` for QuickBooks). Omit or `false` attaches no PDF. This does not use the organization `attachInvoice` setting.","type":"boolean"},"depositType":{"description":"Xero only. Required when the accounting system is Xero. Do not use with other accounting systems. `prepayment` creates a Xero prepayment and needs `revenueAccountId`. `overpayment` creates a Xero overpayment and needs `bankAccountId`.","type":"string","enum":["prepayment","overpayment"]},"revenueAccountId":{"description":"Xero only. Required when `depositType=prepayment`. Account id for the prepayment line (revenue, prepayment, liability, or current asset). Get it from GET /v2/accounting-accounts?purpose=prepayment. This does not replace the gateway deposit account.","type":"string","minLength":1,"maxLength":100},"bankAccountId":{"description":"Xero only. Required when `depositType=overpayment`. Xero bank account the overpayment posts to. Get it from GET /v2/accounting-accounts?purpose=overpayment. Its currency must match the charge currency.","type":"string","minLength":1,"maxLength":100}},"required":["paymentMethodId","amount"]}}}},"responses":{"200":{"description":"Charge attempted. Inspect `meta.effects` for charge/accounting/receipt outcomes. Declines and other soft failures still return 200. If `meta.effects.charge.detail` says the transaction was not saved successfully, the charge ran: do not retry it, and expect `GET /v2/transactions` to show an outdated status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTransactionResponse"}}}},"400":{"description":"Bad request — missing/invalid `Idempotency-Key`, body validation failed (`type` `…/validation-error`), and/or charge setup failed (invalid payment method, unsupported currency, pending verification, method disabled after a past error, etc.). Soft declines return 200 with `meta.effects.charge.status=failed`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:transactions:create`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:transactions:create","instance":"/v2/transactions"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/transactions"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/transactions"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"409":{"description":"Idempotency key conflict (`…/idempotency-key-conflict`: same key, different body — use a new key).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests (rate limit or idempotency in-flight)","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"503":{"description":"Idempotency protection is temporarily unavailable, so the charge was not attempted. Retry the same request with the same `Idempotency-Key` after `Retry-After` seconds.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}},"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeaderRequired"}]}},"/v2/transactions/{transactionId}/retry-accounting":{"post":{"summary":"Retry the accounting writeback for a charge","description":"Retries **only** the accounting writeback (QBO / Xero / Business Central) for a charge that already succeeded — for example when `POST /v2/transactions` returned `meta.effects.charge.status=succeeded` with `meta.effects.accounting.status=failed`. The payment method is never charged again, the charge is never voided, and no receipt is sent.\n\nEligibility is read from the saved transaction, so a single call also tells you when there is nothing to write back. HTTP 200 always returns the current transaction in `data` plus `meta.effects.accounting`:\n\n- `succeeded` — applied. `data` carries the accounting payment id and `paymentApplied`.\n- `failed` — the accounting system is still unavailable. Safe to retry later.\n- `skipped` — nothing to apply. `data.status` says why (for example `approved_voided` when the charge was auto-voided after the original apply failed), or accounting was already applied, or the apply is deferred until a bank payment completes.\n\nRequires `organizations:transactions:create` and a required `Idempotency-Key` header. Charges that cannot be retried at all (declined, no invoice, wrong type) return RFC 7807.","tags":["Transactions"],"security":[{"ApiKeyAuth":[]}],"x-bp-require-idempotency":true,"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeaderRequired"},{"in":"path","name":"transactionId","schema":{"type":"string","maxLength":50,"description":"Transaction identifier — `data.id` from `POST /v2/transactions` or a `GET /v2/transactions` row (24-character hex). Unknown or malformed ids return 404.","example":"66f1a2b3c4d5e6f789012345"},"required":true,"description":"Transaction identifier — `data.id` from `POST /v2/transactions` or a `GET /v2/transactions` row (24-character hex). Unknown or malformed ids return 404."}],"responses":{"200":{"description":"Retry evaluated. Inspect `meta.effects.accounting` (`succeeded`, `failed`, or `skipped`) and `data` for the current transaction state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetryChargeAccountingResponse"}}}},"400":{"description":"Bad request — missing/invalid `Idempotency-Key`, or the charge cannot have accounting retried: it never succeeded (declined), it has no invoice to apply to, it is the wrong transaction type (void / refund / prepayment), or its gateway or invoice can no longer be read. Voided, already-applied, and deferred charges return 200 with `meta.effects.accounting.status=skipped`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:transactions:create`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:transactions:create","instance":"/v2/transactions"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/transactions"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/transactions"}}}}}}},"404":{"description":"Not found — unknown or malformed transaction id, or the transaction belongs to another organization.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"409":{"description":"Idempotency key conflict (same key, different body), or the invoice is already being processed.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests (rate limit or idempotency in-flight)","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"503":{"description":"Idempotency protection is temporarily unavailable, so the retry was not attempted. Retry the same request with the same `Idempotency-Key` after `Retry-After` seconds.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/transactions/{transactionId}/receipt":{"get":{"summary":"Download a transaction receipt PDF","description":"Returns a receipt PDF for a payment transaction (`data.id` from `POST /v2/transactions` or `GET /v2/transactions`). Default is the customer copy. Pass `?type=merchant` for the merchant copy. Same receipt formatting as the merchant app download — raw PDF bytes only, no email.","tags":["Transactions"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"transactionId","schema":{"type":"string","maxLength":50,"description":"Transaction identifier — `data.id` from `POST /v2/transactions` or a `GET /v2/transactions` row (24-character hex). Unknown or malformed ids return 404.","example":"66f1a2b3c4d5e6f789012345"},"required":true,"description":"Transaction identifier — `data.id` from `POST /v2/transactions` or a `GET /v2/transactions` row (24-character hex). Unknown or malformed ids return 404."},{"in":"query","name":"type","schema":{"description":"Receipt copy to download. Default `customer`. Use `merchant` for the merchant copy.","type":"string","enum":["customer","merchant"]},"description":"Receipt copy to download. Default `customer`. Use `merchant` for the merchant copy."}],"responses":{"200":{"description":"Transaction receipt PDF. `Content-Disposition` is `attachment; filename=\"Receipt-{transactionId}.pdf\"`.","content":{"application/pdf":{"schema":{"type":"string","description":"Raw transaction receipt PDF bytes (customer or merchant copy).","format":"binary"}}}},"400":{"description":"Bad request — invalid `type` query value (`customer` or `merchant` only).","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:transactions:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:transactions:read","instance":"/v2/transactions"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/transactions"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/transactions"}}}}}}},"404":{"description":"Not found — unknown or malformed transaction id, or the transaction belongs to another organization.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/transactions/{transactionId}/resend-receipt":{"post":{"summary":"Resend the customer receipt email","description":"Regenerates and resends the customer receipt email for a transaction. No charge, void, or accounting writeback. Recipients come from the accounting customer enabled emails (including parent-customer emails for QuickBooks projects/children, same as charge receipts) plus company receipt CC/BCC settings.","tags":["Transactions"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"$ref":"#/components/parameters/IdempotencyKeyHeader"},{"in":"path","name":"transactionId","schema":{"type":"string","maxLength":50,"description":"Transaction identifier — `data.id` from `POST /v2/transactions` or a `GET /v2/transactions` row (24-character hex). Unknown or malformed ids return 404.","example":"66f1a2b3c4d5e6f789012345"},"required":true,"description":"Transaction identifier — `data.id` from `POST /v2/transactions` or a `GET /v2/transactions` row (24-character hex). Unknown or malformed ids return 404."}],"responses":{"200":{"description":"Receipt resend evaluated. Inspect `meta.effects.receipt` (`succeeded` or `failed`) and `data` for the current transaction state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendTransactionReceiptResponse"}}}},"400":{"description":"Bad request — the customer has no enabled email address to send the receipt to.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:transactions:create`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:transactions:create","instance":"/v2/transactions"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/transactions"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/transactions"}}}}}}},"404":{"description":"Not found — unknown or malformed transaction id, or the transaction belongs to another organization.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/emails":{"get":{"summary":"List sent emails for an Organization","description":"Returns paginated sent emails for the organization associated with the authenticated API key. Matches the merchant-app email history, restricted to merchant-facing email types. Filter by customer, type, status, and sent-date range.","tags":["Emails"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"customerId","schema":{"description":"Filter to a single accounting customer ID.","type":"string","maxLength":200},"description":"Filter to a single accounting customer ID."},{"in":"query","name":"type","schema":{"type":"string","enum":["invoice","receipt","cardrequest","emailreminder","generalemail","logininvite","installment","security","nightlyresults","benjiinvoice","other","invoicepaid","emailverify"],"description":"Filter by merchant-facing email type. Internal types cannot be queried."}},{"in":"query","name":"status","schema":{"type":"string","enum":["sent","queued","error"],"description":"Filter by delivery status (`sent`, `queued`, `error`)."}},{"in":"query","name":"sentStart","schema":{"description":"Start of the sent-date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — start of that day in UTC (`00:00:00.000Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-02T07:00:00.000Z`) — exact UTC bound. Optional independently of `sentEnd`.","examples":["2024-07-02","2024-07-02T07:00:00.000Z"],"type":"string","maxLength":40},"description":"Start of the sent-date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — start of that day in UTC (`00:00:00.000Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-02T07:00:00.000Z`) — exact UTC bound. Optional independently of `sentEnd`."},{"in":"query","name":"sentEnd","schema":{"description":"End of the sent-date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — end of that day in UTC (`23:59:59.999Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-03T06:59:59.999Z`) — exact UTC bound. Optional independently of `sentStart`.","examples":["2024-07-02","2024-07-03T06:59:59.999Z"],"type":"string","maxLength":40},"description":"End of the sent-date range (inclusive). Two formats: `(1)` Calendar day `YYYY-MM-DD` (e.g. `2024-07-02`) — end of that day in UTC (`23:59:59.999Z`). `(2)` ISO-8601 UTC timestamp (e.g. `2024-07-03T06:59:59.999Z`) — exact UTC bound. Optional independently of `sentStart`."},{"in":"query","name":"search","schema":{"description":"Free-text search across email fields (recipient, subject, etc.).","type":"string","maxLength":200},"description":"Free-text search across email fields (recipient, subject, etc.)."},{"in":"query","name":"sort","schema":{"description":"Sort field (`sentDate`, `subject`, `status`, `type`).","type":"string","enum":["sentDate","subject","status","type"]},"description":"Sort field (`sentDate`, `subject`, `status`, `type`)."},{"in":"query","name":"order","schema":{"description":"Sort direction. Accepted values: `asc`, `desc`. Defaults to `desc` when omitted.","type":"string","enum":["asc","desc"]},"description":"Sort direction. Accepted values: `asc`, `desc`. Defaults to `desc` when omitted."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":1000}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated email list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEmailsResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query/path parameters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:emails:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:emails:read","instance":"/v2/emails"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/emails"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/emails"}}}}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/emails/{emailId}":{"get":{"summary":"Get a single sent email","description":"Returns a single sent email by its `id` (from the list endpoint), including the body content and the full delivery event timeline. Scoped to the authenticated organization and restricted to merchant-facing email types.","tags":["Emails"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"path","name":"emailId","schema":{"type":"string","pattern":"^[a-f\\d]{24}$","description":"The email identifier (`id` from the list endpoint).","example":"6a313b8505f3f5de0b551543"},"required":true,"description":"The email identifier (`id` from the list endpoint)."}],"responses":{"200":{"description":"Email detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetEmailResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query/path parameters; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:emails:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response","examples":{"missingScope":{"summary":"Missing OAuth scope","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Missing required scope: organizations:emails:read","instance":"/v2/emails"}},"insufficientMappingPermission":{"summary":"Insufficient live mapping permission (API key owner)","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Insufficient permission for this resource","instance":"/v2/emails"}},"freeTrialOverNotPaying":{"summary":"Free trial ended without billing","value":{"type":"https://api.benjipays.com/problems/forbidden","title":"Forbidden","status":403,"detail":"Free trial has ended and billing is not enabled","instance":"/v2/emails"}}}}}}},"404":{"description":"Email not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}},"/v2/autoprocessing-forecast":{"get":{"summary":"List the auto-processing forecast for an Organization","description":"Returns a paginated auto-processing forecast: for each open invoice, whether it will be auto-charged on the supplied run date and the reasons behind that decision. Matches the merchant-app batch forecast report. Requires a connected accounting system.","tags":["Autoprocessing"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/RequestIdHeader"},{"$ref":"#/components/parameters/CorrelationIdHeader"},{"in":"query","name":"startDate","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Run/report date the forecast is evaluated against (YYYY-MM-DD, interpreted as UTC)."},"required":true,"description":"Run/report date the forecast is evaluated against (YYYY-MM-DD, interpreted as UTC)."},{"in":"query","name":"invoiceId","schema":{"description":"When provided, forecast only this single accounting-system invoice ID. Pagination parameters are ignored.","type":"string","minLength":1,"maxLength":200,"example":"1042"},"description":"When provided, forecast only this single accounting-system invoice ID. Pagination parameters are ignored."},{"in":"query","name":"limit","schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"offset","schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"Paginated forecast","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListAutoprocessingForecastResponse"}}}},"400":{"description":"Bad request — request validation failed (invalid query parameters, e.g. date; `type` `…/validation-error` with optional `errors[]`), and/or organization has no accounting integration configured.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"403":{"description":"Forbidden — missing required OAuth scope (`organizations:autoprocessing:read`), insufficient live mapping permission on the API key owner (e.g. `companyAdmin`), and/or free trial ended without billing enabled. Scope, mapping, and billing state are independent gates; see response `detail`.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"404":{"description":"Organization not found","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"number"},"detail":{"type":"string"},"instance":{"type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"RFC 7807 Problem Details error response"}}}}}}}},"components":{"parameters":{"RequestIdHeader":{"name":"X-Request-ID","in":"header","required":false,"description":"Optional client-supplied unique ID for one request. The server generates a UUID v4 if omitted and always echoes the value in the response.","schema":{"type":"string","format":"uuid"}},"CorrelationIdHeader":{"name":"X-Correlation-ID","in":"header","required":false,"description":"Optional ID that flows across service boundaries for distributed tracing. The server generates a UUID v4 if omitted and always echoes the value in the response.","schema":{"type":"string","format":"uuid"}},"IdempotencyKeyHeader":{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional client-supplied key that makes retries safe for POST/PATCH/PUT. Scoped per actor; cached for 24 hours. Replays return the cached response with `X-Idempotency-Replayed: true`. Same key with a different body returns 409. In-flight duplicates return 429 with `Retry-After`. See the Idempotency section in the API overview.","schema":{"type":"string","pattern":"^[a-zA-Z0-9]+$","minLength":1,"maxLength":255},"example":"a1b2c3d4e5f6"},"IdempotencyKeyHeaderRequired":{"name":"Idempotency-Key","in":"header","required":true,"description":"Required client-supplied key that makes retries safe for this endpoint. Scoped per actor; cached for 24 hours. Replays return the cached response with `X-Idempotency-Replayed: true`. Same key with a different body returns 409. Missing key returns 400. In-flight duplicates return 429 with `Retry-After`. See the Idempotency section in the API overview.","schema":{"type":"string","pattern":"^[a-zA-Z0-9]+$","minLength":1,"maxLength":255},"example":"a1b2c3d4e5f6"}},"schemas":{"WhoamiResponse":{"type":"object","properties":{"actor":{"$ref":"#/components/schemas/Actor"},"permissions":{"type":"array","items":{"type":"string"},"description":"List of permissions granted to the actor","example":["partners:accounts:read","partners:subscriptions:read"]},"message":{"type":"string","description":"Response message","example":"hello from api /v2/whoami"},"jsIntegrationDemo":{"type":"string","description":"JavaScript integration demo value","example":"demo-value"},"formattedAmount":{"type":"string","description":"Formatted currency amount","example":"$123.46"},"requestTimestamp":{"description":"Request timestamp (included when includeDetails=true)","example":"2024-01-01T00:00:00.000Z","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))$"},"apiVersion":{"description":"API version (included when includeDetails=true)","example":"v2","type":"string"}},"required":["actor","permissions","message","jsIntegrationDemo","formattedAmount"],"additionalProperties":false,"description":"Whoami response"},"ErrorResponse":{"type":"object","properties":{"type":{"type":"string","description":"Problem type URI","example":"https://api.benjipays.com/problems/unauthorized"},"title":{"type":"string","description":"Error title","example":"Unauthorized"},"status":{"type":"number","description":"HTTP status code","example":401},"detail":{"type":"string","description":"Error detail message","example":"Invalid or missing authentication token"},"instance":{"description":"Instance URI","example":"/v2/whoami","type":"string"}},"required":["type","title","status","detail"],"additionalProperties":false,"description":"Error response (RFC 7807 Problem Details)"},"ListOrganizationGatewaysResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationGateway"},"description":"Enabled payment gateways for the organization"}},"required":["data"],"additionalProperties":false,"description":"List organization gateways response"},"ListOrganizationGatewayCapabilitiesResponse":{"type":"object","properties":{"defaults":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"Company default hash per currency. Each value also appears in `data`.","example":{"USD":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"}},"data":{"type":"array","items":{"$ref":"#/components/schemas/GatewayCapability"},"description":"Selectable gateway hashes for the organization"}},"required":["defaults","data"],"additionalProperties":false,"description":"List organization gateway capabilities response"},"OrganizationSettingsResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"autoProcessing":{"type":"object","properties":{"enabled":{"type":"boolean"},"runHour":{"type":"number"},"delayDays":{"type":"number"},"startDate":{"type":["string","null"]},"processCreditMemos":{"type":"boolean"},"useParentProfiles":{"type":"boolean"},"skips":{"type":"object","properties":{"noTermsDisabled":{"type":"boolean"},"skipDueDateNotMet":{"type":"boolean"},"memoSkip":{"anyOf":[{"type":"object","properties":{"text":{"type":["string","null"]},"action":{"type":["string","null"]}},"required":["text","action"],"additionalProperties":false},{"type":"null"}]},"skipSurcharge":{"type":"object","properties":{"enabled":{"type":"boolean"},"min":{"type":["number","null"]},"max":{"type":["number","null"]}},"required":["enabled","min","max"],"additionalProperties":false},"autoProcessAmountSkip":{"type":"object","properties":{"enabled":{"type":"boolean"},"min":{"type":["number","null"]},"max":{"type":["number","null"]}},"required":["enabled","min","max"],"additionalProperties":false},"invoicePrefixSkip":{"type":"object","properties":{"enabled":{"type":"boolean"},"prefixes":{"type":"array","items":{"type":"string"}},"action":{"type":["string","null"]}},"required":["enabled","prefixes","action"],"additionalProperties":false}},"required":["noTermsDisabled","skipDueDateNotMet","memoSkip","skipSurcharge","autoProcessAmountSkip","invoicePrefixSkip"],"additionalProperties":false}},"required":["enabled","runHour","delayDays","startDate","processCreditMemos","useParentProfiles","skips"],"additionalProperties":false},"email":{"type":"object","properties":{"sendReceipts":{"type":"boolean"},"attachInvoice":{"type":"boolean"},"sendInvoiceAttachments":{"type":"boolean"},"disableCompanyEmailResults":{"type":"boolean"},"onlySendAttemptedBatchResults":{"type":"boolean"},"displayInvoiceEmails":{"type":"boolean"},"selectInvoiceEmails":{"type":"boolean"},"autoPaySendReceiptsInvoiceEmails":{"type":"boolean"},"invoiceCcEmails":{"type":"array","items":{"type":"string"}},"invoiceBccEmails":{"type":"array","items":{"type":"string"}},"receiptCcEmails":{"type":"array","items":{"type":"string"}},"receiptBccEmails":{"type":"array","items":{"type":"string"}},"useSmtp":{"type":"boolean"}},"required":["sendReceipts","attachInvoice","sendInvoiceAttachments","disableCompanyEmailResults","onlySendAttemptedBatchResults","displayInvoiceEmails","selectInvoiceEmails","autoPaySendReceiptsInvoiceEmails","invoiceCcEmails","invoiceBccEmails","receiptCcEmails","receiptBccEmails","useSmtp"],"additionalProperties":false},"customerPortal":{"type":"object","properties":{"enabled":{"type":"boolean"},"url":{"type":["string","null"]},"name":{"type":["string","null"]},"theme":{"type":"object","properties":{"colour":{"type":["string","null"]}},"required":["colour"],"additionalProperties":false},"accessDisabled":{"type":"boolean"},"forceSaveCards":{"type":"boolean"},"disableSaveCards":{"type":"boolean"},"autoEnableProfiles":{"type":"boolean"},"allowPortalChangeAutoPay":{"type":"boolean"},"allowPortalManageEmails":{"type":"boolean"},"allowPortalManageAddress":{"type":"boolean"},"allowPortalSchedulePayment":{"type":"boolean"},"allowAllProfileDeleteOnPortal":{"type":"boolean"},"limitOpenInvoicesView":{"type":"boolean"},"showInvoicesAfterDate":{"type":["string","null"]},"displayInvoiceAttachments":{"type":"boolean"},"sendInvoiceAttachments":{"type":"boolean"},"disablePortalEmailLinks":{"type":"boolean"},"disablePaymentAmountInput":{"type":"boolean"},"disablePartialPayments":{"type":"boolean"},"disableGenericPaymentLink":{"type":"boolean"},"payNowAmountRequired":{"type":"boolean"},"customDomain":{"type":["string","null"]},"preAuthAgreements":{"type":"object","properties":{"card":{"type":"object","properties":{"en":{"type":["string","null"]},"fr":{"type":["string","null"]}},"required":["en","fr"],"additionalProperties":false},"ach":{"type":"object","properties":{"en":{"type":["string","null"]},"fr":{"type":["string","null"]}},"required":["en","fr"],"additionalProperties":false},"eft":{"type":"object","properties":{"en":{"type":["string","null"]},"fr":{"type":["string","null"]}},"required":["en","fr"],"additionalProperties":false},"bacs":{"type":"object","properties":{"en":{"type":["string","null"]},"fr":{"type":["string","null"]}},"required":["en","fr"],"additionalProperties":false},"sepa":{"type":"object","properties":{"en":{"type":["string","null"]},"fr":{"type":["string","null"]}},"required":["en","fr"],"additionalProperties":false}},"required":["card","ach","eft","bacs","sepa"],"additionalProperties":false}},"required":["enabled","url","name","theme","accessDisabled","forceSaveCards","disableSaveCards","autoEnableProfiles","allowPortalChangeAutoPay","allowPortalManageEmails","allowPortalManageAddress","allowPortalSchedulePayment","allowAllProfileDeleteOnPortal","limitOpenInvoicesView","showInvoicesAfterDate","displayInvoiceAttachments","sendInvoiceAttachments","disablePortalEmailLinks","disablePaymentAmountInput","disablePartialPayments","disableGenericPaymentLink","payNowAmountRequired","customDomain","preAuthAgreements"],"additionalProperties":false},"accountingSystem":{"type":"object","properties":{"emailAutoEnable":{"type":"boolean"},"autoEnableNewCustomers":{"type":"boolean"},"surchargeAutoEnable":{"type":"boolean"},"bcAutoPostJournals":{"type":"boolean"}},"required":["emailAutoEnable","autoEnableNewCustomers","surchargeAutoEnable","bcAutoPostJournals"],"additionalProperties":false},"security":{"type":"object","properties":{"disableNonSsoLogin":{"type":"boolean"},"enforceMfa":{"type":"boolean"}},"required":["disableNonSsoLogin","enforceMfa"],"additionalProperties":false}},"required":["autoProcessing","email","customerPortal","accountingSystem","security"],"additionalProperties":false}},"required":["data"],"additionalProperties":false,"description":"Organization settings response"},"OrganizationProfileResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"emailAddress":{"type":["string","null"]},"phone":{"type":["string","null"]},"website":{"type":["string","null"]},"enabled":{"type":"boolean"},"createdDate":{"type":["string","null"]},"accountingType":{"type":["string","null"]},"timeZone":{"type":["string","null"]},"accountingCompanyId":{"type":["string","null"]},"address":{"type":["string","null"]},"city":{"type":["string","null"]},"country":{"type":["string","null"]},"postal":{"type":["string","null"]},"province":{"type":["string","null"]},"homeCurrency":{"type":["string","null"]},"gstNumber":{"type":["string","null"]},"logo":{"anyOf":[{"type":"object","properties":{"location":{"type":["string","null"]},"key":{"type":["string","null"]},"width":{"type":["number","null"]},"height":{"type":["number","null"]},"extension":{"type":["string","null"]},"mimetype":{"type":["string","null"]},"size":{"type":["number","null"]}},"required":["location","key","width","height","extension","mimetype","size"],"additionalProperties":false},{"type":"null"}]},"accountingCompanyInfo":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}],"description":"Raw company info from the connected accounting system. The shape is system-specific and NOT normalized (QuickBooks Online, Xero, Business Central, and QuickBooks Desktop each return a different structure). Passed through as-is."}},"required":["id","name","emailAddress","phone","website","enabled","createdDate","accountingType","timeZone","accountingCompanyId","address","city","country","postal","province","homeCurrency","gstNumber","logo","accountingCompanyInfo"],"additionalProperties":false}},"required":["data"],"additionalProperties":false,"description":"Organization profile response"},"ListOrganizationUsersResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationUser"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total matching users across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated organization users response"},"ListInvoicesResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceSummary"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total matching invoices across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated invoice list response (summary DTO only — no accounting passthrough)"},"GetInvoiceResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InvoiceSummary"}},"required":["data"],"additionalProperties":false,"description":"Single invoice response (summary DTO; optional nested accounting when include=accounting)"},"ListCustomersResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerSummary"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total matching customers across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated customer list response (summary DTO only — no accounting passthrough)"},"ListAccountingAccountsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AccountingAccount"}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated Xero chart-account list"},"GetCustomerResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CustomerSummary"}},"required":["data"],"additionalProperties":false,"description":"Single customer response (summary DTO; optional nested accounting when include=accounting)"},"UpdateCustomerSettingsBody":{"type":"object","properties":{"emailRemindersDisabled":{"description":"Invoice Rover for this customer. `true` disables Invoice Rover notifications, `false` enables them. Rejected (any value) when Invoice Rover is not available on the organization's plan.","type":"boolean"},"autoPaySettings":{"$ref":"#/components/schemas/UpdateCustomerAutoPaySettings"},"portalSettings":{"$ref":"#/components/schemas/UpdateCustomerPortalSettings"}},"additionalProperties":false,"description":"Customer settings to change. Only fields defined in this request schema are accepted, using the same names and nesting as the customer object returned by GET. Every field is optional and only the fields sent are changed; nested objects are merged, not replaced.","example":{"emailRemindersDisabled":false,"autoPaySettings":{"delayDays":3},"portalSettings":{"defaultLanguage":"fr"}}},"NoteCategory":{"type":"object","properties":{"slug":{"type":"string","maxLength":100},"displayName":{"type":"string","maxLength":200},"isSystem":{"type":"boolean"},"sortOrder":{"type":"number"},"enabled":{"type":"boolean"}},"required":["slug","displayName","isSystem","enabled"],"additionalProperties":false},"NoteStatus":{"type":"object","properties":{"slug":{"type":"string","maxLength":100},"displayName":{"type":"string","maxLength":200},"isSystem":{"type":"boolean"},"sortOrder":{"type":"number"},"enabled":{"type":"boolean"},"severity":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]}},"required":["slug","displayName","isSystem","enabled"],"additionalProperties":false},"CustomerNoteSummary":{"type":"object","properties":{"id":{"type":"string","maxLength":24},"content":{"type":"string","maxLength":1000},"entityType":{"type":"string","const":"customer"},"entityId":{"type":"string","maxLength":200},"userInformation":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"createdDate":{"anyOf":[{"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))$"},{"type":"null"}]},"updatedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"deletedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"activity":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","enum":["created","edited","deleted","status_changed","pinned","unpinned"]},"at":{"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))$"},"userInformation":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"changes":{"type":"object","properties":{"content":{"type":"boolean"},"categorySlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false},"statusSlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false}},"additionalProperties":false},"reason":{"type":"string","enum":["created","replaced","removed","root_deleted"]},"source":{"type":"string","enum":["note","comment"]},"commentId":{"type":"string","maxLength":24}},"required":["action"],"additionalProperties":false}},"parentNoteId":{"type":"null"},"categorySlug":{"type":"string","maxLength":100},"statusSlug":{"type":"string","maxLength":100},"pinned":{"type":"boolean"},"resolvedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"resolvedBy":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"canDelete":{"type":"boolean"},"replyCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"latestActivityAt":{"anyOf":[{"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))$"},{"type":"null"}]}},"required":["id","content","parentNoteId","categorySlug","statusSlug","pinned","replyCount","latestActivityAt"],"additionalProperties":false},"CustomerNote":{"type":"object","properties":{"id":{"type":"string","maxLength":24},"content":{"type":"string","maxLength":1000},"entityType":{"type":"string","const":"customer"},"entityId":{"type":"string","maxLength":200},"userInformation":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"createdDate":{"anyOf":[{"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))$"},{"type":"null"}]},"updatedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"deletedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"activity":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","enum":["created","edited","deleted","status_changed","pinned","unpinned"]},"at":{"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))$"},"userInformation":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"changes":{"type":"object","properties":{"content":{"type":"boolean"},"categorySlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false},"statusSlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false}},"additionalProperties":false},"reason":{"type":"string","enum":["created","replaced","removed","root_deleted"]},"source":{"type":"string","enum":["note","comment"]},"commentId":{"type":"string","maxLength":24}},"required":["action"],"additionalProperties":false}},"parentNoteId":{"type":"null"},"categorySlug":{"type":"string","maxLength":100},"statusSlug":{"type":"string","maxLength":100},"pinned":{"type":"boolean"},"resolvedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"resolvedBy":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"canDelete":{"type":"boolean"}},"required":["id","content","parentNoteId","categorySlug","statusSlug","pinned"],"additionalProperties":false},"CustomerNoteThread":{"type":"object","properties":{"note":{"$ref":"#/components/schemas/CustomerNoteSummary"},"comments":{"type":"array","items":{"$ref":"#/components/schemas/CustomerNoteComment"}},"activity":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","enum":["created","edited","deleted","status_changed","pinned","unpinned"]},"at":{"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))$"},"userInformation":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"changes":{"type":"object","properties":{"content":{"type":"boolean"},"categorySlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false},"statusSlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false}},"additionalProperties":false},"reason":{"type":"string","enum":["created","replaced","removed","root_deleted"]},"source":{"type":"string","enum":["note","comment"]},"commentId":{"type":"string","maxLength":24}},"required":["action"],"additionalProperties":false}}},"required":["note","comments","activity"],"additionalProperties":false},"CustomerNoteComment":{"type":"object","properties":{"id":{"type":"string","maxLength":24},"content":{"type":"string","maxLength":1000},"entityType":{"type":"string","const":"customer"},"entityId":{"type":"string","maxLength":200},"userInformation":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"createdDate":{"anyOf":[{"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))$"},{"type":"null"}]},"updatedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"deletedAt":{"anyOf":[{"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))$"},{"type":"null"}]},"activity":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string","enum":["created","edited","deleted","status_changed","pinned","unpinned"]},"at":{"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))$"},"userInformation":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string","maxLength":200},"userName":{"type":"string","maxLength":200},"userEmail":{"type":"string","maxLength":320}},"additionalProperties":false},{"type":"null"}]},"changes":{"type":"object","properties":{"content":{"type":"boolean"},"categorySlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false},"statusSlug":{"type":"object","properties":{"from":{"type":"string","maxLength":100},"to":{"type":"string","maxLength":100}},"additionalProperties":false}},"additionalProperties":false},"reason":{"type":"string","enum":["created","replaced","removed","root_deleted"]},"source":{"type":"string","enum":["note","comment"]},"commentId":{"type":"string","maxLength":24}},"required":["action"],"additionalProperties":false}},"parentNoteId":{"type":"string","maxLength":24},"canDelete":{"type":"boolean"}},"required":["id","content","parentNoteId","canDelete"],"additionalProperties":false},"ListPaymentMethodsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethod"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total matching payment methods across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated payment methods response"},"PaymentMethodWithMandate":{"type":"object","properties":{"id":{"type":"string","description":"Payment method identifier (profile `_id`)"},"accountingCompanyId":{"description":"Accounting company ID","type":"string"},"customerId":{"description":"Accounting system customer ID this payment method belongs to","type":"string"},"accountingType":{"description":"Accounting platform type (e.g. quickbooks, xero)","type":"string"},"gatewayProcessor":{"description":"Payment processor identifier (public key, e.g. `benjipayments`)","type":"string"},"gatewayId":{"description":"Gateway store identifier","type":"string"},"gatewayCustomerId":{"description":"Processor-specific customer ID","type":["string","null"]},"vaultToken":{"description":"Processor payment-method token (e.g. Moneris data key, Stripe `pm_…` id), or `null` if none. Treat as sensitive.","type":["string","null"]},"customerName":{"description":"Accounting customer display name (denormalized from the linked customer onto the profile)","type":"string"},"maskedPan":{"description":"Masked card or bank account number","type":"string"},"expiryMonth":{"description":"Card expiry month (CC only)","type":"string"},"expiryYear":{"description":"Card expiry year (CC only)","type":"string"},"cardBrand":{"description":"Card brand, e.g. Visa, Mastercard (CC only)","type":"string"},"paymentType":{"type":"string","description":"Payment type, defaults to \"cc\""},"isDebitCard":{"description":"Whether the card is a debit card (CC only, defaults to false)","type":"boolean"},"autoPayEnabled":{"type":"boolean","description":"Whether autopay is enabled (enabled and not fuse-blown)"},"autoPayPriority":{"description":"Processing priority when multiple methods exist","type":"number"},"benjiSurchargeEnabled":{"type":"boolean","description":"Whether Benji surcharging is enabled (!surchargingDisabled)"},"note":{"type":"string"},"declineCount":{"type":"number","description":"Number of declines, defaults to 0"},"lastDeclineDate":{"type":["string","null"]},"creatorIpAddress":{"type":"string"},"createdDate":{"type":"string"},"lastModifiedDate":{"type":"string"},"mandate":{"anyOf":[{"$ref":"#/components/schemas/Mandate"},{"type":"null"}],"description":"Authorization mandate for this payment method, or null when none was captured"}},"required":["id","paymentType","autoPayEnabled","benjiSurchargeEnabled","declineCount","mandate"],"additionalProperties":false,"description":"Saved payment method with its authorization mandate"},"ListInstallmentPlansResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InstallmentPlan"}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated installment plan list"},"CreateInstallmentPlanRequest":{"type":"object","properties":{"invoiceId":{"type":"string","minLength":1,"maxLength":200,"description":"Accounting invoice id."},"customerId":{"type":"string","minLength":1,"maxLength":200,"description":"Accounting customer id. Must match the customer on the invoice."},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","minLength":10,"maxLength":10,"description":"Charge date, YYYY-MM-DD. Must be on or after the invoice due date."},"amount":{"type":"number","description":"Charge amount. The rows must add up to the invoice balance."}},"required":["date","amount"]},"description":"Scheduled charges for this invoice."}},"required":["invoiceId","customerId","installments"],"description":"Create an installment plan for one invoice."},"InstallmentPlan":{"type":"object","properties":{"id":{"type":"string","description":"Installment plan id"},"invoiceId":{"description":"Accounting invoice id","type":["string","null"]},"customerId":{"description":"Accounting customer id","type":["string","null"]},"invoiceNumber":{"type":["string","null"]},"invoiceTotal":{"type":["number","null"]},"invoiceBalance":{"type":["number","null"]},"dates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Installment date id"},"date":{"description":"Charge date, YYYY-MM-DD","type":["string","null"]},"amount":{"description":"Charge amount","type":["number","null"]}},"required":["id","date","amount"],"additionalProperties":false}}},"required":["id","invoiceId","customerId","invoiceNumber","invoiceTotal","invoiceBalance","dates"],"additionalProperties":false,"description":"Invoice installment plan."},"CreateUnappliedPaymentLinkResponse":{"type":"object","properties":{"url":{"type":"string","description":"Portal pay-now link to send to the customer."},"expiresAt":{"type":"string","description":"ISO timestamp when the link expires."}},"required":["url","expiresAt"],"additionalProperties":false,"description":"Unapplied payment link response"},"CreateAppliedPaymentLinkResponse":{"type":"object","properties":{"url":{"type":"string","description":"Portal pay-now link tied to the invoice (tokenized)."},"expiresAt":{"type":"string","description":"ISO 8601 expiry timestamp for the payment link token."}},"required":["url","expiresAt"],"additionalProperties":false,"description":"Applied payment link response"},"ListPaymentMethodRequestsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethodRequest"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total matching payment method requests across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated payment-method-request list response"},"PaymentMethodRequest":{"type":"object","properties":{"id":{"type":"string","description":"Payment method request Mongo id."},"url":{"type":"string","description":"Portal link to send to the customer so they can save a payment method. Does not email or SMS."},"status":{"type":"string","enum":["pending","completed"],"description":"Request status. Create always returns `pending`. Completed after the customer saves a payment method."},"customerId":{"description":"Accounting system customer ID the request is for.","type":["string","null"]},"currency":{"description":"Normalized 3-letter currency code.","type":["string","null"]},"gatewayId":{"description":"Resolved gateway store identifier (or default-currency hash).","type":["string","null"]},"createdDate":{"description":"ISO timestamp when the request was created.","type":["string","null"]},"completedDate":{"description":"ISO timestamp when the customer completed the request, or null if still pending.","type":["string","null"]}},"required":["id","url","status","customerId","currency","gatewayId","createdDate","completedDate"],"additionalProperties":false,"description":"Payment method on-file request"},"ListWebhooksResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookRegistrationSummary"}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"One page of webhook registrations"},"WebhookRegistration":{"type":"object","properties":{"id":{"type":"string","description":"Webhook registration id."},"url":{"type":"string","description":"Normalized HTTPS URL that receives events."},"enabled_events":{"type":"array","items":{"type":"string","enum":["payment.succeeded","payment.failed"]},"description":"Event types sent to this URL."},"status":{"type":"string","enum":["enabled"],"description":"Registration status. Create always returns `enabled`."},"secret":{"type":"string","description":"Signing secret used to verify the `Benji-Signature` header. Returned only on create. Store it securely; it cannot be retrieved again."},"created":{"description":"ISO timestamp when the registration was created.","type":["string","null"]}},"required":["id","url","enabled_events","status","secret","created"],"additionalProperties":false,"description":"Webhook registration"},"ListWebhookDeliveriesResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"One page of webhook deliveries"},"WebhookRegistrationSummary":{"type":"object","properties":{"id":{"type":"string","description":"Webhook registration id."},"url":{"type":"string","description":"Normalized HTTPS URL that receives events."},"enabled_events":{"type":"array","items":{"type":"string","enum":["payment.succeeded","payment.failed"]},"description":"Event types sent to this URL."},"status":{"type":"string","enum":["enabled"],"description":"Registration status. Create always returns `enabled`."},"created":{"description":"ISO timestamp when the registration was created.","type":["string","null"]}},"required":["id","url","enabled_events","status","created"],"additionalProperties":false,"description":"Webhook registration. The signing secret is not included."},"UpdateWebhookRegistration":{"type":"object","properties":{"url":{"description":"Public HTTPS URL that receives event POSTs. Localhost, private, and link-local addresses are rejected. Must be unique per organization. Omit to leave the URL unchanged.","example":"https://example.com/benji/webhooks","pattern":"^https://","type":"string","minLength":1,"maxLength":2048,"format":"uri"},"enabled_events":{"description":"Event types to send to this URL. Replaces the current list. At least one when sent. Omit to leave the list unchanged.","example":["payment.succeeded","payment.failed"],"minItems":1,"type":"array","items":{"type":"string","enum":["payment.succeeded","payment.failed"]}}},"additionalProperties":false,"description":"Fields to change on a webhook registration. At least one of `url` or `enabled_events` is required. The signing secret is not changed."},"ListTransactionsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Transaction"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total matching transactions across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated transactions response"},"CreateTransactionResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Transaction"},"meta":{"type":"object","properties":{"effects":{"type":"object","properties":{"charge":{"$ref":"#/components/schemas/TransactionEffectResult"},"accounting":{"$ref":"#/components/schemas/TransactionEffectResult"},"receipt":{"$ref":"#/components/schemas/TransactionEffectResult"}},"required":["charge","accounting","receipt"],"additionalProperties":false,"description":"Charge, accounting apply, and receipt outcomes for this request"}},"required":["effects"],"additionalProperties":false,"description":"Create-charge response metadata"}},"required":["data","meta"],"additionalProperties":false,"description":"Create transaction (invoice charge) response"},"RetryChargeAccountingResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Transaction"},"meta":{"type":"object","properties":{"effects":{"type":"object","properties":{"accounting":{"$ref":"#/components/schemas/TransactionEffectResult"}},"required":["accounting"],"additionalProperties":false,"description":"Accounting writeback outcome for this retry (no charge, no receipt)"}},"required":["effects"],"additionalProperties":false,"description":"Retry-accounting response metadata"}},"required":["data","meta"],"additionalProperties":false,"description":"Retry accounting writeback response"},"ResendTransactionReceiptResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Transaction"},"meta":{"type":"object","properties":{"effects":{"type":"object","properties":{"receipt":{"$ref":"#/components/schemas/TransactionEffectResult"}},"required":["receipt"],"additionalProperties":false,"description":"Receipt resend outcome for this request (no charge, no accounting)"}},"required":["effects"],"additionalProperties":false,"description":"Resend-receipt response metadata"}},"required":["data","meta"],"additionalProperties":false,"description":"Resend transaction receipt response"},"ListEmailsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EmailSummary"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total matching emails across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated email list response"},"GetEmailResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/EmailDetail"}},"required":["data"],"additionalProperties":false,"description":"Single email response"},"ListAutoprocessingForecastResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AutoprocessingForecastItem"}},"pagination":{"type":"object","properties":{"total":{"type":"number","description":"Total open invoices across all pages"},"limit":{"type":"number"},"offset":{"type":"number"},"hasMore":{"type":"boolean"},"nextOffset":{"type":["number","null"]},"prevOffset":{"type":["number","null"]}},"required":["total","limit","offset","hasMore","nextOffset","prevOffset"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false,"description":"Paginated auto-processing forecast response"},"Actor":{"type":"object","properties":{"type":{"type":"string","enum":["distributor","partner","internal","organization"],"description":"Type of actor","example":"partner"},"actorId":{"description":"Actor identifier","example":"bp-actor-123","type":"string"}},"required":["type"],"additionalProperties":false,"description":"Actor information for the authenticated caller"},"OrganizationGateway":{"type":"object","properties":{"id":{"type":"string","description":"Gateway store identifier","example":"store_abc123"},"gatewayProcessor":{"type":"string","description":"Payment processor key","example":"benjipayments"},"description":{"description":"Human-readable gateway label","example":"Main Benji Payments terminal","type":["string","null"]},"portalMessage":{"description":"Message displayed on the payment portal","type":["string","null"]},"currencies":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"Currency code","example":"CAD"}},"required":["value"],"additionalProperties":{},"description":"Currency entry"},"description":"Supported currency codes for this gateway"},"enabled":{"type":"boolean","description":"Whether the gateway is enabled","example":true},"enabledPayments":{"type":"array","items":{"type":"string"},"description":"Enabled payment types","example":["cc","eft"]},"surchargeEnabled":{"anyOf":[{"type":"string","enum":["benjipays","gateway"]},{"type":"null"}],"description":"Surcharge mode: \"benjipays\" (managed by Benji Payments) or \"gateway\" (managed by the processor); null when disabled"},"surchargeNoPopup":{"type":"boolean","description":"Whether the surcharge disclosure popup is suppressed"},"createdDate":{"description":"Gateway creation timestamp (ISO 8601)","type":["string","null"]},"lastModifiedDate":{"description":"Gateway last modified timestamp (ISO 8601)","type":["string","null"]},"terminalIds":{"description":"Connected PIN pad terminal IDs (Moneris only)","type":"array","items":{"type":"string"}},"shopperStatement":{"description":"Statement descriptor shown to cardholders (Benji Payments and Elavon only)","type":["string","null"]},"mccEnabled":{"description":"Whether MCC is enabled (Elavon only)","type":"boolean"},"automatedReconciliationEnabled":{"description":"Whether automated reconciliation is enabled (Benji Payments only)","type":"boolean"},"balanceAccountSettlementTiming":{"description":"Settlement timing configuration keyed by balance account (Benji Payments only)","anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"eftMaxBatchAmount":{"description":"Maximum EFT batch amount (Bambora only)","type":["number","null"]},"ebpMaxBatchLineAmount":{"description":"Maximum EBP batch line amount (Bambora only)","type":["number","null"]},"ebpCreditLag":{"description":"EBP credit lag in days (Bambora only)","type":["number","null"]},"surchargeOptions":{"description":"Surcharge card-type options (non-Benji Payments, when surcharging enabled)","anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"surchargeDebitEnabled":{"description":"Whether debit cards are surcharged (Benji Payments, when surcharging enabled)","type":"boolean"},"surchargePercentages":{"description":"Surcharge percentages by card type (when surcharging enabled)","type":"object","properties":{"othercc":{"type":"number","description":"Surcharge percentage applied to non-Amex credit cards","example":3},"amex":{"description":"Surcharge percentage applied to Amex (Benji Payments only)","example":3.5,"type":"number"}},"required":["othercc"],"additionalProperties":false}},"required":["id","gatewayProcessor","description","portalMessage","currencies","enabled","enabledPayments","surchargeEnabled","surchargeNoPopup","createdDate","lastModifiedDate"],"additionalProperties":false,"description":"Payment gateway configuration for an organization"},"GatewayCapability":{"type":"object","properties":{"hash":{"type":"string","description":"SHA-256 gateway hash identifying this capability.","example":"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"},"paymentTypes":{"type":"array","items":{"type":"string","enum":["cc","ach","eft","sepa","bacs"]},"description":"Payment types this hash can collect, in canonical order","example":["cc","ach"]},"currencies":{"type":"array","items":{"type":"string"},"description":"ISO currency codes this hash supports","example":["USD"]},"setup":{"type":"object","properties":{"card":{"type":"boolean","description":"True when paymentTypes includes cc"},"bank":{"type":"boolean","description":"True when paymentTypes includes ach, eft, bacs, or sepa"}},"required":["card","bank"],"additionalProperties":false,"description":"Whether this hash can collect card and/or bank payments"},"gateways":{"type":"array","items":{"$ref":"#/components/schemas/CapabilityGateway"},"description":"Enabled stores inside this hash"}},"required":["hash","paymentTypes","currencies","setup","gateways"],"additionalProperties":false,"description":"One selectable gateway hash and the payment types it can collect"},"OrganizationUser":{"type":"object","properties":{"id":{"type":"string","description":"Login account identifier"},"firstName":{"description":"User first name","type":["string","null"]},"lastName":{"description":"User last name","type":["string","null"]},"emailAddress":{"description":"User email address","type":["string","null"]},"mfaEnabled":{"type":"boolean","description":"Whether MFA is enabled for this user"},"enabled":{"type":"boolean","description":"Whether the user is enabled for this organization"},"companyAdmin":{"type":"boolean","description":"Whether the user is a company admin for this organization"}},"required":["id","firstName","lastName","emailAddress","mfaEnabled","enabled","companyAdmin"],"additionalProperties":false,"description":"Organization user"},"InvoiceSummary":{"type":"object","properties":{"id":{"description":"Accounting system invoice ID (same value accepted by GET /invoices/:invoiceId)","type":["string","null"]},"invoiceNumber":{"description":"Human-readable invoice number (filter: invoiceNumber)","type":["string","null"]},"invoiceDate":{"description":"Invoice date YYYY-MM-DD (filter: invoiceDateStart/End)","type":["string","null"]},"dueDate":{"description":"Due date YYYY-MM-DD (filter: dueDateStart/End)","type":["string","null"]},"postingDate":{"description":"Business Central posting date YYYY-MM-DD. Null for other accounting systems and when no valid date is stored. A future date means the invoice cannot be charged until that date.","type":["string","null"]},"createdDate":{"description":"Created / approved timestamp when available (MetaData.CreateTime or bpApprovedDate)","type":["string","null"]},"total":{"description":"Invoice total (currency-sensible, 2dp)","type":["number","null"]},"balance":{"description":"Amount remaining (currency-sensible, 2dp)","type":["number","null"]},"subtotal":{"type":["number","null"]},"taxTotal":{"type":["number","null"]},"currency":{"description":"ISO 4217 currency code","type":["string","null"]},"status":{"type":"string","enum":["open","paid","overdue"],"description":"Per-invoice Benji status derived from balance / due date: `overdue` when unpaid past due, `open` when unpaid and not yet due, `paid` when balance is zero. Note the list `?status=open` filter returns all unpaid invoices regardless of due date, so it can include invoices whose own `status` here reads `overdue`; use `?status=overdue` to filter to only those. Native accounting status (Xero/BC) is only under `accounting` when include=accounting."},"paid":{"type":"boolean"},"emailed":{"type":"boolean"},"terms":{"$ref":"#/components/schemas/InvoiceTerms"},"brandingTheme":{"$ref":"#/components/schemas/InvoiceBrandingTheme"},"reference":{"type":["string","null"]},"memo":{"type":["string","null"]},"lastModifiedDate":{"type":["string","null"]},"customer":{"$ref":"#/components/schemas/InvoiceCustomer"},"accounting":{"description":"Full stored invoice object (fields from the accounting system plus our own). Only present on GET /invoices/:invoiceId when include=accounting.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","invoiceNumber","invoiceDate","dueDate","postingDate","createdDate","total","balance","subtotal","taxTotal","currency","status","paid","emailed","terms","brandingTheme","reference","memo","lastModifiedDate","customer"],"additionalProperties":false,"description":"Benji-controlled camelCase invoice summary. Top-level = stable API; optional `accounting` = full stored invoice (accounting-system fields plus our own; detail + include=accounting only)."},"CustomerSummary":{"type":"object","properties":{"id":{"description":"Accounting system customer ID (same value accepted by GET /customers/:customerId)","type":["string","null"]},"name":{"description":"Customer display name from the accounting system","type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"active":{"type":"boolean"},"isProject":{"description":"QBO-only (Jobs/sub-customers); omitted entirely for QBD, Xero, and Business Central.","type":"boolean"},"parents":{"description":"Sub-customer/job hierarchy, direct parent first. QBO/QBD only; omitted entirely for Xero/Business Central.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id"],"additionalProperties":false}},"balance":{"type":["number","null"]},"currency":{"description":"ISO 4217 currency code when available","type":["string","null"]},"billingAddress":{"$ref":"#/components/schemas/CustomerBillingAddress"},"createdDate":{"type":["string","null"]},"lastModifiedDate":{"type":["string","null"]},"emails":{"type":"array","items":{"$ref":"#/components/schemas/CustomerEmail"}},"paymentMethodsCount":{"type":"number"},"autoPaySettings":{"$ref":"#/components/schemas/CustomerAutoPaySettings"},"emailRemindersDisabled":{"type":"boolean"},"portalSettings":{"$ref":"#/components/schemas/CustomerPortalSettings"},"accounting":{"description":"Full stored customer object (fields from the accounting system plus our own). Only present on GET /customers/:customerId when include=accounting.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","name","email","phone","active","balance","currency","billingAddress","createdDate","lastModifiedDate","emails","paymentMethodsCount","autoPaySettings","emailRemindersDisabled","portalSettings"],"additionalProperties":false,"description":"Benji-controlled camelCase customer summary. Top-level = stable API; optional `accounting` = full stored customer (accounting-system fields plus our own; detail + include=accounting only)."},"AccountingAccount":{"type":"object","properties":{"id":{"type":"string","description":"Xero account id. Same value the deposit charge accepts (`revenueAccountId` for prepayment, `bankAccountId` for overpayment)."},"name":{"type":["string","null"]},"type":{"type":["string","null"]},"currency":{"description":"Xero currency code, or null when the account has none.","type":["string","null"]}},"required":["id","name","type","currency"],"additionalProperties":false,"description":"Xero chart account for a deposit. Not a gateway deposit or refund account."},"UpdateCustomerAutoPaySettings":{"type":"object","properties":{"delayDays":{"description":"Days relative to the invoice due date at which to auto-process this customer. Use a positive number to wait past the due date and a negative number to process before the due date. Whole number from -365 to 365 (both bounds inclusive). Rejected while statement processing is enabled for the organization.","example":3,"type":"integer","minimum":-365,"maximum":365},"applyCreditMemos":{"description":"Automatically apply credit memos for this customer. Rejected when automatic credit memo application is not available to the organization.","type":"boolean"},"surchargingDisabled":{"description":"Set `true` to turn off Benji Pays-managed surcharging for this customer. Rejected when the organization has no gateway with Benji Pays-managed surcharging.","type":"boolean"},"autoProcessingDisabled":{"description":"Set `true` to exclude this customer from automated processing. Rejected when auto processing is not available to the organization.","type":"boolean"}},"additionalProperties":false,"description":"Per-customer auto-pay / processing settings to change. Only the fields sent are changed.","minProperties":1},"UpdateCustomerPortalSettings":{"type":"object","properties":{"portalAccessDisabled":{"description":"Set `true` to block this customer from the customer portal. Rejected when the customer portal is not available to the organization.","type":"boolean"},"defaultLanguage":{"description":"Language for communications with this customer. `null` uses the organization default.","example":"fr","anyOf":[{"type":"string","enum":["en","fr"]},{"type":"null"}]},"forceSavePaymentMethod":{"description":"Per-customer override of \"force save payment method\". `true` always saves the payment method, `false` never does, and `null` inherits (from the parent profile customer when parent profiles are enabled, otherwise from the portal setting).","type":["boolean","null"]}},"additionalProperties":false,"description":"Per-customer portal settings to change. Only the fields sent are changed.","minProperties":1},"PaymentMethod":{"type":"object","properties":{"id":{"type":"string","description":"Payment method identifier (profile `_id`)"},"accountingCompanyId":{"description":"Accounting company ID","type":"string"},"customerId":{"description":"Accounting system customer ID this payment method belongs to","type":"string"},"accountingType":{"description":"Accounting platform type (e.g. quickbooks, xero)","type":"string"},"gatewayProcessor":{"description":"Payment processor identifier (public key, e.g. `benjipayments`)","type":"string"},"gatewayId":{"description":"Gateway store identifier","type":"string"},"gatewayCustomerId":{"description":"Processor-specific customer ID","type":["string","null"]},"vaultToken":{"description":"Processor payment-method token (e.g. Moneris data key, Stripe `pm_…` id), or `null` if none. Treat as sensitive.","type":["string","null"]},"customerName":{"description":"Accounting customer display name (denormalized from the linked customer onto the profile)","type":"string"},"maskedPan":{"description":"Masked card or bank account number","type":"string"},"expiryMonth":{"description":"Card expiry month (CC only)","type":"string"},"expiryYear":{"description":"Card expiry year (CC only)","type":"string"},"cardBrand":{"description":"Card brand, e.g. Visa, Mastercard (CC only)","type":"string"},"paymentType":{"type":"string","description":"Payment type, defaults to \"cc\""},"isDebitCard":{"description":"Whether the card is a debit card (CC only, defaults to false)","type":"boolean"},"autoPayEnabled":{"type":"boolean","description":"Whether autopay is enabled (enabled and not fuse-blown)"},"autoPayPriority":{"description":"Processing priority when multiple methods exist","type":"number"},"benjiSurchargeEnabled":{"type":"boolean","description":"Whether Benji surcharging is enabled (!surchargingDisabled)"},"note":{"type":"string"},"declineCount":{"type":"number","description":"Number of declines, defaults to 0"},"lastDeclineDate":{"type":["string","null"]},"creatorIpAddress":{"type":"string"},"createdDate":{"type":"string"},"lastModifiedDate":{"type":"string"}},"required":["id","paymentType","autoPayEnabled","benjiSurchargeEnabled","declineCount"],"additionalProperties":false,"description":"Saved payment method for an accounting customer"},"Mandate":{"type":"object","properties":{"id":{"type":"string","description":"Mandate identifier"},"acceptedAt":{"description":"When the customer accepted off-session billing authorization (ISO-8601)","type":["string","null"]},"ip":{"description":"IP address recorded at acceptance","type":["string","null"]},"type":{"description":"Where the customer agreed: `web-app`, `payment-portal`, `customer-portal`, `api`, `billing-profile`, or `advanced-notification`.","type":["string","null"]},"agreement":{"description":"Authorization text the customer agreed to","type":["string","null"]},"loginName":{"description":"Portal user name, if the mandate was accepted by a logged-in portal user","type":["string","null"]},"loginEmail":{"description":"Portal user email, if the mandate was accepted by a logged-in portal user","type":["string","null"]}},"required":["id","acceptedAt","ip","type","agreement","loginName","loginEmail"],"additionalProperties":false,"description":"Off-session billing authorization mandate, e.g. for chargeback defense (Stripe accepted_at/IP)"},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","description":"Webhook delivery id."},"webhook_id":{"type":"string","description":"Webhook registration id this delivery was sent for."},"event_type":{"type":"string","enum":["payment.succeeded","payment.failed"],"description":"Event type that was delivered."},"status":{"type":"string","enum":["pending","sent","failed"],"description":"Delivery status."},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"How many send attempts have been made."},"transaction_id":{"description":"Transaction id for this delivery, when the event is for a charge.","type":["string","null"]},"url":{"type":"string","description":"URL the delivery was sent to."},"created":{"description":"ISO timestamp when the delivery was created.","type":["string","null"]},"sent_at":{"description":"ISO timestamp when the delivery was accepted. Null until it is sent.","type":["string","null"]},"next_attempt_at":{"description":"ISO timestamp of the next send attempt. Null when no retry is scheduled.","type":["string","null"]},"last_error":{"description":"Short text from the last failed attempt. Null when the last attempt succeeded or none has run.","type":["string","null"]}},"required":["id","webhook_id","event_type","status","attempts","transaction_id","url","created","sent_at","next_attempt_at","last_error"],"additionalProperties":false,"description":"Webhook delivery. The signing secret and raw request body are not included."},"Transaction":{"type":"object","properties":{"id":{"type":"string","description":"Transaction identifier (result `_id`)"},"type":{"description":"Transaction type (e.g. payment, void, refund, deposit)","type":["string","null"]},"amount":{"description":"Transaction amount (`amountChargedToCard` or `amount`), rounded to 2 decimal places","type":["number","null"]},"surchargeRate":{"type":["number","null"]},"surchargeAmount":{"description":"Surcharge amount, rounded to 2 decimal places","type":["number","null"]},"currency":{"type":["string","null"]},"approved":{"type":["boolean","null"]},"status":{"description":"Stored status (e.g. `approved`, `declined`, `queued`, `pending`, `approved_void_pending`). `inprocess` is a list filter, not a stored value.","type":["string","null"]},"paymentType":{"description":"e.g. cc, bank","type":["string","null"]},"details":{"type":"object","properties":{"message":{"description":"Gateway message (card payments)","type":["string","null"]},"maskedPan":{"description":"Masked card number","type":["string","null"]},"cardType":{"description":"Card brand (e.g. Visa, Mastercard)","type":["string","null"]},"receiptNumber":{"type":["string","null"]},"paymentRef":{"description":"Gateway payment reference","type":["string","null"]},"account":{"description":"Masked bank account number (bank payments)","type":["string","null"]}},"additionalProperties":false,"description":"Payment details (legacy `details` object)"},"paymentLocation":{"description":"Where the payment was made. Known values: `web-app` (merchant app), `customer-portal` (customer portal), `payment-portal` (pay link / payment portal), `api` (API charge, including `POST /v2/transactions`). Null when the result has no stored `paymentLocation`.","type":["string","null"]},"accountingPaymentId":{"description":"Accounting system payment id","type":["string","null"]},"surchargeJournalEntryId":{"type":["string","null"]},"surchargeJournalEntryNumber":{"type":["string","null"]},"transactionDate":{"description":"ISO date of transaction","type":["string","null"]},"integrationData":{"description":"External integration data (e.g. Quoter)","anyOf":[{"type":"object","properties":{"dataId":{"description":"External integration data id (e.g. Quoter quote id)","type":["string","null"]},"integrationType":{"description":"Integration source type","type":["string","null"]}},"additionalProperties":false,"description":"Integration payload from external sources"},{"type":"null"}]},"paymentsToMake":{"description":"Invoice payments to apply (null for void/refund)","anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/PaymentAllocation"}},{"type":"null"}]},"customerId":{"description":"Accounting system customer ID","type":["string","null"]},"voided":{"type":["boolean","null"]},"voidTransactions":{"description":"Void transaction details (void type only)","anyOf":[{"type":"array","items":{"type":"object","properties":{"paymentId":{"description":"Accounting payment id for the void/refund","type":["string","null"]},"payments":{"description":"Original invoice allocations","anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/PaymentAllocation"}},{"type":"null"}]},"paymentRefNumber":{"description":"Gateway payment reference number (void only)","type":["string","null"]}},"additionalProperties":false,"description":"Void or refund transaction detail"}},{"type":"null"}]},"refundTransactions":{"description":"Refund transaction details (refund type only)","anyOf":[{"type":"array","items":{"type":"object","properties":{"paymentId":{"description":"Accounting payment id for the void/refund","type":["string","null"]},"payments":{"description":"Original invoice allocations","anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/PaymentAllocation"}},{"type":"null"}]},"paymentRefNumber":{"description":"Gateway payment reference number (void only)","type":["string","null"]}},"additionalProperties":false,"description":"Void or refund transaction detail"}},{"type":"null"}]},"dueDate":{"description":"Invoice due date","type":["string","null"]},"estimatedSettlementDate":{"description":"Estimated settlement date (Benji Payments)","type":["string","null"]},"invoiceNumber":{"description":"Accounting invoice number","type":["string","null"]},"invoiceId":{"description":"Accounting invoice ID","type":["string","null"]},"customerName":{"description":"Customer display name","type":["string","null"]},"result":{"description":"Raw result string from gateway","type":["string","null"]},"paymentSubType":{"description":"Payment sub-type (e.g. debit)","type":["string","null"]},"surchargeReportingAmount":{"description":"Surcharge amount used for reporting, rounded to 2 decimal places","type":["number","null"]},"commissions":{"description":"Platform commission amount, rounded to 2 decimal places","type":["number","null"]},"expectedSettlementAmount":{"description":"Expected net settlement amount, rounded to 2 decimal places","type":["number","null"]},"gatewayId":{"type":["string","null"]},"gatewayProcessor":{"description":"e.g. benjipayments, bambora, moneris, elavon, stripe, clover","type":["string","null"]},"settlementEligible":{"type":"boolean","description":"Whether settlement tracking applies (e.g. Benji Payments)"},"settlementStatus":{"type":"string","enum":["open","complete","error","na"],"description":"Derived settlement status; `na` when not settlement-eligible"},"settlementDate":{"description":"ISO actual settlement date, or null","type":["string","null"]},"paymentApplied":{"description":"Whether payment was applied in accounting","type":["boolean","null"]},"batchRefNumber":{"description":"Bank batch reference number","type":["string","null"]}},"required":["id","details","settlementEligible","settlementStatus","settlementDate"],"additionalProperties":false,"description":"A single payment transaction"},"TransactionEffectResult":{"type":"object","properties":{"status":{"type":"string","enum":["succeeded","voided","failed","skipped","notified"],"description":"Outcome of one side effect for this create-charge request. `notified` is used when a BACS/SEPA advance notice was sent and the debit is scheduled for later."},"detail":{"description":"Human-readable processing messages when present; null when there are none","type":["string","null"]},"paymentId":{"description":"Accounting payment id when accounting apply succeeded (accounting effect only)","type":["string","null"]}},"required":["status","detail"],"additionalProperties":false,"description":"Side-effect result bucket"},"EmailSummary":{"type":"object","properties":{"id":{"type":"string","description":"Email identifier (Mongo `_id`)"},"type":{"description":"Email type (e.g. invoice, receipt, emailreminder)","type":["string","null"]},"status":{"description":"Delivery status (sent, queued, error)","type":["string","null"]},"subject":{"type":["string","null"]},"from":{"type":["string","null"]},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"sentDate":{"anyOf":[{"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))$"},{"type":"null"}],"description":"ISO-8601 UTC timestamp the email was created/sent"},"opened":{"type":"boolean"},"lastOpened":{"anyOf":[{"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))$"},{"type":"null"}],"description":"ISO-8601 UTC timestamp of the last non-bot open"},"bounced":{"type":"boolean"},"delivered":{"type":"boolean"},"customerId":{"description":"Accounting customer ID","type":["string","null"]},"invoiceIds":{"type":"array","items":{"type":"string"},"description":"Associated accounting invoice IDs"},"sentBy":{"description":"Display name of the user who sent the email","type":["string","null"]},"reminderRule":{"$ref":"#/components/schemas/EmailReminderRule"},"hasAttachments":{"type":"boolean"}},"required":["id","type","status","subject","from","to","cc","bcc","sentDate","opened","lastOpened","bounced","delivered","customerId","invoiceIds","sentBy","reminderRule","hasAttachments"],"additionalProperties":false,"description":"A sent email (summary)"},"EmailDetail":{"type":"object","properties":{"id":{"type":"string","description":"Email identifier (Mongo `_id`)"},"type":{"description":"Email type (e.g. invoice, receipt, emailreminder)","type":["string","null"]},"status":{"description":"Delivery status (sent, queued, error)","type":["string","null"]},"subject":{"type":["string","null"]},"from":{"type":["string","null"]},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}},"sentDate":{"anyOf":[{"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))$"},{"type":"null"}],"description":"ISO-8601 UTC timestamp the email was created/sent"},"opened":{"type":"boolean"},"lastOpened":{"anyOf":[{"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))$"},{"type":"null"}],"description":"ISO-8601 UTC timestamp of the last non-bot open"},"bounced":{"type":"boolean"},"delivered":{"type":"boolean"},"customerId":{"description":"Accounting customer ID","type":["string","null"]},"invoiceIds":{"type":"array","items":{"type":"string"},"description":"Associated accounting invoice IDs"},"sentBy":{"description":"Display name of the user who sent the email","type":["string","null"]},"reminderRule":{"$ref":"#/components/schemas/EmailReminderRule"},"hasAttachments":{"type":"boolean"},"html":{"description":"HTML body of the email","type":["string","null"]},"text":{"description":"Plain-text body of the email","type":["string","null"]},"events":{"type":"array","items":{"$ref":"#/components/schemas/EmailEvent"},"description":"Full delivery event timeline"}},"required":["id","type","status","subject","from","to","cc","bcc","sentDate","opened","lastOpened","bounced","delivered","customerId","invoiceIds","sentBy","reminderRule","hasAttachments","html","text","events"],"additionalProperties":false,"description":"A sent email (detail, with body and event timeline)"},"AutoprocessingForecastItem":{"type":"object","properties":{"id":{"description":"Accounting system invoice ID","type":["string","null"]},"invoiceNumber":{"description":"Invoice document number","type":["string","null"]},"customerId":{"description":"Accounting customer ID","type":["string","null"]},"customerName":{"type":["string","null"]},"currency":{"type":["string","null"]},"dueDate":{"description":"Invoice due date (YYYY-MM-DD)","type":["string","null"]},"amountToCharge":{"description":"Amount that would be charged","type":["number","null"]},"willBeCharged":{"type":"boolean","description":"Whether the invoice will be auto-charged on the run date"},"dueDateMet":{"type":"boolean"},"autoProcessingEnabled":{"type":"boolean","description":"Whether auto-processing is enabled for the customer"},"hasEnabledProfile":{"type":"boolean","description":"Whether an enabled payment profile exists"},"hasInstallments":{"type":"boolean"},"installmentDateMet":{"description":"Whether an installment date is met; null when no installments","type":["boolean","null"]},"startDateMet":{"type":"boolean"},"memoSkip":{"type":"boolean","description":"Whether the invoice is skipped by the memo rule"},"amountSkip":{"type":"boolean","description":"Whether the invoice is skipped by the amount rule"},"reasons":{"type":"array","items":{"type":"string"},"description":"Human-readable reasons explaining the forecast outcome"}},"required":["id","invoiceNumber","customerId","customerName","currency","dueDate","amountToCharge","willBeCharged","dueDateMet","autoProcessingEnabled","hasEnabledProfile","hasInstallments","installmentDateMet","startDateMet","memoSkip","amountSkip","reasons"],"additionalProperties":false,"description":"Auto-processing forecast for a single invoice"},"CapabilityGateway":{"type":"object","properties":{"id":{"type":"string","description":"Gateway store identifier. Same as GET /v2/gateways `id`.","example":"store_cc_001"},"description":{"description":"Human-readable gateway label","example":"Main Benji Payments terminal","type":["string","null"]},"gatewayProcessor":{"type":"string","description":"Public processor key","example":"benjipayments"},"paymentTypes":{"type":"array","items":{"type":"string","enum":["cc","ach","eft","sepa","bacs"]},"description":"Payment types this store handles in this hash","example":["cc"]}},"required":["id","description","gatewayProcessor","paymentTypes"],"additionalProperties":false,"description":"Store inside a gateway hash"},"InvoiceTerms":{"anyOf":[{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Payment terms (id + name). Null for systems that do not use terms (e.g. Xero — use brandingTheme)."},"InvoiceBrandingTheme":{"anyOf":[{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":["string","null"]}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Xero branding theme (id + name). Null for non-Xero systems."},"InvoiceCustomer":{"anyOf":[{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"description":"Customer display name from the accounting system","type":["string","null"]},"active":{"type":"boolean"},"isProject":{"description":"QBO-only (Jobs/sub-customers); omitted entirely for QBD, Xero, and Business Central.","type":"boolean"},"parents":{"description":"Sub-customer/job hierarchy, direct parent first. QBO/QBD only; omitted entirely for Xero/Business Central.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]}},"required":["id"],"additionalProperties":false}}},"required":["id","name","active"],"additionalProperties":false},{"type":"null"}],"description":"Customer enrichment (from BenjiCustomer), camelCase, no internal Mongo fields."},"CustomerBillingAddress":{"anyOf":[{"type":"object","properties":{"line1":{"type":["string","null"]},"line2":{"type":["string","null"]},"city":{"type":["string","null"]},"region":{"type":["string","null"]},"postalCode":{"type":["string","null"]},"country":{"type":["string","null"]}},"required":["line1","city","postalCode","country"],"additionalProperties":false},{"type":"null"}],"description":"Billing address normalized across accounting systems."},"CustomerEmail":{"type":"object","properties":{"email":{"type":"string"},"enabled":{"type":"boolean"},"source":{"type":"string"}},"required":["email"],"additionalProperties":false,"description":"Customer email entry (Benji emails[] slimmed for the API)."},"CustomerAutoPaySettings":{"type":"object","properties":{"applyCreditMemos":{"type":"boolean"},"autoProcessingDisabled":{"type":"boolean"},"delayDays":{"type":"number"},"surchargingDisabled":{"type":"boolean"},"autoProcessAmountSkip":{"anyOf":[{},{"type":"null"}]}},"required":["applyCreditMemos","autoProcessingDisabled","delayDays","surchargingDisabled","autoProcessAmountSkip"],"additionalProperties":false,"description":"Per-customer auto-pay / processing overrides."},"CustomerPortalSettings":{"type":"object","properties":{"portalAccessDisabled":{"type":"boolean"},"defaultLanguage":{"type":["string","null"]},"forceSavePaymentMethod":{"description":"Customer-level override of \"force save payment method\": `true` = force, `false` = never, `null` = inherit (from the parent profile customer when parent profiles are enabled, otherwise from the portal setting). This is the stored customer value, not the resolved effective value.","type":["boolean","null"]}},"required":["portalAccessDisabled","defaultLanguage","forceSavePaymentMethod"],"additionalProperties":false,"description":"Per-customer portal overrides (portal.* company settings)."},"PaymentAllocation":{"type":"object","properties":{"invoiceId":{"description":"Accounting invoice ID","type":["string","null"]},"amount":{"description":"Amount applied to this invoice, rounded to 2 decimal places","type":["number","null"]},"invoiceNumber":{"description":"Accounting invoice number","type":["string","null"]},"currency":{"description":"Invoice currency","type":["string","null"]},"installmentDateId":{"description":"Installment plan date identifier","type":["string","null"]},"installmentDate":{"description":"Installment due date","type":["string","null"]},"installmentAmount":{"description":"Installment amount, rounded to 2 decimal places","type":["number","null"]},"date":{"description":"Invoice date (YYYY-MM-DD)","type":["string","null"]}},"required":["invoiceId","amount","invoiceNumber","currency","installmentDateId","installmentDate","installmentAmount","date"],"additionalProperties":false,"description":"Invoice payment allocation"},"EmailReminderRule":{"anyOf":[{"type":"object","properties":{"displayName":{"description":"Friendly reminder rule name, resolved from email-reminder settings","type":["string","null"]}},"required":["displayName"],"additionalProperties":false},{"type":"null"}],"description":"Reminder rule descriptor for reminder emails; null for non-reminder emails"},"EmailEvent":{"type":"object","properties":{"type":{"type":"string","description":"Event type (e.g. Send, Delivery, Open, Bounce, Complaint)"},"timestamp":{"anyOf":[{"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))$"},{"type":"null"}],"description":"ISO-8601 UTC timestamp of the event"},"recipients":{"description":"Recipients for delivery events","type":"array","items":{"type":"string"}}},"required":["type","timestamp"],"additionalProperties":false,"description":"A single delivery event"}},"headers":{"XRequestId":{"description":"Echoes the request ID (incoming `X-Request-ID` header or server-generated UUID v4).","schema":{"type":"string","format":"uuid"}},"XCorrelationId":{"description":"Echoes the correlation ID for distributed tracing (incoming `X-Correlation-ID` header or server-generated UUID v4).","schema":{"type":"string","format":"uuid"}},"XIdempotencyReplayed":{"description":"Present and set to `true` only when a cached idempotent response is being replayed.","schema":{"type":"string","enum":["true"]}},"RetryAfter":{"description":"Number of seconds the client should wait before retrying. Sent with 429 responses (rate-limit exceeded or idempotency in-flight).","schema":{"type":"integer","minimum":0}},"XRateLimitLimit":{"description":"Maximum requests allowed in the current sliding window.","schema":{"type":"integer","minimum":0}},"XRateLimitRemaining":{"description":"Requests remaining in the current window.","schema":{"type":"integer","minimum":0}},"XRateLimitReset":{"description":"Unix timestamp (seconds) when the current window resets.","schema":{"type":"integer","minimum":0}}},"responses":{"TooManyRequests":{"description":"Rate limit exceeded, or an idempotent request with the same key is still being processed. Retry after the duration indicated by `Retry-After`.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"X-Request-ID":{"$ref":"#/components/headers/XRequestId"},"X-Correlation-ID":{"$ref":"#/components/headers/XCorrelationId"}},"content":{"application/problem+json":{"schema":{"type":"object","description":"RFC 7807 Problem Details for 429 responses.","properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer","enum":[429]},"detail":{"type":"string"},"instance":{"type":"string"},"requestId":{"type":"string","format":"uuid"},"correlationId":{"type":"string","format":"uuid"},"retryAfterSeconds":{"type":"integer","minimum":0}},"required":["type","title","status"]}}}}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Organization-scoped API key. Send it in the x-api-key header. Available on organization endpoints only."}}}}