{"openapi":"3.1.2","info":{"title":"Custard API","version":"0.2.0","description":"The Custard API manages saved invoices, recurring schedules, customers, payment methods and workspace settings using the same rules as the Custard application. It also generates free invoice PDFs without an account. Requests use HTTP methods and JSON; responses contain JSON or a private file attachment.\n\nSee [authentication](/docs/authentication), [API keys](/docs/http-api-keys) and [invoice operations](/docs/invoice-operations). Anonymous PDF generation remains separate from saved workspace invoices."},"servers":[{"url":"/v1","description":"Same deployment as this reference"}],"tags":[{"name":"Authenticated API","description":"Manage saved workspace resources as a user with a workspace-bound API key."},{"name":"Invoice PDFs","description":"Generate an invoice PDF from the details in your request. No account is required."}],"paths":{"/invoice-pdfs":{"post":{"operationId":"generateInvoicePdf","tags":["Invoice PDFs"],"summary":"Create an invoice PDF","security":[],"description":"Creates an A4 invoice PDF from the details in your request. Returns the PDF as an attachment, with calculated amounts in the X-Invoice-* response headers.\n\nNo account is required. Omit the Authorization header; a supplied credential is rejected. This operation does not save an invoice or customer, reserve a workspace number, publish a page or send email.\n\nSend monetary amounts as decimal strings and dates as YYYY-MM-DD. The due date must be on or after the issue date. Supply either discount or discountRate. The server rounds each line to the currency precision, applies the discount, then calculates tax on the discounted subtotal.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreeInvoicePdfRequest"},"example":{"number":"INV-2026-001","issueDate":"2026-10-24","dueDate":"2026-11-23","currency":"USD","issuer":{"name":"Example Studio","email":"billing@example.com","address":"10 Example Street\nLondon, UK"},"customer":{"name":"Example Client","email":"accounts@example.net","address":"20 Sample Avenue\nNew York, US"},"items":[{"description":"Design services","quantity":"2","unitPrice":"125.50"}],"discountRate":"10","taxRate":"20","notes":"Thank you for your business.","paymentInstructions":"Please include the invoice number as your payment reference.","bankAccount":{"accountHolderName":"Example Studio","bankName":"Example Bank","currency":"USD","details":[{"label":"Account number","value":"000123456789"}]}}}}},"responses":{"200":{"description":"A PDF attachment. The example produces subtotal 251, discount 25.1, tax 45.18 and total 271.08 USD.","headers":{"Content-Disposition":{"description":"Attachment filename, including UTF-8 filename*.","schema":{"type":"string"}},"X-Request-Id":{"description":"Identifier for support.","schema":{"type":"string"}},"X-Invoice-Subtotal":{"description":"Calculated decimal subtotal.","schema":{"type":"string"}},"X-Invoice-Discount":{"description":"Calculated decimal discount amount.","schema":{"type":"string"}},"X-Invoice-Tax":{"description":"Calculated decimal tax amount.","schema":{"type":"string"}},"X-Invoice-Total":{"description":"Calculated decimal total.","schema":{"type":"string"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"The request body is not valid JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"This endpoint is anonymous. Omit Authorization; use the authenticated saved-invoice routes for account invoices.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"The request's browser origin is not allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"406":{"description":"The client does not accept a PDF response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"The request body exceeds 128 KiB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send an uncompressed application/json request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Check the invoice fields. The discount must not exceed the subtotal, and the PDF must fit within 10 pages and 5 MiB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"A request limit or rendering capacity was reached. Wait for the number of seconds in Retry-After before retrying.","headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"PDF generation is temporarily unavailable. No PDF was returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/entitlements":{"get":{"operationId":"getEntitlements","summary":"Get organization plan and feature access","tags":["Authenticated API"],"description":"Reads plan access for this key's organization. When Stripe is configured, source=provider and plan/status/isPremium/dates come from reconciled server-owned subscription state. Without Stripe configuration, source=unconfigured, status=unavailable and plan/isPremium/dates are null. Existing API access stays unmetered during the billing rollout. Feature flags do not override role/resource permissions or guarantee provider/MCP readiness. Null limits mean no access restriction. Never infer a paid subscription from unmetered access. Read-only; members and admins may call it. No query parameters or organization override are accepted.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/OrganizationEntitlements"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/organizations":{"get":{"operationId":"listAccountOrganizations","summary":"List your account's organization memberships","tags":["Authenticated API"],"description":"Returns your account membership summaries (WorkOS organization ID, name and role), without granting access to those organizations' invoices. Existing resource routes remain bound to this key's organization. This account-level metadata operation is not paginated.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"array","items":{"type":"object","required":["workosOrganizationId","name","role","current"],"properties":{"workosOrganizationId":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["admin","user"]},"current":{"type":"boolean"}}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"createAccountOrganization","summary":"Create a business organization","tags":["Authenticated API"],"description":"Creates a business organization using the same onboarding requirement and creation limits as the app (3 attempts per day, 10 active creations). Returns id, workosOrganizationId and name. Reuse Idempotency-Key on retries. The current key stays bound to its original organization; create a separate key in the new organization to access it.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["id","workosOrganizationId","name"],"properties":{"id":{"type":"string","format":"uuid"},"workosOrganizationId":{"type":"string"},"name":{"type":"string"}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/organization/leave":{"post":{"operationId":"leaveOrganization","summary":"Leave the key's organization","tags":["Authenticated API"],"description":"Leaves only this key's organization using the native owner, last-admin and remaining-organization safeguards. Success immediately removes this key's membership access. A retry may return 401/403 because membership is gone.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"null"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/organization":{"delete":{"operationId":"deleteOrganization","summary":"Delete the key's organization","tags":["Authenticated API"],"description":"Deletes only this key's organization for all members. Requires an admin, another active organization membership and an exact confirmation name. Saved records are hidden using the native soft-deletion service. Success invalidates subsequent requests using this organization's keys; a retry may return 401/403/404. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmation":{"type":"string","minLength":1,"maxLength":200}},"required":["confirmation"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"null"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"operationId":"getOrganization","summary":"Get the key's organization","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedOrganization"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updateOrganization","summary":"Replace organization details","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"legalName":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"website":{"type":"string","maxLength":200},"address":{"type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":50},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"}},"required":["name","legalName","email","website","address","color"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedOrganization"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/me":{"get":{"operationId":"getProfile","summary":"Get your profile","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedProfile"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"updateProfile","summary":"Update your name and personal role","tags":["Authenticated API"],"description":"Partial update of firstName, lastName and personal role. Changes are saved to the same identity/profile records the app reads. Email, password and linked sign-in changes require interactive verification and are not accepted here.","security":[{"CustomerApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","minLength":1,"maxLength":80},"lastName":{"type":"string","maxLength":80},"role":{"type":"string","maxLength":120}},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedProfile"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/me/photo":{"get":{"operationId":"getProfilePhoto","summary":"Download your profile photo","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"Private file attachment.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"image/png":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"updateProfilePhoto","summary":"Upload a profile photo","tags":["Authenticated API"],"description":"Send base64 PNG or JPEG image bytes, at least 96 × 96 pixels and up to 3 MiB decoded. The same native image pipeline normalizes and stores the photo. Returns hasPhoto. JSON upload routes allow 4.25 MiB bodies to fit the hosting request limit.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["image/png","image/jpeg"]},"base64":{"type":"string","minLength":4,"maxLength":4194304,"pattern":"^[A-Za-z0-9+/]+={0,2}$"}},"required":["name","contentType","base64"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["hasPhoto"],"properties":{"hasPhoto":{"type":"boolean"}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"deleteProfilePhoto","summary":"Remove your profile photo","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["hasPhoto"],"properties":{"hasPhoto":{"type":"boolean"}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/receipts":{"post":{"operationId":"uploadReceipt","summary":"Upload a private payment receipt","tags":["Authenticated API"],"description":"Send name, contentType and base64 file bytes (without a data: prefix), up to 3 MiB decoded. Returns key, name, contentType and size. Pass this receipt record when recording a bank payment. The receipt is private; download it through an accessible invoice.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"base64":{"type":"string","minLength":4,"maxLength":4194304,"pattern":"^[A-Za-z0-9+/]+={0,2}$"}},"required":["name","contentType","base64"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedReceipt"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/receipt":{"get":{"operationId":"downloadReceipt","summary":"Download an accessible invoice's payment receipt","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"Private file attachment.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/organization/logo":{"post":{"operationId":"uploadOrganizationLogo","summary":"Replace the organization logo","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["image/png","image/jpeg"]},"base64":{"type":"string","minLength":4,"maxLength":4194304,"pattern":"^[A-Za-z0-9+/]+={0,2}$"}},"required":["name","contentType","base64"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedOrganization"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"removeOrganizationLogo","summary":"Remove the organization logo","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedOrganization"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/template-assets/logo":{"post":{"operationId":"uploadTemplateLogo","summary":"Upload a template logo","tags":["Authenticated API"],"description":"Uploads and normalizes an image; returns logoUrl. Reference this URL in PUT /invoice-settings to save a custom template logo. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["image/png","image/jpeg"]},"base64":{"type":"string","minLength":4,"maxLength":4194304,"pattern":"^[A-Za-z0-9+/]+={0,2}$"}},"required":["name","contentType","base64"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["logoUrl"],"properties":{"logoUrl":{"type":"string"}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/template-assets/background":{"post":{"operationId":"uploadTemplateBackground","summary":"Upload a template background","tags":["Authenticated API"],"description":"Uploads and normalizes an image; returns backgroundUrl. Reference this URL in PUT /invoice-settings to save a template background. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["image/png","image/jpeg"]},"base64":{"type":"string","minLength":4,"maxLength":4194304,"pattern":"^[A-Za-z0-9+/]+={0,2}$"}},"required":["name","contentType","base64"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["backgroundUrl"],"properties":{"backgroundUrl":{"type":"string"}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices":{"get":{"operationId":"listInvoices","summary":"List accessible invoices","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."},{"in":"query","name":"status","schema":{"type":"string","enum":["draft","sent","viewed","paid","cancelled","overdue","scheduled"]}},{"in":"query","name":"customerId","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"scheduleId","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedInvoice"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"issueInvoice","summary":"Create a draft, issue an invoice or start a recurring series","tags":["Authenticated API"],"description":"Uses the same issuance flow as Custard. draft saves privately; one-time publishes now; recurring creates a private first invoice and a schedule. A schedule can generate private drafts or email at its configured local time. Monetary amounts are decimal strings. requestId must equal Idempotency-Key. Returns the first invoice with recurringScheduleId when applicable. Email delivery must be configured for sendEmail or email schedules.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"type":"object","properties":{"sequenceNumber":{"type":"string","pattern":"^\\d{1,10}$"},"customerId":{"type":"string","minLength":1,"maxLength":200},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"currencyFormat":{"type":"object","properties":{"name":{"default":"","type":"string","maxLength":80},"symbol":{"type":"string","minLength":1,"maxLength":12},"position":{"type":"string","enum":["prefix","suffix"]},"decimals":{"type":"integer","minimum":0,"maximum":18},"spaceBetween":{"type":"boolean"},"groupThousands":{"type":"boolean"}},"required":["symbol","position","decimals","spaceBetween","groupThousands"]},"template":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"items":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"unitPrice":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"}},"required":["description","quantity","unitPrice"]}},"discount":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"discountRate":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxName":{"type":"string","maxLength":40},"delivery":{"type":"object","properties":{"mode":{"type":"string","enum":["email","link","schedule"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"boolean"}},"required":["mode"]},"notes":{"default":"","type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}},"paymentMethodIds":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"acceptCards":{"type":"boolean"},"access":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"principalType":{"type":"string","enum":["user","group"]},"principalId":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["view","edit"]}},"required":["principalType","principalId","level"]}}},"required":["customerId","currency","issueDate","dueDate","items"]},"issuance":{"type":"string","enum":["one-time","draft","recurring"]},"recurrence":{"type":"object","properties":{"frequency":{"type":"string","enum":["weekly","monthly","quarterly","yearly","custom"]},"interval":{"anyOf":[{"type":"object","properties":{"count":{"type":"integer","minimum":1,"maximum":1000},"unit":{"type":"string","enum":["days","months"]}},"required":["count","unit"]},{"type":"null"}]},"endDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"memo":{"default":"","type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}}},"required":["frequency"]},"schedule":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"deliveryMode":{"default":"draft","type":"string","enum":["draft","email"]}},"required":["startDate","startTime","timezone"]},"paid":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"method":{"type":"string","enum":["crypto","bank","card"]},"paymentMethodId":{"type":"string","minLength":1,"maxLength":200},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"transactionUrl":{"default":"","type":"string","maxLength":500},"memo":{"default":"","type":"string","maxLength":1000},"routing":{"type":"object","properties":{"asset":{"type":"string","minLength":1,"maxLength":20},"network":{"type":"string","minLength":1,"maxLength":60},"invoiced":{"type":"string","maxLength":40},"received":{"type":"string","maxLength":40},"fees":{"default":[],"maxItems":5,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["platform","card","swap"]},"amount":{"type":"string","maxLength":40},"percent":{"type":"string","maxLength":12},"fixed":{"type":"string","maxLength":40}},"required":["kind","amount"]}}},"required":["asset","network","invoiced","received"]},"receipt":{"type":"object","properties":{"key":{"type":"string","maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"size":{"type":"integer","exclusiveMinimum":0,"maximum":10485760}},"required":["key","name","contentType","size"]}},"required":["date","method"]},"sendEmail":{"type":"boolean"},"requestId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"existingId":{"type":"string","minLength":1},"releaseSchedule":{"type":"boolean"}},"required":["invoice","issuance","requestId"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}":{"get":{"operationId":"getInvoice","summary":"Get an invoice","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updateInvoice","summary":"Replace editable invoice fields","tags":["Authenticated API"],"description":"Supply all invoice fields. Paid invoices cannot be edited. Published unpaid invoices can be edited using the native app rules; existing invoice numbers are retained.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sequenceNumber":{"type":"string","pattern":"^\\d{1,10}$"},"customerId":{"type":"string","minLength":1,"maxLength":200},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"currencyFormat":{"type":"object","properties":{"name":{"default":"","type":"string","maxLength":80},"symbol":{"type":"string","minLength":1,"maxLength":12},"position":{"type":"string","enum":["prefix","suffix"]},"decimals":{"type":"integer","minimum":0,"maximum":18},"spaceBetween":{"type":"boolean"},"groupThousands":{"type":"boolean"}},"required":["symbol","position","decimals","spaceBetween","groupThousands"]},"template":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"items":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"unitPrice":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"}},"required":["description","quantity","unitPrice"]}},"discount":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"discountRate":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxName":{"type":"string","maxLength":40},"delivery":{"type":"object","properties":{"mode":{"type":"string","enum":["email","link","schedule"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"boolean"}},"required":["mode"]},"notes":{"default":"","type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}},"paymentMethodIds":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"acceptCards":{"type":"boolean"},"access":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"principalType":{"type":"string","enum":["user","group"]},"principalId":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["view","edit"]}},"required":["principalType","principalId","level"]}}},"required":["customerId","currency","issueDate","dueDate","items"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"updateInvoiceStatus","summary":"Change lifecycle status or payment methods","tags":["Authenticated API"],"description":"Supply status and paymentMethodIds. Valid transitions follow the native app: draft to sent, sent to paid, or void. Paid documents are locked here; use the explicit void action to void a paid invoice. A paid state is represented by paidAt while stored status remains sent.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["draft","sent","paid","cancelled"]},"paymentMethodIds":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"payment":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"method":{"type":"string","enum":["crypto","bank","card"]},"paymentMethodId":{"type":"string","minLength":1,"maxLength":200},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"transactionUrl":{"default":"","type":"string","maxLength":500},"memo":{"default":"","type":"string","maxLength":1000},"routing":{"type":"object","properties":{"asset":{"type":"string","minLength":1,"maxLength":20},"network":{"type":"string","minLength":1,"maxLength":60},"invoiced":{"type":"string","maxLength":40},"received":{"type":"string","maxLength":40},"fees":{"default":[],"maxItems":5,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["platform","card","swap"]},"amount":{"type":"string","maxLength":40},"percent":{"type":"string","maxLength":12},"fixed":{"type":"string","maxLength":40}},"required":["kind","amount"]}}},"required":["asset","network","invoiced","received"]},"receipt":{"type":"object","properties":{"key":{"type":"string","maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"size":{"type":"integer","exclusiveMinimum":0,"maximum":10485760}},"required":["key","name","contentType","size"]}},"required":["date","method"]}},"required":["status","paymentMethodIds"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/pdf":{"get":{"operationId":"downloadInvoicePdf","summary":"Download an invoice PDF","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"Private file attachment.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/publish":{"post":{"operationId":"publishInvoice","summary":"Publish a draft","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/void":{"post":{"operationId":"voidInvoice","summary":"Void an invoice, including a paid invoice","tags":["Authenticated API"],"description":"Voids an invoice, including an already paid invoice, using the native app rules. Returns status cancelled; the app displays this as Voided. Cancels pending email deliveries. It does not refund or reverse a payment.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/duplicate":{"post":{"operationId":"duplicateInvoice","summary":"Duplicate an invoice as a new draft","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/send":{"post":{"operationId":"sendInvoice","summary":"Send a draft invoice by email","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/remind":{"post":{"operationId":"remindInvoice","summary":"Request an invoice reminder","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedDelivery"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/{id}/mark-paid":{"post":{"operationId":"markInvoicePaid","summary":"Record a manual payment","tags":["Authenticated API"],"description":"Records a manual payment, its date and optional receipt. No funds move and no blockchain verification occurs. The invoice must be published. Routed payment details cannot be supplied by callers.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"method":{"type":"string","enum":["crypto","bank","card"]},"paymentMethodId":{"type":"string","minLength":1,"maxLength":200},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"transactionUrl":{"default":"","type":"string","maxLength":500},"memo":{"default":"","type":"string","maxLength":1000},"receipt":{"type":"object","properties":{"key":{"type":"string","maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"size":{"type":"integer","exclusiveMinimum":0,"maximum":10485760}},"required":["key","name","contentType","size"]}},"required":["date","method"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoice"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/deliveries/{id}/retry":{"post":{"operationId":"retryInvoiceDelivery","summary":"Retry a failed invoice delivery","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"acknowledgedUncertain":{"default":false,"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedDelivery"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/schedules":{"get":{"operationId":"listSchedules","summary":"List accessible recurring and one-time schedules","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedSchedule"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/schedules/{id}":{"get":{"operationId":"getSchedule","summary":"Get a schedule","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedSchedule"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"operationId":"updateSchedule","summary":"Update timing, recurrence or invoice template","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"schedule":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"deliveryMode":{"default":"draft","type":"string","enum":["draft","email"]}},"required":["startDate","startTime","timezone"]},"frequency":{"type":"string","enum":["weekly","monthly","quarterly","yearly","custom"]},"interval":{"anyOf":[{"type":"object","properties":{"count":{"type":"integer","minimum":1,"maximum":1000},"unit":{"type":"string","enum":["days","months"]}},"required":["count","unit"]},{"type":"null"}]},"endDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"memo":{"type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}},"template":{"type":"object","properties":{"sequenceNumber":{"type":"string","pattern":"^\\d{1,10}$"},"customerId":{"type":"string","minLength":1,"maxLength":200},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"currencyFormat":{"type":"object","properties":{"name":{"default":"","type":"string","maxLength":80},"symbol":{"type":"string","minLength":1,"maxLength":12},"position":{"type":"string","enum":["prefix","suffix"]},"decimals":{"type":"integer","minimum":0,"maximum":18},"spaceBetween":{"type":"boolean"},"groupThousands":{"type":"boolean"}},"required":["symbol","position","decimals","spaceBetween","groupThousands"]},"template":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"items":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"unitPrice":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"}},"required":["description","quantity","unitPrice"]}},"discount":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"discountRate":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxName":{"type":"string","maxLength":40},"delivery":{"type":"object","properties":{"mode":{"type":"string","enum":["email","link","schedule"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"boolean"}},"required":["mode"]},"notes":{"default":"","type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}},"paymentMethodIds":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"acceptCards":{"type":"boolean"},"access":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"principalType":{"type":"string","enum":["user","group"]},"principalId":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["view","edit"]}},"required":["principalType","principalId","level"]}}},"required":["customerId","currency","issueDate","dueDate","items"]}}}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedSchedule"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/schedules/{id}/pause":{"post":{"operationId":"pauseSchedule","summary":"Pause a schedule","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedSchedule"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/schedules/{id}/resume":{"post":{"operationId":"resumeSchedule","summary":"Resume a schedule","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedSchedule"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/schedules/{id}/stop":{"post":{"operationId":"stopSchedule","summary":"Stop a schedule","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedSchedule"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoices/validate":{"post":{"operationId":"validateInvoice","summary":"Validate invoice fields and resolve its customer without saving","tags":["Authenticated API"],"description":"Side-effect-free preflight for incomplete invoice JSON. Resolves an accessible customer by exact email/company/name/ID, reports all field and receiving-reference issues, and uses native invoice validation and totals on a private copy. Does not reserve numbers, save, publish or send email. A valid report does not guarantee unchanged state at execution. No Idempotency-Key required.","security":[{"CustomerApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"customer":{"type":"string","minLength":1,"maxLength":254}},"required":["invoice"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/InvoiceValidation"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/customers/validate":{"post":{"operationId":"validateCustomer","summary":"Validate a customer profile and check for duplicate email","tags":["Authenticated API"],"description":"Checks the complete customer profile and workspace-scoped case-insensitive email uniqueness without saving or enriching. Optional id validates an update. Returns an accessible existing customer on duplicate email. No Idempotency-Key required.","security":[{"CustomerApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"id":{"type":"string","maxLength":100}},"required":["customer"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/CustomerValidation"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/customers/resolve":{"get":{"operationId":"resolveCustomer","summary":"Resolve an accessible customer by exact email, company name or ID","tags":["Authenticated API"],"description":"Searches all accessible customers. A single exact email, ID, company or contact name resolves; ambiguous exact names or partial matches return candidates for clarification. No inferred choice or cross-workspace lookup.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"search","required":true,"schema":{"type":"string","minLength":1,"maxLength":254},"description":"Exact email, company/name or customer ID. Partial matches are suggestions only; ambiguous exact matches require clarification."},{"in":"query","name":"search","required":true,"schema":{"type":"string","minLength":1,"maxLength":254},"description":"Exact email, company/name or customer ID. Partial matches are suggestions only; ambiguous exact matches require clarification."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/CustomerResolution"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/customers":{"get":{"operationId":"listCustomers","summary":"List customers","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedCustomer"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"createCustomer","summary":"Create a Customer","tags":["Authenticated API"],"description":"Creates a customer after native validation. Email is trimmed/lowercased and unique per workspace; duplicates return 409 customer_exists. Missing logos use the email domain through the shared Context.dev cache; provider failure falls back to initials and explicit logos remain unchanged. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string"},"address":{"default":"","type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":64},"website":{"default":"","type":"string","maxLength":200},"currency":{"default":"","type":"string","pattern":"^([A-Z][A-Z0-9]{1,11})?$"},"notes":{"default":"","type":"string","maxLength":2000},"logoUrl":{"default":"","type":"string","maxLength":400000,"pattern":"^(data:image\\/png;base64,[A-Za-z0-9+/]+={0,2})?$"}},"required":["name","company","email"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedCustomer"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/customers/{id}":{"get":{"operationId":"getCustomer","summary":"Get a Customer","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedCustomer"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updateCustomer","summary":"Replace a Customer","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string"},"address":{"default":"","type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":64},"website":{"default":"","type":"string","maxLength":200},"currency":{"default":"","type":"string","pattern":"^([A-Z][A-Z0-9]{1,11})?$"},"notes":{"default":"","type":"string","maxLength":2000},"logoUrl":{"default":"","type":"string","maxLength":400000,"pattern":"^(data:image\\/png;base64,[A-Za-z0-9+/]+={0,2})?$"}},"required":["name","company","email"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedCustomer"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"deleteCustomer","summary":"Delete a customer without invoices","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedCustomer"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/payment-methods":{"get":{"operationId":"listPaymentMethods","summary":"List payment-methods","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedPaymentMethod"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"createPaymentMethod","summary":"Create a PaymentMethod","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"network":{"type":"string","minLength":1,"maxLength":80},"asset":{"type":"string","enum":["USDC","USDT"]},"tokens":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[A-Z0-9.]{1,12}$"}},"address":{"type":"string","minLength":1,"maxLength":300},"instructions":{"default":"","type":"string","maxLength":1000}},"required":["name","network","asset","address"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedPaymentMethod"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/payment-methods/{id}":{"get":{"operationId":"getPaymentMethod","summary":"Get a PaymentMethod","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedPaymentMethod"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updatePaymentMethod","summary":"Replace a PaymentMethod","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"network":{"type":"string","minLength":1,"maxLength":80},"asset":{"type":"string","enum":["USDC","USDT"]},"tokens":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[A-Z0-9.]{1,12}$"}},"address":{"type":"string","minLength":1,"maxLength":300},"instructions":{"default":"","type":"string","maxLength":1000}},"required":["name","network","asset","address"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedPaymentMethod"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/bank-accounts":{"get":{"operationId":"listBankAccounts","summary":"List bank-accounts","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedBankAccount"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"createBankAccount","summary":"Create a BankAccount","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"default":"","type":"string","maxLength":20},"bankCountry":{"type":"string"},"currency":{"type":"string"},"rail":{"type":"string"},"accountHolderName":{"type":"string","minLength":1,"maxLength":100},"bankName":{"default":"","type":"string","maxLength":200},"accountType":{"default":"checking","anyOf":[{"type":"string","enum":["checking","savings"]},{"type":"null"}]},"achEnabled":{"default":true,"type":"boolean"},"wireEnabled":{"default":false,"type":"boolean"},"fields":{"default":{},"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":300}},"address":{"type":"object","properties":{"country":{"default":"","type":"string"},"streetLine1":{"default":"","type":"string","maxLength":100},"streetLine2":{"default":"","type":"string","maxLength":100},"city":{"default":"","type":"string","maxLength":100},"postalCode":{"default":"","type":"string","maxLength":20},"subdivision":{"default":"","type":"string","maxLength":100}}},"instructions":{"default":"","type":"string","maxLength":1000}},"required":["bankCountry","currency","rail","accountHolderName","address"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedBankAccount"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/bank-accounts/{id}":{"get":{"operationId":"getBankAccount","summary":"Get a BankAccount","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedBankAccount"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updateBankAccount","summary":"Replace a BankAccount","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"default":"","type":"string","maxLength":20},"bankCountry":{"type":"string"},"currency":{"type":"string"},"rail":{"type":"string"},"accountHolderName":{"type":"string","minLength":1,"maxLength":100},"bankName":{"default":"","type":"string","maxLength":200},"accountType":{"default":"checking","anyOf":[{"type":"string","enum":["checking","savings"]},{"type":"null"}]},"achEnabled":{"default":true,"type":"boolean"},"wireEnabled":{"default":false,"type":"boolean"},"fields":{"default":{},"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":300}},"address":{"type":"object","properties":{"country":{"default":"","type":"string"},"streetLine1":{"default":"","type":"string","maxLength":100},"streetLine2":{"default":"","type":"string","maxLength":100},"city":{"default":"","type":"string","maxLength":100},"postalCode":{"default":"","type":"string","maxLength":20},"subdivision":{"default":"","type":"string","maxLength":100}}},"instructions":{"default":"","type":"string","maxLength":1000}},"required":["bankCountry","currency","rail","accountHolderName","address"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedBankAccount"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/payment-networks":{"get":{"operationId":"listPaymentNetworks","summary":"List built-in and custom payment networks","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"array","items":{"type":"string"}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"createPaymentNetwork","summary":"Create a custom payment network","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80}},"required":["name"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["id","organizationId","name"],"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoice-settings":{"get":{"operationId":"getInvoiceSettings","summary":"Get invoice-settings","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoiceSettings"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updateInvoiceSettings","summary":"Replace invoice-settings","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"numberPattern":{"default":"INV-[Number]","type":"string","minLength":1,"maxLength":60},"defaultCurrency":{"default":"USD","type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"dueDays":{"default":30,"type":"integer","minimum":0,"maximum":365},"defaultNote":{"default":"","type":"string","maxLength":3000},"taxName":{"default":"","type":"string","maxLength":40},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"applyTaxByDefault":{"default":false,"type":"boolean"},"emails":{"default":{"status":"pending","fromName":"","fromLocalPart":"invoices","replyTo":""},"type":"object","properties":{"status":{"default":"pending","type":"string","enum":["pending","verified","failed"]},"fromName":{"default":"","type":"string","maxLength":80},"fromLocalPart":{"default":"invoices","type":"string","pattern":"^[a-z0-9](?:[a-z0-9._+-]{0,62}[a-z0-9])?$"},"replyTo":{"default":"","type":"string","maxLength":254}}},"domain":{"default":{"kind":"subdomain","subdomain":"","customDomain":"","status":"pending"},"type":"object","properties":{"kind":{"default":"subdomain","type":"string","enum":["subdomain","custom"]},"subdomain":{"default":"","type":"string","pattern":"^(?:[a-z0-9][a-z0-9-]{1,61}[a-z0-9])?$"},"customDomain":{"default":"","type":"string","pattern":"^(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63})?$"},"status":{"default":"pending","type":"string","enum":["pending","active","failed"]}}},"reminders":{"default":{"enabled":false,"offsets":[-3,0,7]},"type":"object","properties":{"enabled":{"default":false,"type":"boolean"},"timezone":{"type":"string","maxLength":100},"offsets":{"minItems":3,"maxItems":3,"type":"array","items":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}}},"required":["offsets"]},"templates":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^tpl_[a-z0-9]{6,32}$"},"name":{"type":"string","minLength":1,"maxLength":40},"header":{"default":"standard","type":"string","enum":["standard","letterhead","banner","sidebar"]},"partyPictures":{"default":true,"type":"boolean"},"details":{"default":"beside","type":"string","enum":["beside","row","hidden"]},"summary":{"default":"hidden","type":"string","enum":["hidden","top","below"]},"payButton":{"default":true,"type":"boolean"},"paymentLayout":{"default":"standard","type":"string","enum":["standard","details"]},"paymentTheme":{"default":"device","type":"string","enum":["light","dark","device"]},"theme":{"default":"light","type":"string","enum":["light","dark"]},"pageColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"accent":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"logo":{"default":"organization","type":"string","enum":["organization","custom","none"]},"logoUrl":{"default":null,"anyOf":[{"type":"string","maxLength":700000},{"type":"null"}]},"paymentLogos":{"default":"both","type":"string","enum":["both","yours","none"]},"hideBranding":{"default":false,"type":"boolean"},"background":{"default":"standard","type":"string","enum":["standard","color","image"]},"backgroundColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"backgroundUrl":{"default":null,"anyOf":[{"type":"string","maxLength":1500000},{"type":"null"}]}},"required":["id","name"]}},"defaultTemplate":{"default":"light","type":"string"},"standardTemplate":{"anyOf":[{"type":"object","properties":{"name":{"default":"Standard","type":"string","minLength":1,"maxLength":40},"header":{"default":"standard","type":"string","enum":["standard","letterhead","banner","sidebar"]},"partyPictures":{"default":true,"type":"boolean"},"details":{"default":"beside","type":"string","enum":["beside","row","hidden"]},"summary":{"default":"hidden","type":"string","enum":["hidden","top","below"]},"payButton":{"default":true,"type":"boolean"},"paymentLayout":{"default":"standard","type":"string","enum":["standard","details"]},"paymentTheme":{"default":"device","type":"string","enum":["light","dark","device"]},"theme":{"default":"light","type":"string","enum":["light","dark"]},"pageColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"accent":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"logo":{"default":"organization","type":"string","enum":["organization","custom","none"]},"logoUrl":{"default":null,"anyOf":[{"type":"string","maxLength":700000},{"type":"null"}]},"paymentLogos":{"default":"both","type":"string","enum":["both","yours","none"]},"hideBranding":{"default":false,"type":"boolean"},"background":{"default":"standard","type":"string","enum":["standard","color","image"]},"backgroundColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"backgroundUrl":{"default":null,"anyOf":[{"type":"string","maxLength":1500000},{"type":"null"}]}}},{"type":"null"}]}}}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvoiceSettings"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invoice-numbering":{"get":{"operationId":"getInvoiceNumbering","summary":"Get invoice-numbering","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["nextInvoiceNumber"],"properties":{"nextInvoiceNumber":{"type":"integer","minimum":1}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updateInvoiceNumbering","summary":"Replace invoice-numbering","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"nextInvoiceNumber":{"type":"string","pattern":"^\\d{1,10}$"}},"required":["nextInvoiceNumber"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["nextInvoiceNumber"],"properties":{"nextInvoiceNumber":{"type":"integer","minimum":1}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/routing":{"get":{"operationId":"getRoutingSettings","summary":"Get routing","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"anyOf":[{"$ref":"#/components/schemas/AuthenticatedRoutingSettings"},{"type":"null"}]},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"put":{"operationId":"updateRoutingSettings","summary":"Replace routing","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"default":true,"type":"boolean"},"payoutMethodId":{"type":"string","minLength":1},"payoutAsset":{"type":"string","enum":["USDC","USDT"]},"termsAccepted":{"type":"boolean","const":true}},"required":["payoutMethodId","payoutAsset","termsAccepted"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"anyOf":[{"$ref":"#/components/schemas/AuthenticatedRoutingSettings"},{"type":"null"}]},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"operationId":"disableRouting","summary":"Turn off crypto routing","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"null"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/members":{"get":{"operationId":"listMembers","summary":"List organization members","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedMember"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invitations":{"get":{"operationId":"listInvitations","summary":"List pending invitations","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedInvitation"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"inviteMember","summary":"Invite a member","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":254},"role":{"type":"string","enum":["admin","user"]},"clients":{"default":"all","anyOf":[{"type":"string","const":"all"},{"maxItems":500,"type":"array","items":{"type":"string","minLength":1}}]}},"required":["email","role"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvitation"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invitations/{id}/resend":{"post":{"operationId":"resendInvitation","summary":"Resend an invitation","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvitation"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invitations/{id}":{"delete":{"operationId":"revokeInvitation","summary":"Revoke an invitation","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"null"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/members/{id}/role":{"put":{"operationId":"changeMemberRole","summary":"Change a member's role","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["admin","user"]}},"required":["role"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedMember"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/members/{id}/clients":{"put":{"operationId":"assignMemberClients","summary":"Assign clients to a member","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clients":{"anyOf":[{"type":"string","const":"all"},{"maxItems":500,"type":"array","items":{"type":"string","minLength":1}}]}},"required":["clients"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedMember"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/invitations/{id}/clients":{"put":{"operationId":"assignInvitationClients","summary":"Assign clients to an invitation","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clients":{"anyOf":[{"type":"string","const":"all"},{"maxItems":500,"type":"array","items":{"type":"string","minLength":1}}]}},"required":["clients"],"additionalProperties":false}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedInvitation"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/members/{id}":{"delete":{"operationId":"removeMember","summary":"Remove a member","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"null"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/groups":{"get":{"operationId":"listGroups","summary":"List permission groups","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedGroup"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"operationId":"createGroup","summary":"Create a permission group","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app. Organization admin required.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","format":"uuid"},"description":"A new UUID for each logical workspace mutation. Retry the same body and key after an uncertain response. For POST /invoices, requestId must equal this header."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"memberIds":{"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}}},"required":["name","memberIds"]}}}},"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedGroup"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/deliveries":{"get":{"operationId":"listDeliveries","summary":"List accessible invoice email deliveries","tags":["Authenticated API"],"description":"Only deliveries associated with accessible invoices. Results include queue state and attempt history. An accepted send queues delivery; it does not guarantee the recipient has received mail.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuthenticatedDelivery"}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/deliveries/{id}":{"get":{"operationId":"getDelivery","summary":"Inspect an accessible email delivery","tags":["Authenticated API"],"description":"Uses the same validation, permissions and business rules as the native Custard app.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"An identifier returned by this organization's collection. Inaccessible identifiers return 404."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"$ref":"#/components/schemas/AuthenticatedDelivery"},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/notifications":{"get":{"operationId":"listNotifications","summary":"List derived notifications","tags":["Authenticated API"],"description":"Derived from accessible invoices and deliveries. Read/unread state is browser-local in the native app and is not changed by this operation.","security":[{"CustomerApiKey":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"in":"query","name":"after","schema":{"type":"string"},"description":"nextCursor from the previous page; stable ID order. Restart if that record is no longer accessible."}],"responses":{"200":{"description":"The result of the operation. Collection results contain items and nextCursor.","headers":{"X-Request-Id":{"schema":{"type":"string","format":"uuid"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","requestId","links"],"properties":{"data":{"type":"object","required":["items","nextCursor"],"properties":{"items":{"type":"array","items":{}},"nextCursor":{"type":["string","null"]}}},"requestId":{"type":"string","format":"uuid"},"links":{"type":"object","required":["app","api","invoices"],"properties":{"app":{"type":"string","format":"uri"},"api":{"type":"string","format":"uri"},"invoices":{"type":"string","format":"uri"}}}}}}}},"400":{"description":"Malformed JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Missing, invalid, expired or revoked user key. Browser cookies and organization-owned keys are not accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Inactive membership, unverified email, insufficient key permission or role.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"Resource missing or inaccessible.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Lifecycle or business-rule conflict, email unavailable, or Idempotency-Key already used with another request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Body or file exceeds its limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"415":{"description":"Send uncompressed application/json.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid fields, query, cursor, or missing/mismatched UUID Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Per workspace: 10,000 reads and 1,000 writes per UTC day across all API keys and members; 5 total requests per rolling second. Wait for Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Private receipt storage is temporarily unavailable. Retry with the same Idempotency-Key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Provider, storage or database unavailable. Retry the same mutation body and key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"components":{"schemas":{"FreeInvoicePdfRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"number":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[^\\p{Cc}\\p{Cf}]+$"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"currency":{"default":"USD","type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"currencyFormat":{"type":"object","properties":{"name":{"default":"","type":"string","maxLength":80},"symbol":{"type":"string","minLength":1,"maxLength":12},"position":{"type":"string","enum":["prefix","suffix"]},"decimals":{"type":"integer","minimum":0,"maximum":18},"spaceBetween":{"type":"boolean"},"groupThousands":{"type":"boolean"}},"required":["symbol","position","decimals","spaceBetween","groupThousands"],"additionalProperties":false},"issuer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"default":"","type":"string","maxLength":200},"email":{"default":"","anyOf":[{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},"address":{"default":"","type":"string","maxLength":1000},"website":{"default":"","anyOf":[{"type":"string","maxLength":200,"format":"uri"},{"type":"string","const":""}]}},"required":["name"],"additionalProperties":false},"customer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"default":"","type":"string","maxLength":200},"email":{"default":"","anyOf":[{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"string","const":""}]},"address":{"default":"","type":"string","maxLength":1000}},"required":["name"],"additionalProperties":false},"items":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"unitPrice":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"}},"required":["description","quantity","unitPrice"],"additionalProperties":false}},"discount":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"discountRate":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"notes":{"default":"","type":"string","maxLength":2000},"paymentInstructions":{"default":"","type":"string","maxLength":1000},"payment":{"type":"object","properties":{"method":{"type":"string","enum":["bank","stablecoin","custom"]},"details":{"type":"string","minLength":1,"maxLength":1000}},"required":["method","details"],"additionalProperties":false},"bankAccount":{"type":"object","properties":{"accountHolderName":{"type":"string","minLength":1,"maxLength":200},"bankName":{"default":"","type":"string","maxLength":200},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"details":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":80},"value":{"type":"string","minLength":1,"maxLength":1000}},"required":["label","value"],"additionalProperties":false}},"instructions":{"default":"","type":"string","maxLength":1000}},"required":["accountHolderName","currency","details"],"additionalProperties":false},"template":{"default":"light","type":"string","enum":["light","dark"]}},"required":["number","issueDate","dueDate","issuer","customer","items"],"additionalProperties":false},"ApiError":{"type":"object","additionalProperties":false,"required":["error","requestId"],"properties":{"requestId":{"type":"string","format":"uuid"},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","required":["path","message"],"properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}},"OrganizationEntitlements":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"billing":{"type":"object","properties":{"source":{"type":"string","enum":["unconfigured","provider"]},"plan":{"anyOf":[{"type":"string","enum":["free","basic","pro"]},{"type":"null"}]},"status":{"type":"string","enum":["unavailable","trialing","active","past_due","canceled","expired","incomplete"]},"isPremium":{"type":["boolean","null"]},"trialEndsAt":{"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"}]},"currentPeriodEndsAt":{"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":["source","plan","status","isPremium","trialEndsAt","currentPeriodEndsAt"]},"access":{"type":"object","properties":{"mode":{"type":"string","enum":["unmetered","enforced"]},"features":{"type":"object","properties":{"invoicePdf":{"type":"boolean"},"savedInvoices":{"type":"boolean"},"recurringInvoices":{"type":"boolean"},"httpApi":{"type":"boolean"}},"required":["invoicePdf","savedInvoices","recurringInvoices","httpApi"]},"limits":{"type":"object","properties":{"seats":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]}},"required":["seats"]}},"required":["mode","features","limits"]}},"required":["organizationId","billing","access"]},"CustomerResolution":{"type":"object","required":["status","customer","candidates"],"properties":{"status":{"type":"string","enum":["found","ambiguous","not_found"]},"customer":{"anyOf":[{"type":"object","required":["id","email","name","company"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"company":{"type":"string"}}},{"type":"null"}]},"candidates":{"type":"array","items":{"type":"object","required":["id","email","name","company"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"company":{"type":"string"}}}}}},"CustomerValidation":{"type":"object","required":["valid","customer","existingCustomer","issues"],"properties":{"valid":{"type":"boolean"},"customer":{"anyOf":[{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string"},"address":{"default":"","type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":64},"website":{"default":"","type":"string","maxLength":200},"currency":{"default":"","type":"string","pattern":"^([A-Z][A-Z0-9]{1,11})?$"},"notes":{"default":"","type":"string","maxLength":2000},"logoUrl":{"default":"","type":"string","maxLength":400000,"pattern":"^(data:image\\/png;base64,[A-Za-z0-9+/]+={0,2})?$"}},"required":["name","company","email"]},{"type":"null"}]},"existingCustomer":{"anyOf":[{"type":"object","required":["id","email","name","company"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"company":{"type":"string"}}},{"type":"null"}]},"issues":{"type":"array","items":{"type":"object","required":["path","code","message"],"properties":{"path":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}}}},"InvoiceValidation":{"type":"object","required":["valid","invoice","customer","issues","warnings","totals"],"properties":{"valid":{"type":"boolean"},"invoice":{"anyOf":[{"type":"object","properties":{"sequenceNumber":{"type":"string","pattern":"^\\d{1,10}$"},"customerId":{"type":"string","minLength":1,"maxLength":200},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"currencyFormat":{"type":"object","properties":{"name":{"default":"","type":"string","maxLength":80},"symbol":{"type":"string","minLength":1,"maxLength":12},"position":{"type":"string","enum":["prefix","suffix"]},"decimals":{"type":"integer","minimum":0,"maximum":18},"spaceBetween":{"type":"boolean"},"groupThousands":{"type":"boolean"}},"required":["symbol","position","decimals","spaceBetween","groupThousands"]},"template":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"items":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"unitPrice":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"}},"required":["description","quantity","unitPrice"]}},"discount":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"discountRate":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxName":{"type":"string","maxLength":40},"delivery":{"type":"object","properties":{"mode":{"type":"string","enum":["email","link","schedule"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"boolean"}},"required":["mode"]},"notes":{"default":"","type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}},"paymentMethodIds":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"acceptCards":{"type":"boolean"},"access":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"principalType":{"type":"string","enum":["user","group"]},"principalId":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["view","edit"]}},"required":["principalType","principalId","level"]}}},"required":["customerId","currency","issueDate","dueDate","items"]},{"type":"null"}]},"customer":{"anyOf":[{"type":"object","required":["status","customer","candidates"],"properties":{"status":{"type":"string","enum":["found","ambiguous","not_found"]},"customer":{"anyOf":[{"type":"object","required":["id","email","name","company"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"company":{"type":"string"}}},{"type":"null"}]},"candidates":{"type":"array","items":{"type":"object","required":["id","email","name","company"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"company":{"type":"string"}}}}}},{"type":"null"}]},"issues":{"type":"array","items":{"type":"object","required":["path","code","message"],"properties":{"path":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}},"warnings":{"type":"array","items":{"type":"object","required":["path","code","message"],"properties":{"path":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}},"totals":{"anyOf":[{"type":"object","required":["currency","subtotal","discountTotal","taxTotal","total"],"properties":{"currency":{"type":"string"},"subtotal":{"type":"string"},"discountTotal":{"type":"string"},"taxTotal":{"type":"string"},"total":{"type":"string"}}},{"type":"null"}]}}},"AuthenticatedInvoice":{"type":"object","properties":{"sequenceNumber":{"type":"string","pattern":"^\\d{1,10}$"},"customerId":{"type":"string","minLength":1,"maxLength":200},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"currencyFormat":{"type":"object","properties":{"name":{"default":"","type":"string","maxLength":80},"symbol":{"type":"string","minLength":1,"maxLength":12},"position":{"type":"string","enum":["prefix","suffix"]},"decimals":{"type":"integer","minimum":0,"maximum":18},"spaceBetween":{"type":"boolean"},"groupThousands":{"type":"boolean"}},"required":["symbol","position","decimals","spaceBetween","groupThousands"]},"template":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"items":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"unitPrice":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"}},"required":["description","quantity","unitPrice"]}},"discount":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"discountRate":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxName":{"type":"string","maxLength":40},"delivery":{"type":"object","properties":{"mode":{"type":"string","enum":["email","link","schedule"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"boolean"}},"required":["mode"]},"notes":{"default":"","type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}},"paymentMethodIds":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"acceptCards":{"type":"boolean"},"access":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"principalType":{"type":"string","enum":["user","group"]},"principalId":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["view","edit"]}},"required":["principalType","principalId","level"]}},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"publicId":{"type":"string"},"number":{"type":"string"},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"createdBy":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["draft","sent","cancelled"]},"subtotal":{"type":"string"},"discountTotal":{"type":"string"},"taxTotal":{"type":"string"},"total":{"type":"string"},"paidAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"scheduledAt":{"type":["string","null"]},"createdAt":{"type":"string"},"firstViewedAt":{"type":["string","null"]},"lastViewedAt":{"type":["string","null"]},"viewCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"organization":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"legalName":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"website":{"type":"string","maxLength":200},"address":{"type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":50},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["name","legalName","email","website","address","color","id"],"additionalProperties":{}},"customer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string"},"address":{"default":"","type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":64},"website":{"default":"","type":"string","maxLength":200},"currency":{"default":"","type":"string","pattern":"^([A-Z][A-Z0-9]{1,11})?$"},"notes":{"default":"","type":"string","maxLength":2000},"logoUrl":{"default":"","type":"string","maxLength":400000,"pattern":"^(data:image\\/png;base64,[A-Za-z0-9+/]+={0,2})?$"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["name","company","email","id","organizationId"],"additionalProperties":{}},"paymentMethods":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"network":{"type":"string","minLength":1,"maxLength":80},"asset":{"type":"string","enum":["USDC","USDT"]},"tokens":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[A-Z0-9.]{1,12}$"}},"address":{"type":"string","minLength":1,"maxLength":300},"instructions":{"default":"","type":"string","maxLength":1000},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"active":{"type":"boolean"}},"required":["name","network","asset","address","id","organizationId","active"]}},"events":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["created","sent","viewed","paid","cancelled","updated"]},"at":{"type":"string"}},"required":["type","at"]}}},"required":["customerId","currency","issueDate","dueDate","items","id","publicId","number","organizationId","createdBy","status","subtotal","discountTotal","taxTotal","total","sentAt","createdAt","firstViewedAt","lastViewedAt","viewCount","organization","customer","paymentMethods","events"],"additionalProperties":{}},"AuthenticatedProfile":{"type":"object","required":["id","firstName","lastName","email","role"],"properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string"}}},"AuthenticatedCustomer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string"},"address":{"default":"","type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":64},"website":{"default":"","type":"string","maxLength":200},"currency":{"default":"","type":"string","pattern":"^([A-Z][A-Z0-9]{1,11})?$"},"notes":{"default":"","type":"string","maxLength":2000},"logoUrl":{"default":"","type":"string","maxLength":400000,"pattern":"^(data:image\\/png;base64,[A-Za-z0-9+/]+={0,2})?$"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"color":{"type":"string"}},"required":["name","company","email","id","organizationId","color"]},"AuthenticatedOrganization":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"legalName":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"website":{"type":"string","maxLength":200},"address":{"type":"string","maxLength":1000},"taxId":{"default":"","type":"string","maxLength":50},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["name","legalName","email","website","address","color","id"],"additionalProperties":{}},"AuthenticatedPaymentMethod":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"network":{"type":"string","minLength":1,"maxLength":80},"asset":{"type":"string","enum":["USDC","USDT"]},"tokens":{"maxItems":100,"type":"array","items":{"type":"string","pattern":"^[A-Z0-9.]{1,12}$"}},"address":{"type":"string","minLength":1,"maxLength":300},"instructions":{"default":"","type":"string","maxLength":1000},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"active":{"type":"boolean"}},"required":["name","network","asset","address","id","organizationId","active"]},"AuthenticatedBankAccount":{"type":"object","properties":{"label":{"default":"","type":"string","maxLength":20},"bankCountry":{"type":"string"},"currency":{"type":"string"},"rail":{"type":"string"},"accountHolderName":{"type":"string","minLength":1,"maxLength":100},"bankName":{"default":"","type":"string","maxLength":200},"accountType":{"default":"checking","anyOf":[{"type":"string","enum":["checking","savings"]},{"type":"null"}]},"achEnabled":{"default":true,"type":"boolean"},"wireEnabled":{"default":false,"type":"boolean"},"fields":{"default":{},"type":"object","propertyNames":{"type":"string","maxLength":40},"additionalProperties":{"type":"string","maxLength":300}},"address":{"type":"object","properties":{"country":{"default":"","type":"string"},"streetLine1":{"default":"","type":"string","maxLength":100},"streetLine2":{"default":"","type":"string","maxLength":100},"city":{"default":"","type":"string","maxLength":100},"postalCode":{"default":"","type":"string","maxLength":20},"subdivision":{"default":"","type":"string","maxLength":100}}},"instructions":{"default":"","type":"string","maxLength":1000},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["bankCountry","currency","rail","accountHolderName","address","id","organizationId"],"additionalProperties":true},"AuthenticatedGroup":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"memberIds":{"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["name","memberIds","id"]},"AuthenticatedInvoiceSettings":{"type":"object","properties":{"numberPattern":{"default":"INV-[Number]","type":"string","minLength":1,"maxLength":60},"defaultCurrency":{"default":"USD","type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"dueDays":{"default":30,"type":"integer","minimum":0,"maximum":365},"defaultNote":{"default":"","type":"string","maxLength":3000},"taxName":{"default":"","type":"string","maxLength":40},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"applyTaxByDefault":{"default":false,"type":"boolean"},"emails":{"default":{"status":"pending","fromName":"","fromLocalPart":"invoices","replyTo":""},"type":"object","properties":{"status":{"default":"pending","type":"string","enum":["pending","verified","failed"]},"fromName":{"default":"","type":"string","maxLength":80},"fromLocalPart":{"default":"invoices","type":"string","pattern":"^[a-z0-9](?:[a-z0-9._+-]{0,62}[a-z0-9])?$"},"replyTo":{"default":"","type":"string","maxLength":254}}},"domain":{"default":{"kind":"subdomain","subdomain":"","customDomain":"","status":"pending"},"type":"object","properties":{"kind":{"default":"subdomain","type":"string","enum":["subdomain","custom"]},"subdomain":{"default":"","type":"string","pattern":"^(?:[a-z0-9][a-z0-9-]{1,61}[a-z0-9])?$"},"customDomain":{"default":"","type":"string","pattern":"^(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63})?$"},"status":{"default":"pending","type":"string","enum":["pending","active","failed"]}}},"reminders":{"default":{"enabled":false,"offsets":[-3,0,7]},"type":"object","properties":{"enabled":{"default":false,"type":"boolean"},"timezone":{"type":"string","maxLength":100},"offsets":{"minItems":3,"maxItems":3,"type":"array","items":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}}},"required":["offsets"]},"templates":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^tpl_[a-z0-9]{6,32}$"},"name":{"type":"string","minLength":1,"maxLength":40},"header":{"default":"standard","type":"string","enum":["standard","letterhead","banner","sidebar"]},"partyPictures":{"default":true,"type":"boolean"},"details":{"default":"beside","type":"string","enum":["beside","row","hidden"]},"summary":{"default":"hidden","type":"string","enum":["hidden","top","below"]},"payButton":{"default":true,"type":"boolean"},"paymentLayout":{"default":"standard","type":"string","enum":["standard","details"]},"paymentTheme":{"default":"device","type":"string","enum":["light","dark","device"]},"theme":{"default":"light","type":"string","enum":["light","dark"]},"pageColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"accent":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"logo":{"default":"organization","type":"string","enum":["organization","custom","none"]},"logoUrl":{"default":null,"anyOf":[{"type":"string","maxLength":700000},{"type":"null"}]},"paymentLogos":{"default":"both","type":"string","enum":["both","yours","none"]},"hideBranding":{"default":false,"type":"boolean"},"background":{"default":"standard","type":"string","enum":["standard","color","image"]},"backgroundColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"backgroundUrl":{"default":null,"anyOf":[{"type":"string","maxLength":1500000},{"type":"null"}]}},"required":["id","name"]}},"defaultTemplate":{"default":"light","type":"string"},"standardTemplate":{"anyOf":[{"type":"object","properties":{"name":{"default":"Standard","type":"string","minLength":1,"maxLength":40},"header":{"default":"standard","type":"string","enum":["standard","letterhead","banner","sidebar"]},"partyPictures":{"default":true,"type":"boolean"},"details":{"default":"beside","type":"string","enum":["beside","row","hidden"]},"summary":{"default":"hidden","type":"string","enum":["hidden","top","below"]},"payButton":{"default":true,"type":"boolean"},"paymentLayout":{"default":"standard","type":"string","enum":["standard","details"]},"paymentTheme":{"default":"device","type":"string","enum":["light","dark","device"]},"theme":{"default":"light","type":"string","enum":["light","dark"]},"pageColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"accent":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"logo":{"default":"organization","type":"string","enum":["organization","custom","none"]},"logoUrl":{"default":null,"anyOf":[{"type":"string","maxLength":700000},{"type":"null"}]},"paymentLogos":{"default":"both","type":"string","enum":["both","yours","none"]},"hideBranding":{"default":false,"type":"boolean"},"background":{"default":"standard","type":"string","enum":["standard","color","image"]},"backgroundColor":{"anyOf":[{"type":"string","pattern":"^#?[0-9a-fA-F]{6}$"},{"type":"null"}]},"backgroundUrl":{"default":null,"anyOf":[{"type":"string","maxLength":1500000},{"type":"null"}]}}},{"type":"null"}]}}},"AuthenticatedRoutingSettings":{"type":"object","properties":{"enabled":{"default":true,"type":"boolean"},"payoutMethodId":{"type":"string","minLength":1},"payoutAsset":{"type":"string","enum":["USDC","USDT"]},"termsAccepted":{"type":"boolean","const":true}},"required":["payoutMethodId","payoutAsset","termsAccepted"]},"AuthenticatedMember":{"type":"object","required":["id","name","email","role"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","user"]},"clients":{"oneOf":[{"const":"all"},{"type":"array","items":{"type":"string","format":"uuid"}}]}}},"AuthenticatedInvitation":{"type":"object","required":["id","email","role","clients","invitedAt","invitedBy"],"properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","user"]},"clients":{"oneOf":[{"const":"all"},{"type":"array","items":{"type":"string","format":"uuid"}}]},"invitedAt":{"type":"string","format":"date-time"},"invitedBy":{"type":"string","format":"uuid"},"expiresAt":{"type":"string","format":"date-time"}}},"AuthenticatedSchedule":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"createdBy":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"frequency":{"type":"string","enum":["weekly","monthly","quarterly","yearly","custom"]},"interval":{"anyOf":[{"type":"object","properties":{"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unit":{"type":"string","enum":["days","months"]}},"required":["count","unit"]},{"type":"null"}]},"endDate":{"type":["string","null"]},"memo":{"type":"string"},"recipientEmails":{"type":"array","items":{"type":"string"}},"template":{"type":"object","properties":{"sequenceNumber":{"type":"string","pattern":"^\\d{1,10}$"},"customerId":{"type":"string","minLength":1,"maxLength":200},"currency":{"type":"string","pattern":"^[A-Z][A-Z0-9]{1,11}$"},"currencyFormat":{"type":"object","properties":{"name":{"default":"","type":"string","maxLength":80},"symbol":{"type":"string","minLength":1,"maxLength":12},"position":{"type":"string","enum":["prefix","suffix"]},"decimals":{"type":"integer","minimum":0,"maximum":18},"spaceBetween":{"type":"boolean"},"groupThousands":{"type":"boolean"}},"required":["symbol","position","decimals","spaceBetween","groupThousands"]},"template":{"type":"string"},"issueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"items":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"quantity":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"unitPrice":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"}},"required":["description","quantity","unitPrice"]}},"discount":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"discountRate":{"type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxRate":{"default":"0","type":"string","pattern":"^\\d{1,12}(\\.\\d{1,18})?$"},"taxName":{"type":"string","maxLength":40},"delivery":{"type":"object","properties":{"mode":{"type":"string","enum":["email","link","schedule"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"timezone":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"boolean"}},"required":["mode"]},"notes":{"default":"","type":"string","maxLength":3000},"recipientEmails":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":254}},"paymentMethodIds":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"bankAccountId":{"type":"string","minLength":1,"maxLength":200},"acceptCards":{"type":"boolean"},"access":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"principalType":{"type":"string","enum":["user","group"]},"principalId":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["view","edit"]}},"required":["principalType","principalId","level"]}}},"required":["customerId","currency","issueDate","dueDate","items"]},"nextIssueDate":{"type":"string"},"occurrence":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"boolean"},"lastError":{"type":["string","null"]},"kind":{"type":"string","enum":["one-time","recurring"]},"deliveryMode":{"type":"string","enum":["draft","email"]},"timezone":{"type":"string"},"localStart":{"type":"string"},"nextRunAt":{"type":"string"},"anchorOccurrence":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["active","paused","completed","cancelled","blocked"]}},"required":["id","organizationId","createdBy","frequency","interval","endDate","memo","recipientEmails","template","nextIssueDate","occurrence","active","lastError","kind","deliveryMode","timezone","localStart","nextRunAt","anchorOccurrence","state"]},"AuthenticatedDelivery":{"type":"object","required":["id","invoiceId","organizationId","recipient","status","attempts","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"invoiceId":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"recipient":{"type":"string","format":"email"},"kind":{"type":"string","enum":["queued","sending","accepted","delivered","failed","unknown","cancelled"]},"attempts":{"type":"integer"},"nextAttemptAt":{"type":["string","null"]},"lastError":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"providerMessageId":{"type":["string","null"]},"history":{"type":"array","items":{"type":"object"}}}},"AuthenticatedReceipt":{"type":"object","required":["key","name","contentType","size"],"properties":{"key":{"type":"string"},"name":{"type":"string"},"contentType":{"type":"string","enum":["application/pdf","image/png","image/jpeg","image/webp"]},"size":{"type":"integer","minimum":1,"maximum":3145728}}}},"securitySchemes":{"CustomerApiKey":{"type":"http","scheme":"bearer","description":"A user-owned, workspace-bound WorkOS API key from Profile > Integrations. Keys created by Custard inherit your current role, assigned clients and invoice grants in that workspace. Membership and key validity are checked on every request. Explicitly permissioned keys require custard:read for GET or custard:write for mutations. Browser cookies, MCP tokens and organization-owned keys are not substitutes. Omit Authorization for anonymous PDF generation."}}}}