{"openapi":"3.1.0","info":{"title":"peppol.sh API","version":"2.1.0","description":"Send Peppol documents (invoices, credit notes, etc.) from your app. JSON in, e-invoice out, delivered via Peppol.\n\n## Quick Start (zero UI required)\n\n```bash\n# 1. Create an account — returns a sandbox API key instantly\ncurl -X POST https://api.peppol.sh/v1/signup \\\n  -d '{\"email\": \"agent@bot.com\"}'\n\n# 2. Create a company to send documents from\ncurl -X POST https://sandbox.peppol.sh/v1/companies \\\n  -H \"Authorization: Bearer ps_test_...\" \\\n  -d '{\"name\": \"Acme BV\", \"tax_id\": \"BE0123456749\", \"country\": \"BE\", \"peppol_id\": \"0208:0123456749\"}'\n\n# 3. Send a test document from that company to the sandbox test receiver\ncurl -X POST https://sandbox.peppol.sh/v1/documents \\\n  -H \"Authorization: Bearer ps_test_...\" \\\n  -d '{\"company_id\": \"com_...\", \"number\": \"INV-001\", \"due_date\": \"2026-11-21\", \"to\": {\"name\": \"Sandbox Test Receiver\", \"tax_id\": \"BE1234567894\"}, ...}'\n\n# 4. Invite a team member to your workspace\ncurl -X POST https://sandbox.peppol.sh/v1/workspaces/wsp_.../members \\\n  -H \"Authorization: Bearer ps_test_...\" \\\n  -d '{\"email\": \"jan@acme.be\", \"role\": \"admin\"}'\n```\n\n## Core Concepts\n\n### Accounts\nAn **account** represents any API consumer — an autonomous agent, a human\ndeveloper, or a service account. Every account authenticates with long-lived\nbearer API keys (`ps_test_*` for sandbox, `ps_live_*` for production).\n\n### Workspaces\nA **workspace** is the top-level aggregation, billing, and access-control boundary.\nWorkspaces contain companies, hold the credit balance, and own API keys and webhooks.\nOn signup, every account automatically gets a personal workspace where they are the owner.\n\n### Companies\nA **company** is a business entity that sends documents. Companies belong to\nexactly one workspace and hold their own provider credentials, tax IDs, and\nPeppol registrations.\n\n### Membership & Roles\nThe `workspace_members` relationship links accounts to workspaces with a role:\n- **owner** — full access, can manage members, workspaces, and all settings\n- **admin** — can manage members and workspace settings, can mint API keys\n- **member** — can send documents and view data, cannot manage the workspace\n\nThe account that creates a workspace automatically becomes its owner.\n\n## Authentication\n```\nAuthorization: Bearer ps_test_...   (sandbox)\nAuthorization: Bearer ps_live_...   (production)\n```\n\n**Public endpoints** (no key needed):\n- `POST /v1/signup` — create an account and get a sandbox API key\n- `GET /v1/health` — health check\n- `GET /v1/lookup/{peppol_id}` — lookup a Peppol participant (rate-limited per IP)\n- `GET /v1/lookup/{peppol_id}/dns` — DNS-only resolution (rate-limited per IP)\n- `GET /v1/openapi.json` — this spec\n- `GET /.well-known/oauth-protected-resource` — how to authenticate to this host (RFC 9728)\n\n**All other endpoints** require a valid `Authorization: Bearer <api_key>` header.\n\nKeys created in the dashboard or via the API work identically on all endpoints.\nSandbox keys (`ps_test_*`) route to the sandbox environment; live keys (`ps_live_*`) route to production.\nThere is no per-endpoint scoping — a valid key grants access to everything the account has access to.\n\n## Bootstrap Flow\n```\n1. POST /v1/signup           → account + personal workspace + sandbox API key\n2. POST /v1/companies        → company in the workspace\n3. POST /v1/documents        → send documents via that company\n4. POST /v1/workspaces/:id/members  → invite team members to the workspace\n```\n\n## Environments\n| Environment | Base URL | Delivery |\n|---|---|---|\n| Sandbox | `sandbox.peppol.sh` | No Peppol delivery; the receiver is checked on the SML |\n| Production | `api.peppol.sh` | Real Peppol network |\n\n## Sandbox\nA sandbox send runs the checks of a live send, in the same order. A\nsandbox pass predicts a live pass for those checks. A receiver that is\nregistered but does not accept the document type still fails live. The request\nbody gets the same checks as live first: an error there is a `400` or\n`422` response at once. After the `202`, the sandbox checks:\n1. **The schema.** The fields of the document must have the form that the\n   Peppol network takes, as in `POST /v1/validate`. If not, the send fails\n   with \"The document failed Peppol BIS 3.0 validation: …\"\n   (`invalid_document`).\n2. **The Peppol IDs.** A Peppol ID must follow for the sender and the\n   receiver, from a `peppol_id` or a `tax_id` with a country prefix. If\n   not, the send fails with \"The Peppol ID of the sender or the receiver\n   could not be found.\" (`sender_not_derivable`).\n3. **The sender.** `from` must be the company of `company_id`: a\n   `from.peppol_id`, or a VAT number in `from.tax_id`, that gives another\n   Peppol ID fails with \"The sender Peppol ID … is not registered for this\n   company\" (`sender_not_registered`). A `from` with neither sends as the\n   company.\n4. **The totals and the Peppol BIS 3.0 rules.** The same validation as\n   `POST /v1/validate`. A document that breaks a rule fails with \"The\n   document failed Peppol BIS 3.0 validation: …\" (`invalid_document`).\n   For example, a document with an amount due needs a `due_date` (rule\n   BR-CO-25); the API sets no default.\n5. **The receiver.** It must be registered on the Peppol network (in the\n   SML). A receiver that is not fails with \"The document could not be\n   delivered over the Peppol network.\"\n\nA failed check makes the document `failed`. The reason is the `message`\nof its `failed` event (`GET /v1/documents/{id}`) and the `error_message`\nof the `document.failed` webhook. The stored UBL\n(`GET /v1/documents/{id}/ubl`) is rendered by the validator of\n`POST /v1/validate` (a local render when that validator is unavailable).\n\nWhat is different in the sandbox:\n- **No credits.** A sandbox send is free.\n- **No go-live.** A sandbox send needs no Workspace KYC and no go-live.\n- **No simulated network failures.** The sandbox does not simulate\n  network failures. Its checks call the provider's validator and the\n  SML, so a send can still end in `provider_unavailable` when those are\n  unreachable, in `rate_limited` when the validator answers 429, and in\n  `provider_error` when it refuses the shared key (401 or 403).\n- **No wait.** A document goes from `queued` through `sending` to\n  `delivered` or `failed` in seconds, with the same statuses and webhook\n  events as live.\n- **Rate limit.** 60 requests per minute for a sandbox key, 120 for a live\n  key (see Rate Limits).\n\n**Sandbox test receiver:** send sandbox documents to `0208:1234567894`\n(VAT number `BE1234567894`), a test participant that is registered on the\nPeppol network. Use it only in the sandbox.\n\n## Rate Limits\nAuthenticated requests are counted per API key, in windows of one minute:\n- Sandbox keys (`ps_test_*`): 60 requests per minute\n- Live keys (`ps_live_*`): 120 requests per minute\n\nSupport can set a higher limit for an account. The public lookup\nendpoints have their own limits per hour (see those endpoints).\n\nEach response that is counted against a rate limit includes these headers:\n\n| Header | Meaning |\n|---|---|\n| `RateLimit-Limit` | Requests allowed in the current window |\n| `RateLimit-Remaining` | Requests left in the current window |\n| `RateLimit-Reset` | Seconds until the window resets |\n\nThese are the `RateLimit-*` headers of the IETF draft\n`draft-ietf-httpapi-ratelimit-headers`. The older `X-RateLimit-Limit`,\n`X-RateLimit-Remaining` and `X-RateLimit-Reset` headers stay available;\n`X-RateLimit-Reset` is a Unix timestamp, not a number of seconds.\n\nWhen the limit is exceeded, the response is `429 rate_limit_exceeded` with\na `Retry-After` header (seconds). Wait for that time, then retry.\n\n## Authentication errors\nA `401` response includes\n`WWW-Authenticate: Bearer resource_metadata=\"https://<host>/.well-known/oauth-protected-resource\"`.\nThat document (RFC 9728) says how to authenticate to the host. There is no\nOAuth authorization server: the credential is an API key in the\n`Authorization: Bearer` header.\n\n## Versioning and deprecation\nThe version is in the path (`/v1`). Changes that are not breaking (new\nendpoints, new optional request fields, new response fields, new error\ncodes) can be released at any time.\n\nFor a breaking change or the removal of an endpoint in `v1`, we give a\nnotice of 6 months minimum. During the notice period:\n- The operation is marked `deprecated: true` in this spec.\n- Its responses include a `Deprecation` header (RFC 9745) with the date\n  on which the operation became deprecated, and a `Sunset` header\n  (RFC 8594) with the date after which it can stop.\n- Its responses include\n  `Link: <https://peppol.sh/deprecation>; rel=\"deprecation\"`.\n- The notice is published at https://peppol.sh/deprecation.\n\nNo operation is deprecated at this time.\n","contact":{"name":"peppol.sh Support","email":"support@peppol.sh","url":"https://peppol.sh"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://api.peppol.sh","description":"Production"},{"url":"https://sandbox.peppol.sh","description":"Sandbox (no Peppol delivery; the receiver is checked on the SML)"},{"url":"http://localhost:8787","description":"Local development"}],"security":[{"BearerAuth":[]}],"tags":[{"name":"Workspace","description":"Workspace management: CRUD, membership, and billing.\nA workspace is the top-level boundary for companies, API keys, credits, and webhooks.\n"},{"name":"Account","description":"Signup, API key management, and account details.\n\nAn account is the identity you authenticate with. It can represent an\nAI agent, a human developer, or a service. Accounts are linked to\ncompanies via memberships.\n"},{"name":"Companies","description":"Create and manage companies (business entities).\n\nA company holds provider credentials, a tax ID, and Peppol registration.\nDocuments are always sent **from** a company. Team access is granted at\nthe workspace level — see the workspace member endpoints.\n"},{"name":"KYC","description":"Know-Your-Customer verification for going live on the real Peppol network.\n\n## Workspace-level model\n\nKYC is **workspace-level**, not company-level. One verification covers the\nwhole workspace and every company in it. The workspace carries a single\n`status`:\n\n```\nnone ──▶ pending ──▶ approved   (approved is terminal)\n            │\n            └──────▶ rejected ──▶ pending   (fix and resubmit)\n```\n\n- **none** — nothing submitted yet. This is where a fresh workspace starts.\n- **pending** — submitted and awaiting review by peppol.sh ops. Uploads are\n  locked while pending.\n- **approved** — ops accepted the submission. **Terminal.** On approval the\n  workspace organisation is onboarded with the e-invoice.be provider and\n  every existing company is provisioned for Tier-2 go-live. From then on,\n  any company you create in the workspace **auto-provisions** on creation\n  (see `POST /v1/companies`).\n- **rejected** — ops declined; `reject_reason` explains why. Fix the issue\n  and submit again (this returns the workspace to `pending`).\n\nReview is performed manually by peppol.sh operations. There is no\nprogrammatic approval — you submit, then wait for a human decision.\n\n## The own-company anchor\n\nOne company in the workspace is the **own company** — the legal entity that\noperates the workspace and signs the attestation. Its id is echoed as\n`company_id` in `GET /v1/kyc` and passed as `company_id` to\n`POST /v1/kyc/submit`. The own company is **exempt** from the mandate\nrequirement (you do not hold a mandate from yourself).\n\n## Attestation-only gate\n\nSubmission is gated by a versioned **attestation** — a checkbox statement\nthe signer accepts on behalf of the workspace legal entity. The current\nattestation version is `2026-08-26`. The full attestation text and the\ncurrent version are returned in `GET /v1/kyc` under `attestation.text` and\n`attestation.current_version`; echo that exact version back in\n`attestation_version` when you submit.\n\nThree workspace-level documents are **required** before you can submit:\n`registry_extract`, `representative_id`, and `authority_proof`. Per-company\n`mandate` documents are **optional supporting evidence** — they never gate\nsubmission (they are surfaced as `mandate_coverage` for ops context only).\n\n## Go live — walkthrough\n\n1. **Create your own company** with `POST /v1/companies` (the legal entity\n   that operates the workspace).\n2. **Upload the three workspace documents** with `POST /v1/kyc/documents`\n   (`registry_extract`, `representative_id`, `authority_proof`). Optionally\n   upload `mandate` documents for the other companies you represent.\n3. **Read the attestation** with `GET /v1/kyc` — take `attestation.text` and\n   `attestation.current_version`, and check `requirements.can_submit`.\n4. **Submit** with `POST /v1/kyc/submit`, passing the own `company_id`,\n   legal name, enterprise number, signer name/role, `attested: true`, and\n   `attestation_version` equal to the current version. Status becomes\n   `pending`.\n5. **Wait for review.** peppol.sh ops approve or reject.\n6. On **approval** the workspace org is onboarded and every company is\n   provisioned automatically. Newly created companies then go live on\n   creation with no further KYC.\n\n## Company liveness (Connect)\n\nA company is **live** once it has a provider tenant; each company reports\nthis as `is_live`. For Connect platforms the model is: verify the\nworkspace once, then onboard as many companies as you like — every one\ngoes live on `POST /v1/companies` with no per-company re-verification.\n"},{"name":"Documents","description":"Send Peppol documents (invoices, credit notes, etc.).\n\nAll document operations require a `company_id` — either in the request body\n(for POST) or as a query parameter (for GET). The calling account must be a\nmember of that company.\n"},{"name":"Lookup","description":"Check Peppol network registration for a tax ID"},{"name":"Validate","description":"Validate document payloads without sending"},{"name":"Events","description":"Chronological feed of document lifecycle events (queued, sending,\ndelivered, failed, retry) across the workspace, with cursor-based\npagination and filtering.\n"},{"name":"Webhooks","description":"Real-time HTTP notifications for document lifecycle and account events.\nRegister an endpoint with `POST /v1/webhooks`, subscribe to one or more\nevent types, and we POST a signed JSON payload to your URL every time a\nmatching event fires.\n\n## Delivery request\n\nEvery delivery is an HTTP `POST` with `Content-Type: application/json`\nand these headers:\n\n| Header | Meaning |\n|---|---|\n| `X-Peppol-Signature-V2` | **Recommended.** Timestamped HMAC signature (see below). Use this to verify. |\n| `X-Peppol-Signature` | Legacy HMAC of the raw body only. Kept byte-identical forever; no replay protection. |\n| `X-Peppol-Timestamp` | Unix epoch seconds when the delivery was signed. Same value as `t=` in the V2 header. |\n| `X-Peppol-Event` | The event type, e.g. `document.delivered`. |\n| `X-Peppol-Delivery-Id` | Unique delivery id (`whd_…`). **Stable across retries — use it as an idempotency key.** |\n\nThe request body is the exact JSON string that was signed. Verify the\nsignature against the **raw received bytes, before you JSON-parse** —\nre-serializing the parsed object can change byte-for-byte spacing and\nbreak the HMAC.\n\n## Signature algorithm\n\nBoth headers use **HMAC-SHA256**. The key is the webhook signing secret\nas UTF-8 bytes; the output is lowercase hex (64 characters).\n\n- **`X-Peppol-Signature-V2` (recommended).** Format:\n  `t=<timestamp>,v1=<hex>` with one `v1=` per active signing secret\n  (current secret first). The signed message is the timestamp, a literal\n  `.`, then the raw body:\n\n  ```\n  signed_string = \"<X-Peppol-Timestamp>\" + \".\" + <raw request body>\n  v1 = hex( HMAC_SHA256(secret, signed_string) )\n  ```\n\n  Because the timestamp is inside the HMAC, a receiver that rejects old\n  timestamps (e.g. more than 5 minutes of clock skew) gets true replay\n  protection. During a secret rotation the header carries two `v1=`\n  values — accept the delivery if **any** of them matches.\n\n- **`X-Peppol-Signature` (legacy).** HMAC of the raw body only; the\n  timestamp travels unsigned in `X-Peppol-Timestamp`, so it gives no\n  replay protection. Provided for backward compatibility — prefer V2 for\n  new integrations. During a secret rotation the legacy header\n  switches to the new secret immediately (no overlap), so a rotating\n  integration that still verifies the legacy header can miss deliveries.\n\n## Signing secret\n\nThe secret has the form `whsec_` followed by a 40-character token. It is\nreturned **once** in the `201` response from `POST /v1/webhooks` (and once\nagain from a rotation) and is never retrievable afterwards — `GET`\nresponses omit it. Store it securely.\n\n**Rotation.** `POST /v1/webhooks/{id}/rotate-secret` mints a new secret\n(returned once) and moves the previous one into a 24-hour overlap window.\nDuring that window `X-Peppol-Signature-V2` is signed with both secrets\n(new first, one `v1=` each) so you can roll the new secret out to your\nverifier without dropping deliveries. At most two secrets are active;\nrotating again before the window closes drops the older one.\n\n## Retries, idempotency & failure\n\nDeliveries are queued and retried with backoff on any non-2xx response or\nnetwork error, up to **5 attempts**. After the final failed attempt the\ndelivery is marked `failed` (and lands in a dead-letter queue). Redirects\nare never followed (SSRF hardening) and each attempt has a 10-second\ntimeout. Return a `2xx` status quickly to acknowledge receipt; do heavy\nwork asynchronously. Because `X-Peppol-Delivery-Id` is stable across\nretries, **deduplicate on it** so a retried delivery is processed once.\nInspect attempts via `GET /v1/webhooks/{id}/deliveries`.\n\n## Events & payload shape\n\nSubscribe to any of: `document.queued`, `document.sending`,\n`document.delivered`, `document.failed`, `credits.low` (or `*` for all).\nA synthetic `webhook.test` event is sent by `POST /v1/webhooks/{id}/test`.\n\n`document.*` payload:\n\n```json\n{\n  \"id\": \"evt_9fJ2kQ7bTx0Lm4Ne1Ry8\",\n  \"type\": \"document.delivered\",\n  \"created_at\": \"2026-03-05T12:00:00.000Z\",\n  \"data\": {\n    \"document_id\": \"doc_abc123\",\n    \"company_id\": \"com_abc123\",\n    \"status\": \"delivered\",\n    \"number\": \"INV-2026-001\",\n    \"error_message\": null\n  }\n}\n```\n\n`credits.low` payload:\n\n```json\n{\n  \"id\": \"evt_3aB7cD9eF1gH2iJ4kL6mN\",\n  \"type\": \"credits.low\",\n  \"created_at\": \"2026-03-05T12:00:00.000Z\",\n  \"data\": { \"company_id\": \"com_abc123\", \"balance\": 8, \"threshold\": 10 }\n}\n```\n\n## Verifying a delivery\n\nCompute the expected V2 signature over `timestamp + \".\" + rawBody` and\ncompare with a **constant-time** equality check. Reject stale timestamps\nto defeat replay.\n\n**Node.js / TypeScript** (`crypto.timingSafeEqual`):\n\n```ts\nimport crypto from \"node:crypto\";\n\n// rawBody is the exact received body string — verify BEFORE JSON.parse.\nexport function verifyWebhook(\n  rawBody: string,\n  headerV2: string, // X-Peppol-Signature-V2\n  secret: string,\n  toleranceSec = 300,\n): boolean {\n  const parts = headerV2.split(\",\");\n  const t = parts.find((p) => p.startsWith(\"t=\"))?.slice(2);\n  const sigs = parts.filter((p) => p.startsWith(\"v1=\")).map((p) => p.slice(3));\n  if (!t || sigs.length === 0) return false;\n  if (Math.abs(Date.now() / 1000 - Number(t)) > toleranceSec) return false;\n\n  const expected = crypto\n    .createHmac(\"sha256\", secret)\n    .update(`${t}.${rawBody}`)\n    .digest(\"hex\");\n  const expectedBuf = Buffer.from(expected);\n  return sigs.some(\n    (sig) =>\n      sig.length === expected.length &&\n      crypto.timingSafeEqual(expectedBuf, Buffer.from(sig)),\n  );\n}\n```\n\n**Python** (`hmac.compare_digest`):\n\n```python\nimport hashlib, hmac, time\n\ndef verify_webhook(raw_body: bytes, header_v2: str, secret: str,\n                   tolerance: int = 300) -> bool:\n    t, sigs = None, []\n    for part in header_v2.split(\",\"):\n        key, _, val = part.partition(\"=\")\n        if key == \"t\":\n            t = val\n        elif key == \"v1\":\n            sigs.append(val)\n    if t is None or not sigs:\n        return False\n    if abs(time.time() - int(t)) > tolerance:\n        return False\n    signed = f\"{t}.\".encode() + raw_body  # raw_body verified before json.loads\n    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()\n    return any(hmac.compare_digest(expected, sig) for sig in sigs)\n```\n\n**PHP** (`hash_equals`):\n\n```php\nfunction verify_webhook(string $rawBody, string $headerV2,\n                        string $secret, int $tolerance = 300): bool {\n    $t = null; $sigs = [];\n    foreach (explode(',', $headerV2) as $part) {\n        [$k, $v] = array_pad(explode('=', $part, 2), 2, '');\n        if ($k === 't')  $t = $v;\n        elseif ($k === 'v1') $sigs[] = $v;\n    }\n    if ($t === null || !$sigs) return false;\n    if (abs(time() - (int) $t) > $tolerance) return false;\n\n    $expected = hash_hmac('sha256', $t . '.' . $rawBody, $secret);\n    foreach ($sigs as $sig) {\n        if (hash_equals($expected, $sig)) return true;\n    }\n    return false;\n}\n```\n"},{"name":"Audit","description":"Append-only audit trail for security-relevant account and workspace events.\nRecords API key creation/revocation, membership changes, company mutations,\nand webhook lifecycle events.\n"},{"name":"Health","description":"Public health check for uptime monitoring and connectivity probes"}],"paths":{"/.well-known/oauth-protected-resource":{"get":{"operationId":"getProtectedResourceMetadata","tags":["Health"],"summary":"Protected-resource metadata","description":"Says how to authenticate to the host that you called (RFC 9728). Each\n`401` response points to this document in its `WWW-Authenticate`\nheader. No authentication required.\n\nThe document names no authorization servers, scopes or signing\nalgorithms, because there is no OAuth authorization server. The\ncredential is an API key in the `Authorization: Bearer` header; get\none from `POST /v1/signup`.\n","security":[],"responses":{"200":{"description":"Protected-resource metadata of this host","content":{"application/json":{"schema":{"type":"object","required":["resource","bearer_methods_supported","resource_documentation"],"properties":{"resource":{"type":"string","format":"uri","description":"Origin of the host that you called."},"bearer_methods_supported":{"type":"array","items":{"type":"string","enum":["header"]}},"resource_documentation":{"type":"string","format":"uri"}}},"example":{"resource":"https://api.peppol.sh","bearer_methods_supported":["header"],"resource_documentation":"https://peppol.sh/auth.md"}}}}}}},"/v1/health":{"get":{"operationId":"getHealth","tags":["Health"],"summary":"Health check","description":"Returns the operational status of the API. Probes database connectivity.\nReturns 200 when healthy, 503 when degraded. No authentication required.\n","security":[],"responses":{"200":{"description":"API is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"status":"ok","version":"2.0.0","environment":"production","checks":{"db":"ok"}}}}},"503":{"description":"API is degraded (one or more checks failed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"status":"degraded","version":"2.0.0","environment":"production","checks":{"db":"error"}}}}}}}},"/v1/workspaces":{"post":{"operationId":"createWorkspace","tags":["Workspace"],"summary":"Create a workspace","description":"Creates a new workspace with the authenticated account as owner.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Workspace created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"}}},"get":{"operationId":"listWorkspaces","tags":["Workspace"],"summary":"List workspaces","description":"Returns all workspaces the authenticated account is a member of.","responses":{"200":{"description":"Workspace list","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Workspace"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}}},"/v1/workspaces/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"operationId":"getWorkspace","tags":["Workspace"],"summary":"Get workspace details","description":"Returns the workspace including the caller's `role`, credit balance,\nsuspension flag, and operating `mode`. The calling account must be a\nmember of the workspace.\n","responses":{"200":{"description":"Workspace detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"}}},"patch":{"operationId":"updateWorkspace","tags":["Workspace"],"summary":"Update workspace","description":"Only workspace owners and admins can update workspace details.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"operationId":"deleteWorkspace","tags":["Workspace"],"summary":"Delete workspace","description":"Only workspace owners can delete a workspace. Deletion is refused if\nany member account would be left without an owner workspace.\n","responses":{"200":{"description":"Workspace deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/workspaces/{id}/members":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"operationId":"listWorkspaceMembers","tags":["Workspace"],"summary":"List workspace members","description":"Returns every account that is a member of the workspace, with each\nmember's role. The calling account must be a member of the workspace.\n","responses":{"200":{"description":"Member list","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceMember"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"}}},"post":{"operationId":"inviteWorkspaceMember","tags":["Workspace"],"summary":"Invite a member to the workspace","description":"Only workspace owners and admins can invite members.\n\nThis endpoint adds only an existing peppol.sh account, given by\n`account_id` or by `email`. An email with no account gives\n`404 account_not_found`. Unlike the API, the dashboard can invite an\naddress that has no account yet.\n\nThe added account gets an email that says to which workspace it was\nadded, with which role, and by whom.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string","description":"ID of an existing account (prefixed `acc_`)."},"email":{"type":"string","format":"email","description":"Email of an existing account. Used when `account_id` is\nnot given.\n"},"role":{"type":"string","enum":["owner","admin","member"],"default":"member"}}}}}},"responses":{"201":{"description":"Member invited","content":{"application/json":{"schema":{"type":"object","required":["account_id","workspace_id","role"],"properties":{"account_id":{"type":"string","description":"ID of the invited account (prefixed `acc_`)."},"workspace_id":{"type":"string","description":"ID of the workspace (prefixed `wsp_`)."},"role":{"type":"string","enum":["owner","admin","member"]}}},"example":{"account_id":"acc_abc123","workspace_id":"wsp_abc123","role":"admin"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/workspaces/{id}/members/{accountId}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"accountId","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"operationId":"changeWorkspaceMemberRole","tags":["Workspace"],"summary":"Change a member's role","description":"Only workspace owners can change roles.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["owner","admin","member"]}}}}}},"responses":{"200":{"description":"Role updated","content":{"application/json":{"schema":{"type":"object","required":["account_id","role"],"properties":{"account_id":{"type":"string","description":"ID of the member account (prefixed `acc_`)."},"role":{"type":"string","enum":["owner","admin","member"],"description":"The new role of the member."}}},"example":{"account_id":"acc_abc123","role":"admin"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}},"delete":{"operationId":"removeWorkspaceMember","tags":["Workspace"],"summary":"Remove a member from the workspace","description":"Only workspace owners and admins can remove members.\nRemoving a member cascade-revokes their API keys for this workspace.\n","responses":{"200":{"description":"Member removed","content":{"application/json":{"schema":{"type":"object","required":["removed","account_id"],"properties":{"removed":{"type":"boolean","const":true},"account_id":{"type":"string","description":"ID of the removed account (prefixed `acc_`)."}}},"example":{"removed":true,"account_id":"acc_abc123"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/workspaces/{id}/transfer-ownership":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"post":{"operationId":"transferWorkspaceOwnership","tags":["Workspace"],"summary":"Transfer workspace ownership","description":"Makes the target account an owner and demotes the caller to admin.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["account_id"],"properties":{"account_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Ownership transferred","content":{"application/json":{"schema":{"type":"object","required":["transferred","new_owner"],"properties":{"transferred":{"type":"boolean","const":true},"new_owner":{"type":"string","description":"ID of the account that is now an owner (prefixed `acc_`)."}}},"example":{"transferred":true,"new_owner":"acc_abc123"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/signup":{"post":{"operationId":"signup","summary":"Create account","tags":["Account"],"description":"Create a new account and receive a sandbox API key instantly.\nNo UI, no email verification, no credit card required.\n\nThe returned `api_key` is the full key — **store it securely**, it is\nonly shown once. Use it in the `Authorization: Bearer <key>` header\nfor all subsequent requests.\n\nAfter signup, create a company with `POST /v1/companies` to start\nsending documents.\n","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email","description":"Unique email address for this account"},"name":{"type":"string","description":"Display name (optional)"}}},"examples":{"agent":{"summary":"Agent signup","value":{"email":"agent@bot.com"}},"human":{"summary":"Human signup","value":{"email":"dev@company.com","name":"Jane Developer"}}}}}},"responses":{"201":{"description":"Account created with sandbox API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupResponse"},"example":{"id":"acc_abc123def456","email":"agent@bot.com","status":"active","api_key":"ps_test_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"}}}},"400":{"description":"Invalid email","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"409":{"description":"Email already registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","message":"An account with this email already exists","code":"email_taken"}}}}},"429":{"$ref":"#/components/responses/RateLimited"}},"x-payment-info":{"intent":"session","method":"stripe","amount":0,"currency":"EUR","description":"Free signup — no payment required"}}},"/v1/account":{"get":{"operationId":"getAccount","tags":["Account"],"summary":"Get account details","description":"Returns the authenticated account's profile, API keys (prefixes only —\nnever full keys), and aggregate usage statistics.\n","responses":{"200":{"description":"Account details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}}},"/v1/account/keys":{"post":{"operationId":"createKey","tags":["Account"],"summary":"Create API key","description":"Create an additional API key for this account.\n\n- `sandbox: true` (default) — creates a `ps_test_*` key for sandbox use\n- `sandbox: false` — creates a `ps_live_*` key for production use\n\nThe full key is returned **once** in the response. Store it securely.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","description":"Human-readable label to identify this key"},"sandbox":{"type":"boolean","default":true,"description":"`false` creates a production key"}}},"example":{"label":"CI/CD pipeline","sandbox":true}}}},"responses":{"201":{"description":"Key created (full key shown only once)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/account/keys/{prefix}":{"delete":{"operationId":"revokeKey","tags":["Account"],"summary":"Revoke API key","description":"Permanently revoke an API key by its prefix. The key will immediately\nstop working for authentication. This action cannot be undone.\n","parameters":[{"name":"prefix","in":"path","required":true,"schema":{"type":"string"},"description":"Key prefix as shown in `GET /v1/account` (e.g., `ps_test_a1b2c3...`)","example":"ps_test_a1b2c3..."}],"responses":{"200":{"description":"Key revoked","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean","example":true},"prefix":{"type":"string"}}}}}},"404":{"description":"Key not found or already revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/account/audit":{"get":{"operationId":"listAccountAuditEvents","tags":["Audit"],"summary":"List audit events for the calling account","description":"Returns paginated audit events from all workspaces where the calling\naccount is a member. Events include API key creation/revocation,\nmembership changes, company mutations, and webhook lifecycle events.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Opaque cursor from a previous response's `next_cursor` field","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated list of audit events","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AuditEvent"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}}},"/v1/workspaces/{id}/audit":{"get":{"operationId":"listWorkspaceAuditEvents","tags":["Audit"],"summary":"List audit events for a workspace","description":"Returns paginated audit events scoped to a specific workspace.\nThe calling account must be a member of the workspace.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","example":"wsp_abc123"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Opaque cursor from a previous response's `next_cursor` field","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated list of audit events","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AuditEvent"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/account/usage":{"get":{"operationId":"getUsage","tags":["Account"],"summary":"Get usage statistics","description":"Returns daily usage statistics for the authenticated account.\nIncludes documents sent and API calls per day, plus period totals.\n","parameters":[{"name":"days","in":"query","description":"Number of days of history to return (max 90)","schema":{"type":"integer","default":30,"maximum":90}}],"responses":{"200":{"description":"Usage statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}}},"/v1/kyc":{"get":{"operationId":"getKyc","tags":["KYC"],"summary":"Get workspace KYC state","description":"Returns the complete KYC state for the caller's workspace: the current\n`status`, the own-company anchor, submitted metadata, the versioned\nattestation (including its full text and current version), every\nuploaded document, informational mandate coverage, and a `requirements`\nblock telling you exactly what is still missing before you can submit.\n\nRead this before uploading documents and before submitting — it drives\nthe whole go-live flow. `attestation.text` and\n`attestation.current_version` are what you echo back on submit, and\n`requirements.can_submit` tells you whether a submit will pass the gates.\n\nThe document `sha256` and `r2_key` are stored internally and are\n**never** returned.\n","responses":{"200":{"description":"Workspace KYC state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KycState"},"examples":{"none":{"summary":"Fresh workspace (nothing submitted)","value":{"status":"none","company_id":null,"submitted_at":null,"reviewed_at":null,"reject_reason":null,"review_reference":null,"legal_name":null,"enterprise_number":null,"attestation":{"name":null,"role":null,"version":null,"current_version":"2026-08-26","text":"**Workspace verification and mandate attestation**\n\nBy checking this box I confirm, on behalf of **[Workspace legal entity]**:\n\n1. **Authority.** I am an authorised representative of this entity and may accept these terms for it.\n...\n☐ I have read and agree. Signed: **[name] — [role] — [date]**"},"documents":[],"mandate_coverage":{"companies_with_mandate":0,"total_companies":0},"requirements":{"has_company":false,"own_company_id":null,"missing_workspace_doc_types":["registry_extract","representative_id","authority_proof"],"can_submit":false}}},"approved":{"$ref":"#/components/examples/KycStateApproved"}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"description":"Workspace not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"not_found","code":"workspace_not_found","message":"Workspace not found","retry":{"retryable":false}}}}}}}}},"/v1/kyc/documents":{"post":{"operationId":"uploadKycDocument","tags":["KYC"],"summary":"Upload a KYC document","description":"Upload one KYC document as base64-encoded bytes. Two families of\ndocument exist:\n\n- **Workspace-level** (`registry_extract`, `representative_id`,\n  `authority_proof`) — cover the whole workspace. `company_id` and\n  `mandate_grantor_name` **must be omitted**. All three are required\n  before you can submit.\n- **Company-level** (`mandate`) — one per company you represent.\n  Requires both `company_id` (a company in the workspace) and\n  `mandate_grantor_name`. Mandates are optional evidence and never gate\n  submission; the own company is exempt.\n\n**Constraints**\n\n- Max size **10 MB** per document.\n- Accepted types: PDF, PNG, JPEG, XLSX. The MIME type is **sniffed from\n  the file's magic bytes** — the server does not trust a declared\n  `mime_type`. If you send `mime_type` and it disagrees with the sniffed\n  type the upload is rejected (`kyc_mime_mismatch`); omit it to skip that\n  check.\n- Uploads are **locked** once the workspace status is `pending` or\n  `approved` (`kyc_locked`).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KycDocumentUpload"},"examples":{"workspace_doc":{"summary":"Workspace document (registry_extract)","value":{"doc_type":"registry_extract","filename":"kbo-extract.pdf","content":"JVBERi0xLjcK... (base64 of a %PDF file)","mime_type":"application/pdf"}},"mandate_doc":{"summary":"Company mandate document","value":{"doc_type":"mandate","filename":"mandate-bakery.pdf","content":"JVBERi0xLjcK... (base64 of a %PDF file)","mime_type":"application/pdf","company_id":"com_2mN4oP6qR8sT0uV2wX4yZ","mandate_grantor_name":"Marie Dubois"}}}}}},"responses":{"201":{"description":"Document stored","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KycDocument"},"examples":{"workspace_doc":{"summary":"registry_extract stored","value":{"id":"kyd_3aB7cD9eF1gH2iJ4kL6mN","company_id":null,"doc_type":"registry_extract","filename":"kbo-extract.pdf","mime_type":"application/pdf","size_bytes":184320,"mandate_grantor_name":null,"created_at":"2026-08-27T10:15:00.000Z"}},"mandate_doc":{"summary":"mandate stored","value":{"id":"kyd_9qR1sT3uV5wX7yZ9aB1cD","company_id":"com_2mN4oP6qR8sT0uV2wX4yZ","doc_type":"mandate","filename":"mandate-bakery.pdf","mime_type":"application/pdf","size_bytes":66000,"mandate_grantor_name":"Marie Dubois","created_at":"2026-08-27T10:16:20.000Z"}}}}}},"400":{"description":"Bad request. `code` distinguishes the cause:\n- `kyc_missing_content` — `content` absent or empty.\n- `kyc_invalid_encoding` — `content` is not valid base64.\n- `kyc_invalid_doc_type` — `doc_type` is not one of the four types.\n- `kyc_unsupported_type` — the sniffed magic bytes match no accepted type.\n- `kyc_mime_mismatch` — declared `mime_type` disagrees with the sniffed type.\n- `kyc_mandate_requires_company` — a `mandate` upload is missing `company_id` or `mandate_grantor_name`.\n- `kyc_doc_pairing_invalid` — a workspace document carries `company_id` or `mandate_grantor_name`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"kyc_mime_mismatch","message":"Declared application/pdf but content is image/png","param":"file","retry":{"retryable":false}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"description":"Not found. `workspace_not_found` if the workspace row is missing, or\n`company_not_found` if a `mandate` `company_id` is not a company of\nthis workspace.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"not_found","code":"company_not_found","message":"Company not found","retry":{"retryable":false}}}}}},"409":{"description":"`kyc_locked` — uploads are locked because the workspace status is\n`pending` or `approved`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"kyc_locked","message":"KYC documents cannot be changed once submitted","retry":{"retryable":false}}}}}},"413":{"description":"`kyc_document_too_large` — the decoded document exceeds the 10 MB cap.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"kyc_document_too_large","message":"Document exceeds the 10 MB limit","param":"file","retry":{"retryable":false}}}}}}}}},"/v1/kyc/submit":{"post":{"operationId":"submitKyc","tags":["KYC"],"summary":"Submit workspace KYC for review","description":"Submit the workspace for KYC review. Allowed only from `none` or\n`rejected`; on success the status becomes `pending` and the response is\nthe full `GET /v1/kyc` shape reflecting the new state.\n\nBefore submitting, all of the following must hold (check\n`requirements.can_submit` in `GET /v1/kyc`):\n\n- the workspace has at least one company;\n- `company_id` names the own company (the signing legal entity);\n- all three workspace document types have been uploaded\n  (`registry_extract`, `representative_id`, `authority_proof`);\n- `kyc_legal_name` and `kyc_enterprise_number` are provided\n  (the enterprise number is stored verbatim — no format check);\n- `attestation_name` and `attestation_role` are provided;\n- `attested` is exactly `true`;\n- `attestation_version` equals the current version from\n  `attestation.current_version` (currently `2026-08-26`).\n\nMandate documents are optional and are **not** required to submit. The\nown company is exempt from the mandate requirement.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KycSubmit"},"example":{"company_id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","kyc_legal_name":"Acme Trading BV","kyc_enterprise_number":"0123.456.789","attestation_name":"Jan Janssens","attestation_role":"Managing Director","attested":true,"attestation_version":"2026-08-26"}}}},"responses":{"200":{"description":"Submitted. Body is the full `GET /v1/kyc` state with `status`\nflipped to `pending` and the submitted metadata populated.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KycState"},"examples":{"submitted":{"$ref":"#/components/examples/KycStateSubmitted"}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"409":{"description":"`kyc_not_submittable` — the workspace is not in a state that can\ntransition to `pending` (it is already `pending` or `approved`, or a\nconcurrent submit won the race).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"kyc_not_submittable","message":"KYC is not in a submittable state","retry":{"retryable":false}}}}}},"422":{"description":"A submission gate failed. Gates are evaluated in order; `code`\nidentifies the first one that failed:\n- `kyc_no_companies` — the workspace has no companies.\n- `kyc_no_own_company` — `company_id` was blank.\n- `kyc_invalid_company` — `company_id` is not a company of this workspace.\n- `kyc_missing_documents` — a required workspace doc type is missing (`details.missing` lists them).\n- `kyc_missing_legal_name` — `kyc_legal_name` was blank.\n- `kyc_missing_enterprise_number` — `kyc_enterprise_number` was blank.\n- `kyc_attestation_incomplete` — `attestation_name` or `attestation_role` was blank.\n- `kyc_attestation_not_accepted` — `attested` was not `true`.\n- `kyc_attestation_version_mismatch` — `attestation_version` does not equal the current version.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"kyc_attestation_version_mismatch","message":"Attestation version must equal 2026-08-26","retry":{"retryable":false}}}}}}}}},"/v1/companies":{"post":{"operationId":"createCompany","tags":["Companies"],"summary":"Create a company","description":"Create a new company (business entity) in the caller's workspace. The\nresponse echoes the caller's workspace `role`.\n\n`name`, `country` and a Peppol ID are required. `country` must be an\nISO 3166-1 alpha-2 code for a country with active Peppol support (e.g.\n`BE`); codes that are unknown or not Peppol-active (e.g. `FR`) are\nrejected with `invalid_country`. A missing `name` or `country` returns\n`missing_field`.\n\n**Peppol ID.** Send `peppol_id`, except for a Belgian company with a\n`company_registration_id`: it defaults to `0208:<company_registration_id>`,\nwithout the dots and spaces of the registration number\n(`0410.086.603` gives `0208:0410086603`). With no Peppol ID the request\nfails with `missing_peppol_id`. The Peppol ID is checked against the\nOpenPeppol participant identifier scheme code list: the scheme must be\nactive, the identifier must have the format and check digit of its\nscheme (`invalid_peppol_id`), and the scheme must belong to `country` or\nbe international, such as `0088` (GLN) or `0199` (LEI)\n(`peppol_id_country_mismatch`). For example, a company in `GB` uses\n`9932:GB123456789` (UK VAT number), not a Belgian `0208` number.\n\nThe identifier after the colon has 1 to 130 characters: letters,\ndigits, `-`, `.`, `_` and `~` (Peppol Policy for use of Identifiers,\nPOLICY 1), and no whitespace anywhere. A scheme with its own format is\nstricter: a `0208` identifier is a 10-digit enterprise number, and a\n`9925` identifier is `BE` plus that number. Spaces and separators are\nnever removed for you: `0208:0410.086.603` fails with\n`invalid_peppol_id`, and the message names the clean value\n(`Use 0208:0410086603.`).\n\n**VAT schemes.** An EU VAT scheme (`99xx`) takes the VAT number with\nits country prefix, in the national format, with its check digit where\nthe country publishes one: `9930:DE123456788`, `9914:ATU12345675`,\n`9944:NL123456782B01`, `9957:FR11123456782`. Greece (`9933`) is the\nexception: the 9-digit TIN without `EL` (`9933:123456783`, Peppol BIS\nrule GR-R-009). A register number in a VAT scheme fails with\n`invalid_peppol_id` and a message that says so: `9930:DEHRB135199B` is\na German register number, not a VAT number. When `tax_id` is a valid\nVAT number of the scheme, the Peppol ID must be that VAT number\n(`peppol_id_tax_id_mismatch`); the message names the Peppol ID to use\n(`Use 9930:DE240712418.`). A `tax_id` of another kind, such as a\nGerman tax number, is not compared.\n\n**Auto-provisioning.** In a workspace whose KYC status is already\n`approved`, creating a company **auto-provisions** its e-invoice.be\nprovider tenant so it can go live immediately (`is_live: true`). This is\nbest-effort: if provisioning fails the company is still created and the\ncall still returns `201` with `is_live: false`. In workspaces that are\nnot yet approved, `is_live` is always `false` until the workspace passes\nKYC (see the KYC tag).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyCreate"},"examples":{"minimal":{"summary":"Minimal (name + country)","value":{"name":"Acme BV","country":"BE"}},"full":{"summary":"Full details","value":{"name":"Acme BV","country":"BE","company_registration_id":"0123456749","tax_id":"BE0123456749","email":"billing@acme.be","iban":"BE68539007547034","address":{"street":"Keizerslaan 1","city":"Brussels","postal_code":"1000"}}}}}}},"responses":{"201":{"description":"Company created. Caller is the owner.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Company"},"example":{"id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","name":"Acme BV","workspace_id":"wsp_abc123def456","role":"owner","is_live":false,"company_registration_id":"0123456749","tax_id":"BE0123456749","email":"billing@acme.be","country":"BE","address":{"street":"Keizerslaan 1","city":"Brussels","postal_code":"1000"},"iban":"BE68539007547034","peppol_id":"0208:0123456749","created_at":"2026-03-05T12:00:00.000Z"}}}},"400":{"description":"Validation error — `missing_field` (`name` or `country` omitted),\n`invalid_country` (country unknown or not Peppol-active),\n`missing_peppol_id` (no Peppol ID given and none can be derived),\n`invalid_peppol_id` (not `scheme:id`; whitespace or a character that\nPeppol does not permit; unknown, removed or deprecated scheme; wrong\nformat or check digit; a register number in a VAT scheme),\n`peppol_id_country_mismatch` (the scheme belongs to another\ncountry), or `peppol_id_tax_id_mismatch` (a VAT-scheme Peppol ID\nthat is not the VAT number in `tax_id`). The message names the\nschemes to use instead, or the Peppol ID to use when it is known.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"invalid_country","message":"Country FR is not supported for Peppol","param":"country","retry":{"retryable":false}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}},"get":{"operationId":"listCompanies","tags":["Companies"],"summary":"List your companies","description":"Returns every company in the caller's workspace, newest first. A\ncompany-scoped API key sees only its own company.\n\nList items are a summary shape — they carry `is_live` and\n`workspace_id` but omit the address, registration id, email, IBAN,\nPeppol id, and role. Fetch a single company for the full detail shape.\n","responses":{"200":{"description":"List of companies","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CompanyListItem"}}}},"example":{"data":[{"id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","name":"Acme BV","tax_id":"BE0123456749","country":"BE","is_live":true,"workspace_id":"wsp_abc123def456","created_at":"2026-03-05T12:00:00Z"}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}}},"/v1/companies/{id}":{"get":{"operationId":"getCompany","tags":["Companies"],"summary":"Get company details","description":"Returns full details for a company. The calling account must be a\nmember of the company. A company-scoped API key gets\n`403 key_company_scope` for any other company.\n","parameters":[{"$ref":"#/components/parameters/CompanyId"}],"responses":{"200":{"description":"Company details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyDetail"},"example":{"id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","name":"Acme BV","workspace_id":"wsp_abc123def456","company_registration_id":"0123456749","tax_id":"BE0123456749","email":"billing@acme.be","country":"BE","address":{"street":"Keizerslaan 1","city":"Brussels","postal_code":"1000"},"iban":"BE68539007547034","peppol_id":"0208:0123456749","is_live":true,"created_at":"2026-03-05T12:00:00.000Z","updated_at":"2026-03-06T09:30:00.000Z"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"description":"The API key is scoped to a different company (`key_company_scope`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"404":{"description":"Company not found (or you are not a member)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}},"patch":{"operationId":"updateCompany","tags":["Companies"],"summary":"Update company","description":"Update company details. Only **owners** and **admins** can update.\nSend only the fields you want to change.\n","parameters":[{"$ref":"#/components/parameters/CompanyId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyUpdate"},"example":{"name":"Acme BV (new name)","tax_id":"BE0123456749"}}}},"responses":{"200":{"description":"Company updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyDetail"},"example":{"id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","name":"Acme BV (new name)","workspace_id":"wsp_abc123def456","company_registration_id":"0123456749","tax_id":"BE0123456749","email":"billing@acme.be","country":"BE","address":{"street":"Keizerslaan 1","city":"Brussels","postal_code":"1000"},"iban":"BE68539007547034","peppol_id":"0208:0123456749","is_live":true,"created_at":"2026-03-05T12:00:00.000Z","updated_at":"2026-03-07T14:05:00.000Z"}}}},"400":{"description":"`no_fields_to_update`, `invalid_country`, `invalid_peppol_id` (as on\ncreate, with the clean value in the message when only spaces or\nseparators are wrong), `peppol_id_country_mismatch`, or\n`peppol_id_tax_id_mismatch`. The Peppol ID is checked against the\ncompany country and `tax_id` after the update, so a request that\nchanges only `country` or `tax_id` to another value re-checks the\nstored Peppol ID.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"peppol_id_country_mismatch","message":"0208 (BE enterprise number) is for a company in Belgium, not in the United Kingdom. Use 9932 (UK VAT), for example 9932:GB123456789, or an international scheme such as 0088 (GLN).","param":"peppol_id","retry":{"retryable":false}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"description":"Only owners and admins can update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"404":{"description":"Company not found (or you are not a member)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"502":{"description":"`provider_update_failed` — a live company's `peppol_id` change could\nnot be pushed to its provider tenant. No changes were made.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}},"delete":{"operationId":"deleteCompany","tags":["Companies"],"summary":"Delete company","description":"Delete a company with its documents, its company-scoped API keys, and\nits Peppol registration. Only workspace **owners** can delete a\ncompany.\n\n**Warning:** you cannot undo the delete. A live company also loses\nits Peppol registration: other Peppol participants can no longer send\ninvoices to its Peppol ID.\n\nA `ps_test_` key can delete only a company that is not live\n(`is_live: false`). To delete a live company, use a `ps_live_` key.\nThe company that anchors the workspace verification (KYC) cannot be\ndeleted.\n\nThe delete is safe to repeat after a `502`. A repeat after a\nsuccessful delete gives `404`.\n","parameters":[{"$ref":"#/components/parameters/CompanyId"}],"responses":{"204":{"description":"Company deleted. The response has no body."},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"description":"`insufficient_role` — only workspace owners can delete a company.\n`live_company_requires_live_key` — the company is live and the\nrequest used a `ps_test_` key. `key_company_scope` — the API key\nis scoped to a different company.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"authorization_error","code":"live_company_requires_live_key","message":"This company is live on the Peppol network. Use a live API key (ps_live_) to delete it.","retry":{"retryable":false}}}}}},"404":{"description":"`company_not_found` — the company does not exist, or you are not\na member of its workspace.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"409":{"description":"`company_is_kyc_anchor` — the company anchors the workspace\nverification (KYC) and cannot be deleted. The `type` is\n`validation_error`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"502":{"description":"`provider_unavailable` — the company could not be removed from\nthe Peppol network. Nothing was changed. Try again later.\n`company_delete_incomplete` — the company was removed from the\nPeppol network, but its record was not deleted. The message\ncontains the company id. Repeat the delete.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/documents":{"post":{"operationId":"sendDocument","summary":"Send a document","tags":["Documents"],"description":"Create and send a Peppol document in a single call.\n\n**Requires `company_id`** — the company whose provider credentials\nwill be used. The calling account must be a member of that company.\n\n- With `ps_test_` keys: the sandbox runs the checks of a live send\n  (the schema, the Peppol IDs, the sender is the company, the totals\n  and Peppol BIS 3.0, the receiver is on the Peppol network), then\n  simulates the delivery. See Sandbox in the introduction. Test with\n  the sandbox test receiver `0208:1234567894`.\n- With `ps_live_` keys: delivered via Peppol network (production)\n\nTo make a retry safe, send an `Idempotency-Key` header (or the\n`idempotency_key` body field, which is the same key).\n","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/DocumentCreate"},{"type":"object","required":["company_id"],"properties":{"company_id":{"type":"string","description":"ID of the company sending this document"}}}]},"examples":{"invoice":{"summary":"Invoice to the sandbox test receiver","value":{"company_id":"com_abc123","type":"invoice","number":"INV-2026-001","issue_date":"2026-03-01","due_date":"2026-03-31","currency":"EUR","from":{"name":"Acme BV","tax_id":"BE0123456749","address":{"street":"Keizerslaan 1","city":"Brussels","postal_code":"1000","country":"BE"}},"to":{"name":"Sandbox Test Receiver","tax_id":"BE1234567894","address":{"street":"Teststraat 1","city":"Brussels","postal_code":"1000","country":"BE"}},"lines":[{"description":"API Integration Services","quantity":1,"unit_price":500,"tax_rate":21}]}},"credit_note":{"summary":"Credit note with a preceding invoice reference","value":{"company_id":"com_abc123","type":"credit_note","number":"CN-2026-001","issue_date":"2026-03-15","due_date":"2026-04-14","currency":"EUR","preceding_invoice":{"number":"INV-2026-001","issue_date":"2026-03-01"},"from":{"name":"Acme BV","tax_id":"BE0123456749","address":{"street":"Keizerslaan 1","city":"Brussels","postal_code":"1000","country":"BE"}},"to":{"name":"Sandbox Test Receiver","tax_id":"BE1234567894","address":{"street":"Teststraat 1","city":"Brussels","postal_code":"1000","country":"BE"}},"lines":[{"description":"API Integration Services","quantity":1,"unit_price":500,"tax_rate":21}]}}}}}},"responses":{"200":{"description":"Idempotent replay — the same idempotency key was already accepted,\nso the `id` and `url` of the existing document are returned and no\nsecond send is queued. A replay does not cost a credit, and it\nsucceeds when the balance is 0. `status` is always `queued` here;\nget the document at `url` for its current status.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentAccepted"}}}},"202":{"description":"Accepted for async sending. The document is persisted and queued;\npoll the document at the `Location` URL or subscribe to webhooks\nfor the outcome. When the remaining balance is below the\nlow-balance threshold, the response includes an\n`X-Credits-Remaining` header.\n","headers":{"Location":{"$ref":"#/components/headers/Location"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentAccepted"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"403":{"description":"Not a member of the specified company","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"422":{"$ref":"#/components/responses/ValidationError"},"429":{"$ref":"#/components/responses/RateLimited"}},"x-payment-info":{"intent":"charge","method":"stripe","amount":0.1,"currency":"EUR","description":"Per-document charge: from €0.10 per invoice sent via Peppol"}},"get":{"operationId":"listDocuments","tags":["Documents"],"summary":"List sent documents","description":"List documents sent by a company. Results use cursor-based pagination.\n\n**Requires `company_id` query parameter.**\n","parameters":[{"name":"company_id","in":"query","required":true,"description":"Filter by company","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/DocumentStatus"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"cursor","in":"query","description":"Opaque cursor from a previous response's `next_cursor` field","schema":{"type":"string"}}],"responses":{"200":{"description":"List of documents","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentList"}}}},"403":{"description":"Not a member of the specified company","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/documents/batch":{"post":{"operationId":"sendDocumentBatch","tags":["Documents"],"summary":"Send a batch of documents","description":"Send up to 100 documents in a single request. All documents in a batch\nmust use the same `company_id`.\n\nEach document is processed independently — partial failures are possible.\nThe response array maps 1:1 to the input array.\n\nThe `Idempotency-Key` header has no effect here, because one key\ncannot identify many documents. To make a retry safe, set\n`idempotency_key` on each document. An item whose key was already\naccepted gets the `id` and `url` of the existing document and does\nnot cost a credit.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/DocumentCreate"},{"type":"object","required":["company_id"],"properties":{"company_id":{"type":"string"}}}]},"maxItems":100}}}},"responses":{"202":{"description":"Accepted — batch results, one entry per input document. When the\ncompany's remaining balance after the batch is below the\nlow-balance threshold, the response includes an\n`X-Credits-Remaining` header.\n","content":{"application/json":{"schema":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/DocumentAccepted"},{"$ref":"#/components/schemas/ErrorObject"}]}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PaymentRequired"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/documents/{id}":{"get":{"operationId":"getDocument","tags":["Documents"],"summary":"Get document details","description":"Retrieve details of a specific document. Requires `company_id` query\nparameter, and the calling account must be a member of that company.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"doc_a1b2c3d4"},{"name":"company_id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Document details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetail"}}}},"403":{"description":"Not a member of the specified company","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/documents/{id}/history":{"get":{"operationId":"getDocumentHistory","tags":["Documents"],"summary":"Get delivery history","description":"Timeline of events for this document: created, validated,\nqueued, in transit, delivered, or failed. Scoped to the caller's\nworkspace.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Event history","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentEvent"}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"description":"`document_not_found` — no document with this id in the caller's\nworkspace.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/documents/{id}/ubl":{"get":{"operationId":"getDocumentUbl","tags":["Documents"],"summary":"Download the Send-ready UBL","description":"Stream the stored Send-ready UBL XML for a document, scoped to the\ncaller's workspace. Returns `404` until the document has been sent and\nits UBL persisted.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"doc_a1b2c3d4"}],"responses":{"200":{"description":"UBL document","content":{"application/xml":{"schema":{"type":"string"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/documents/{id}/attachments":{"get":{"operationId":"listDocumentAttachments","tags":["Documents"],"summary":"List document attachments","description":"List metadata for every attachment stored with a document, scoped to\nthe caller's workspace. Bytes are fetched via the per-attachment\nendpoint.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Attachment metadata","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentAttachment"}}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/documents/{id}/attachments/{att_id}":{"get":{"operationId":"getDocumentAttachment","tags":["Documents"],"summary":"Download an attachment","description":"Stream one attachment's raw bytes from storage with its verified\n`Content-Type`, scoped to the caller's workspace.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"att_id","in":"path","required":true,"schema":{"type":"string"},"example":"att_a1b2c3d4"}],"responses":{"200":{"description":"Attachment bytes","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/events":{"get":{"operationId":"listEvents","tags":["Events"],"summary":"List document events","description":"Returns a chronological feed of document events (queued, sending,\ndelivered, failed) across the workspace, newest first. Workspace is\ndetermined from the API key. Optionally narrow to a single company\nwith the `company_id` query parameter.\n\nSupports filtering by event type, date range, document ID, and\nfree-text search on document number or recipient.\nUses cursor-based keyset pagination for stable results under\nconcurrent inserts.\n","parameters":[{"name":"company_id","in":"query","required":false,"schema":{"type":"string"},"description":"Optional company filter; must belong to the workspace"},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["queued","sending","delivered","failed","retry"]},"description":"Filter by event type"},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Start of date range (inclusive)"},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"End of date range (inclusive)"},{"name":"document_id","in":"query","required":false,"schema":{"type":"string"},"description":"Filter to events for a specific document"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Free-text search. Matches case-insensitively on document number or recipient name."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Pagination cursor from previous response"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"description":"Number of events per page"}],"responses":{"200":{"description":"Paginated list of events","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EventWithContext"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}}}}}}}},"/v1/lookup/{peppol_id}":{"get":{"operationId":"lookupParticipant","summary":"Lookup Peppol participant via SMP","tags":["Lookup"],"security":[],"description":"Resolve a Peppol participant directly via SMP (Service Metadata Publisher).\nUses NAPTR DNS lookup with SHA-256 hashing to discover the SMP,\nthen fetches ServiceGroup and ServiceMetadata to return supported\ndocument types and AS4 endpoints.\n\n**Public endpoint** — no API key required. Anonymous callers are\nrate-limited to 60 lookups/hour per IP. Pass a sandbox key for 600/h\nor a live key for 6000/h.\n\nEach endpoint in the response includes parsed X.509 certificate\nfields (`cert_subject`, `cert_issuer`, `cert_valid_from`,\n`cert_valid_to`, `cert_fingerprint_sha256`). Unparsable certificates\nreturn `null` for these fields.\n","parameters":[{"name":"peppol_id","in":"path","required":true,"description":"Peppol participant ID in `EAS:code` format (e.g., `0208:0123456749`)\n","schema":{"type":"string"},"example":"0208:0123456749"},{"name":"domain","in":"query","required":false,"description":"SML domain to query. `sml` for production, `smk` for test.\n","schema":{"type":"string","enum":["sml","smk"],"default":"sml"}}],"responses":{"200":{"description":"Participant found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmpLookupResult"}}}},"400":{"description":"Invalid peppol_id or scheme","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"404":{"description":"Participant not found in SML/SMP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"429":{"description":"Rate limit exceeded. Check the `Retry-After` header.\nAnonymous limit is 60/h per IP — pass an API key for higher limits.\n","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"502":{"description":"`smp_error`: the DNS lookup or the SMP failed, for example when\nthe DNS resolver answers with an error (SERVFAIL). It does not\nsay that the participant is missing. Retry later.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}},"x-payment-info":{"intent":"charge","method":"stripe","amount":0,"currency":"EUR","description":"Free — included with API access"}}},"/v1/lookup/{peppol_id}/dns":{"get":{"operationId":"lookupParticipantDns","tags":["Lookup"],"summary":"DNS-only Peppol participant resolution","security":[],"description":"Resolve just the NAPTR/SMP DNS layer for a Peppol participant without\nfetching the full ServiceGroup or business card. Returns the computed\nNAPTR hostname, the resolved SMP URL, and the domain used.\n\n**Public endpoint** — same rate limits as the full lookup.\n","parameters":[{"name":"peppol_id","in":"path","required":true,"description":"Peppol participant ID in `EAS:code` format (e.g., `0208:0123456749`)\n","schema":{"type":"string"},"example":"0208:0123456749"},{"name":"domain","in":"query","required":false,"description":"SML domain to query. `sml` for production, `smk` for test.\n","schema":{"type":"string","enum":["sml","smk"],"default":"sml"}}],"responses":{"200":{"description":"DNS resolution result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DnsLookupResult"}}}},"400":{"description":"Invalid peppol_id or scheme","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"404":{"description":"Participant not found (no NAPTR record)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"`smp_error`: the DNS lookup failed, for example when the DNS\nresolver answers with an error (SERVFAIL). It does not say that\nthe participant is missing. Retry later.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/validate":{"post":{"operationId":"validateDocument","summary":"Validate a document payload","tags":["Validate"],"description":"Validate a document payload without creating or sending anything.\nReturns a `ValidationResult` with field-level errors and warnings —\nperfect for form validation in your UI.\n\nAccepts either:\n  - `application/json`: a `DocumentCreate` body plus `company_id`.\n  - `multipart/form-data`: a UBL XML `file` plus `company_id` field.\n\nAn issue that the Peppol validation rules find has the rule id in `code`\n(e.g. `BR-S-02`) and no `path`. An issue in the request body itself has\na dot-path in `path` (e.g. `to.tax_id`, `lines[0].unit_price`) so SDK\nclients can highlight the right form field.\n\nA sandbox send (`POST /v1/documents` with a `ps_test_` key) runs this\nsame validation, so a document that is `valid` here passes the Peppol\nBIS 3.0 check of the sandbox. Only a send checks the sender and that\nthe receiver is registered on the Peppol network.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/DocumentCreate"},{"type":"object","required":["company_id"],"properties":{"company_id":{"type":"string","description":"Company whose provider credentials should validate this document."}}}]},"examples":{"invoice":{"summary":"Validate an invoice payload","value":{"company_id":"com_abc123","type":"invoice","number":"INV-2026-0001","issue_date":"2026-04-04","due_date":"2026-05-04","from":{"name":"Acme BV","tax_id":"BE0123456749"},"to":{"name":"Globex NV","tax_id":"BE0403170701"},"lines":[{"description":"Consulting","quantity":1,"unit_price":1000,"tax_rate":21}]}}}},"multipart/form-data":{"schema":{"type":"object","required":["file","company_id"],"properties":{"file":{"type":"string","format":"binary","description":"UBL XML document to validate (max 5 MB). Send the part with\nan XML content type such as `application/xml` or\n`text/xml`, or as `application/octet-stream`.\n"},"company_id":{"type":"string","description":"Company whose provider credentials should validate this document."}}},"encoding":{"file":{"contentType":"application/xml, text/xml, application/octet-stream"}}}}},"responses":{"200":{"description":"Validation result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationResult"},"examples":{"valid":{"summary":"Payload is valid","value":{"valid":true,"errors":[],"warnings":[]}},"invalid":{"summary":"Document breaks a Peppol validation rule","value":{"valid":false,"errors":[{"code":"BR-S-02","message":"[BR-S-02]-An Invoice that contains an Invoice line (BG-25) where the Invoiced item VAT category code (BT-151) is \"Standard rated\" shall contain the Seller VAT Identifier (BT-31), the Seller tax registration identifier (BT-32) and/or the Seller tax representative VAT identifier (BT-63)."}],"warnings":[{"code":"UBL-CR-005","message":"[UBL-CR-005]-A UBL invoice should not include the UUID"}]}}}}}},"400":{"description":"The request could not be read. The error `type` is\n`validation_error`, with `code` `invalid_body` (the body is not a\nJSON object or not valid multipart), `unsupported_content_type`,\n`missing_field` (no `file` part), or `invalid_field` (the `file`\npart type is not accepted).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"invalid_body","message":"The request body could not be read as a JSON object"}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"description":"`file_too_large` — the `file` part exceeds the 5 MB limit.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"file_too_large","message":"file exceeds maximum size of 5242880 bytes","param":"file"}}}}},"502":{"description":"The Peppol network could not validate the document. The error\n`type` is `provider_error`, with `code` `provider_unavailable`,\n`rate_limited`, `sender_not_registered`, or `provider_error`. A\ndocument that the network rejects comes back as a `200` with\n`valid: false`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}},"x-payment-info":{"intent":"charge","method":"stripe","amount":0,"currency":"EUR","description":"Free — included with API access"}}},"/v1/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List webhooks","description":"List every webhook configured for the caller's workspace.\n","responses":{"200":{"description":"List of webhooks","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Create a webhook","description":"Create a webhook to receive real-time notifications for document events.\nThe webhook belongs to the caller's workspace.\n\nThe response contains the signing `secret` (`whsec_…`) **once** — store\nit now, it is never returned again. Use it to verify the\n`X-Peppol-Signature-V2` header on every delivery (see the Webhooks tag\ndescription for the algorithm and per-language verification examples).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreate"}}}},"responses":{"201":{"description":"Webhook created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"400":{"description":"The body is not a valid webhook. The error `type` is\n`validation_error`, with `code` `missing_url`, `invalid_url`,\n`missing_events`, or `invalid_event`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"validation_error","code":"missing_url","message":"url is required","param":"url"}}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}}},"/v1/webhooks/{id}":{"get":{"operationId":"getWebhook","tags":["Webhooks"],"summary":"Get a webhook","description":"Fetch a single webhook by id, scoped to the caller's workspace. The\nsigning `secret` is returned only on creation and is never included\nhere.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"},"example":{"id":"whk_abc123","url":"https://example.com/webhooks/peppol","events":["document.delivered","document.failed"],"active":true,"created_at":"2026-03-05T12:00:00.000Z"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"404":{"description":"Webhook not found for the authenticated account's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"not_found","code":"webhook_not_found","message":"Webhook whk_abc123 not found","param":"id","retry":{"retryable":false}}}}}}}},"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Delete a webhook","description":"Delete a webhook belonging to the caller's workspace.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook deleted","content":{"application/json":{"schema":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"boolean","description":"Always `true` when the webhook was removed."}}},"example":{"deleted":true}}}},"401":{"$ref":"#/components/responses/Unauthenticated"}}}},"/v1/webhooks/{id}/deliveries":{"get":{"operationId":"listWebhookDeliveries","tags":["Webhooks"],"summary":"List webhook deliveries","description":"Paginated delivery log for a webhook. Returns attempts with their HTTP\nstatus, retry state, and failure reason. Delivery records are retained\nfor both successful and failed attempts so customers can diagnose\nintegration issues.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Page size (default 50, max 100).","schema":{"type":"integer","default":50,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"Delivery id returned in the previous page's `next_cursor`.","schema":{"type":"string"}}],"responses":{"200":{"description":"Page of webhook deliveries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryList"}}}},"404":{"description":"Webhook not found for the authenticated account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/webhooks/{id}/test":{"post":{"operationId":"testWebhook","tags":["Webhooks"],"summary":"Send a test event","description":"Send a synthetic `webhook.test` event to the webhook's configured URL\nright now. The response echoes the downstream HTTP status so you can\nverify your receiver is reachable and validating signatures correctly.\nThe attempt is recorded in the delivery log just like a real event.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Test event dispatched (check `success` + `status_code` for the receiver's response)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookTestResponse"}}}},"404":{"description":"Webhook not found for the authenticated account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/webhooks/{id}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","tags":["Webhooks"],"summary":"Rotate the signing secret","description":"Mint a new signing secret for this webhook and return it ONCE in the\nresponse — it is never retrievable again, exactly like the secret from\ncreation. The previous secret enters a 24-hour overlap window: during\nthat window `X-Peppol-Signature-V2` carries one `v1=` signature per\nactive secret (new first), so a receiver can accept either while it\nrolls out the new secret. The legacy `X-Peppol-Signature` switches to\nthe new secret immediately. Rotating again before the window closes\ndrops the older secret (max two active secrets).\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"New secret minted (returned once) and overlap window opened","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRotateSecretResponse"}}}},"404":{"description":"Webhook not found for the authenticated account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}}},"/v1/billing/checkout":{"post":{"operationId":"purchaseCredits","summary":"Purchase invoice credits","x-payment-info":{"intent":"session","method":"stripe","amount":25,"currency":"EUR","description":"Credit top-up starting at €25 for 125 credits"}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key prefixed with `ps_live_` (production) or `ps_test_` (sandbox).\n\nPass in the `Authorization` header:\n```\nAuthorization: Bearer ps_test_a1b2c3...\n```\n"}},"parameters":{"CompanyId":{"name":"id","in":"path","required":true,"description":"Company ID (e.g., `com_abc123`)","schema":{"type":"string"},"example":"com_abc123"},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Unique key that prevents a duplicate send when you retry a request.\nIt is an alias of the `idempotency_key` body field: send the key in\nthe header or in the body. A second request with the same key in the\nsame workspace returns the `id` of the original document with `200`\nand queues no second send. If you send the two and they are different,\nthe response is `400 idempotency_key_mismatch`. An empty header is\nignored.\n","schema":{"type":"string"},"example":"inv-2026-001-attempt"}},"headers":{"Location":{"description":"Relative URL of the accepted document (`/v1/documents/{id}`). Poll it for the outcome.","schema":{"type":"string"},"example":"/v1/documents/doc_abc123"},"RetryAfter":{"description":"Number of seconds to wait before the next request.","schema":{"type":"integer"},"example":42},"RateLimitLimit":{"description":"Number of requests allowed in the current window.","schema":{"type":"integer"},"example":120},"RateLimitRemaining":{"description":"Number of requests left in the current window.","schema":{"type":"integer"},"example":0},"RateLimitReset":{"description":"Number of seconds until the current window resets.","schema":{"type":"integer"},"example":42},"WWWAuthenticate":{"description":"Bearer challenge. `resource_metadata` is the URL of the\nprotected-resource metadata (RFC 9728) of the host that you called.\n","schema":{"type":"string"},"example":"Bearer resource_metadata=\"https://api.peppol.sh/.well-known/oauth-protected-resource\""}},"examples":{"KycStateApproved":{"summary":"Approved workspace (live)","value":{"status":"approved","company_id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","submitted_at":"2026-08-20 09:14:02","reviewed_at":"2026-08-21 11:30:00","reject_reason":null,"review_reference":"OPS-2026-0042","legal_name":"Acme Trading BV","enterprise_number":"0123.456.789","attestation":{"name":"Jan Janssens","role":"Managing Director","version":"2026-08-26","current_version":"2026-08-26","text":"**Workspace verification and mandate attestation**\n\n...\n☐ I have read and agree. Signed: **[name] — [role] — [date]**"},"documents":[{"id":"kyd_3aB7cD9eF1gH2iJ4kL6mN","company_id":null,"doc_type":"registry_extract","filename":"kbo-extract.pdf","mime_type":"application/pdf","size_bytes":184320,"mandate_grantor_name":null,"created_at":"2026-08-20T09:10:11.000Z"},{"id":"kyd_5oP7qR9sT1uV2wX4yZ6aB","company_id":null,"doc_type":"representative_id","filename":"id-card.png","mime_type":"image/png","size_bytes":90210,"mandate_grantor_name":null,"created_at":"2026-08-20T09:11:00.000Z"},{"id":"kyd_7cD9eF1gH2iJ4kL6mN8oP","company_id":null,"doc_type":"authority_proof","filename":"board-resolution.pdf","mime_type":"application/pdf","size_bytes":51200,"mandate_grantor_name":null,"created_at":"2026-08-20T09:12:30.000Z"},{"id":"kyd_9qR1sT3uV5wX7yZ9aB1cD","company_id":"com_2mN4oP6qR8sT0uV2wX4yZ","doc_type":"mandate","filename":"mandate-bakery.pdf","mime_type":"application/pdf","size_bytes":66000,"mandate_grantor_name":"Marie Dubois","created_at":"2026-08-20T09:13:45.000Z"}],"mandate_coverage":{"companies_with_mandate":1,"total_companies":1},"requirements":{"has_company":true,"own_company_id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","missing_workspace_doc_types":[],"can_submit":false}}},"KycStateSubmitted":{"summary":"Just submitted (pending review)","value":{"status":"pending","company_id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","submitted_at":"2026-08-27 10:20:00","reviewed_at":null,"reject_reason":null,"review_reference":null,"legal_name":"Acme Trading BV","enterprise_number":"0123.456.789","attestation":{"name":"Jan Janssens","role":"Managing Director","version":"2026-08-26","current_version":"2026-08-26","text":"**Workspace verification and mandate attestation**\n\n...\n☐ I have read and agree. Signed: **[name] — [role] — [date]**"},"documents":[{"id":"kyd_3aB7cD9eF1gH2iJ4kL6mN","company_id":null,"doc_type":"registry_extract","filename":"kbo-extract.pdf","mime_type":"application/pdf","size_bytes":184320,"mandate_grantor_name":null,"created_at":"2026-08-20T09:10:11.000Z"}],"mandate_coverage":{"companies_with_mandate":0,"total_companies":0},"requirements":{"has_company":true,"own_company_id":"com_9fJ2kQ7bTx0Lm4Ne1Ry8","missing_workspace_doc_types":[],"can_submit":false}}}},"schemas":{"AuditEvent":{"type":"object","description":"A single append-only audit-trail entry for a security-relevant event.","required":["id","event_type","created_at"],"properties":{"id":{"type":"string","description":"Audit event ID (prefixed `aae_`).","example":"aae_abc123xyz"},"actor_account_id":{"type":"string","nullable":true,"description":"Account that performed the action, or null for system events.","example":"acc_abc123"},"workspace_id":{"type":"string","nullable":true,"description":"Workspace the event is scoped to, or null.","example":"wsp_abc123"},"event_type":{"type":"string","enum":["api_key.created","api_key.revoked","company.created","company.updated","membership.invited","membership.invite_resent","membership.removed","membership.role_changed","membership.ownership_transferred","webhook.created","webhook.deleted","workspace.created"],"example":"api_key.created"},"subject_type":{"type":"string","nullable":true,"enum":["api_key","company","membership","webhook","workspace"],"example":"api_key"},"subject_id":{"type":"string","nullable":true,"example":"ps_test_abc123..."},"ip":{"type":"string","nullable":true},"user_agent":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true,"description":"JSON-encoded event-specific metadata"},"created_at":{"type":"string","format":"date-time"}}},"HealthResponse":{"type":"object","description":"Health-check result with overall status and per-dependency checks.","required":["status","version","environment","worker_version","checks"],"properties":{"status":{"type":"string","enum":["ok","degraded"],"description":"Overall API health status"},"version":{"type":"string","description":"API version","example":"2.0.0"},"environment":{"type":"string","enum":["production","staging","development","test","unknown"],"description":"Current deployment environment"},"worker_version":{"type":["object","null"],"description":"The Cloudflare Worker version that served this request. A check\nafter a deploy waits until `created_at` is later than the deploy\nstart. `null` when the runtime has no version metadata.\n","required":["id","created_at"],"properties":{"id":{"type":"string","description":"Worker version id"},"created_at":{"type":"string","format":"date-time","description":"When the version was uploaded"}}},"checks":{"type":"object","required":["db"],"properties":{"db":{"type":"string","enum":["ok","error"],"description":"Database connectivity status"}}}}},"Workspace":{"type":"object","description":"A workspace is the top-level aggregation, billing, and access-control boundary.","properties":{"id":{"type":"string","description":"Workspace ID (prefixed `wsp_`)","example":"wsp_abc123def456"},"name":{"type":"string","example":"My Workspace"},"connect_enabled":{"type":"boolean","readOnly":true,"description":"Whether the workspace is enabled to operate on behalf of customer\ncompanies (multi-company/agency use). Ops-gated. Not returned on the\ncreate response.\n","example":false},"credit_balance":{"type":"integer","description":"Current credit balance for the workspace","example":100},"suspended":{"type":"boolean","description":"Whether the workspace is suspended","example":false},"role":{"type":"string","enum":["owner","admin","member"],"description":"The authenticated account's role in this workspace"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"WorkspaceMember":{"type":"object","description":"An account's membership of a workspace, with its assigned role.","properties":{"account_id":{"type":"string","description":"ID of the member account (prefixed `acc_`)."},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","admin","member"]},"created_at":{"type":"string","format":"date-time"}}},"SignupResponse":{"type":"object","description":"Response from `POST /v1/signup`. Contains the account ID and a one-time API key.","properties":{"id":{"type":"string","description":"Account ID (prefixed `acc_`)","example":"acc_abc123def456"},"email":{"type":"string","format":"email"},"status":{"type":"string","enum":["active"],"description":"New accounts start as `active`"},"api_key":{"type":"string","description":"Full sandbox API key — **shown only once**. Store it securely.\nUse in `Authorization: Bearer <key>` header.\n","example":"ps_test_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"}}},"Account":{"type":"object","description":"Full account details including API keys and usage.","properties":{"id":{"type":"string","description":"Account ID (prefixed `acc_`)"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","invited","disabled"],"description":"- `active` — fully operational\n- `invited` — created via company invite, pending activation\n- `disabled` — deactivated by admin\n"},"api_keys":{"type":"array","description":"API keys (prefix only — full key is never shown again)","items":{"type":"object","properties":{"prefix":{"type":"string","description":"First 15 chars + \"...\""},"sandbox":{"type":"boolean","description":"Whether this is a sandbox (`ps_test_`) key."},"label":{"type":"string","nullable":true},"last_used_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"revoked":{"type":"boolean"}}}},"usage":{"type":"object","description":"Aggregate usage totals for the account.","properties":{"total_documents_sent":{"type":"integer","description":"Lifetime count of documents sent."},"total_api_calls":{"type":"integer","description":"Lifetime count of API calls."}}},"created_at":{"type":"string","format":"date-time"}}},"ApiKeyCreated":{"type":"object","description":"Response when creating a new API key. The full key is shown only once.","properties":{"api_key":{"type":"string","description":"Full key — **store securely**, shown only once"},"prefix":{"type":"string","description":"Display prefix for identification"},"sandbox":{"type":"boolean"},"label":{"type":"string","nullable":true}}},"UsageResponse":{"type":"object","description":"Aggregate usage over a period with a daily breakdown.","properties":{"period":{"type":"object","properties":{"days":{"type":"integer"},"since":{"type":"string","format":"date"}}},"totals":{"type":"object","properties":{"documents_sent":{"type":"integer"},"api_calls":{"type":"integer"}}},"daily":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"documents_sent":{"type":"integer"},"api_calls":{"type":"integer"}}}}}},"CompanyCreate":{"type":"object","description":"Request body for creating a company.","required":["name","country"],"properties":{"name":{"type":"string","description":"Legal company name."},"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code. Must be a country with active\nPeppol support (e.g. `BE`); trimmed and upper-cased server-side.\nUnknown or non-active codes are rejected with `invalid_country`.\n"},"company_registration_id":{"type":"string","description":"Company registration number (e.g. KBO/CBE number). Optional."},"tax_id":{"type":"string","description":"VAT number (e.g., `BE0123456749`). Optional. A Peppol ID in the VAT\nscheme of the country must be this VAT number.\n"},"email":{"type":"string","format":"email","description":"Contact email for the company. Optional."},"iban":{"type":"string","description":"Bank account IBAN used as a payment default. Optional."},"peppol_id":{"type":"string","description":"Peppol participant identifier in `scheme:id` form (e.g.\n`0208:0123456749`). Required, except for a Belgian company with a\n`company_registration_id`: it defaults to\n`0208:<company_registration_id>` without dots and spaces. Without\none the request fails with `missing_peppol_id`. The scheme must be\nactive in the OpenPeppol participant identifier scheme code list\nand the identifier must have its format and check digit\n(`invalid_peppol_id`). The identifier has 1 to 130 characters:\nletters, digits, `-`, `.`, `_` and `~`, no whitespace; a `0208`\nidentifier is 10 digits (`0208:0410086603`, not\n`0208:0410.086.603`) and a `9925` identifier is `BE` plus those\ndigits. The scheme must belong to `country` or be\ninternational (`peppol_id_country_mismatch`). An EU VAT scheme\n(`99xx`) takes the VAT number with its country prefix\n(`9930:DE123456788`; Greece `9933` without `EL`), and it must be\nthe VAT number in `tax_id` when `tax_id` is one\n(`peppol_id_tax_id_mismatch`).\n"},"address":{"type":"object","description":"Company address. Optional.","properties":{"street":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"}}}}},"CompanyUpdate":{"type":"object","description":"Partial update — send only the fields you want to change.\nAt least one updatable field must be provided.\n","properties":{"name":{"type":"string"},"company_registration_id":{"type":"string"},"tax_id":{"type":"string"},"email":{"type":"string","format":"email"},"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code; validated the same way as on create.\nA new country re-checks the stored Peppol ID and fails with\n`peppol_id_country_mismatch` when its scheme belongs to another\ncountry.\n"},"iban":{"type":"string"},"peppol_id":{"type":"string","description":"Peppol participant identifier in `scheme:id` form. Editable both\nbefore and after go-live: once the company's provider tenant is\nprovisioned, a change is pushed to that tenant BEFORE it is stored,\nso the tenant always owns the Peppol ID it sends from. It is checked\nas on create (characters, format, check digit), against the company\ncountry and `tax_id` after the update: `invalid_peppol_id`,\n`peppol_id_country_mismatch` or `peppol_id_tax_id_mismatch`. A provider\nfailure on the push returns `502 provider_update_failed` and leaves\nthe value unchanged.\n"},"address":{"type":"object","properties":{"street":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"}}}}},"Company":{"type":"object","description":"Company as returned by `POST /v1/companies`. This create shape carries\nthe caller's workspace `role` and omits `updated_at` (fetch the company\nfor that).\n","properties":{"id":{"type":"string","description":"Company ID (prefixed `com_`)."},"name":{"type":"string"},"workspace_id":{"type":"string","description":"ID of the workspace that owns this company (prefixed `wsp_`)."},"role":{"type":"string","enum":["owner","admin","member"],"description":"The calling account's role in the workspace."},"is_live":{"type":"boolean","readOnly":true,"description":"Whether the company is live on the real Peppol network — `true`\nonly once its e-invoice.be provider tenant has been provisioned. In\nan approved workspace the tenant auto-provisions on create; otherwise\nthis is `false` until the workspace passes KYC.\n"},"company_registration_id":{"type":"string","nullable":true,"description":"Company registration number (distinct from the VAT `tax_id`)."},"tax_id":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"country":{"type":"string","description":"Normalised ISO 3166-1 alpha-2 country code."},"address":{"type":"object","nullable":true,"properties":{"street":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true}}},"iban":{"type":"string","nullable":true},"peppol_id":{"type":"string","nullable":true,"description":"Peppol participant identifier in `scheme:id` form. Derived to\n`0208:<company_registration_id>` for a Belgian company when not\ngiven explicitly; null otherwise.\n"},"created_at":{"type":"string","format":"date-time"}}},"CompanyListItem":{"type":"object","description":"Summary of a company in `GET /v1/companies` list responses. A reduced\nshape — no address, registration id, email, IBAN, Peppol id, or role.\n","properties":{"id":{"type":"string","description":"Company ID (prefixed `com_`)."},"name":{"type":"string"},"tax_id":{"type":"string","nullable":true},"country":{"type":"string","nullable":true,"description":"ISO 3166-1 alpha-2 country code."},"is_live":{"type":"boolean","readOnly":true,"description":"Whether the company is live on the Peppol network — derived solely\nfrom whether its provider tenant has been provisioned.\n"},"workspace_id":{"type":"string","description":"ID of the owning workspace."},"created_at":{"type":"string","format":"date-time"}}},"CompanyDetail":{"type":"object","description":"Full company details from `GET /v1/companies/{id}` and\n`PATCH /v1/companies/{id}`. Includes `peppol_id` and `updated_at`;\nunlike the create shape it does not carry `role`.\n","properties":{"id":{"type":"string","description":"Company ID (prefixed `com_`)."},"name":{"type":"string"},"workspace_id":{"type":"string","description":"ID of the owning workspace."},"company_registration_id":{"type":"string","nullable":true,"description":"Company registration number (distinct from the VAT `tax_id`)."},"tax_id":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code."},"address":{"type":"object","properties":{"street":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"postal_code":{"type":"string","nullable":true}}},"iban":{"type":"string","nullable":true},"peppol_id":{"type":"string","nullable":true,"description":"Peppol participant identifier in `scheme:id` form (e.g.\n`0208:0123456749`) — the identifier the company's provider tenant\nowns and sends from.\n"},"is_live":{"type":"boolean","readOnly":true,"description":"Whether the company is live on the Peppol network — derived solely\nfrom whether its provider tenant has been provisioned.\n"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"KycState":{"type":"object","description":"Complete workspace KYC state, returned by `GET /v1/kyc` and by\n`POST /v1/kyc/submit`. Drives the whole go-live flow.\n","required":["status","attestation","documents","mandate_coverage","requirements"],"properties":{"status":{"type":"string","enum":["none","pending","approved","rejected"],"description":"Workspace KYC status. `none` → nothing submitted; `pending` → awaiting\nops review (uploads locked); `approved` → accepted and provisioned\n(terminal); `rejected` → declined, resubmit after fixing.\n"},"company_id":{"type":"string","nullable":true,"description":"The own-company anchor — the company that operates the workspace and\nsigns the attestation. Null until first submit.\n"},"submitted_at":{"type":"string","nullable":true,"description":"When the workspace was last submitted for review. UTC timestamp in\n`YYYY-MM-DD HH:MM:SS` format — space separator, no timezone suffix\n(e.g. `2026-08-20 09:14:02`). Not RFC-3339.\n"},"reviewed_at":{"type":"string","nullable":true,"description":"When ops last reviewed the submission. UTC timestamp in\n`YYYY-MM-DD HH:MM:SS` format — space separator, no timezone suffix\n(e.g. `2026-08-21 11:30:00`). Not RFC-3339.\n"},"reject_reason":{"type":"string","nullable":true,"description":"Human-readable reason when `status` is `rejected`."},"review_reference":{"type":"string","nullable":true,"description":"Internal ops reference for the review, if set."},"legal_name":{"type":"string","nullable":true,"description":"Legal entity name captured at submission."},"enterprise_number":{"type":"string","nullable":true,"description":"Enterprise/company number captured at submission, stored verbatim."},"attestation":{"$ref":"#/components/schemas/KycAttestation"},"documents":{"type":"array","description":"All uploaded KYC documents, oldest first.","items":{"$ref":"#/components/schemas/KycDocument"}},"mandate_coverage":{"$ref":"#/components/schemas/KycMandateCoverage"},"requirements":{"$ref":"#/components/schemas/KycRequirements"}}},"KycAttestation":{"type":"object","description":"The versioned attestation the signer accepts on behalf of the workspace\nlegal entity.\n","required":["current_version","text"],"properties":{"name":{"type":"string","nullable":true,"description":"Signer name from the last submission, or null."},"role":{"type":"string","nullable":true,"description":"Signer role from the last submission, or null."},"version":{"type":"string","nullable":true,"description":"Attestation version accepted at the last submission (may lag current)."},"current_version":{"type":"string","description":"Current attestation version. Echo this exact value back as\n`attestation_version` when submitting. Currently `2026-08-26`.\n","example":"2026-08-26"},"text":{"type":"string","description":"Full attestation text (Markdown) that the signer must accept."}}},"KycMandateCoverage":{"type":"object","description":"Informational mandate coverage across the workspace's non-own companies.\nNever gates submission — surfaced for ops context only. The workspace's\nown company (the one referenced by the KYC record's `company_id`) is\nexempt from the mandate requirement — mandates concern companies you\noperate Peppol services for on behalf of others.\n","required":["companies_with_mandate","total_companies"],"properties":{"companies_with_mandate":{"type":"integer","description":"Number of non-own companies that have at least one mandate document."},"total_companies":{"type":"integer","description":"Number of companies other than the own company."}}},"KycRequirements":{"type":"object","description":"What is still required before the workspace can be submitted.","required":["has_company","missing_workspace_doc_types","can_submit"],"properties":{"has_company":{"type":"boolean","description":"Whether the workspace has at least one company."},"own_company_id":{"type":"string","nullable":true,"description":"The own-company anchor id, or null if not yet set."},"missing_workspace_doc_types":{"type":"array","description":"Which of the three required workspace document types are still\nmissing (subset of `registry_extract`, `representative_id`,\n`authority_proof`).\n","items":{"type":"string","enum":["registry_extract","representative_id","authority_proof"]}},"can_submit":{"type":"boolean","description":"Whether a submit would pass the gates now — the status is a legal\nedge to `pending`, a company and own company exist, and no workspace\ndoc types are missing.\n"}}},"KycDocument":{"type":"object","description":"A stored KYC document projection. The internal `sha256` and `r2_key` are\nnever returned.\n","required":["id","doc_type","filename","mime_type","size_bytes","created_at"],"properties":{"id":{"type":"string","description":"Document ID (prefixed `kyd_`).","example":"kyd_3aB7cD9eF1gH2iJ4kL6mN"},"company_id":{"type":"string","nullable":true,"description":"Company this document belongs to (mandate docs only); null for workspace docs."},"doc_type":{"type":"string","enum":["registry_extract","representative_id","authority_proof","mandate"],"description":"Document type. `registry_extract`, `representative_id`,\n`authority_proof` are workspace-level; `mandate` is company-level.\n"},"filename":{"type":"string","description":"Original filename, or `document` if none was supplied."},"mime_type":{"type":"string","enum":["application/pdf","image/png","image/jpeg","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],"description":"MIME type sniffed from the file's magic bytes."},"size_bytes":{"type":"integer","description":"Size of the stored document in bytes (max 10485760)."},"mandate_grantor_name":{"type":"string","nullable":true,"description":"Name of the mandate grantor (mandate docs only); null otherwise."},"created_at":{"type":"string","format":"date-time","description":"When the document was uploaded. RFC-3339 timestamp in UTC\n(e.g. `2026-08-27T10:15:00.000Z`).\n"}}},"KycDocumentUpload":{"type":"object","description":"Request body for `POST /v1/kyc/documents`.","required":["doc_type","content"],"properties":{"doc_type":{"type":"string","enum":["registry_extract","representative_id","authority_proof","mandate"],"description":"Document type. Workspace types (`registry_extract`,\n`representative_id`, `authority_proof`) must omit `company_id` and\n`mandate_grantor_name`; `mandate` requires both.\n"},"content":{"type":"string","format":"byte","description":"Base64-encoded file bytes (max 10 MB decoded). Required."},"filename":{"type":"string","description":"Original filename. Optional; defaults to `document`."},"mime_type":{"type":"string","description":"Declared MIME type. Optional — if present it must match the type\nsniffed from the bytes, otherwise the upload is rejected.\n"},"company_id":{"type":"string","description":"Company the mandate covers (mandate docs only; must belong to the workspace)."},"mandate_grantor_name":{"type":"string","description":"Name of the authorised representative who granted the mandate (mandate docs only)."}}},"KycSubmit":{"type":"object","description":"Request body for `POST /v1/kyc/submit`.","required":["company_id","kyc_legal_name","kyc_enterprise_number","attestation_name","attestation_role","attested","attestation_version"],"properties":{"company_id":{"type":"string","description":"The own/signing company (must be a company of the workspace)."},"kyc_legal_name":{"type":"string","description":"Legal entity name."},"kyc_enterprise_number":{"type":"string","description":"Enterprise/company number. Stored verbatim — no format validation."},"attestation_name":{"type":"string","description":"Name of the person accepting the attestation."},"attestation_role":{"type":"string","description":"Role of the person accepting the attestation."},"attested":{"type":"boolean","description":"Must be exactly `true` to accept the attestation."},"attestation_version":{"type":"string","description":"Must equal the current attestation version (`attestation.current_version`).","example":"2026-08-26"}}},"DocumentCreate":{"type":"object","description":"Request payload for creating and sending a Peppol document.","required":["number","issue_date","from","to","lines"],"properties":{"type":{"type":"string","enum":["invoice","credit_note"],"default":"invoice"},"number":{"type":"string","description":"Your document number (e.g., \"INV-2026-001\")"},"issue_date":{"type":"string","format":"date"},"due_date":{"type":"string","format":"date"},"currency":{"type":"string","default":"EUR","description":"ISO 4217 currency code"},"from":{"$ref":"#/components/schemas/Party"},"to":{"$ref":"#/components/schemas/RecipientParty"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"},"minItems":1},"note":{"type":"string","description":"Optional note to include on the document"},"payment_means":{"$ref":"#/components/schemas/PaymentMeans"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}},"idempotency_key":{"type":"string","description":"Unique key to prevent duplicate sends.\nIf provided, a second request with the same key\nreturns the original result. On `POST /v1/documents` you can\nsend the same key in the `Idempotency-Key` header instead.\n"},"buyer_reference":{"type":"string","description":"Buyer reference (BT-10), `cbc:BuyerReference`: the reference the\nbuyer asks for, for example a cost centre or a Leitweg-ID. It is\nnot copied to `cac:OrderReference/cbc:ID` (BT-13): send a purchase\norder in `purchase_order`.\n\nWithout `buyer_reference`, a document gets `purchase_order`,\nelse `to.identifier`, else `Unknown` as BT-10.\n"},"purchase_order":{"type":"string","description":"Purchase order reference (BT-13), `cac:OrderReference/cbc:ID`: the\nnumber of the buyer's purchase order.\n","example":"PO-4711"},"sales_order":{"type":"string","description":"Sales order reference (BT-14), `cac:OrderReference/cbc:SalesOrderID`:\nthe seller's own order number. Without `purchase_order`, the\n`cbc:ID` of the order reference is `NA`.\n","example":"SO-88"},"allowances":{"type":"array","description":"Document-level allowances (BG-20) — deductions applied before tax.","items":{"$ref":"#/components/schemas/AllowanceCharge"}},"charges":{"type":"array","description":"Document-level charges (BG-21) — additions applied before tax.","items":{"$ref":"#/components/schemas/AllowanceCharge"}},"tax_code":{"type":"string","description":"Document VAT category code (BT-118), e.g. `S` (standard), `Z` (zero),\n`E` (exempt), `AE` (reverse charge). Defaults to `S`, or `Z` when\nevery line is zero-rated.\n"},"vatex":{"type":"string","description":"VAT exemption reason code (BT-121) from the VATEX code list, e.g.\n`VATEX-EU-132`. Applies at document level only.\n"},"vatex_note":{"type":"string","description":"VAT exemption reason text (BT-120). Applies at document level only."},"invoice_period":{"$ref":"#/components/schemas/InvoicePeriod"},"preceding_invoice":{"$ref":"#/components/schemas/PrecedingInvoice"},"amount_due":{"type":"number","minimum":0,"multipleOf":0.01,"description":"Amount due for payment (BT-115), in the document currency. Use it\nfor a document that is paid, fully or in part, before you send it:\n`0` for a fully prepaid document. Allowed on both `invoice` and\n`credit_note`.\n\nThe value must be from `0` up to the document total with VAT\n(BT-112) plus `rounding_amount`, with at most two decimals. A value\nabove that is refused with a 422 `amount_due_exceeds_total`. The\nprepaid amount (BT-113, `cbc:PrepaidAmount`) is not an input: it is\nthe total with VAT plus `rounding_amount` less `amount_due`.\n\nIf you omit the field, the amount due is the total with VAT plus\n`rounding_amount`, and the document has no prepaid amount.\n","example":0},"rounding_amount":{"type":"number","description":"Rounding amount (BT-114, `cbc:PayableRoundingAmount`), in the\ndocument currency: the signed amount that rounds the amount due,\nfor example to whole kronor. Allowed on both `invoice` and\n`credit_note`, for any seller country and currency.\n\nThe amount due (BT-115) is the total with VAT (BT-112) less the\nprepaid amount (BT-113) plus `rounding_amount`. `total` does not\ninclude it. With an `amount_due`, send the rounded amount: an\n`amount_due` equal to the total, with a rounding that is not `0`,\nis refused with a 422 `amount_due_excludes_rounding` when the\nrounding is positive, and with a 422 `amount_due_exceeds_total`\nwhen it is negative.\n\nThe value has at most two decimals and must be below `1.00` either\nway. A value of `1.00` or more, or one that takes the total below\n`0`, is refused with a 422 `rounding_amount_out_of_range`. With `0`\nthe document has no rounding amount in the UBL.\n","example":-0.6}}},"AllowanceCharge":{"type":"object","description":"A document- or line-level allowance or charge. The sign is fixed by\nwhich array carries it (`allowances` deducts, `charges` adds), so\n`amount` is always a positive value.\n","required":["amount","reason","tax_rate"],"properties":{"amount":{"type":"number","description":"Positive amount, in the document currency, max 2 decimals."},"reason":{"type":"string","description":"Human-readable reason for the allowance or charge."},"tax_rate":{"type":"number","description":"VAT percentage (e.g. `21.00`) selecting the VAT breakdown this\nadjustment belongs to. At line level the line's own rate applies.\n"}}},"InvoicePeriod":{"type":"object","description":"Invoicing period (BG-14) — the service or billing date range.","properties":{"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date"}}},"PrecedingInvoice":{"type":"object","description":"Preceding invoice reference — the earlier invoice this document\ncorrects, for example the invoice a credit note credits. Allowed on\nboth `invoice` and `credit_note`; one reference per document.\n\nThe value is an opaque reference that you supply. It is not looked up\nor checked against an earlier peppol.sh document. It is emitted as\n`cac:BillingReference/cac:InvoiceDocumentReference`.\n","required":["number"],"properties":{"number":{"type":"string","minLength":1,"description":"Number of the preceding invoice (BT-25). Leading and trailing\nwhitespace is removed; the result must not be empty.\n"},"issue_date":{"type":"string","format":"date","description":"Issue date of the preceding invoice (BT-26), `YYYY-MM-DD`."}},"example":{"number":"INV-2026-001","issue_date":"2026-03-01"}},"Party":{"type":"object","description":"A sender or recipient party on a document. A party needs a `tax_id`,\na `peppol_id`, or both.\n","required":["name"],"properties":{"name":{"type":"string"},"tax_id":{"type":"string","description":"Tax ID. Required when `peppol_id` is absent, and then it must not\nbe empty or only whitespace; else the document is rejected with\n`invalid_document_body` (400). Can be in Peppol format (`0208:0123456749`)\nor plain (`BE0123456749`) — we resolve the scheme. A Swedish VAT\nnumber (`SE556905539401`) resolves to the 10-digit organisation\nnumber (`0007:5569055394`). When `peppol_id` is absent, the\nresolved Peppol ID must have the format and check digit of its\nscheme, else the document is rejected with `invalid_peppol_id`\n(422). For `from`, this check does not apply to a VAT number. A French VAT number (`FR12345678901`)\ndoes not resolve to a Peppol ID: it is sent as the VAT number.\nA `tax_id` with a country prefix (`BE…`, `NL…B01`, `ATU…`) is sent\nas the VAT number. A `tax_id` with no country prefix (for example\nthe Norwegian org number `995313863`) is not a VAT number: it is\nnot sent as one, and the party then needs a `peppol_id`. For\n`from`, the Peppol ID of the company is used when `peppol_id` is\nabsent. If no Peppol ID can be found, the send fails with\n`sender_not_derivable`.\n"},"address":{"$ref":"#/components/schemas/Address"},"email":{"type":"string","format":"email","description":"Contact email (BT-43 for `from`, BT-58 for `to`),\n`cac:Contact/cbc:ElectronicMail`.\n"},"contact_name":{"type":"string","description":"Contact name (BT-41 for `from`, BT-56 for `to`),\n`cac:Contact/cbc:Name`. Needs an `email` on the same party, else\nthe document is rejected with `invalid_document_body` (400).\n","example":"Ann Peeters"},"peppol_id":{"type":"string","pattern":"^\\d{4}:\\S+$","description":"Explicit Peppol participant ID (overrides tax_id lookup).\nFormat: `scheme:id` — a 4-digit scheme, a colon, then a non-empty\nid (e.g., `0208:0785666049`). Validated at ingest: a malformed id\nis rejected synchronously with `invalid_peppol_id` (422) instead of\nfailing later at the provider. Scheme `0208` (BE enterprise number)\nmust be a 10-digit CBE number with a valid mod-97 checksum; a\nleading `BE` is normalized away.\n"}}},"RecipientParty":{"description":"The `to` party. A `Party` with a buyer identifier.","allOf":[{"$ref":"#/components/schemas/Party"},{"type":"object","properties":{"identifier":{"type":"string","description":"Buyer identifier (BT-46), `cac:PartyIdentification/cbc:ID` with\nno `schemeID`: the number of the buyer in your system. Only on\n`to`: `from.identifier` is rejected with\n`invalid_document_body` (400).\n","example":"CUST-007"}}}]},"Address":{"type":"object","description":"A postal address.","properties":{"street":{"type":"string"},"city":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string","description":"ISO 3166-1 alpha-2 country code"}}},"LineItem":{"type":"object","description":"A single invoice or credit-note line.","required":["description","quantity","unit_price","tax_rate"],"properties":{"description":{"type":"string"},"quantity":{"type":"number"},"unit":{"type":"string","default":"C62","description":"UN/CEFACT unit code (C62 = unit/piece)"},"unit_price":{"type":"number","description":"Price per unit (excl. tax)"},"tax_rate":{"type":"number","description":"VAT percentage (e.g., 21.00)"},"discount":{"type":"number","deprecated":true,"description":"Absolute discount amount on this line, in the document currency\n(not a percentage). Deprecated — use line-level `allowances[]`.\n"},"allowances":{"type":"array","description":"Line-level allowances (BG-27) — deductions from the line net.","items":{"$ref":"#/components/schemas/AllowanceCharge"}},"charges":{"type":"array","description":"Line-level charges (BG-28) — additions to the line net.","items":{"$ref":"#/components/schemas/AllowanceCharge"}}}},"PaymentMeans":{"type":"object","description":"How the document should be paid: one method, one reference, and one or\nmore accounts. Use `accounts` for a bankgiro or plusgiro number or for\nmore than one account. `iban` and `bic` are the older form of one\n`iban` account: they give a 400 together with `accounts`.\n","properties":{"method":{"type":"string","enum":["bank_transfer","card","direct_debit","other"],"default":"bank_transfer","description":"Must be `bank_transfer` when `accounts` is present."},"iban":{"type":"string"},"bic":{"type":"string"},"reference":{"type":"string","description":"Payment reference / structured communication"},"accounts":{"type":"array","minItems":1,"maxItems":10,"description":"The accounts the buyer can pay to, with the same method and reference.","items":{"$ref":"#/components/schemas/PaymentAccount"}}},"example":{"method":"bank_transfer","reference":"12345678","accounts":[{"type":"bankgiro","number":"5555-5555"},{"type":"iban","number":"SE4550000000058398257466","bic":"ESSESESS"}]}},"PaymentAccount":{"type":"object","description":"One account a document can be paid to.","required":["type","number"],"properties":{"type":{"type":"string","enum":["iban","bankgiro","plusgiro","other"]},"number":{"type":"string","description":"Payment account identifier (BT-84). Spaces and `-` are removed.\n`bankgiro`: 7 or 8 digits. `plusgiro`: 2 to 8 digits. `iban`: 15 to\n34 characters that start with 2 letters.\n"},"bic":{"type":"string","description":"BIC (BT-86). Only for `iban` and `other`."}}},"Attachment":{"type":"object","description":"A file to embed with the document, as base64 content.","required":["filename","content"],"properties":{"filename":{"type":"string"},"content":{"type":"string","format":"byte","description":"Base64-encoded file content"},"mime_type":{"type":"string","default":"application/pdf"}}},"Document":{"type":"object","description":"A sent document with computed totals and delivery status.","properties":{"id":{"type":"string","description":"peppol.sh document ID (prefixed `doc_`)"},"type":{"type":"string","enum":["invoice","credit_note"]},"number":{"type":"string"},"status":{"$ref":"#/components/schemas/DocumentStatus"},"from":{"$ref":"#/components/schemas/PartyInfo"},"to":{"$ref":"#/components/schemas/RecipientPartyInfo"},"buyer_reference":{"type":"string","description":"Buyer reference (BT-10). Present only when the document was\ncreated with one.\n"},"purchase_order":{"type":"string","description":"Purchase order reference (BT-13). Present only when the document\nwas created with one.\n"},"sales_order":{"type":"string","description":"Sales order reference (BT-14). Present only when the document was\ncreated with one.\n"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/LineItem"}},"subtotal":{"type":"number","description":"Total amount without VAT (BT-109), max 2 decimals. Computed from\nthe lines and the line-level and document-level allowances and\ncharges.\n"},"tax_total":{"type":"number","description":"Total VAT amount (BT-110), max 2 decimals. Computed from the lines\nand the line-level and document-level allowances and charges.\n"},"total":{"type":"number","description":"Total amount with VAT (BT-112). Computed from the lines and the\nline-level and document-level allowances and charges, max 2\ndecimals. A document that has no stored lines returns the total\nthat was recorded when it was created.\n"},"currency":{"type":"string"},"issue_date":{"type":"string","format":"date"},"due_date":{"type":"string","format":"date"},"preceding_invoice":{"$ref":"#/components/schemas/PrecedingInvoice","description":"Preceding invoice reference (BT-25, BT-26). Present only when the\ndocument was created with one; otherwise the field is omitted.\n"},"amount_due":{"type":"number","description":"Amount due for payment (BT-115). Present only when the document\nwas created with one; otherwise the field is omitted and the\namount due is the document total with VAT plus `rounding_amount`.\nThe prepaid amount\n(BT-113) is the document total with VAT (BT-112) plus\n`rounding_amount` less `amount_due`. `total` does not change when\na document has an `amount_due`.\n"},"rounding_amount":{"type":"number","description":"Rounding amount (BT-114), signed. Present only when the document\nwas created with one, also when it is `0`; otherwise the field is\nomitted. `total` does not include it, and `amount_due` stays as\nsent.\n"},"created_at":{"type":"string","format":"date-time"},"sent_at":{"type":"string","format":"date-time","nullable":true},"delivered_at":{"type":"string","format":"date-time","nullable":true}}},"DocumentDetail":{"description":"A document with its sandbox flag and its delivery history.","allOf":[{"$ref":"#/components/schemas/Document"},{"type":"object","required":["sandbox","events"],"properties":{"sandbox":{"type":"boolean","description":"`true` when a `ps_test_` key sent the document; it never\nreached the Peppol network.\n"},"events":{"type":"array","description":"The status changes of the document, oldest first.","items":{"$ref":"#/components/schemas/DocumentEvent"}}}}]},"DocumentAccepted":{"type":"object","description":"A document accepted for async sending. Get the full document at `url`.\n","required":["id","status","url"],"properties":{"id":{"type":"string","description":"peppol.sh document ID (prefixed `doc_`)"},"status":{"type":"string","enum":["queued"]},"url":{"type":"string","description":"Relative URL of the document (`/v1/documents/{id}`)."},"credits_remaining":{"type":"integer","description":"Remaining credit balance. Present only on `POST /v1/documents`\nwith a live key, when the balance is below the low-balance\nthreshold.\n"}},"example":{"id":"doc_abc123","status":"queued","url":"/v1/documents/doc_abc123"}},"DocumentStatus":{"type":"string","description":"Delivery status of a document. A sandbox document has the same\nstatuses, but it is `delivered` or `failed` within seconds: there is\nno wait for the Peppol network.\n","enum":["queued","sending","delivered","failed"]},"PartyInfo":{"type":"object","description":"Resolved party identity as stored on a sent document. `email` and\n`contact_name` are present only when the document was created with\nthem.\n","properties":{"name":{"type":"string"},"tax_id":{"type":"string"},"peppol_id":{"type":"string"},"email":{"type":"string","description":"Contact email (BT-43 for `from`, BT-58 for `to`)."},"contact_name":{"type":"string","description":"Contact name (BT-41 for `from`, BT-56 for `to`)."}}},"RecipientPartyInfo":{"description":"The `to` party of a sent document.","allOf":[{"$ref":"#/components/schemas/PartyInfo"},{"type":"object","properties":{"identifier":{"type":"string","description":"Buyer identifier (BT-46). Present only when the document was\ncreated with one.\n"}}}]},"DocumentEvent":{"type":"object","description":"One status change in a document's delivery-history timeline.","required":["id","type","from_status","to_status","message","created_at"],"properties":{"id":{"type":"string","description":"Event ID (prefixed `evt_`)"},"type":{"type":"string","description":"The kind of event; for a status change, the new status.","example":"delivered"},"from_status":{"description":"The status before the event; `null` for the first event.","anyOf":[{"$ref":"#/components/schemas/DocumentStatus"},{"type":"null"}]},"to_status":{"$ref":"#/components/schemas/DocumentStatus"},"message":{"type":["string","null"],"description":"Detail of the event, for example the reason of a failure."},"created_at":{"type":"string","format":"date-time"}}},"DocumentAttachment":{"type":"object","description":"Metadata for one attachment stored with a document.","required":["id","filename","mime_type","size_bytes","sha256","created_at"],"properties":{"id":{"type":"string","example":"att_a1b2c3d4"},"filename":{"type":"string"},"mime_type":{"type":"string","description":"Magic-byte-verified MIME type."},"size_bytes":{"type":"integer"},"sha256":{"type":"string","description":"Lowercase hex SHA-256 of the stored bytes."},"created_at":{"type":"string","format":"date-time"}}},"EventWithContext":{"type":"object","description":"A document event enriched with its document and company context.","required":["id","document_id","document_number","recipient","company_id","company_name","type","to_status","created_at"],"properties":{"id":{"type":"string"},"document_id":{"type":"string"},"document_number":{"type":"string"},"recipient":{"type":"string","nullable":true},"company_id":{"type":"string"},"company_name":{"type":"string"},"type":{"type":"string","enum":["queued","sending","delivered","failed","retry"]},"from_status":{"type":"string","nullable":true},"to_status":{"type":"string"},"message":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"DocumentList":{"type":"object","description":"A cursor-paginated page of documents.","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true}}},"SmpLookupResult":{"type":"object","description":"Result of a Peppol participant lookup via SMP.\nIncludes NAPTR resolution details, supported document types, and business card information.\n","properties":{"participant_id":{"type":"object","properties":{"scheme":{"type":"string","description":"EAS scheme code (e.g., \"0208\" for Belgium)"},"id":{"type":"string","description":"Participant identifier value"}}},"domain":{"type":"string","enum":["sml","smk"],"description":"SML domain used for lookup"},"naptr_domain":{"type":"string","description":"The DNS NAPTR domain queried (SHA-256 hash + scheme + SML domain)"},"smp_url":{"type":"string","format":"uri","description":"The resolved SMP base URL"},"services":{"type":"array","description":"List of supported document types and their endpoints","items":{"type":"object","properties":{"document_type_id":{"type":"string","description":"Full document type identifier (e.g., busdox-docid-qns::urn:oasis:...)"},"document_type_name":{"type":"string","nullable":true,"description":"Human-readable document type name (e.g., \"Peppol BIS Billing UBL Invoice V3\")"},"process_id":{"type":"string","description":"Process identifier (e.g., cenbii-procid-ubl::urn:fdc:peppol.eu:...)"},"process_name":{"type":"string","nullable":true,"description":"Human-readable process name (e.g., \"Peppol BIS Billing 3.0\")"},"endpoints":{"type":"array","items":{"type":"object","properties":{"transport_profile":{"type":"string","description":"Transport protocol (e.g., \"peppol-transport-as4-v2_0\")"},"url":{"type":"string","format":"uri","description":"Access Point endpoint URL"},"certificate":{"type":"string","description":"Base64-encoded X.509 certificate (raw PEM)"},"cert_subject":{"type":"string","nullable":true,"description":"Parsed certificate subject (e.g., \"CN=Access Point, O=Corp, C=BE\")"},"cert_issuer":{"type":"string","nullable":true,"description":"Parsed certificate issuer"},"cert_valid_from":{"type":"string","nullable":true,"description":"Certificate validity start (ISO 8601)"},"cert_valid_to":{"type":"string","nullable":true,"description":"Certificate validity end (ISO 8601)"},"cert_fingerprint_sha256":{"type":"string","nullable":true,"description":"SHA-256 fingerprint of the DER-encoded certificate (lowercase hex)"},"activation_date":{"type":"string","nullable":true},"expiration_date":{"type":"string","nullable":true},"technical_contact":{"type":"string","nullable":true,"description":"Technical contact URL"},"technical_info":{"type":"string","nullable":true,"description":"Technical information URL"}}}}}}},"business_card":{"type":"object","nullable":true,"description":"Business card information for the participant (if available)","properties":{"participant_id":{"type":"object","properties":{"scheme":{"type":"string"},"id":{"type":"string"}}},"entities":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","nullable":true,"description":"Business entity name"},"country_code":{"type":"string","nullable":true,"description":"ISO 3166-1 alpha-2 country code"},"geographic_info":{"type":"string","nullable":true},"identifiers":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string","description":"Identifier scheme (e.g., \"VAT\")"},"value":{"type":"string","description":"Identifier value"}}}},"website_urls":{"type":"array","description":"As the participant entered them in its Business Card;\nnot always an absolute URI (for example `www.peppol.org`).\n","items":{"type":"string"}},"contacts":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true}}}}}}}}}}},"DnsLookupResult":{"type":"object","description":"DNS-only resolution result for a Peppol participant.\nReturns the NAPTR hostname and resolved SMP URL without fetching service metadata.\n","properties":{"peppol_id":{"type":"string","description":"The Peppol participant ID that was resolved"},"naptr_hostname":{"type":"string","description":"The computed NAPTR DNS hostname"},"smp_url":{"type":"string","format":"uri","description":"The resolved SMP base URL from the NAPTR record"},"domain":{"type":"string","enum":["sml","smk"],"description":"The SML domain used for resolution"}}},"ValidationResult":{"type":"object","description":"Outcome of validating a document payload, with errors and warnings.","properties":{"valid":{"type":"boolean"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/ValidationIssue"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/ValidationIssue"}}}},"ValidationIssue":{"type":"object","required":["message"],"description":"A single validation issue attached to a field within a document payload.\n","properties":{"path":{"type":"string","description":"Dot-path to the offending field, e.g. `buyer.tax_id` or\n`lines[0].unit_price`. Omitted when the issue is document-wide.\n"},"code":{"type":"string","description":"Machine-readable issue code: the Peppol validation rule id (e.g.\n`BR-S-02`), our own code for a request body issue (e.g.\n`invalid_document_body`), or `invalid_document` when the provider\nrejects the document without a rule id.\n"},"message":{"type":"string","description":"Human-readable description of the issue."}}},"Webhook":{"type":"object","description":"A webhook subscription for real-time document event notifications.","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["document.queued","document.sending","document.delivered","document.failed","credits.low"]}},"active":{"type":"boolean"},"secret":{"type":"string","description":"HMAC signing secret (`whsec_…`). Returned only on creation and on\nsecret rotation; omitted from all other responses. Used to verify\nthe `X-Peppol-Signature-V2` / `X-Peppol-Signature` delivery headers.\n"},"created_at":{"type":"string","format":"date-time"}}},"WebhookCreate":{"type":"object","description":"Request body for creating a webhook subscription.","required":["url","events"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["document.queued","document.sending","document.delivered","document.failed","credits.low"]}},"secret":{"type":"string","description":"Signing secret for webhook payloads.\nIf not provided, one will be generated.\n"}}},"WebhookDelivery":{"type":"object","description":"A single delivery attempt for a webhook event.","properties":{"id":{"type":"string","description":"Delivery id (e.g. `whd_abc123`)."},"webhook_id":{"type":"string"},"document_id":{"type":"string","nullable":true,"description":"The document that triggered the event, or null for non-document events (e.g. `credits.low`, `webhook.test`)."},"event":{"type":"string","description":"Event type (e.g. `document.queued`, `credits.low`, `webhook.test`)."},"status":{"type":"string","enum":["pending","delivered","failed"]},"status_code":{"type":"integer","nullable":true,"description":"Last HTTP status code returned by the receiver, if the request completed."},"attempts":{"type":"integer","description":"Number of delivery attempts made so far."},"last_error":{"type":"string","nullable":true},"next_retry_at":{"type":"string","nullable":true},"delivered_at":{"type":"string","nullable":true},"created_at":{"type":"string"}}},"WebhookDeliveryList":{"type":"object","description":"A cursor-paginated page of webhook delivery attempts.","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"has_more":{"type":"boolean"},"next_cursor":{"type":"string","nullable":true,"description":"Pass this back as the `cursor` query param to fetch the next page."}}},"WebhookTestResponse":{"type":"object","description":"Result of dispatching a synthetic test event to a webhook.","properties":{"delivery_id":{"type":"string","description":"Recorded delivery id for this test attempt — look up in the deliveries list."},"success":{"type":"boolean","description":"True when the receiver returned a 2xx status."},"status_code":{"type":"integer","nullable":true,"description":"HTTP status code from the receiver, or null if the request never completed."},"error":{"type":"string","nullable":true,"description":"Error message when the request failed to reach the receiver or returned non-2xx."}}},"WebhookRotateSecretResponse":{"type":"object","description":"Result of rotating a webhook's signing secret.","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"secret":{"type":"string","description":"The new signing secret. Returned ONCE — store it now; it cannot be retrieved again."},"secret_overlap_expires_at":{"type":"integer","description":"Unix seconds when the previous (overlap) secret stops signing deliveries (24h after rotation)."}}},"ErrorObject":{"type":"object","required":["error"],"description":"Canonical error envelope returned by every non-2xx response.\n\n**Shape:** `{ error: { type, code, message, param?, details? } }`\n\n### Error codes\n\n| `type` | `code` | Meaning |\n|---|---|---|\n| validation_error | `missing_field` | A required field was omitted. |\n| validation_error | `invalid_field` | A field is present but has an invalid value or format. |\n| validation_error | `email_taken` | 409 — an account with this email already exists. |\n| validation_error | `already_member` | 409 — account is already a member of this company. |\n| validation_error | `no_fields_to_update` | PATCH with an empty update body. |\n| validation_error | `last_owner` | Cannot remove/demote the last owner of a company. |\n| validation_error | `invalid_account_status` | Operation not allowed in the account's current status. |\n| validation_error | `invalid_peppol_id` | Peppol participant ID has an invalid format, check digit or scheme. |\n| validation_error | `missing_peppol_id` | 400 — a company needs a Peppol ID and none was given or derived. |\n| validation_error | `peppol_id_country_mismatch` | 400 — the Peppol ID scheme belongs to another country than the company. |\n| validation_error | `peppol_id_tax_id_mismatch` | 400 — a VAT-scheme Peppol ID is not the VAT number in the `tax_id` of the company. The message names the Peppol ID to use. |\n| validation_error | `invalid_scheme` | Peppol scheme (EAS) is unknown. |\n| validation_error | `invalid_body` | The request body could not be read (for example, it is not valid JSON). |\n| validation_error | `invalid_document_body` | A document field is missing or has an invalid value. `param` is its dot-path, for example `from.tax_id`. |\n| validation_error | `amount_due_exceeds_total` | 422 — `amount_due` is more than the document total with VAT plus `rounding_amount`. |\n| validation_error | `amount_due_excludes_rounding` | 422 — `amount_due` equals the document total with VAT, but the document has a positive `rounding_amount`. |\n| validation_error | `rounding_amount_out_of_range` | 422 — `rounding_amount` is `1.00` or more either way, or takes the document total below `0`. |\n| validation_error | `batch_too_large` | Batch contains more than 100 documents. |\n| validation_error | `mixed_company_ids` | Batch mixes multiple `company_id`s. |\n| validation_error | `idempotency_key_mismatch` | The `Idempotency-Key` header and the `idempotency_key` body field carry different keys. |\n| validation_error | `ubl_schema_invalid` | UBL payload failed Zod schema validation (see `details.issues`). |\n| validation_error | `ubl_business_rule` | UBL payload failed business rule validation (see `details`). |\n| validation_error | `ubl_missing_document_type` | UBL payload has neither `invoiceLine` nor `creditNoteLine`. |\n| validation_error | `unsupported_content_type` | Request Content-Type is not supported by this endpoint. |\n| authentication_error | `missing_api_key` | `Authorization` header missing. |\n| authentication_error | `invalid_api_key` | API key format is wrong or key is unknown. |\n| authentication_error | `disabled_account` | 403 — account is disabled. |\n| authorization_error | `not_a_member` | Caller is not a member of the specified company. |\n| authorization_error | `insufficient_role` | Caller's role is too low for this operation. |\n| validation_error | `invalid_country` | 400 — country is unknown or not Peppol-active. |\n| validation_error | `kyc_missing_content` | 400 — KYC upload `content` is absent or empty. |\n| validation_error | `kyc_invalid_encoding` | 400 — KYC upload `content` is not valid base64. |\n| validation_error | `kyc_invalid_doc_type` | 400 — `doc_type` is not a recognised KYC document type. |\n| validation_error | `kyc_unsupported_type` | 400 — sniffed magic bytes match no accepted type. |\n| validation_error | `kyc_mime_mismatch` | 400 — declared `mime_type` disagrees with the sniffed type. |\n| validation_error | `kyc_mandate_requires_company` | 400 — a `mandate` upload is missing `company_id`/`mandate_grantor_name`. |\n| validation_error | `kyc_doc_pairing_invalid` | 400 — a workspace document carries `company_id`/`mandate_grantor_name`. |\n| validation_error | `kyc_document_too_large` | 413 — KYC document exceeds the 10 MB cap. |\n| validation_error | `kyc_locked` | 409 — KYC uploads are locked (status is `pending`/`approved`). |\n| validation_error | `kyc_not_submittable` | 409 — workspace is not in a submittable state. |\n| validation_error | `kyc_no_companies` | 422 — workspace has no companies. |\n| validation_error | `kyc_no_own_company` | 422 — submit `company_id` was blank. |\n| validation_error | `kyc_invalid_company` | 422 — submit `company_id` is not a company of this workspace. |\n| validation_error | `kyc_missing_documents` | 422 — a required workspace doc type is missing (`details.missing`). |\n| validation_error | `kyc_missing_legal_name` | 422 — `kyc_legal_name` was blank. |\n| validation_error | `kyc_missing_enterprise_number` | 422 — `kyc_enterprise_number` was blank. |\n| validation_error | `kyc_attestation_incomplete` | 422 — `attestation_name` or `attestation_role` was blank. |\n| validation_error | `kyc_attestation_not_accepted` | 422 — `attested` was not `true`. |\n| validation_error | `kyc_attestation_version_mismatch` | 422 — `attestation_version` is not the current version. |\n| not_found | `company_not_found` | Company does not exist or caller cannot see it. |\n| not_found | `workspace_not_found` | Workspace row not found. |\n| not_found | `webhook_not_found` | Webhook not found in the caller's workspace. |\n| not_found | `account_not_found` | Authenticated account was not found. |\n| not_found | `member_not_found` | Target account is not a member of the company. |\n| not_found | `document_not_found` | Document does not exist. |\n| not_found | `api_key_not_found` | API key not found or already revoked. |\n| not_found | `participant_not_found` | Peppol participant not found in SML/SMP. |\n| not_found | `route_not_found` | HTTP method/path does not match any route. |\n| provider_error | `provider_error` | Upstream provider returned an unexpected error. |\n| provider_error | `provider_validation_failed` | Upstream provider rejected the payload (see `details`). |\n| provider_error | `smp_error` | SMP or DNS lookup failed. |\n| rate_limit_error | `rate_limit_exceeded` | Too many requests. Wait for the `Retry-After` time, then retry. |\n| billing_error | `insufficient_credits` | Company does not have enough credits to send the document(s). Purchase more via `POST /v1/billing/checkout`. |\n| billing_error | `sandbox_not_allowed` | Billing endpoints (e.g. `POST /v1/billing/checkout`) reject sandbox API keys. |\n| internal_error | `internal_error` | Unexpected server error. Give us the `request_id` so that we can find it. |\n","properties":{"error":{"type":"object","required":["type","code","message"],"properties":{"type":{"type":"string","enum":["validation_error","authentication_error","authorization_error","not_found","rate_limit_error","provider_error","billing_error","internal_error"],"description":"Error category:\n- `validation_error` — invalid input\n- `authentication_error` — missing or invalid API key\n- `authorization_error` — authenticated but not authorized (e.g., wrong role)\n- `not_found` — resource does not exist\n- `rate_limit_error` — too many requests\n- `provider_error` — upstream provider failure\n- `billing_error` — credit/billing problem (e.g. insufficient credits). Returned as HTTP 402.\n- `internal_error` — unexpected server error\n"},"code":{"type":"string","description":"Machine-readable error code. See the Error codes table above for the\nfull taxonomy. SDK clients should switch on `code` (not `message`).\n"},"message":{"type":"string","description":"Human-readable error message."},"param":{"type":"string","description":"Dot-path to the field that caused the error, e.g. `buyer.tax_id`\nor `lines[0].unit_price`. Omitted for non-field errors.\n"},"details":{"description":"Optional structured payload with additional context (e.g. the list\nof issues for UBL schema/business-rule failures, or the provider's\nraw validation errors for `provider_validation_failed`).\n"},"request_id":{"type":"string","description":"Only on `internal_error`. The ID of the request (the `cf-ray`\nheader). Give it to us when you report the error.\n"}}}}}},"responses":{"BadRequest":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"Unauthenticated":{"description":"Missing or invalid API key (`missing_api_key` or `invalid_api_key`).\n","headers":{"WWW-Authenticate":{"$ref":"#/components/headers/WWWAuthenticate"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"},"example":{"error":{"type":"authentication_error","code":"missing_api_key","message":"Missing API key","retry":{"retryable":false}}}}}},"Unauthorized":{"description":"Missing or invalid API key","headers":{"WWW-Authenticate":{"$ref":"#/components/headers/WWWAuthenticate"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"Forbidden":{"description":"Authenticated but not authorized (e.g. not a member of the target company, or insufficient role)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"PaymentRequired":{"description":"Insufficient credits — purchase more via `POST /v1/billing/checkout`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"ValidationError":{"description":"Payload validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"RateLimited":{"description":"Too many requests. Wait for the number of seconds in `Retry-After`, then retry.","headers":{"Retry-After":{"$ref":"#/components/headers/RetryAfter"},"RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}},"InternalError":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorObject"}}}}}},"x-service-info":{"name":"peppol.sh","description":"Peppol e-invoicing API for developers","categories":["invoicing","e-invoicing","peppol","fintech"],"homepage":"https://peppol.sh"}}