{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "CEM Platform API",
    "version": "0.1.0",
    "summary": "Certified electronic mail - dispatch, tracking and evidence.",
    "description": "Public HTTP API of the CEM platform.\n\nConventions:\n\n* Every tenant endpoint is authenticated with an API key sent as a bearer token.\n* Every `POST` that creates a resource requires an `Idempotency-Key` header.\n* Errors use `application/problem+json` (RFC 9457) with a stable machine-readable `code`.\n* Lists are paginated with an opaque `cursor`; a response without `nextCursor` is the last page.\n* Timestamps are RFC 3339 in UTC. SHA-256 digests are lowercase hexadecimal.\n* Clients must ignore response properties they do not know; new optional properties\n  are not a breaking change.\n",
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.{domain}",
      "description": "Tenant API",
      "variables": {
        "domain": {
          "default": "miplataforma.com"
        }
      }
    },
    {
      "url": "http://127.0.0.1:{port}",
      "description": "Local stack",
      "variables": {
        "port": {
          "default": "8080"
        }
      }
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Messages",
      "x-displayName": "Messages",
      "description": "Submit certified messages and read their state."
    },
    {
      "name": "Attachments",
      "x-displayName": "Attachments",
      "description": "Upload large attachments before submitting a message."
    },
    {
      "name": "Events",
      "x-displayName": "Events",
      "description": "State changes, per message or as a polling feed."
    },
    {
      "name": "Evidence",
      "x-displayName": "Evidence",
      "description": "Sealed receipts and their artifacts."
    },
    {
      "name": "Settings",
      "x-displayName": "Settings",
      "description": "Configuration catalog and per-level overrides."
    },
    {
      "name": "Webhooks",
      "x-displayName": "Webhooks",
      "description": "Delivery of events to tenant endpoints."
    },
    {
      "name": "Suppressions",
      "x-displayName": "Suppressions",
      "description": "Addresses the platform will not send to."
    },
    {
      "name": "Batches",
      "x-displayName": "Batches",
      "description": "Bulk submission from an uploaded manifest."
    },
    {
      "name": "Verification",
      "x-displayName": "Verification",
      "description": "Public, unauthenticated verification of evidence."
    },
    {
      "name": "Portal",
      "x-displayName": "Recipient portal",
      "description": "Public API of the secure-content portal used by recipients of `SECURE_LINK` attachments: preview, confirmation of receipt and presigned downloads. It is served on the portal host, accepts only same-origin `POST` requests with a JSON body and answers errors as `{error, message}`."
    }
  ],
  "paths": {
    "/v1/api-keys": {
      "get": {
        "operationId": "listApiKeys",
        "tags": [
          "Settings"
        ],
        "summary": "List the API keys of the tenant",
        "description": "Metadata only; neither secrets nor hashes are ever returned.",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "The keys.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiKey"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "apikeys:read",
          "apikeys:write"
        ]
      },
      "post": {
        "operationId": "createApiKey",
        "tags": [
          "Settings"
        ],
        "summary": "Issue an API key",
        "description": "The secret and the full `token` appear only in this response; only a SHA-256 of the secret is\nstored. A key can never carry scopes its issuer does not hold, and `platform:admin` is never\ngranted through the API.\n",
        "x-cem-owner-wp": "70",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The key with its secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyIssued"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "apikeys:write"
        ]
      }
    },
    "/v1/api-keys/{keyId}/rotate": {
      "post": {
        "operationId": "rotateApiKey",
        "tags": [
          "Settings"
        ],
        "summary": "Rotate an API key",
        "description": "Issues a replacement with the same label, scopes and expiry, and retires the old key:\nimmediately, or after `graceDays` so clients can switch without downtime.\n",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/KeyIdPath"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "graceDays": {
                    "description": "Days the old key keeps working after its replacement is issued (0 to 30). With `0` it is retired immediately.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 30,
                    "default": 0
                  },
                  "environment": {
                    "description": "Environment of the replacement token: `live` or `test`.",
                    "type": "string",
                    "enum": [
                      "live",
                      "test"
                    ],
                    "default": "live"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key; `rotatedFrom` names the old one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyIssued"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "apikeys:write"
        ]
      }
    },
    "/v1/api-keys/{keyId}": {
      "delete": {
        "operationId": "revokeApiKey",
        "tags": [
          "Settings"
        ],
        "summary": "Revoke an API key",
        "description": "Idempotent. The last active key of a tenant cannot be revoked (`409 last_active_key`); rotate it instead.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/KeyIdPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "apikeys:write"
        ]
      }
    },
    "/v1/attachments": {
      "post": {
        "operationId": "createAttachment",
        "tags": [
          "Attachments"
        ],
        "summary": "Reserve an attachment and get a presigned upload",
        "description": "For attachments that do not fit inline. Upload the file with the returned\nrequest, then reference `attachmentId` in `POST /v1/messages`. Unused uploads\nare deleted after `retention.staging.days`.\n",
        "x-cem-owner-wp": "20",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAttachmentRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Upload reserved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAttachmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "description": "Larger than `api.message.maxBytes`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "attachments:write",
          "messages:write"
        ]
      }
    },
    "/v1/batches": {
      "post": {
        "operationId": "createBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Register a batch and get the manifest upload",
        "description": "Reserves a batch and returns a presigned request to upload the manifest\n(CSV or JSONL). Upload it, then call `POST /v1/batches/{batchId}/start`.\nEvery row goes through the same flow as `POST /v1/messages`.\n",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replay of an earlier request with the same `Idempotency-Key`.",
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateBatchResponse"
                }
              }
            }
          },
          "201": {
            "description": "Batch created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateBatchResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "description": "Manifest larger than the allowed size (`manifest_too_large`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "batches:write",
          "messages:write"
        ]
      }
    },
    "/v1/batches/{batchId}/start": {
      "post": {
        "operationId": "startBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Start processing an uploaded manifest",
        "description": "Checks that the uploaded manifest matches the declared size and SHA-256 and\nstarts processing. Starting a running batch answers `200`.\n",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Already running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "202": {
            "description": "Processing started.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The batch is finished (`batch_not_startable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Manifest missing or different from the declaration (`manifest_not_uploaded`, `manifest_mismatch`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "batches:write",
          "messages:write"
        ]
      }
    },
    "/v1/batches/{batchId}/cancel": {
      "post": {
        "operationId": "cancelBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Cancel a batch",
        "description": "Stops the execution; no row is processed after the cancellation is recorded.\nCanceling a canceled batch answers `200`.\n",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Already canceled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "202": {
            "description": "Canceled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The batch is finished (`batch_not_cancelable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "batches:write",
          "messages:write"
        ]
      }
    },
    "/v1/batches/{batchId}": {
      "get": {
        "operationId": "getBatch",
        "tags": [
          "Batches"
        ],
        "summary": "Read the state and progress of a batch",
        "description": "Status, counters and progress. When the batch has finished, `downloads`\ncarries presigned links to the report and the rejected rows.\n",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "batches:read",
          "messages:read"
        ]
      }
    },
    "/v1/batches/{batchId}/items": {
      "get": {
        "operationId": "listBatchItems",
        "tags": [
          "Batches"
        ],
        "summary": "List the outcome of each row",
        "description": "Rows in manifest order, with cursor paging.",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only rows with this outcome.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCEPTED",
                "REJECTED"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "name": "limit",
            "description": "Maximum number of rows per page, from 1 to 1000 (default 100).",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of rows.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchItemList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "batches:read",
          "messages:read"
        ]
      }
    },
    "/v1/domains": {
      "post": {
        "operationId": "createDomain",
        "tags": [
          "Settings"
        ],
        "summary": "Register a sending domain",
        "description": "Creates the SES identity (Easy DKIM RSA-2048, custom MAIL FROM `bounce.{domain}`), binds it to\nthe tenant's SES tenant and configuration set and returns the exact DNS records to publish.\nThe domain stays `PENDING` until SES verifies DKIM (polled automatically, at most 72 hours),\nthen becomes `ACTIVE`, or `FAILED` with a diagnosis. A `FAILED` or removed domain can be\nregistered again. Registering is not idempotent: a second call answers `409 domain_exists`.\n",
        "x-cem-owner-wp": "70",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainRegistration"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The domain with its DNS wizard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/BadGateway"
          }
        },
        "x-cem-scopes": [
          "domains:write"
        ]
      },
      "get": {
        "operationId": "listDomains",
        "tags": [
          "Settings"
        ],
        "summary": "List the domains of the tenant",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "Every registered domain with its status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Domain"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "domains:read",
          "domains:write"
        ]
      }
    },
    "/v1/domains/{domain}": {
      "get": {
        "operationId": "getDomain",
        "tags": [
          "Settings"
        ],
        "summary": "Read a domain with its DNS records and status",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The domain.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "domains:read",
          "domains:write"
        ]
      },
      "put": {
        "operationId": "updateDomain",
        "tags": [
          "Settings"
        ],
        "summary": "Choose whether you will publish the optional SPF and DMARC records",
        "description": "With `publishSpfDmarc: true` the optional `SPF` and `DMARC` records are also checked in public\nDNS (on this call and on every verification) and reported with warnings; with `false` (the\ndefault) they are neither checked nor insisted upon. It never changes the domain status: only\nDKIM gates `ACTIVE`.\n",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The domain with its refreshed DNS wizard.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "domains:write"
        ]
      },
      "delete": {
        "operationId": "deleteDomain",
        "tags": [
          "Settings"
        ],
        "summary": "Remove a domain",
        "description": "Deletes the SES identity and retires the domain; it stops being usable to send.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/BadGateway"
          }
        },
        "x-cem-scopes": [
          "domains:write"
        ]
      }
    },
    "/v1/domains/{domain}/verify": {
      "post": {
        "operationId": "verifyDomain",
        "tags": [
          "Settings"
        ],
        "summary": "Check the DNS records now",
        "description": "Asks SES for the current DKIM and MAIL FROM status and updates the domain. Safe to repeat.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The domain after the check.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/BadGateway"
          }
        },
        "x-cem-scopes": [
          "domains:write"
        ]
      }
    },
    "/v1/messages/{trackId}/events": {
      "get": {
        "operationId": "listMessageEvents",
        "tags": [
          "Events"
        ],
        "summary": "List the events of a message",
        "description": "Oldest first.",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "name": "rcpt",
            "in": "query",
            "description": "Only the events of this recipient.",
            "schema": {
              "$ref": "#/components/schemas/RecipientId"
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag of a previous response; a match answers `304` without a body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of events.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventPage"
                }
              }
            }
          },
          "304": {
            "description": "Not modified since the ETag sent in `If-None-Match`.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read"
        ]
      }
    },
    "/v1/events": {
      "get": {
        "operationId": "pollEvents",
        "tags": [
          "Events"
        ],
        "summary": "Poll the events of the tenant",
        "description": "Reconciliation feed: every event the tenant would receive by webhook, in a\nstable order. Store the last `nextCursor` and pass it as `after`. No state\nchange depends on webhooks alone.\n",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "Cursor returned by the previous call; omit to start from the oldest retained event.",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Events after the cursor. An empty page keeps the same cursor.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read"
        ]
      }
    },
    "/v1/messages/{trackId}/evidence": {
      "get": {
        "operationId": "listMessageEvidence",
        "tags": [
          "Evidence"
        ],
        "summary": "List the receipts sealed for a message",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "name": "rcpt",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/RecipientId"
            }
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag of a previous response; a match answers `304` without a body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receipts with their digests. Kept after the purge, when `status` is `EXPIRED`.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceList"
                }
              }
            }
          },
          "304": {
            "description": "Not modified since the ETag sent in `If-None-Match`.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "evidence:read",
          "messages:read"
        ]
      }
    },
    "/v1/messages/{trackId}/recipients/{rcptId}/evidence/latest": {
      "get": {
        "operationId": "getLatestRecipientEvidence",
        "tags": [
          "Evidence"
        ],
        "summary": "Read or download the latest cumulative receipt of a recipient",
        "description": "Primary evidence endpoint for a recipient. Without `format`, returns the JSON\nrepresentation of the current head receipt (`chainHeadEvidenceId`), including\nartifact links and chain position. With `?format=asice|xml|pdf|eml`, redirects\n(`302`) to a short-lived presigned URL (or answers `202` with `Retry-After`\nwhile the container or lazy PDF is being rendered). The latest ASiC-E container\ncarries the cumulative root XML together with every earlier receipt XML in\n`previous/` (and the cumulative PDF when `receipts.pdf.mode` is `EAGER`).\n",
        "x-cem-owner-wp": "98",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/RecipientIdPath"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "When given, redirect (`302`) to a presigned download URL for this artifact format instead of returning JSON.",
            "schema": {
              "$ref": "#/components/schemas/EvidenceFormat"
            }
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag of a previous response; a match answers `304` without a body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metadata, links and chain position of the latest cumulative receipt.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Evidence"
                }
              }
            }
          },
          "202": {
            "description": "The requested artifact (`format`) is being generated or waits for its timestamp.\nRetry after `Retry-After` seconds.\n",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "retryAfterSeconds"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "GENERATING",
                        "TSA_PENDING"
                      ]
                    },
                    "retryAfterSeconds": {
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                }
              }
            }
          },
          "302": {
            "description": "Redirect to the requested artifact (`format`).",
            "headers": {
              "Location": {
                "description": "Presigned URL, short-lived (`CEM_PRESIGNED_URL_TTL_SECONDS`, 300 s by default).",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "Cache-Control": {
                "description": "Always `no-store`.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "304": {
            "description": "Not modified since the ETag sent in `If-None-Match`.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "Custody ended; only the digests remain.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "422": {
            "description": "The requested artifact format cannot be produced for this receipt.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "Storage or the renderer is temporarily unavailable; `Retry-After` may be present.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-cem-scopes": [
          "evidence:read",
          "messages:read"
        ]
      }
    },
    "/v1/messages/{trackId}/recipients/{rcptId}/evidence": {
      "get": {
        "operationId": "listRecipientEvidence",
        "tags": [
          "Evidence"
        ],
        "summary": "List the cumulative receipt chain of a recipient",
        "description": "Returns every receipt of the recipient ordered by `position`, including\n`receiptKey`, digests, `covers`, `coveredSeq` and `latest` (`true` on the current\nchain head). Downloading `GET /v1/evidence/{evidenceId}/asice` for an earlier\nsuperseded receipt regenerates its container on demand from the locked XML files.\n",
        "x-cem-owner-wp": "98",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/RecipientIdPath"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag of a previous response; a match answers `304` without a body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ordered receipt chain for the recipient.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceList"
                }
              }
            }
          },
          "304": {
            "description": "Not modified since the ETag sent in `If-None-Match`.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "evidence:read",
          "messages:read"
        ]
      }
    },
    "/v1/messages/{trackId}/recipients/{rcptId}/mdn": {
      "get": {
        "operationId": "listRecipientMdn",
        "tags": [
          "Evidence"
        ],
        "summary": "List the inbound MDNs recorded for a recipient",
        "description": "Returns the authenticated Message Disposition Notifications (RFC 8098) received\nfor the recipient, including authentication strength (`STRONG` or `WEAK`) and\ndisposition metadata. The raw `.eml` is downloaded via `GET /v1/mdn/{mdnId}/eml`.\n",
        "x-cem-owner-wp": "98",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/RecipientIdPath"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag of a previous response; a match answers `304` without a body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inbound MDNs recorded for the recipient.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MdnList"
                }
              }
            }
          },
          "304": {
            "description": "Not modified since the ETag sent in `If-None-Match`.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "evidence:read",
          "messages:read"
        ]
      }
    },
    "/v1/mdn/{mdnId}/eml": {
      "get": {
        "operationId": "downloadMdnEml",
        "tags": [
          "Evidence"
        ],
        "summary": "Download the raw .eml of an inbound MDN",
        "description": "Redirects (`302`) to a short-lived presigned URL for the stored `.eml` of an\ninbound Message Disposition Notification. Answers `410` after the retention\nperiod has elapsed.\n",
        "x-cem-owner-wp": "98",
        "parameters": [
          {
            "$ref": "#/components/parameters/MdnIdPath"
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the raw MDN `.eml`.",
            "headers": {
              "Location": {
                "description": "Presigned URL, short-lived (`CEM_PRESIGNED_URL_TTL_SECONDS`, 300 s by default).",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "Cache-Control": {
                "description": "Always `no-store`.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "Custody ended; only the digests remain.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "Evidence storage is temporarily unavailable; `Retry-After` may be present.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-cem-scopes": [
          "evidence:read",
          "messages:read"
        ]
      }
    },
    "/v1/evidence/{evidenceId}/{format}": {
      "get": {
        "operationId": "downloadEvidence",
        "tags": [
          "Evidence"
        ],
        "summary": "Download one artifact of a receipt",
        "description": "Redirects to a short-lived presigned URL. A lazy PDF (and the ASiC-E container,\nwhich embeds it) is generated on first request: the call waits a bounded time for\nthe render and, if it is not ready, answers `202` with `Retry-After`; repeat the\ncall after that many seconds. An ASiC-E container of a receipt whose timestamp is\nstill pending also answers `202`. After the retention period the artifacts are gone\nbut their digests are still returned in the `410` body and in\n`GET /v1/messages/{trackId}/evidence`.\n",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "$ref": "#/components/parameters/EvidenceIdPath"
          },
          {
            "name": "format",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/EvidenceFormat"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the artifact.",
            "headers": {
              "Location": {
                "description": "Presigned URL, short-lived (`CEM_PRESIGNED_URL_TTL_SECONDS`, 300 s by default).",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "Cache-Control": {
                "description": "Always `no-store`.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "202": {
            "description": "The artifact is being generated (or waits for its timestamp). Retry after the\nnumber of seconds in `Retry-After`.\n",
            "headers": {
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "retryAfterSeconds"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`GENERATING` the render is running; `TSA_PENDING` the timestamp is still to be added.",
                      "enum": [
                        "GENERATING",
                        "TSA_PENDING"
                      ]
                    },
                    "retryAfterSeconds": {
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "Custody ended; only the digests remain.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "422": {
            "description": "The artifact cannot be produced for this receipt (e.g. the container is disabled by configuration).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "Storage or the renderer is temporarily unavailable; `Retry-After` may be present.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-cem-scopes": [
          "evidence:read",
          "messages:read"
        ]
      }
    },
    "/v1/evidence/{evidenceId}/legal-hold": {
      "post": {
        "operationId": "placeLegalHold",
        "tags": [
          "Evidence"
        ],
        "summary": "Keep a receipt beyond its retention period",
        "description": "Places a legal hold on every artifact of the receipt. The purge skips it until\nthe hold is released. Requires `retention.legalHold.enabled`: when the plan of the\ntenant disables it the call answers `403`. Idempotent: repeating it answers `200` with\nthe current state; a new `reason` replaces the recorded one.\n",
        "x-cem-owner-wp": "37",
        "parameters": [
          {
            "$ref": "#/components/parameters/EvidenceIdPath"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LegalHoldRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The hold is in place.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Evidence"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "Already purged.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "The ledger or the vault is temporarily unavailable; `Retry-After` may be present.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-cem-scopes": [
          "evidence:write"
        ]
      },
      "delete": {
        "operationId": "releaseLegalHold",
        "tags": [
          "Evidence"
        ],
        "summary": "Release the legal hold of a receipt",
        "description": "Clears the legal hold on every artifact of the receipt; the purge resumes at the\nnormal `expiresAt`. Releasing is allowed even when `retention.legalHold.enabled` was\nswitched off afterwards. Idempotent: releasing a receipt without a hold answers `200`.\n",
        "x-cem-owner-wp": "37",
        "parameters": [
          {
            "$ref": "#/components/parameters/EvidenceIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The receipt has no legal hold.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Evidence"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "410": {
            "description": "Already purged.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "The ledger or the vault is temporarily unavailable; `Retry-After` may be present.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-cem-scopes": [
          "evidence:write"
        ]
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "submitMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Submit a certified message",
        "description": "Accepts a message for certified delivery. Nothing is sent before the request is\ndurably recorded, so a `202` means the message will be processed exactly once.\n",
        "x-cem-owner-wp": "20",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitMessageRequest"
              },
              "examples": {
                "default": {
                  "$ref": "#/components/examples/SubmitMessageRequest"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted for delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitMessageResponse"
                },
                "examples": {
                  "default": {
                    "$ref": "#/components/examples/SubmitMessageResponse"
                  }
                }
              }
            }
          },
          "200": {
            "description": "Replay of a request already accepted with the same `Idempotency-Key`.",
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitMessageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyInProgress"
          },
          "413": {
            "description": "The message exceeds `api.inline.maxBytes` or `api.message.maxBytes`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write"
        ]
      },
      "get": {
        "operationId": "listMessages",
        "tags": [
          "Messages"
        ],
        "summary": "List messages of the tenant",
        "description": "Newest first. Combine `from`/`to` with `status`, or look up by `clientTrackId`.",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "name": "clientTrackId",
            "description": "Only the message submitted with this `clientTrackId` (up to 128 characters).",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Accepted at or after this instant.",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Accepted before this instant.",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only messages with at least one recipient in this state.",
            "schema": {
              "$ref": "#/components/schemas/RecipientStatus"
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag of a previous response; a match answers `304` without a body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of messages.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagePage"
                }
              }
            }
          },
          "304": {
            "description": "Not modified since the ETag sent in `If-None-Match`.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read"
        ]
      }
    },
    "/v1/messages/{trackId}": {
      "get": {
        "operationId": "getMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Read a message and the state of each recipient",
        "description": "Returns the message metadata, per-recipient delivery/interaction state, and each\nrecipient's `certification` summary (`state`, `pendingEvents`, `expectedBy`,\n`latestReceipt`). The `ETag` changes whenever any field in the representation—including\n`certification`—changes; send `If-None-Match` to receive `304 Not Modified` when unchanged.\n",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag of a previous response; a match answers `304` without a body.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The message.",
            "headers": {
              "ETag": {
                "description": "Validator of this representation, for `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          },
          "304": {
            "description": "Not modified since the ETag sent in `If-None-Match`.",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read"
        ]
      }
    },
    "/portal/v1/session": {
      "post": {
        "operationId": "openPortalSession",
        "tags": [
          "Portal"
        ],
        "summary": "Open a secure link and describe the message",
        "description": "Public. Called by the portal page with the handle it read from the URL fragment. Nothing\nis served yet: the answer says whether the recipient must confirm receipt (`CLICK`) or\nenter an e-mailed code (`OTP`) before the attachments can be downloaded. In `OTP` mode only\nthe sender and the number of files are revealed. Requests must come from the portal origin.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalHandleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "State of the link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalOpenResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PortalBadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PortalForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PortalNotFound"
          },
          "410": {
            "$ref": "#/components/responses/PortalGone"
          },
          "413": {
            "$ref": "#/components/responses/PortalPayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/PortalUnsupportedMedia"
          },
          "429": {
            "$ref": "#/components/responses/PortalRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/PortalInternalError"
          },
          "503": {
            "$ref": "#/components/responses/PortalUnavailable"
          }
        }
      }
    },
    "/portal/v1/otp": {
      "post": {
        "operationId": "requestPortalCode",
        "tags": [
          "Portal"
        ],
        "summary": "E-mail the one-time code to the recipient",
        "description": "Public. Only for links in `OTP` mode. Sends an 8-digit code, valid for a few minutes, to the\nmailbox registered for the recipient. The code is limited per address and per recipient.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalHandleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Code sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalOtpResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PortalBadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PortalForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PortalNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PortalConflict"
          },
          "410": {
            "$ref": "#/components/responses/PortalGone"
          },
          "413": {
            "$ref": "#/components/responses/PortalPayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/PortalUnsupportedMedia"
          },
          "429": {
            "$ref": "#/components/responses/PortalRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/PortalInternalError"
          },
          "503": {
            "$ref": "#/components/responses/PortalUnavailable"
          }
        }
      }
    },
    "/portal/v1/confirm": {
      "post": {
        "operationId": "confirmPortalReceipt",
        "tags": [
          "Portal"
        ],
        "summary": "Confirm receipt and open a download session",
        "description": "Public. Records the explicit confirmation of receipt (an `L4` human confirmation in the\nevidence) and returns a short-lived session. In `CLICK` mode send `acknowledged: true`; in\n`OTP` mode send the `code`. If the confirmation cannot be recorded the request fails\n(`503`) so that no evidence is lost.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalConfirmRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receipt confirmed; the session can download.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfirmResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PortalBadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PortalForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PortalNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PortalConflict"
          },
          "410": {
            "$ref": "#/components/responses/PortalGone"
          },
          "413": {
            "$ref": "#/components/responses/PortalPayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/PortalUnsupportedMedia"
          },
          "429": {
            "$ref": "#/components/responses/PortalRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/PortalInternalError"
          },
          "503": {
            "$ref": "#/components/responses/PortalUnavailable"
          }
        }
      }
    },
    "/portal/v1/download": {
      "post": {
        "operationId": "downloadPortalAttachment",
        "tags": [
          "Portal"
        ],
        "summary": "Get a presigned download of an attachment",
        "description": "Public. With a confirmed session (or any session when no confirmation is required),\nrecords the download together with the SHA-256 of the file and returns a short-lived\npresigned URL. The page only follows URLs whose host is on its allow-list.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalDownloadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Presigned download.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalDownloadResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PortalBadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PortalForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PortalNotFound"
          },
          "410": {
            "$ref": "#/components/responses/PortalGone"
          },
          "413": {
            "$ref": "#/components/responses/PortalPayloadTooLarge"
          },
          "415": {
            "$ref": "#/components/responses/PortalUnsupportedMedia"
          },
          "429": {
            "$ref": "#/components/responses/PortalRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/PortalInternalError"
          },
          "503": {
            "$ref": "#/components/responses/PortalUnavailable"
          }
        }
      }
    },
    "/v1/sender-policy": {
      "get": {
        "operationId": "getSenderPolicy",
        "tags": [
          "Settings"
        ],
        "summary": "Read the sender policy and Fast Onboarding switch",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "The policy in force (`smtp.senderPolicy`, `smtp.fastOnboarding.enabled`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SenderPolicy"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "senders:read",
          "senders:write"
        ]
      },
      "put": {
        "operationId": "putSenderPolicy",
        "tags": [
          "Settings"
        ],
        "summary": "Change the sender policy and/or Fast Onboarding",
        "description": "Writes tenant-level overrides (they appear in the settings history). `WHOLE_DOMAIN` needs at\nleast one `ACTIVE` domain. Fast Onboarding sends through the shared platform domain, with the\noriginal address in `Reply-To`, while the tenant's own domain is not verified.\n",
        "x-cem-owner-wp": "70",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SenderPolicyUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The policy after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SenderPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "senders:write"
        ]
      }
    },
    "/v1/senders": {
      "get": {
        "operationId": "listSenders",
        "tags": [
          "Settings"
        ],
        "summary": "List the authorized senders",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "The senders and the policy in force.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SenderPolicy"
                    },
                    {
                      "type": "object",
                      "required": [
                        "items"
                      ],
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Sender"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "senders:read",
          "senders:write"
        ]
      }
    },
    "/v1/senders/{email}": {
      "get": {
        "operationId": "getSender",
        "tags": [
          "Settings"
        ],
        "summary": "Read one sender and its verification status",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/SenderEmailPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The sender, with `verification.status` (PENDING, VERIFIED or EXPIRED).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sender"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "senders:read",
          "senders:write"
        ]
      },
      "put": {
        "operationId": "putSender",
        "tags": [
          "Settings"
        ],
        "summary": "Authorize or update a sender address",
        "description": "The address must belong to a domain registered by the tenant (or, with Fast Onboarding, to a\ndomain nobody else owns). An empty body authorizes the sender; `enabled: false` blocks it\nunder any policy. Under Fast Onboarding, a signed one-time mailbox verification link is sent\nto the real address (or re-sent via `sendVerification: true`). `201` when created, `200` when updated.\n",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/SenderEmailPath"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SenderUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sender"
                }
              }
            }
          },
          "201": {
            "description": "Created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sender"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/BadGateway"
          }
        },
        "x-cem-scopes": [
          "senders:write"
        ]
      },
      "delete": {
        "operationId": "deleteSender",
        "tags": [
          "Settings"
        ],
        "summary": "Remove a sender address",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/SenderEmailPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "senders:write"
        ]
      }
    },
    "/public/v1/senders/verify": {
      "get": {
        "operationId": "verifySenderEmail",
        "tags": [
          "Settings"
        ],
        "summary": "Confirm mailbox ownership for Fast Onboarding",
        "description": "Public. Validates the signed token sent to the sender's real e-mail address and marks the\ntenant sender record (`SENDER#`) verified with its configured expiration.\n",
        "x-cem-owner-wp": "70",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/SenderVerificationTokenQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Mailbox verified cleanly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SenderVerifyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/BadGateway"
          }
        }
      }
    },
    "/v1/settings/catalog": {
      "get": {
        "operationId": "getSettingsCatalog",
        "tags": [
          "Settings"
        ],
        "summary": "Read the catalog of parameters",
        "description": "Types, ranges, defaults and the levels at which each parameter can be overridden, filtered\nto what the caller may see: tenant credentials do not see infrastructure parameters.\nEvery item states which levels this caller may edit through the API (`editableLevels`;\nempty means read-only, e.g. platform-level parameters for a tenant), so a console can mirror\nthe validation rules without hard-coding them.\n",
        "x-cem-owner-wp": "42",
        "responses": {
          "200": {
            "description": "The catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SettingsCatalog"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "caller": {
                          "type": "object",
                          "description": "Who the credential resolves to.",
                          "required": [
                            "tenantId",
                            "planId",
                            "level",
                            "canWrite"
                          ],
                          "properties": {
                            "tenantId": {
                              "type": "string"
                            },
                            "planId": {
                              "type": "string"
                            },
                            "level": {
                              "type": "string",
                              "enum": [
                                "TENANT",
                                "PLATFORM_ADMIN"
                              ]
                            },
                            "canWrite": {
                              "type": "boolean"
                            }
                          }
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string",
                                "description": "First segment of the key, used to group parameters."
                              },
                              "editableLevels": {
                                "type": "array",
                                "items": {
                                  "$ref": "#/components/schemas/SettingLevel"
                                }
                              },
                              "readOnly": {
                                "type": "boolean"
                              },
                              "messageOverridable": {
                                "type": "boolean",
                                "description": "The value set at tenant level is the default of the message-level option."
                              },
                              "ceilingMode": {
                                "type": "string",
                                "enum": [
                                  "none",
                                  "numeric_max"
                                ]
                              },
                              "pattern": {
                                "type": "string"
                              },
                              "itemPattern": {
                                "type": "string"
                              },
                              "minItems": {
                                "type": "integer"
                              },
                              "maxItems": {
                                "type": "integer"
                              },
                              "uniqueItems": {
                                "type": "boolean"
                              },
                              "allowEmpty": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "messages:read",
          "settings:read"
        ]
      }
    },
    "/v1/tenants/{tenantId}/settings": {
      "get": {
        "operationId": "getTenantSettings",
        "tags": [
          "Settings"
        ],
        "summary": "Read the settings of a tenant",
        "description": "A tenant credential can read only its own tenant; a platform administrator any tenant.\nWith `effective=true` every visible key is returned with its resolved value, the level\nthat set it, the explanation (`reason`), the value originally requested and, when a ceiling\nof a higher level capped it, which level imposed it. The `ETag` is the settings version.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "name": "effective",
            "in": "query",
            "description": "Also return the resolved value of every key and the level it comes from.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-level overrides and, on request, effective values.",
            "headers": {
              "ETag": {
                "description": "Strong entity tag of the settings version, e.g. `\"v3\"`. Send it as `If-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SettingsDocument"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "tenantId": {
                          "type": "string"
                        },
                        "planId": {
                          "type": "string"
                        },
                        "catalogVersion": {
                          "type": "string"
                        },
                        "configVersion": {
                          "type": "string"
                        },
                        "effective": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "reason": {
                                "type": "string"
                              },
                              "requestedValue": {
                                "$ref": "#/components/schemas/SettingValue"
                              },
                              "trace": {
                                "type": "array",
                                "description": "Levels that contributed, from DEFAULT upwards.",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "level"
                                  ],
                                  "properties": {
                                    "level": {
                                      "$ref": "#/components/schemas/SettingLevel"
                                    },
                                    "value": {
                                      "$ref": "#/components/schemas/SettingValue"
                                    },
                                    "ceiling": {
                                      "$ref": "#/components/schemas/SettingValue"
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "settings:read"
        ]
      },
      "put": {
        "operationId": "putTenantSettings",
        "tags": [
          "Settings"
        ],
        "summary": "Replace the tenant-level overrides",
        "description": "Validated against the catalog and the ceilings of the plan and the platform.\nCreates a new audited version (author, date, comment). Not retroactive unless the catalog\nsays so. Infrastructure parameters are rejected (`infra_parameter`).\nOptimistic concurrency: send `expectedVersion` in the body or the `ETag` of a previous read\nas `If-Match`; a mismatch answers `409` with the current `ETag`. When both are present they\nmust agree.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "description": "`ETag` of the version being replaced, e.g. `\"v3\"`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New version stored, with the resolved values and what changed.",
            "headers": {
              "ETag": {
                "description": "Strong entity tag of the new version.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SettingsDocument"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "tenantId": {
                          "type": "string"
                        },
                        "planId": {
                          "type": "string"
                        },
                        "configVersion": {
                          "type": "string"
                        },
                        "changes": {
                          "type": "array",
                          "description": "Old to new difference against the previous version.",
                          "items": {
                            "type": "object",
                            "required": [
                              "key",
                              "change"
                            ],
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "change": {
                                "type": "string",
                                "enum": [
                                  "added",
                                  "changed",
                                  "removed"
                                ]
                              },
                              "from": {
                                "oneOf": [
                                  {
                                    "$ref": "#/components/schemas/SettingValue"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "to": {
                                "oneOf": [
                                  {
                                    "$ref": "#/components/schemas/SettingValue"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/SettingsConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "settings:write"
        ]
      }
    },
    "/v1/tenants/{tenantId}/settings/history": {
      "get": {
        "operationId": "listTenantSettingsHistory",
        "tags": [
          "Settings"
        ],
        "summary": "List the versions of the tenant settings",
        "description": "Newest first. Each version carries who changed it (`updatedBy`), when (`updatedAt`), the\nreason (`comment`) and the old to new difference against the previous version (`changes`).\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of versions.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SettingsHistoryPage"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "changes"
                            ],
                            "properties": {
                              "changes": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "required": [
                                    "key",
                                    "change"
                                  ],
                                  "properties": {
                                    "key": {
                                      "type": "string"
                                    },
                                    "change": {
                                      "type": "string",
                                      "enum": [
                                        "added",
                                        "changed",
                                        "removed"
                                      ]
                                    },
                                    "from": {
                                      "oneOf": [
                                        {
                                          "$ref": "#/components/schemas/SettingValue"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "to": {
                                      "oneOf": [
                                        {
                                          "$ref": "#/components/schemas/SettingValue"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "settings:read"
        ]
      }
    },
    "/v1/admin/plans": {
      "get": {
        "operationId": "listPlans",
        "tags": [
          "Settings"
        ],
        "summary": "List the commercial plans",
        "description": "Platform administrators only (`platform:admin` scope). Lists the plans configured at\ndeployment (`source: config`, read-only) and the ones created through this API\n(`source: api`).\n",
        "x-cem-owner-wp": "42",
        "responses": {
          "200": {
            "description": "The plans with the version of their settings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "planId",
                          "name",
                          "source",
                          "settingsVersion",
                          "overrideCount"
                        ],
                        "properties": {
                          "planId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "config",
                              "api"
                            ]
                          },
                          "settingsVersion": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "overrideCount": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "createdAt": {
                            "$ref": "#/components/schemas/Timestamp"
                          },
                          "updatedAt": {
                            "$ref": "#/components/schemas/Timestamp"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      },
      "post": {
        "operationId": "createPlan",
        "tags": [
          "Settings"
        ],
        "summary": "Create a commercial plan",
        "description": "Platform administrators only. Stores the plan in the configuration table; plans configured\nat deployment keep their ids reserved. A new plan has no overrides until its settings are\nwritten; tenants can be created on it or moved to it right away.\n",
        "x-cem-owner-wp": "42",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "planId",
                  "name"
                ],
                "additionalProperties": false,
                "properties": {
                  "planId": {
                    "description": "Identifier of the new plan: lowercase letters, digits and hyphens.",
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "name": {
                    "description": "Display name of the plan (1 to 100 characters).",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "description": "Free-text description of the plan (up to 500 characters).",
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The stored plan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "planId",
                    "name",
                    "source",
                    "settingsVersion",
                    "overrideCount"
                  ],
                  "properties": {
                    "planId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "api"
                      ]
                    },
                    "settingsVersion": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "overrideCount": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "createdAt": {
                      "$ref": "#/components/schemas/Timestamp"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v1/admin/plans/{planId}/settings": {
      "get": {
        "operationId": "getPlanSettings",
        "tags": [
          "Settings"
        ],
        "summary": "Read the settings of a plan",
        "description": "Platform administrators only. The `ETag` is the settings version.",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/PlanIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Plan-level overrides.",
            "headers": {
              "ETag": {
                "description": "Strong entity tag of the settings version.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SettingsDocument"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "planId": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      },
      "put": {
        "operationId": "putPlanSettings",
        "tags": [
          "Settings"
        ],
        "summary": "Replace the plan-level overrides",
        "description": "Platform administrators only. Validated against the platform ceilings; for numeric\nparameters the plan value is in turn the ceiling of its tenants. Same concurrency rules\nas the tenant update.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/PlanIdPath"
          },
          {
            "name": "If-Match",
            "description": "`ETag` of the settings version being replaced, e.g. `\"v3\"`.",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New version stored.",
            "headers": {
              "ETag": {
                "description": "Strong entity tag of the new version.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SettingsDocument"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "planId": {
                          "type": "string"
                        },
                        "changes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "key",
                              "change"
                            ],
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "change": {
                                "type": "string",
                                "enum": [
                                  "added",
                                  "changed",
                                  "removed"
                                ]
                              },
                              "from": {},
                              "to": {}
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/SettingsConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v1/admin/plans/{planId}/settings/history": {
      "get": {
        "operationId": "listPlanSettingsHistory",
        "tags": [
          "Settings"
        ],
        "summary": "List the versions of the plan settings",
        "description": "Platform administrators only. Newest first, with the old to new changes.",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/PlanIdPath"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsHistoryPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v1/admin/tenants/{tenantId}/plan": {
      "put": {
        "operationId": "assignTenantPlan",
        "tags": [
          "Settings"
        ],
        "summary": "Assign a plan to a tenant",
        "description": "Platform administrators only. The tenant's overrides are kept; those above the ceilings of\nthe new plan are listed in `clampedKeys` and resolve to the ceiling. Optimistic concurrency\non the tenant record through `expectedVersion` or `If-Match`.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "name": "If-Match",
            "description": "`ETag` of the tenant record version returned by a previous read. Alternative to `expectedVersion`.",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "planId"
                ],
                "additionalProperties": false,
                "properties": {
                  "planId": {
                    "description": "Plan to assign to the tenant. It must exist.",
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "expectedVersion": {
                    "description": "Version of the tenant record the caller read; the change fails with `409` if the current version differs.",
                    "type": "integer",
                    "minimum": 0
                  },
                  "comment": {
                    "description": "Reason for the change (up to 500 characters).",
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Plan assigned.",
            "headers": {
              "ETag": {
                "description": "Strong entity tag of the tenant record version.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "tenantId",
                    "planId",
                    "previousPlanId",
                    "version",
                    "updatedAt",
                    "clampedKeys"
                  ],
                  "properties": {
                    "tenantId": {
                      "type": "string"
                    },
                    "planId": {
                      "type": "string"
                    },
                    "previousPlanId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "updatedAt": {
                      "$ref": "#/components/schemas/Timestamp"
                    },
                    "updatedBy": {
                      "type": "string"
                    },
                    "clampedKeys": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/SettingsConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v1/suppressions": {
      "get": {
        "operationId": "listSuppressions",
        "tags": [
          "Suppressions"
        ],
        "summary": "List the tenant's suppressed addresses",
        "description": "Entries of the calling tenant only, ordered by `emailSha256`. Platform-wide\nentries are never listed. Expired entries are not returned. Addresses are\nstored as SHA-256 digests of the lowercased address.\n",
        "x-cem-owner-wp": "72",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of entries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuppressionList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "suppressions:read"
        ]
      },
      "post": {
        "operationId": "addSuppression",
        "tags": [
          "Suppressions"
        ],
        "summary": "Suppress an address manually",
        "description": "Adds (or refreshes) a `MANUAL` entry for the tenant. Without `ttlDays` the\nentry does not expire. Messages to a suppressed address are not sent and the\nrecipient ends as `SUPPRESSED`.\n",
        "x-cem-owner-wp": "72",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSuppressionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The entry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuppressionEntry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "suppressions:write"
        ]
      }
    },
    "/v1/suppressions/{emailSha256}": {
      "delete": {
        "operationId": "removeSuppression",
        "tags": [
          "Suppressions"
        ],
        "summary": "Remove a suppression entry",
        "description": "Deletes the tenant's entry stored under the digest of the address.",
        "x-cem-owner-wp": "72",
        "parameters": [
          {
            "name": "emailSha256",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Sha256"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "suppressions:write"
        ]
      }
    },
    "/v1/admin/tenants": {
      "post": {
        "operationId": "createTenant",
        "tags": [
          "Settings"
        ],
        "summary": "Create a tenant (platform administrator)",
        "description": "Creates an `ACTIVE` tenant. With `apiKey` (an object, possibly empty) the first key is issued\nand returned once in the response; it defaults to every tenant scope so the tenant can\nonboard itself (domains, senders, keys). The plan must exist (`404 plan_not_found`).\n",
        "x-cem-owner-wp": "70",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "planId"
                ],
                "properties": {
                  "name": {
                    "description": "Display name of the tenant (1 to 120 characters).",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "planId": {
                    "description": "Plan the tenant starts on. It must exist.",
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "tenantId": {
                    "type": "string",
                    "description": "Generated when omitted.",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "apiKey": {
                    "$ref": "#/components/schemas/ApiKeyRequestOptional"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The tenant, with `apiKey` when requested.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Tenant"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "apiKey": {
                          "$ref": "#/components/schemas/ApiKeyIssued"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      },
      "get": {
        "operationId": "listTenants",
        "tags": [
          "Settings"
        ],
        "summary": "List tenants (platform administrator)",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/TenantLifecycleStatus"
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of tenants.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Tenant"
                      }
                    },
                    "nextCursor": {
                      "$ref": "#/components/schemas/Cursor"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v1/admin/tenants/{tenantId}": {
      "get": {
        "operationId": "getTenant",
        "tags": [
          "Settings"
        ],
        "summary": "Read a tenant (platform administrator)",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The tenant, including a deleted one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tenant"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v1/admin/tenants/{tenantId}/status": {
      "put": {
        "operationId": "setTenantStatus",
        "tags": [
          "Settings"
        ],
        "summary": "Suspend, reactivate or delete a tenant (platform administrator)",
        "description": "`SUSPENDED` and `DELETED` make the authorizer reject the tenant's keys. `DELETED` is terminal\nand also deletes the tenant's SES identities. Repeating the current status is a no-op.\n",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "$ref": "#/components/schemas/TenantLifecycleStatus"
                  },
                  "reason": {
                    "description": "Reason for the change (up to 500 characters).",
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tenant after the change.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tenant"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v1/admin/tenants/{tenantId}/api-keys": {
      "post": {
        "operationId": "createTenantApiKey",
        "tags": [
          "Settings"
        ],
        "summary": "Issue an API key for a tenant (platform administrator)",
        "description": "Recovery path for a tenant that lost every credential. The secret is shown once.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The key with its secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyIssued"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/ControlPlaneConflict"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "x-cem-scopes": [
          "platform:admin"
        ]
      }
    },
    "/v/{trackId}": {
      "get": {
        "operationId": "verifyTrackShort",
        "tags": [
          "Verification"
        ],
        "summary": "Human/QR verification entry point and content-negotiated track status",
        "description": "Public human and QR verification URL (`https://verify.<platform_domain>/v/{trackId}`).\n\n* **Browsers and QR scanners (`Accept: text/html`)**: CloudFront serves the static web\n  verifier application directly at `/v/{trackId}`, which strips any `code` from the URL bar\n  and queries the canonical JSON endpoint `GET /public/v1/verify/track/{trackId}`. If a\n  browser hits the HTTP API origin directly with `Accept: text/html` and\n  `CEM_VERIFY_WEB_BASE_URL` is configured, the API validates `trackId` (ULID) and optional\n  `code` and responds `302 Found` to `{verify_web_base_url}/v/{trackId}` (moving `code` to\n  the `#code=...` fragment).\n* **API clients (`Accept: application/json`)**: CloudFront responds `307 Temporary Redirect`\n  to `/public/v1/verify/track/{trackId}` (preserving `?code=...`), and the HTTP API origin\n  returns `200 application/json` (`VerifyTrackResponse`).\n",
        "x-cem-owner-wp": "38",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/VerifyCodeQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Receipt status and digests for the tracking identifier (JSON clients).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyTrackResponse"
                }
              }
            }
          },
          "302": {
            "description": "Redirect to the public web verifier when `Accept` prefers `text/html` on the API origin."
          },
          "307": {
            "description": "Redirect at the CloudFront edge to `/public/v1/verify/track/{trackId}` for `Accept: application/json`."
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/VerifyInvalidCode"
          },
          "404": {
            "$ref": "#/components/responses/VerifyNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/public/v1/verify/track/{trackId}": {
      "get": {
        "operationId": "verifyTrack",
        "tags": [
          "Verification"
        ],
        "summary": "Canonical JSON verification status and digests by tracking ID",
        "description": "Public canonical JSON endpoint for programmatic clients and the web verifier. Always returns\n`application/json` (or `application/problem+json` on error) and never redirects to HTML.\nReturns receipt sealing status and artifact SHA-256 digests without personal data; supplying\n`code` unlocks extended metadata (timestamp, signer key id, chain link, retention) for the\nmatching receipt only.\n",
        "x-cem-owner-wp": "38",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/VerifyCodeQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Receipt status and digests for the tracking identifier.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyTrackResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/VerifyInvalidCode"
          },
          "404": {
            "$ref": "#/components/responses/VerifyNotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/public/v1/verify/hash": {
      "post": {
        "operationId": "verifyHash",
        "tags": [
          "Verification"
        ],
        "summary": "Check whether a digest belongs to issued evidence",
        "description": "Public. The caller computes the SHA-256 locally and sends only the digest.\nWorks after the retention period too, against the digest index.\n",
        "x-cem-owner-wp": "38",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyHashRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result of the lookup; `match` is `false` when nothing was found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyHashResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/public/v1/verify/container": {
      "post": {
        "operationId": "verifyContainer",
        "tags": [
          "Verification"
        ],
        "summary": "Validate an ASiC-E evidence container",
        "description": "Public. Validates signature, certificate chain, RFC 3161 timestamp, inclusion\nproof and consistency with the digest index. The container is not stored.\n",
        "x-cem-owner-wp": "38",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.etsi.asic-e+zip": {
              "schema": {
                "type": "string",
                "contentMediaType": "application/vnd.etsi.asic-e+zip",
                "maxLength": 5242880
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation performed; read `result` for the outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyContainerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "413": {
            "description": "Larger than 5 MB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "Not an ASiC-E container.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/v1/webhooks/deliveries/{deliveryId}/replay": {
      "post": {
        "operationId": "replayWebhookDelivery",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a webhook delivery again",
        "description": "Re-queues the delivery with the same `webhook-id`, so a consumer that\ndeduplicates will recognise it. Allowed for deliveries in `FAILED`,\n`PARKED` or `DELIVERED`.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryIdPath"
          }
        ],
        "responses": {
          "202": {
            "description": "Queued again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The delivery is still being attempted.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write",
          "webhooks:write"
        ]
      }
    },
    "/v1/webhooks/deliveries/{deliveryId}": {
      "get": {
        "operationId": "getWebhookDelivery",
        "tags": [
          "Webhooks"
        ],
        "summary": "Read one webhook delivery",
        "description": "State of the attempt chain of one event towards one endpoint. Delivery rows are\nkept for `retention.webhookDeliveries.days`; afterwards the call answers `404`.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read",
          "webhooks:read"
        ]
      }
    },
    "/v1/webhooks/endpoints/{endpointId}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "tags": [
          "Webhooks"
        ],
        "summary": "List the deliveries of an endpoint",
        "description": "Newest first. Use `status=FAILED` to find what can be replayed.",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "name": "endpointId",
            "description": "Identifier of the webhook endpoint.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only deliveries in this state.",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "DELIVERED",
                "FAILED",
                "PARKED"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of deliveries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookDelivery"
                      }
                    },
                    "nextCursor": {
                      "$ref": "#/components/schemas/Cursor"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read",
          "webhooks:read"
        ]
      }
    },
    "/v1/webhooks/endpoints/{endpointId}/replay": {
      "post": {
        "operationId": "replayWebhookDeliveries",
        "tags": [
          "Webhooks"
        ],
        "summary": "Replay a range of deliveries of an endpoint",
        "description": "Re-queues the deliveries of the endpoint that are in `status` and were created within\n`from`..`to`, keeping their `webhook-id`. At most `limit` deliveries are replayed per\ncall, spread over time to protect the endpoint; when `nextCursor` is returned, call again\nwith it to continue. Deliveries of a suspended endpoint stay `PARKED` until it recovers.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "name": "endpointId",
            "description": "Identifier of the webhook endpoint.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "description": "State of the deliveries to replay. Defaults to `FAILED`.",
                    "enum": [
                      "FAILED",
                      "PARKED",
                      "DELIVERED"
                    ]
                  },
                  "from": {
                    "$ref": "#/components/schemas/Timestamp"
                  },
                  "to": {
                    "$ref": "#/components/schemas/Timestamp"
                  },
                  "limit": {
                    "description": "Maximum number of deliveries replayed by this call, from 1 to 1000 (default 500).",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 500
                  },
                  "cursor": {
                    "$ref": "#/components/schemas/Cursor"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "replayed",
                    "skipped"
                  ],
                  "properties": {
                    "replayed": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "skipped": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Deliveries examined but outside the requested range."
                    },
                    "nextCursor": {
                      "$ref": "#/components/schemas/Cursor"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The endpoint is disabled or the status cannot be replayed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write",
          "webhooks:write"
        ]
      }
    },
    "/v1/webhooks/endpoints": {
      "post": {
        "operationId": "createWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Register a webhook endpoint",
        "description": "Registers an HTTPS endpoint that receives the subscribed events. The URL is checked at\nregistration: `https` only, no credentials in the URL, and every address the host resolves\nto must be public (no private, loopback, link-local or metadata ranges); the same check runs\nagain on every delivery. The signing `secret` is returned **only in this response** and in\na rotation; store it now. The number of active endpoints is limited by\n`webhooks.maxEndpoints`.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookEndpointRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replay of an earlier request with the same `Idempotency-Key`. The endpoint is returned\nwithout its secret, which was shown by the original response.\n",
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "201": {
            "description": "Endpoint registered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "description": "The URL is not allowed or does not resolve (`url_blocked`, `url_unresolvable`), the\nlimit of endpoints is reached (`endpoint_limit_reached`) or the key was used with a\ndifferent body (`idempotency_key_reused`).\n",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write",
          "webhooks:write"
        ]
      },
      "get": {
        "operationId": "listWebhookEndpoints",
        "tags": [
          "Webhooks"
        ],
        "summary": "List the webhook endpoints",
        "description": "Ordered by `endpointId`. Secret values are never returned.",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of endpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookEndpoint"
                      }
                    },
                    "nextCursor": {
                      "$ref": "#/components/schemas/Cursor"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read",
          "webhooks:read"
        ]
      }
    },
    "/v1/webhooks/endpoints/{endpointId}": {
      "get": {
        "operationId": "getWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Read one webhook endpoint",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint, without secret values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:read",
          "webhooks:read"
        ]
      },
      "patch": {
        "operationId": "updateWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Change a webhook endpoint",
        "description": "Changes the URL (checked again), the subscribed events, the description or the status.\nSetting `status` to `ACTIVE` on a `SUSPENDED` endpoint closes its circuit breaker: the\nfailure counter is reset and the deliveries parked while it was suspended are released.\n`SUSPENDED` is set by the platform only and cannot be requested.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookEndpointRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The endpoint changed concurrently (`concurrent_update`); retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write",
          "webhooks:write"
        ]
      },
      "delete": {
        "operationId": "deleteWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "description": "Stops all deliveries to the endpoint. Delivery history is kept until it expires.",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write",
          "webhooks:write"
        ]
      }
    },
    "/v1/webhooks/endpoints/{endpointId}/secrets/rotate": {
      "post": {
        "operationId": "rotateWebhookEndpointSecret",
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate the signing secret of an endpoint",
        "description": "Generates a new secret, returned only here. The previous secret keeps signing for the\noverlap window (`expiresAt` of its entry in `secrets`), so deliveries carry one signature\nper valid secret and the consumer can switch without downtime.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint and the new secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The endpoint changed concurrently (`concurrent_update`); retry.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write",
          "webhooks:write"
        ]
      }
    },
    "/v1/webhooks/endpoints/{endpointId}/test": {
      "post": {
        "operationId": "testWebhookEndpoint",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test event to an endpoint",
        "description": "Sends one signed `webhook.test` event now and waits for the answer. It uses the same\naddress checks, signing and timeout as real deliveries, is never retried and does not\nchange the circuit breaker or the delivery history. A failed ping answers `200` with\n`success: false`.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Result of the ping.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookTestResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        },
        "x-cem-scopes": [
          "messages:write",
          "webhooks:write"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "cem_live_{tenant}_{keyId}_{secret}",
        "description": "Tenant API key. The tenant and the key id are part of the token; only a\nSHA-256 of the secret is stored by the platform.\n"
      }
    },
    "schemas": {
      "CreateAttachmentRequest": {
        "type": "object",
        "required": [
          "filename",
          "bytes",
          "sha256"
        ],
        "additionalProperties": false,
        "properties": {
          "filename": {
            "description": "Name of the file (1 to 255 characters).",
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "mediaType": {
            "description": "Media type of the file (up to 127 characters).",
            "type": "string",
            "maxLength": 127
          },
          "bytes": {
            "type": "integer",
            "description": "Exact size of the file; the upload is rejected if it differs.",
            "minimum": 1,
            "maximum": 41943040
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256"
          }
        }
      },
      "CreateAttachmentResponse": {
        "type": "object",
        "required": [
          "attachmentId",
          "upload",
          "expiresAt"
        ],
        "properties": {
          "attachmentId": {
            "$ref": "#/components/schemas/AttachmentId"
          },
          "upload": {
            "type": "object",
            "description": "Presigned request the client must perform as is. Size and checksum are part\nof the signature: storage rejects a body that does not match them.\n",
            "required": [
              "method",
              "url",
              "headers"
            ],
            "properties": {
              "method": {
                "type": "string",
                "const": "PUT"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "description": "Headers to send verbatim, including `x-amz-checksum-sha256`.",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "BatchId": {
        "type": "string",
        "pattern": "^bat_[0-9A-HJKMNP-TV-Z]{26}$",
        "examples": [
          "bat_01JD90B2M4X7Q8R9S0T1V2W3X4"
        ]
      },
      "BatchStatus": {
        "type": "string",
        "enum": [
          "CREATED",
          "RUNNING",
          "COMPLETED",
          "FAILED",
          "CANCELED"
        ]
      },
      "CreateBatchRequest": {
        "type": "object",
        "required": [
          "format",
          "bytes",
          "sha256"
        ],
        "additionalProperties": false,
        "properties": {
          "format": {
            "type": "string",
            "description": "`JSONL`: one `SubmitMessageRequest` per line. `CSV`: header row with a\nrequired `to` column; lists use `;`.\n",
            "enum": [
              "CSV",
              "JSONL"
            ]
          },
          "bytes": {
            "type": "integer",
            "description": "Exact size of the manifest; the upload is rejected if it differs.",
            "minimum": 1
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256"
          },
          "name": {
            "description": "Name of the batch, repeated in reports and in the `batch.completed` event (1 to 128 characters).",
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "priority": {
            "type": "string",
            "description": "Dispatch lane of the rows that do not set `options.priority`.",
            "enum": [
              "BULK",
              "TRANSACTIONAL"
            ],
            "default": "BULK"
          },
          "defaults": {
            "type": "object",
            "description": "Values applied to every row unless the row sets them (`options` and\n`metadata` are merged). Accepts `from`, `replyTo`, `subject`, `html`,\n`text`, `attachments`, `options` and `metadata`.\n",
            "additionalProperties": true
          }
        }
      },
      "CreateBatchResponse": {
        "type": "object",
        "required": [
          "batchId",
          "status",
          "format",
          "upload",
          "expiresAt"
        ],
        "properties": {
          "batchId": {
            "$ref": "#/components/schemas/BatchId"
          },
          "status": {
            "$ref": "#/components/schemas/BatchStatus"
          },
          "format": {
            "type": "string",
            "enum": [
              "CSV",
              "JSONL"
            ]
          },
          "upload": {
            "type": "object",
            "description": "Presigned request the client must perform as is.",
            "required": [
              "method",
              "url",
              "headers"
            ],
            "properties": {
              "method": {
                "type": "string",
                "const": "PUT"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "BatchDownload": {
        "type": "object",
        "required": [
          "url",
          "expiresAt"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "Batch": {
        "type": "object",
        "required": [
          "batchId",
          "status",
          "format",
          "createdAt",
          "counts",
          "progressPercent"
        ],
        "properties": {
          "batchId": {
            "$ref": "#/components/schemas/BatchId"
          },
          "status": {
            "$ref": "#/components/schemas/BatchStatus"
          },
          "format": {
            "type": "string",
            "enum": [
              "CSV",
              "JSONL"
            ]
          },
          "name": {
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "startedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "completedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "counts": {
            "type": "object",
            "required": [
              "total",
              "accepted",
              "rejected",
              "processed",
              "pending"
            ],
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "accepted": {
                "type": "integer",
                "minimum": 0
              },
              "rejected": {
                "type": "integer",
                "minimum": 0
              },
              "processed": {
                "type": "integer",
                "minimum": 0
              },
              "pending": {
                "type": "integer",
                "description": "Rows not processed (for example, chunks that failed).",
                "minimum": 0
              }
            }
          },
          "progressPercent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "failure": {
            "type": "object",
            "required": [
              "code"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "downloads": {
            "type": "object",
            "description": "Presigned report links, present once the batch has finished.",
            "properties": {
              "report": {
                "$ref": "#/components/schemas/BatchDownload"
              },
              "errors": {
                "$ref": "#/components/schemas/BatchDownload"
              }
            }
          }
        }
      },
      "BatchItem": {
        "type": "object",
        "required": [
          "row",
          "status"
        ],
        "properties": {
          "row": {
            "type": "integer",
            "description": "Position of the record in the manifest, starting at 1.",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "ACCEPTED",
              "REJECTED"
            ]
          },
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "recipients": {
            "type": "integer",
            "minimum": 0
          },
          "replayed": {
            "type": "boolean"
          },
          "code": {
            "type": "string",
            "description": "Rejection code (same codes as `POST /v1/messages`)."
          },
          "title": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "pointer",
                "code"
              ],
              "properties": {
                "pointer": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BatchItemList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchItem"
            }
          },
          "nextCursor": {
            "$ref": "#/components/schemas/Cursor"
          }
        }
      },
      "TrackId": {
        "type": "string",
        "description": "Server-generated ULID that identifies a message.",
        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
        "examples": [
          "01JD90B2M4X7Q8R9S0T1V2W3X4"
        ]
      },
      "RecipientId": {
        "type": "string",
        "description": "Position of the recipient inside its message (`r0`, `r1`, ...).",
        "pattern": "^r(0|[1-9][0-9]{0,2})$",
        "examples": [
          "r0"
        ]
      },
      "EvidenceId": {
        "type": "string",
        "pattern": "^EV-[0-9A-HJKMNP-TV-Z]{10,26}$",
        "examples": [
          "EV-01JD90B2M4X7"
        ]
      },
      "AttachmentId": {
        "type": "string",
        "pattern": "^att_[0-9A-HJKMNP-TV-Z]{26}$",
        "examples": [
          "att_01JD90B2M4X7Q8R9S0T1V2W3X4"
        ]
      },
      "Sha256": {
        "type": "string",
        "description": "SHA-256 digest, lowercase hexadecimal.",
        "pattern": "^[0-9a-f]{64}$",
        "examples": [
          "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
        ]
      },
      "Timestamp": {
        "type": "string",
        "format": "date-time",
        "description": "RFC 3339 instant in UTC.",
        "examples": [
          "2026-03-02T15:04:05Z"
        ]
      },
      "Cursor": {
        "type": "string",
        "description": "Opaque pagination token. Do not parse or build it.",
        "minLength": 1,
        "maxLength": 1024
      },
      "ReceiptType": {
        "type": "string",
        "description": "Kind of certified receipt.",
        "enum": [
          "SUBMISSION",
          "DELIVERY",
          "READ",
          "DOWNLOAD",
          "FAILURE",
          "DELAY",
          "OPEN",
          "CLOSURE"
        ]
      },
      "ReadLevel": {
        "type": "string",
        "description": "Strength of the read signal. `L0` no signal, `L1` machine prefetch or security\nscanner (inconclusive), `L2` probable open through an image proxy, `L3` probable\nhuman interaction, `L4` confirmed on the portal.\n",
        "enum": [
          "L0",
          "L1",
          "L2",
          "L3",
          "L4"
        ]
      },
      "RecipientStatus": {
        "type": "string",
        "description": "Delivery state of one recipient. Interaction (`ReadLevel`) is a separate dimension.",
        "enum": [
          "ACCEPTED",
          "REJECTED",
          "QUEUED",
          "HELD_FOR_SCAN",
          "SUPPRESSED",
          "ON_HOLD",
          "RENDERED",
          "SENDING",
          "SENT",
          "DELIVERED",
          "DELAYED",
          "BOUNCED",
          "REJECTED_SES",
          "COMPLAINED"
        ]
      },
      "TrustLevel": {
        "type": "string",
        "description": "`TEST` when the signer or the timestamp authority is not a trusted third party\n(self-signed certificate, internal TSA). Such evidence has no legal value.\n",
        "enum": [
          "TEST",
          "PRODUCTION"
        ]
      },
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details.",
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri-reference"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string",
            "format": "uri-reference"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code. Every code the API can answer, with its HTTP status and cause, is listed in the `x-error-catalog` extension of this document.",
            "pattern": "^[a-z][a-z0-9_]*$",
            "examples": [
              "idempotency_key_reused"
            ]
          },
          "requestId": {
            "type": "string"
          },
          "verificationSent": {
            "type": "boolean",
            "description": "Only on `403 sender_not_verified` (Fast Onboarding): `true` when this attempt just triggered\nthe verification e-mail to the sender mailbox, `false` when it was throttled or unavailable.\n"
          },
          "verificationRetryAfterSeconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Only with verificationSent=false when throttled: seconds until another e-mail may be sent."
          },
          "errors": {
            "type": "array",
            "description": "Field-level validation errors.",
            "items": {
              "type": "object",
              "required": [
                "pointer",
                "code"
              ],
              "properties": {
                "pointer": {
                  "type": "string",
                  "description": "JSON Pointer (RFC 6901) to the offending value."
                },
                "code": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                }
              }
            }
          }
        },
        "examples": [
          {
            "type": "https://docs.miplataforma.com/errors/idempotency_key_reused",
            "title": "Idempotency key reused with a different request",
            "status": 422,
            "code": "idempotency_key_reused"
          }
        ]
      },
      "TenantLifecycleStatus": {
        "type": "string",
        "description": "Administrative lifecycle of a tenant. `DELETED` is terminal.",
        "enum": [
          "ACTIVE",
          "SUSPENDED",
          "DELETED"
        ]
      },
      "Tenant": {
        "type": "object",
        "required": [
          "tenantId",
          "tenantRef",
          "name",
          "planId",
          "status",
          "createdAt",
          "updatedAt",
          "version"
        ],
        "properties": {
          "tenantId": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
          },
          "tenantRef": {
            "type": "string",
            "description": "Opaque reference that appears in public evidence instead of the tenant id."
          },
          "name": {
            "type": "string"
          },
          "planId": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/TenantLifecycleStatus"
          },
          "sendingPaused": {
            "type": "boolean"
          },
          "sesTenantArn": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "ApiKeyScope": {
        "type": "string",
        "description": "`*` grants every tenant scope. `platform:admin` is never granted through the API.\nAn operation is authorized when the key holds at least one of the scopes listed in the\n`x-cem-scopes` of the operation (several operations accept alternatives, for example\n`evidence:read` or `messages:read`); `*` satisfies every operation except platform\nadministration, which requires `platform:admin` explicitly.\n",
        "enum": [
          "*",
          "messages:read",
          "messages:write",
          "attachments:write",
          "evidence:read",
          "evidence:write",
          "settings:read",
          "settings:write",
          "webhooks:read",
          "webhooks:write",
          "domains:read",
          "domains:write",
          "senders:read",
          "senders:write",
          "apikeys:read",
          "apikeys:write",
          "suppressions:read",
          "suppressions:write",
          "batches:read",
          "batches:write"
        ]
      },
      "ApiKeyRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "label"
        ],
        "properties": {
          "label": {
            "description": "Name that identifies the key, for example the system that will use it (1 to 80 characters).",
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "description": "Defaults to `messages:read` and `messages:write`. Never more than the issuing key holds.",
            "items": {
              "$ref": "#/components/schemas/ApiKeyScope"
            }
          },
          "environment": {
            "description": "Environment of the token: `live` or `test`. It becomes the prefix of the generated token.",
            "type": "string",
            "enum": [
              "live",
              "test"
            ],
            "default": "live"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "ApiKeyRequestOptional": {
        "type": "object",
        "additionalProperties": false,
        "description": "Like `ApiKeyRequest` for the first key of a tenant; `label` defaults to `initial` and `scopes` to every tenant scope.",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/ApiKeyScope"
            }
          },
          "environment": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ],
            "default": "live"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "ApiKey": {
        "type": "object",
        "description": "Metadata of a key. The secret and its hash are never returned again.",
        "required": [
          "keyId",
          "label",
          "scopes",
          "status",
          "current"
        ],
        "properties": {
          "keyId": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "REVOKED",
              "EXPIRED"
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastUsedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "current": {
            "type": "boolean",
            "description": "The key that signed this request."
          }
        }
      },
      "ApiKeyIssued": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiKey"
          },
          {
            "type": "object",
            "required": [
              "environment",
              "secret",
              "token"
            ],
            "properties": {
              "environment": {
                "type": "string",
                "enum": [
                  "live",
                  "test"
                ]
              },
              "secret": {
                "type": "string",
                "description": "Shown only in this response."
              },
              "token": {
                "type": "string",
                "description": "`cem_{live|test}_{tenant}_{keyId}_{secret}`, the bearer credential. Shown only in this response."
              },
              "rotatedFrom": {
                "type": "string"
              },
              "previousKeyExpiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "DnsRecord": {
        "type": "object",
        "required": [
          "purpose",
          "type",
          "name",
          "value",
          "required",
          "verified"
        ],
        "properties": {
          "purpose": {
            "type": "string",
            "description": "`DKIM` (3 CNAME, rotated by SES) and `MAIL_FROM_MX`/`MAIL_FROM_SPF` (custom MAIL FROM\nsubdomain) are required. `SPF` (apex) and `DMARC` are optional proposals computed from what\nthe public DNS of the domain already publishes; they never gate `ACTIVE`.\n",
            "enum": [
              "DKIM",
              "MAIL_FROM_MX",
              "MAIL_FROM_SPF",
              "SPF",
              "DMARC"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "CNAME",
              "MX",
              "TXT"
            ]
          },
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "required": {
            "type": "boolean",
            "description": "Needed for the domain to become `ACTIVE`. Recommended records are not checked."
          },
          "verified": {
            "type": "boolean"
          },
          "advice": {
            "type": "string",
            "description": "Guidance for the optional `SPF` and `DMARC` records."
          },
          "existing": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional records only. The record the domain already publishes (`null` when none, or when\nthe public DNS could not be queried). For `SPF` with an existing record, `value` is that\nrecord already combined with `include:amazonses.com`; for `DMARC` it is the existing record.\n"
          },
          "warnings": {
            "type": "array",
            "description": "Optional records only.",
            "items": {
              "$ref": "#/components/schemas/DnsWarning"
            }
          },
          "dnsLookups": {
            "type": [
              "integer",
              "null"
            ],
            "description": "`SPF` only. DNS lookups the combined record needs (`include`, `a`, `mx`, `exists`, `redirect`, `ptr`, recursive); `null` when unknown."
          },
          "lookupLimit": {
            "type": "integer",
            "description": "`SPF` only. RFC 7208 limit (10)."
          }
        }
      },
      "DnsWarning": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "spf_exists",
              "spf_multiple",
              "spf_lookup_limit",
              "spf_not_published",
              "dmarc_exists",
              "dmarc_multiple",
              "dmarc_not_published"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "DnsAssistant": {
        "type": "object",
        "required": [
          "publishSpfDmarc",
          "dnsCheck"
        ],
        "properties": {
          "publishSpfDmarc": {
            "type": "boolean",
            "description": "The tenant said it will publish the optional SPF/DMARC records; they are then checked in public DNS."
          },
          "dnsCheck": {
            "type": "string",
            "description": "`UNAVAILABLE` when the public DNS could not be queried; the wizard then shows its static proposals.",
            "enum": [
              "OK",
              "UNAVAILABLE"
            ]
          },
          "dedicatedSubdomain": {
            "type": [
              "string",
              "null"
            ],
            "description": "Suggested subdomain (`cert.{domain}`) while the tenant does not publish SPF/DMARC."
          },
          "subdomainAdvice": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DomainUpdate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "publishSpfDmarc"
        ],
        "properties": {
          "publishSpfDmarc": {
            "description": "`true` to also check the optional `SPF` and `DMARC` records in public DNS; `false` to stop checking them.",
            "type": "boolean"
          }
        }
      },
      "DomainRegistration": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "domain"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "description": "Bare host name, for example `example.com`. Internationalized names are stored as punycode.",
            "maxLength": 253
          }
        }
      },
      "Domain": {
        "type": "object",
        "required": [
          "domain",
          "status",
          "dkimMode",
          "smtpEnabled",
          "dnsRecords",
          "verification",
          "sending",
          "version"
        ],
        "properties": {
          "domain": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "`PENDING` until DKIM verifies (up to 72 hours), then `ACTIVE`, or `FAILED` with `failureReason`.",
            "enum": [
              "PENDING",
              "ACTIVE",
              "FAILED"
            ]
          },
          "dkimMode": {
            "type": "string",
            "enum": [
              "EASY_DKIM",
              "BYODKIM"
            ]
          },
          "smtpEnabled": {
            "type": "boolean"
          },
          "failureReason": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "dkim_verification_failed",
              "dns_verification_timeout",
              "ses_identity_missing"
            ]
          },
          "dnsRecords": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DnsRecord"
            }
          },
          "assistant": {
            "$ref": "#/components/schemas/DnsAssistant"
          },
          "verification": {
            "type": "object",
            "required": [
              "requiredRecords",
              "verifiedRecords"
            ],
            "properties": {
              "requiredRecords": {
                "type": "integer"
              },
              "verifiedRecords": {
                "type": "integer"
              },
              "deadline": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "When a still `PENDING` domain is declared `FAILED`."
              }
            }
          },
          "sending": {
            "type": "object",
            "description": "Which From domain mail will use right now.",
            "required": [
              "mode",
              "fromDomain"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "description": "`FAST_ONBOARDING` rewrites the From through the shared platform domain until the tenant's own domain verifies.",
                "enum": [
                  "OWN_DOMAIN",
                  "FAST_ONBOARDING",
                  "UNAVAILABLE"
                ]
              },
              "fromDomain": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "version": {
            "type": "integer"
          }
        }
      },
      "SenderPolicyName": {
        "type": "string",
        "description": "`ALLOWLIST` only addresses registered as senders may use the tenant; `WHOLE_DOMAIN` any\naddress of a verified domain (registered senders can still be disabled).\n",
        "enum": [
          "ALLOWLIST",
          "WHOLE_DOMAIN"
        ]
      },
      "SenderPolicy": {
        "type": "object",
        "required": [
          "policy",
          "fastOnboarding",
          "fastOnboardingAvailable"
        ],
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/SenderPolicyName"
          },
          "fastOnboarding": {
            "type": "boolean"
          },
          "fastOnboardingAvailable": {
            "type": "boolean",
            "description": "The platform has a shared sending domain configured."
          },
          "fastOnboardingDomain": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SenderPolicyUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/SenderPolicyName"
          },
          "fastOnboarding": {
            "description": "Turns Fast Onboarding on or off: while the tenant's own domain is not verified, mail goes out through the shared platform domain.",
            "type": "boolean"
          }
        }
      },
      "Sender": {
        "type": "object",
        "required": [
          "email",
          "enabled"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "enabled": {
            "type": "boolean"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verified": {
            "type": "boolean"
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verificationExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verificationSentAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verification": {
            "type": "object",
            "required": [
              "status",
              "verified"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "PENDING",
                  "VERIFIED",
                  "EXPIRED"
                ]
              },
              "verified": {
                "type": "boolean"
              },
              "verifiedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "expiresAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "sentAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "sending": {
            "type": "object",
            "required": [
              "mode",
              "fromDomain"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "OWN_DOMAIN",
                  "FAST_ONBOARDING",
                  "UNAVAILABLE"
                ]
              },
              "fromDomain": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "SenderUpdate": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "description": "`false` blocks the sender under any policy. Defaults to `true`.",
            "type": "boolean",
            "default": true
          },
          "displayName": {
            "description": "Display name of the sender (up to 200 characters).",
            "type": "string",
            "maxLength": 200
          },
          "sendVerification": {
            "type": "boolean",
            "description": "Trigger sending a signed mailbox verification e-mail to the real sender address."
          }
        }
      },
      "SenderVerifyResponse": {
        "type": "object",
        "required": [
          "verified",
          "email",
          "tenantRef",
          "verifiedAt"
        ],
        "properties": {
          "verified": {
            "type": "boolean"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "tenantRef": {
            "type": "string"
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verificationExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "EventType": {
        "type": "string",
        "description": "Kind of state change. The same names are used by webhooks.",
        "enum": [
          "message.accepted",
          "message.sent",
          "message.delivered",
          "message.delayed",
          "message.bounced",
          "message.complained",
          "message.opened",
          "message.clicked",
          "message.read",
          "message.mdn_received",
          "evidence.sealed",
          "evidence.expiring",
          "tenant.sending_paused",
          "tenant.sending_resumed",
          "domain.verified",
          "domain.failed",
          "batch.completed"
        ]
      },
      "EvidenceRef": {
        "type": "object",
        "description": "Pointer to a sealed receipt.",
        "required": [
          "type",
          "evidenceId",
          "sha256"
        ],
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ReceiptType"
          },
          "evidenceId": {
            "$ref": "#/components/schemas/EvidenceId"
          },
          "sha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Digest of the signed evidence XML."
          },
          "links": {
            "type": "object",
            "description": "Where to fetch each artifact (authenticated API URLs).",
            "properties": {
              "xml": {
                "type": "string",
                "format": "uri"
              },
              "pdf": {
                "type": "string",
                "format": "uri"
              },
              "eml": {
                "type": "string",
                "format": "uri"
              },
              "asice": {
                "type": "string",
                "format": "uri"
              },
              "verify": {
                "type": "string",
                "format": "uri",
                "description": "Public verification page."
              }
            }
          }
        }
      },
      "Event": {
        "type": "object",
        "description": "One immutable state change. `id` is stable across webhook retries and polling,\nso it can be used to deduplicate; `sequence` orders the events of one message.\n",
        "required": [
          "id",
          "type",
          "apiVersion",
          "occurredAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "type": {
            "$ref": "#/components/schemas/EventType"
          },
          "apiVersion": {
            "type": "string",
            "const": "v1"
          },
          "occurredAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "rcptId": {
            "$ref": "#/components/schemas/RecipientId"
          },
          "sequence": {
            "type": "integer",
            "minimum": 0
          },
          "data": {
            "type": "object",
            "description": "Type-specific details; see the webhook schemas for each shape."
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceRef"
            }
          }
        }
      },
      "EventPage": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "nextCursor": {
            "$ref": "#/components/schemas/Cursor"
          }
        }
      },
      "EvidenceFormat": {
        "type": "string",
        "description": "`xml` the signed evidence, `pdf` its human-readable rendition, `eml` the\nmessage as sent, `asice` the self-verifiable container with all of them.\n",
        "enum": [
          "xml",
          "pdf",
          "eml",
          "asice"
        ]
      },
      "Evidence": {
        "type": "object",
        "required": [
          "evidenceId",
          "type",
          "trackId",
          "rcptId",
          "issuedAt",
          "sha256",
          "trustLevel",
          "status"
        ],
        "properties": {
          "evidenceId": {
            "$ref": "#/components/schemas/EvidenceId"
          },
          "type": {
            "$ref": "#/components/schemas/ReceiptType"
          },
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "rcptId": {
            "$ref": "#/components/schemas/RecipientId"
          },
          "issuedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "sha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Digest of the signed evidence XML."
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          },
          "status": {
            "type": "string",
            "description": "`SEALED` signed and timestamped; `TSA_PENDING` signed, timestamp still to be\nadded; `EXPIRED` custody ended and the artifacts were purged.\n",
            "enum": [
              "SEALED",
              "TSA_PENDING",
              "EXPIRED"
            ]
          },
          "previousEvidenceId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EvidenceId"
              }
            ],
            "description": "Earlier receipt of the same recipient this one refers to."
          },
          "signer": {
            "type": "object",
            "properties": {
              "providerId": {
                "type": "string",
                "examples": [
                  "keystore:dev-default"
                ]
              },
              "kid": {
                "type": "string"
              }
            }
          },
          "timestamp": {
            "type": "object",
            "description": "Present once the evidence carries an RFC 3161 timestamp.",
            "properties": {
              "providerId": {
                "type": "string",
                "examples": [
                  "rfc3161:freetsa"
                ]
              },
              "genTime": {
                "$ref": "#/components/schemas/Timestamp"
              }
            }
          },
          "artifacts": {
            "type": "array",
            "description": "Digests of every artifact, available even after the purge.",
            "items": {
              "type": "object",
              "required": [
                "format",
                "sha256"
              ],
              "properties": {
                "format": {
                  "$ref": "#/components/schemas/EvidenceFormat"
                },
                "sha256": {
                  "$ref": "#/components/schemas/Sha256"
                },
                "bytes": {
                  "type": "integer",
                  "minimum": 0
                },
                "available": {
                  "type": "boolean",
                  "description": "`false` when the artifact is not generated yet (lazy PDF) or was purged."
                }
              }
            }
          },
          "expiresAt": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              }
            ],
            "description": "End of custody. The purge never happens before this instant."
          },
          "legalHold": {
            "type": "boolean"
          },
          "position": {
            "type": "integer",
            "description": "Monotonic 1-based position of this receipt in the recipient's cumulative chain.",
            "minimum": 1
          },
          "receiptKey": {
            "type": "string",
            "description": "Primary receipt key satisfied by this receipt (e.g. `DELIVERY`, `READ#L3`, `OPEN#MDN`)."
          },
          "satisfies": {
            "type": "array",
            "description": "Every receipt key satisfied by this cumulative receipt.",
            "items": {
              "type": "string"
            }
          },
          "covers": {
            "type": "array",
            "description": "Event identifiers newly covered by this receipt (including ledger-only events).",
            "items": {
              "type": "string"
            }
          },
          "coveredSeq": {
            "type": "integer",
            "description": "Highest per-recipient event sequence (`evtSeq`) covered by this receipt.",
            "minimum": 0
          },
          "signed": {
            "type": "boolean",
            "description": "`false` when issued as an unsigned informational record (`constancia sin firma`)."
          },
          "latest": {
            "type": "boolean",
            "description": "`true` when this receipt is the current head of the recipient's cumulative chain."
          },
          "final": {
            "type": "boolean",
            "description": "`true` when the recipient's chain is closed (`CLOSURE` or terminal `FAILURE`)."
          },
          "links": {
            "type": "object",
            "description": "Direct authenticated API links to the artifacts of this receipt.",
            "properties": {
              "xml": {
                "type": "string",
                "format": "uri"
              },
              "pdf": {
                "type": "string",
                "format": "uri"
              },
              "eml": {
                "type": "string",
                "format": "uri"
              },
              "asice": {
                "type": "string",
                "format": "uri"
              },
              "verify": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "EvidenceList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Evidence"
            }
          }
        }
      },
      "MdnId": {
        "type": "string",
        "description": "Identifier of an inbound MDN recorded for a recipient.",
        "minLength": 1,
        "maxLength": 128,
        "pattern": "^[A-Za-z0-9._:-]+$",
        "examples": [
          "mdn_01JD90B2M4X7Q8R9S0T1V2W3X4_r0_01"
        ]
      },
      "MdnRecord": {
        "type": "object",
        "description": "Authenticated inbound Message Disposition Notification (RFC 8098).",
        "required": [
          "mdnId",
          "trackId",
          "rcptId",
          "receivedAt",
          "authStrength",
          "disposition"
        ],
        "properties": {
          "mdnId": {
            "$ref": "#/components/schemas/MdnId"
          },
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "rcptId": {
            "$ref": "#/components/schemas/RecipientId"
          },
          "receivedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "from": {
            "type": "string",
            "format": "email"
          },
          "messageId": {
            "type": "string"
          },
          "sha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Digest of the stored raw MDN `.eml`."
          },
          "bytes": {
            "type": "integer",
            "minimum": 0
          },
          "authStrength": {
            "type": "string",
            "enum": [
              "STRONG",
              "WEAK"
            ]
          },
          "addressMode": {
            "type": "string",
            "enum": [
              "TOKEN",
              "SHARED"
            ]
          },
          "authentication": {
            "type": "object",
            "properties": {
              "spf": {
                "type": "string"
              },
              "dkim": {
                "type": "string"
              },
              "dmarc": {
                "type": "string"
              },
              "alignedDomain": {
                "type": "string"
              },
              "authenticationResultsLiteral": {
                "type": "string"
              }
            }
          },
          "disposition": {
            "type": "object",
            "required": [
              "actionMode",
              "sendingMode",
              "type"
            ],
            "properties": {
              "actionMode": {
                "type": "string",
                "enum": [
                  "manual-action",
                  "automatic-action"
                ]
              },
              "sendingMode": {
                "type": "string",
                "enum": [
                  "MDN-sent-manually",
                  "MDN-sent-automatically"
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "displayed",
                  "deleted",
                  "denied",
                  "processed",
                  "dispatched",
                  "failed"
                ]
              },
              "reportingUa": {
                "type": "string"
              },
              "finalRecipient": {
                "type": "string"
              },
              "originalMessageId": {
                "type": "string"
              }
            }
          },
          "certifiedIn": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EvidenceId"
              }
            ],
            "description": "Receipt that first included this MDN, once sealed."
          },
          "emlUrl": {
            "type": "string",
            "format": "uri",
            "description": "Authenticated API URL (`GET /v1/mdn/{mdnId}/eml`) that redirects to the stored `.eml`."
          }
        }
      },
      "MdnList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdnRecord"
            }
          }
        }
      },
      "LegalHoldRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "description": "Free text recorded in the audit trail.",
            "maxLength": 500
          }
        }
      },
      "EvidenceGone": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "description": "What the verification index still knows about the purged evidence.",
            "properties": {
              "evidenceId": {
                "$ref": "#/components/schemas/EvidenceId"
              },
              "issuedAt": {
                "$ref": "#/components/schemas/Timestamp"
              },
              "purgedAt": {
                "$ref": "#/components/schemas/Timestamp"
              },
              "artifacts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "format",
                    "sha256"
                  ],
                  "properties": {
                    "format": {
                      "$ref": "#/components/schemas/EvidenceFormat"
                    },
                    "sha256": {
                      "$ref": "#/components/schemas/Sha256"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "EmailAddress": {
        "type": "object",
        "required": [
          "email"
        ],
        "additionalProperties": false,
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "name": {
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "InlineAttachment": {
        "type": "object",
        "description": "Attachment carried in the request body (subject to `api.inline.maxBytes`).",
        "required": [
          "filename",
          "contentBase64"
        ],
        "additionalProperties": false,
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "contentBase64": {
            "type": "string",
            "contentEncoding": "base64",
            "minLength": 1
          },
          "mediaType": {
            "type": "string",
            "description": "Guessed from the file name when omitted.",
            "maxLength": 127
          }
        }
      },
      "UploadedAttachment": {
        "type": "object",
        "description": "Attachment uploaded beforehand through `POST /v1/attachments`.",
        "required": [
          "attachmentId"
        ],
        "additionalProperties": false,
        "properties": {
          "attachmentId": {
            "$ref": "#/components/schemas/AttachmentId"
          }
        }
      },
      "MessageOptions": {
        "type": "object",
        "description": "Per-message overrides of the configuration. Each one is resolved against the\ntenant, plan and platform levels and capped by their ceilings; the values really\napplied are returned in `effectiveOptions`.\n",
        "additionalProperties": false,
        "properties": {
          "receipts": {
            "type": "array",
            "description": "Overrides `receipts.types`.",
            "items": {
              "$ref": "#/components/schemas/ReceiptType"
            },
            "uniqueItems": true,
            "minItems": 1
          },
          "retentionDays": {
            "type": "integer",
            "description": "Overrides `retention.evidence.days`.",
            "minimum": 1,
            "maximum": 3650
          },
          "attachmentsDeliveryMode": {
            "type": "string",
            "description": "Overrides `attachments.deliveryMode`. With `HYBRID`, the inline size threshold is the `attachments.hybrid.inlineMaxBytes` setting (plan/tenant), capped by the platform value.",
            "enum": [
              "INLINE",
              "SECURE_LINK",
              "HYBRID"
            ]
          },
          "pdf": {
            "type": "string",
            "description": "Overrides `receipts.pdf.mode`.",
            "enum": [
              "LAZY",
              "EAGER",
              "OFF"
            ]
          },
          "readMinLevel": {
            "type": "string",
            "description": "Overrides `receipts.read.minLevel`.",
            "enum": [
              "L2",
              "L3",
              "L4"
            ]
          },
          "priority": {
            "type": "string",
            "description": "Dispatch lane.",
            "enum": [
              "TRANSACTIONAL",
              "BULK"
            ]
          },
          "emailReceiptsToSender": {
            "type": "boolean",
            "description": "Overrides `receipts.emailToSender`."
          },
          "trackOpens": {
            "type": "boolean",
            "description": "Overrides `tracking.opens`."
          },
          "trackClicks": {
            "type": "boolean",
            "description": "Overrides `tracking.clicks`."
          },
          "requestMdn": {
            "type": "boolean",
            "description": "Overrides `tracking.mdn.request`."
          },
          "portalConfirmation": {
            "type": "string",
            "description": "Overrides `tracking.portal.confirmation`.",
            "enum": [
              "OFF",
              "CLICK",
              "OTP"
            ]
          }
        }
      },
      "EffectiveOptions": {
        "type": "object",
        "description": "Options applied to the message after resolving every configuration level.",
        "required": [
          "receipts",
          "retentionDays",
          "attachmentsDeliveryMode",
          "pdf",
          "readMinLevel",
          "priority",
          "configVersion"
        ],
        "properties": {
          "receipts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptType"
            }
          },
          "retentionDays": {
            "type": "integer",
            "minimum": 1
          },
          "attachmentsDeliveryMode": {
            "type": "string",
            "enum": [
              "INLINE",
              "SECURE_LINK",
              "HYBRID"
            ]
          },
          "pdf": {
            "type": "string",
            "enum": [
              "LAZY",
              "EAGER",
              "OFF"
            ]
          },
          "readMinLevel": {
            "type": "string",
            "enum": [
              "L2",
              "L3",
              "L4"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "TRANSACTIONAL",
              "BULK"
            ]
          },
          "emailReceiptsToSender": {
            "type": "boolean"
          },
          "trackOpens": {
            "type": "boolean"
          },
          "trackClicks": {
            "type": "boolean"
          },
          "requestMdn": {
            "type": "boolean"
          },
          "portalConfirmation": {
            "type": "string",
            "enum": [
              "OFF",
              "CLICK",
              "OTP"
            ]
          },
          "configVersion": {
            "type": "string",
            "description": "Version of the effective configuration the message was processed with."
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          }
        }
      },
      "SubmitMessageRequest": {
        "type": "object",
        "required": [
          "from",
          "to",
          "subject"
        ],
        "additionalProperties": false,
        "anyOf": [
          {
            "required": [
              "html"
            ]
          },
          {
            "required": [
              "text"
            ]
          }
        ],
        "properties": {
          "from": {
            "description": "Sender address. It must be an authorized sender of the tenant, according to the sender policy.",
            "$ref": "#/components/schemas/EmailAddress"
          },
          "to": {
            "type": "array",
            "description": "Each recipient is sent, tracked and certified individually.",
            "items": {
              "$ref": "#/components/schemas/EmailAddress"
            },
            "minItems": 1,
            "maxItems": 50
          },
          "cc": {
            "description": "Recipients in copy, up to 50.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailAddress"
            },
            "maxItems": 50
          },
          "bcc": {
            "type": "array",
            "description": "A blind recipient never appears in the evidence of another recipient.",
            "items": {
              "$ref": "#/components/schemas/EmailAddress"
            },
            "maxItems": 50
          },
          "replyTo": {
            "description": "Address that receives the replies, when it differs from the sender.",
            "$ref": "#/components/schemas/EmailAddress"
          },
          "subject": {
            "description": "Subject of the message (1 to 998 characters, no control characters).",
            "type": "string",
            "minLength": 1,
            "maxLength": 998
          },
          "html": {
            "description": "HTML body. At least one of `html` or `text` is required.",
            "type": "string"
          },
          "text": {
            "description": "Plain-text body. At least one of `html` or `text` is required.",
            "type": "string"
          },
          "attachments": {
            "description": "Attachments of the message, up to 50: inline (`filename` and `contentBase64`) or uploaded beforehand (`attachmentId`).",
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/InlineAttachment"
                },
                {
                  "$ref": "#/components/schemas/UploadedAttachment"
                }
              ]
            },
            "maxItems": 50
          },
          "options": {
            "$ref": "#/components/schemas/MessageOptions"
          },
          "clientTrackId": {
            "type": "string",
            "description": "Caller's own reference; searchable with `GET /v1/messages?clientTrackId=`.",
            "minLength": 1,
            "maxLength": 128
          },
          "metadata": {
            "type": "object",
            "description": "Free key/value pairs echoed back in queries and webhooks.",
            "maxProperties": 20,
            "propertyNames": {
              "maxLength": 64
            },
            "additionalProperties": {
              "type": "string",
              "maxLength": 512
            }
          }
        }
      },
      "RecipientState": {
        "type": "object",
        "required": [
          "rcptId",
          "email",
          "status"
        ],
        "properties": {
          "rcptId": {
            "$ref": "#/components/schemas/RecipientId"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "TO",
              "CC",
              "BCC"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/RecipientStatus"
          },
          "statusAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "readLevel": {
            "$ref": "#/components/schemas/ReadLevel"
          },
          "possibleDuplicate": {
            "type": "boolean",
            "description": "`true` when a dispatch worker died between handing the message to the\nmail service and recording it, so the retry may have sent it twice.\n"
          },
          "failure": {
            "type": "object",
            "description": "Present when the recipient ended in a failure state.",
            "properties": {
              "reason": {
                "type": "string",
                "description": "Machine-readable reason, e.g. `hard_bounce`, `suppressed`, `no_mx`."
              },
              "diagnosticCode": {
                "type": "string",
                "description": "Literal diagnostic returned by the remote server, when there is one."
              }
            }
          },
          "certification": {
            "$ref": "#/components/schemas/RecipientCertification"
          }
        }
      },
      "CertificationState": {
        "type": "string",
        "enum": [
          "NONE",
          "PENDING",
          "SEALED",
          "TSA_PENDING"
        ],
        "description": "Per-recipient certification summary: `NONE` (no receipt issued and no pending trigger),\n`PENDING` (uncovered triggering events awaiting settlement window or seal worker),\n`SEALED` (latest receipt is sealed and no new triggering events are pending), or\n`TSA_PENDING` (latest receipt is signed in `XAdES-BASELINE-B` awaiting RFC 3161 timestamp).\n"
      },
      "CertificationLatestReceipt": {
        "type": "object",
        "required": [
          "evidenceId",
          "type",
          "status",
          "sealedAt"
        ],
        "properties": {
          "evidenceId": {
            "$ref": "#/components/schemas/EvidenceId"
          },
          "type": {
            "$ref": "#/components/schemas/ReceiptType"
          },
          "status": {
            "type": "string",
            "enum": [
              "SEALED",
              "TSA_PENDING",
              "EXPIRED"
            ]
          },
          "sealedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "links": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uri-reference"
            }
          }
        }
      },
      "RecipientCertification": {
        "type": "object",
        "required": [
          "state",
          "pendingEvents"
        ],
        "properties": {
          "state": {
            "$ref": "#/components/schemas/CertificationState"
          },
          "pendingEvents": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of recipient ledger events not yet covered by a sealed receipt."
          },
          "expectedBy": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated ISO-8601 UTC timestamp of the next seal, or `null` when not estimable or nothing is pending."
          },
          "latestReceipt": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CertificationLatestReceipt"
              },
              {
                "type": "null"
              }
            ],
            "description": "Latest issued receipt in the recipient chain, or `null` when none exists yet."
          }
        }
      },
      "SubmitMessageResponse": {
        "type": "object",
        "required": [
          "trackId",
          "acceptedAt",
          "recipients",
          "effectiveOptions"
        ],
        "properties": {
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "clientTrackId": {
            "type": "string"
          },
          "acceptedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientState"
            },
            "minItems": 1
          },
          "effectiveOptions": {
            "$ref": "#/components/schemas/EffectiveOptions"
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "trackId",
          "channel",
          "from",
          "subject",
          "acceptedAt",
          "sequence",
          "recipients",
          "statusSummary"
        ],
        "properties": {
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "clientTrackId": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "API",
              "SMTP_SUFFIX"
            ]
          },
          "from": {
            "$ref": "#/components/schemas/EmailAddress"
          },
          "subject": {
            "type": "string"
          },
          "acceptedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "sequence": {
            "type": "integer",
            "description": "Incremented on every state transition of the message; use it to order events.",
            "minimum": 0
          },
          "statusSummary": {
            "type": "object",
            "description": "Number of recipients currently in each state.",
            "propertyNames": {
              "$ref": "#/components/schemas/RecipientStatus"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 1
            }
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientState"
            }
          },
          "effectiveOptions": {
            "$ref": "#/components/schemas/EffectiveOptions"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "MessageSummary": {
        "type": "object",
        "required": [
          "trackId",
          "acceptedAt",
          "statusSummary"
        ],
        "properties": {
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "clientTrackId": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "acceptedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "statusSummary": {
            "type": "object",
            "propertyNames": {
              "$ref": "#/components/schemas/RecipientStatus"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      },
      "MessagePage": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageSummary"
            }
          },
          "nextCursor": {
            "$ref": "#/components/schemas/Cursor"
          }
        }
      },
      "PortalHandle": {
        "type": "string",
        "description": "Access handle of the link the recipient received. It arrives in the URL fragment of the portal page (never in the query string), so it is never sent to a server by the browser until the page posts it in a JSON body.",
        "pattern": "^[a-z0-9]{1,12}\\.[A-Za-z0-9_-]{8,1000}$"
      },
      "PortalSessionToken": {
        "type": "string",
        "description": "Short-lived session issued by the portal; it only authorizes downloads of the same message.",
        "minLength": 1
      },
      "PortalPerson": {
        "type": "object",
        "description": "Sender of the message.",
        "required": [
          "name",
          "address"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "PortalAttachment": {
        "type": "object",
        "description": "One attachment offered for download.",
        "required": [
          "index",
          "filename",
          "contentType",
          "sizeBytes"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65534,
            "description": "Position of the attachment; it is the value to send as `index` to download it."
          },
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PortalMessage": {
        "type": "object",
        "description": "What the recipient is shown about the message.",
        "required": [
          "subject",
          "sender",
          "attachments"
        ],
        "properties": {
          "subject": {
            "type": "string"
          },
          "sender": {
            "$ref": "#/components/schemas/PortalPerson"
          },
          "sentAt": {
            "description": "When the message was sent; `null` when unknown.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PortalAttachment"
            }
          }
        }
      },
      "PortalHandleRequest": {
        "type": "object",
        "required": [
          "handle"
        ],
        "properties": {
          "handle": {
            "$ref": "#/components/schemas/PortalHandle"
          }
        }
      },
      "PortalOpenResponse": {
        "type": "object",
        "description": "State of the link. `state` is `ready` when no confirmation is required (the message and a session are included), `confirm` when the recipient must click to confirm receipt (the message is included, the session is issued by `/portal/v1/confirm`) and `otp` when a one-time code is required (only a preview is shown until the code is verified).",
        "required": [
          "state",
          "mode",
          "expiresAt"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "confirm",
              "otp"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              false,
              "CLICK",
              "OTP"
            ],
            "description": "Confirmation mode applied to the message (`tracking.portal.confirmation`)."
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "focus": {
            "description": "Attachment the recipient arrived for, when the link points to one; otherwise `null`.",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "$ref": "#/components/schemas/PortalMessage"
          },
          "preview": {
            "type": "object",
            "description": "Present in `otp` mode instead of `message`.",
            "required": [
              "sender",
              "attachmentCount"
            ],
            "properties": {
              "sender": {
                "$ref": "#/components/schemas/PortalPerson"
              },
              "attachmentCount": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "maskedEmail": {
            "description": "Mailbox the code is sent to, partially hidden (`a***@e***.com`); `null` when none is registered.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session": {
            "$ref": "#/components/schemas/PortalSessionToken"
          },
          "sessionExpiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "PortalOtpResponse": {
        "type": "object",
        "required": [
          "sent",
          "maskedEmail"
        ],
        "properties": {
          "sent": {
            "type": "boolean",
            "description": "Always `true`; failures answer with an error."
          },
          "maskedEmail": {
            "type": "string",
            "description": "Mailbox the code was sent to, partially hidden."
          }
        }
      },
      "PortalConfirmRequest": {
        "type": "object",
        "required": [
          "handle"
        ],
        "properties": {
          "handle": {
            "$ref": "#/components/schemas/PortalHandle"
          },
          "acknowledged": {
            "type": "boolean",
            "description": "`true` when the recipient clicked to confirm receipt (`CLICK` mode). Required unless `code` is sent."
          },
          "code": {
            "type": "string",
            "pattern": "^[0-9]{8}$",
            "description": "One-time code e-mailed to the recipient (`OTP` mode)."
          }
        }
      },
      "PortalConfirmResponse": {
        "type": "object",
        "description": "Receipt confirmed (it is recorded as human confirmation, level `L4`) and a confirmed session issued.",
        "required": [
          "state",
          "message",
          "session",
          "sessionExpiresAt"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ready"
            ]
          },
          "message": {
            "$ref": "#/components/schemas/PortalMessage"
          },
          "session": {
            "$ref": "#/components/schemas/PortalSessionToken"
          },
          "sessionExpiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "PortalDownloadRequest": {
        "type": "object",
        "required": [
          "session",
          "index"
        ],
        "properties": {
          "session": {
            "$ref": "#/components/schemas/PortalSessionToken"
          },
          "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65534,
            "description": "`index` of the attachment to download, as listed in `message.attachments`."
          }
        }
      },
      "PortalDownloadResponse": {
        "type": "object",
        "required": [
          "url",
          "expiresAt",
          "filename",
          "sizeBytes",
          "sha256"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Presigned download URL, short-lived."
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "filename": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256"
          }
        }
      },
      "PortalError": {
        "type": "object",
        "description": "Error of the portal. Unlike the tenant API, the portal does not use `application/problem+json`: the body is this neutral object and never carries internal details.",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Stable machine-readable code (the `portal` list of the `x-error-catalog`).",
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "message": {
            "type": "string",
            "description": "Neutral text for the recipient."
          }
        }
      },
      "SettingLevel": {
        "type": "string",
        "description": "Level of the configuration hierarchy, from least to most specific.",
        "enum": [
          "DEFAULT",
          "PLATFORM",
          "PLAN",
          "TENANT",
          "MESSAGE"
        ]
      },
      "SettingValue": {
        "description": "Value of a parameter; its JSON type is given by the catalog entry.",
        "oneOf": [
          {
            "type": "boolean"
          },
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": [
                "string",
                "number"
              ]
            }
          }
        ]
      },
      "SettingDefinition": {
        "type": "object",
        "description": "One entry of the typed catalog. A key that is not in the catalog does not exist.",
        "required": [
          "key",
          "type",
          "default",
          "levels",
          "retroactive",
          "infra"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z][A-Za-z0-9]*(\\.[a-z][A-Za-z0-9]*)+$",
            "examples": [
              "retention.evidence.days"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "boolean",
              "integer",
              "number",
              "string",
              "enum",
              "list",
              "duration"
            ]
          },
          "unit": {
            "type": "string",
            "examples": [
              "days"
            ]
          },
          "default": {
            "$ref": "#/components/schemas/SettingValue"
          },
          "minimum": {
            "type": "number"
          },
          "maximum": {
            "type": "number"
          },
          "allowedValues": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "levels": {
            "type": "array",
            "description": "Levels at which the parameter can be overridden.",
            "items": {
              "$ref": "#/components/schemas/SettingLevel"
            },
            "uniqueItems": true
          },
          "retroactive": {
            "type": "boolean",
            "description": "Whether a change applies to what already exists."
          },
          "infra": {
            "type": "boolean",
            "description": "`true` when changing it requires an infrastructure deployment."
          },
          "description": {
            "type": "string"
          }
        }
      },
      "SettingsCatalog": {
        "type": "object",
        "required": [
          "catalogVersion",
          "items"
        ],
        "properties": {
          "catalogVersion": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SettingDefinition"
            }
          }
        }
      },
      "SettingsOverrides": {
        "type": "object",
        "description": "Map of catalog key to value. Unknown keys are rejected.",
        "propertyNames": {
          "pattern": "^[a-z][A-Za-z0-9]*(\\.[a-z][A-Za-z0-9]*)+$"
        },
        "additionalProperties": {
          "$ref": "#/components/schemas/SettingValue"
        },
        "examples": [
          {
            "retention.evidence.days": 365,
            "receipts.read.minLevel": "L4"
          }
        ]
      },
      "UpdateSettingsRequest": {
        "type": "object",
        "required": [
          "settings"
        ],
        "additionalProperties": false,
        "properties": {
          "settings": {
            "$ref": "#/components/schemas/SettingsOverrides"
          },
          "expectedVersion": {
            "type": "integer",
            "description": "Optimistic lock; the update fails with `409` if the current version differs.",
            "minimum": 0
          },
          "comment": {
            "description": "Reason for the change, recorded in the settings history (up to 500 characters).",
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "SettingsDocument": {
        "type": "object",
        "required": [
          "version",
          "settings",
          "updatedAt"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "settings": {
            "$ref": "#/components/schemas/SettingsOverrides"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedBy": {
            "type": "string"
          },
          "comment": {
            "type": "string"
          },
          "effective": {
            "type": "object",
            "description": "Present with `effective=true`. Resolved value of every catalog key.",
            "additionalProperties": {
              "type": "object",
              "required": [
                "value",
                "source"
              ],
              "properties": {
                "value": {
                  "$ref": "#/components/schemas/SettingValue"
                },
                "source": {
                  "$ref": "#/components/schemas/SettingLevel"
                },
                "ceiling": {
                  "type": "object",
                  "description": "Present when a higher level capped the value.",
                  "required": [
                    "value",
                    "source"
                  ],
                  "properties": {
                    "value": {
                      "$ref": "#/components/schemas/SettingValue"
                    },
                    "source": {
                      "$ref": "#/components/schemas/SettingLevel"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "SettingsHistoryPage": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SettingsDocument"
            }
          },
          "nextCursor": {
            "$ref": "#/components/schemas/Cursor"
          }
        }
      },
      "SuppressionEntry": {
        "type": "object",
        "required": [
          "emailSha256",
          "scope",
          "reason",
          "createdAt"
        ],
        "properties": {
          "emailSha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Digest of the lowercased address."
          },
          "scope": {
            "type": "string",
            "enum": [
              "TENANT",
              "GLOBAL"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "HARD_BOUNCE",
              "SOFT_BOUNCE",
              "COMPLAINT",
              "MANUAL"
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "expiresAt": {
            "description": "Null when the entry does not expire.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "SuppressionList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SuppressionEntry"
            }
          },
          "nextCursor": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Cursor"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AddSuppressionRequest": {
        "type": "object",
        "required": [
          "email"
        ],
        "additionalProperties": false,
        "properties": {
          "email": {
            "description": "Address to suppress. It is stored as a SHA-256 digest of the lowercased address.",
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "ttlDays": {
            "type": "integer",
            "description": "Lifetime of the entry; omitted means no expiry.",
            "minimum": 1,
            "maximum": 3650
          }
        }
      },
      "VerifyTrackArtifact": {
        "type": "object",
        "required": [
          "format",
          "sha256"
        ],
        "properties": {
          "format": {
            "$ref": "#/components/schemas/EvidenceFormat"
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256"
          },
          "sizeBytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "available": {
            "type": "boolean"
          }
        }
      },
      "VerifyTrackEvidence": {
        "type": "object",
        "required": [
          "evidenceId",
          "type",
          "issuedAt",
          "status",
          "trustLevel",
          "sha256",
          "artifacts"
        ],
        "properties": {
          "evidenceId": {
            "$ref": "#/components/schemas/EvidenceId"
          },
          "type": {
            "$ref": "#/components/schemas/ReceiptType"
          },
          "issuedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "status": {
            "type": "string",
            "description": "`SEALED` signed and timestamped; `TSA_PENDING` signed, timestamp still to be\nadded; `EXPIRED` custody ended and the artifacts were purged.\n",
            "enum": [
              "SEALED",
              "TSA_PENDING",
              "EXPIRED"
            ]
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          },
          "sha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Digest of the signed evidence XML."
          },
          "artifacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VerifyTrackArtifact"
            }
          },
          "recipientId": {
            "$ref": "#/components/schemas/RecipientId"
          },
          "timestamp": {
            "type": "object",
            "required": [
              "providerId",
              "genTime"
            ],
            "properties": {
              "providerId": {
                "type": "string"
              },
              "genTime": {
                "$ref": "#/components/schemas/Timestamp"
              }
            }
          },
          "signer": {
            "type": "object",
            "required": [
              "providerId",
              "kid"
            ],
            "properties": {
              "providerId": {
                "type": "string"
              },
              "kid": {
                "type": "string"
              }
            }
          },
          "previousEvidence": {
            "type": "object",
            "required": [
              "evidenceId",
              "sha256"
            ],
            "properties": {
              "evidenceId": {
                "$ref": "#/components/schemas/EvidenceId"
              },
              "sha256": {
                "$ref": "#/components/schemas/Sha256"
              }
            }
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "VerifyTrackResponse": {
        "type": "object",
        "description": "Public verification status and digests for a tracked message.",
        "required": [
          "trackId",
          "detailGranted",
          "evidence"
        ],
        "properties": {
          "trackId": {
            "$ref": "#/components/schemas/TrackId"
          },
          "detailGranted": {
            "type": "boolean"
          },
          "evidence": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VerifyTrackEvidence"
            }
          }
        }
      },
      "VerifyHashRequest": {
        "type": "object",
        "required": [
          "sha256"
        ],
        "additionalProperties": false,
        "properties": {
          "sha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Digest computed by the client; the file itself never leaves the device."
          }
        }
      },
      "HashMatch": {
        "type": "object",
        "required": [
          "evidenceId",
          "type",
          "issuedAt",
          "artifact",
          "trustLevel",
          "custody"
        ],
        "properties": {
          "evidenceId": {
            "$ref": "#/components/schemas/EvidenceId"
          },
          "type": {
            "$ref": "#/components/schemas/ReceiptType"
          },
          "issuedAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "artifact": {
            "type": "string",
            "description": "Which artifact of the evidence has this digest.",
            "enum": [
              "xml",
              "pdf",
              "eml",
              "asice",
              "attachment",
              "original_eml"
            ]
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          },
          "timestamp": {
            "type": "object",
            "properties": {
              "providerId": {
                "type": "string"
              },
              "genTime": {
                "$ref": "#/components/schemas/Timestamp"
              }
            }
          },
          "custody": {
            "type": "string",
            "description": "`HELD` while the platform keeps the artifacts, `PURGED` when only the digest index remains.",
            "enum": [
              "HELD",
              "PURGED"
            ]
          }
        }
      },
      "VerifyHashResponse": {
        "type": "object",
        "description": "No personal data is returned, whatever the result.",
        "required": [
          "match",
          "matches"
        ],
        "properties": {
          "match": {
            "type": "boolean"
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HashMatch"
            }
          }
        }
      },
      "VerifyContainerIssue": {
        "type": "object",
        "required": [
          "code",
          "entry",
          "detail"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "entry": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "VerifyContainerResponse": {
        "type": "object",
        "required": [
          "result",
          "trustLevel",
          "checks"
        ],
        "properties": {
          "result": {
            "type": "string",
            "description": "Overall indication, as in ETSI TS 119 102-1.",
            "enum": [
              "TOTAL_PASSED",
              "INDETERMINATE",
              "TOTAL_FAILED"
            ]
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          },
          "evidenceId": {
            "$ref": "#/components/schemas/EvidenceId"
          },
          "checks": {
            "type": "object",
            "required": [
              "structure",
              "signature",
              "certificateChain",
              "timestamp",
              "inclusionProof",
              "index"
            ],
            "properties": {
              "structure": {
                "$ref": "#/components/schemas/VerifyCheck"
              },
              "signature": {
                "$ref": "#/components/schemas/VerifyCheck"
              },
              "certificateChain": {
                "$ref": "#/components/schemas/VerifyCheck"
              },
              "timestamp": {
                "$ref": "#/components/schemas/VerifyCheck"
              },
              "inclusionProof": {
                "$ref": "#/components/schemas/VerifyCheck"
              },
              "index": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/VerifyCheck"
                  }
                ],
                "description": "Whether the digests match what the platform issued."
              }
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VerifyContainerIssue"
            }
          },
          "report": {
            "type": "object",
            "description": "Where to fetch the full ETSI TS 119 102-2 validation report.",
            "properties": {
              "mediaType": {
                "type": "string",
                "const": "application/xml"
              },
              "contentBase64": {
                "type": "string",
                "contentEncoding": "base64"
              }
            }
          }
        }
      },
      "VerifyCheck": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PASSED",
              "FAILED",
              "NOT_APPLICABLE",
              "INDETERMINATE"
            ]
          },
          "detail": {
            "type": "string",
            "maxLength": 300
          }
        }
      },
      "WebhookDelivery": {
        "type": "object",
        "description": "One attempt chain of an event towards a tenant endpoint.",
        "required": [
          "deliveryId",
          "endpointId",
          "eventId",
          "eventType",
          "status",
          "attempts"
        ],
        "properties": {
          "deliveryId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "endpointId": {
            "type": "string"
          },
          "eventId": {
            "type": "string",
            "description": "Sent as `webhook-id`; stable across retries and replays."
          },
          "eventType": {
            "$ref": "#/components/schemas/EventType"
          },
          "status": {
            "type": "string",
            "description": "`PENDING` waiting or retrying, `DELIVERED` acknowledged with 2xx, `FAILED`\nretries exhausted (can be replayed), `PARKED` endpoint suspended by its\ncircuit breaker.\n",
            "enum": [
              "PENDING",
              "DELIVERED",
              "FAILED",
              "PARKED"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "lastAttemptAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "lastResponseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "nextAttemptAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "description": "A tenant webhook subscription. Secret values are never part of it.",
        "required": [
          "endpointId",
          "url",
          "events",
          "status",
          "consecutiveFailures",
          "secrets"
        ],
        "properties": {
          "endpointId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "description": {
            "type": "string",
            "maxLength": 200
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "status": {
            "type": "string",
            "description": "`ACTIVE` receives events, `DISABLED` was switched off by the tenant, `SUSPENDED`\nwas paused by the circuit breaker after repeated failures; deliveries are parked and\nthe endpoint is probed until it answers.\n",
            "enum": [
              "ACTIVE",
              "SUSPENDED",
              "DISABLED"
            ]
          },
          "consecutiveFailures": {
            "type": "integer",
            "minimum": 0
          },
          "secrets": {
            "type": "array",
            "description": "Metadata of the signing secrets that exist; the oldest ones are retiring.",
            "items": {
              "$ref": "#/components/schemas/WebhookSecretInfo"
            }
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "WebhookSecretInfo": {
        "type": "object",
        "required": [
          "secretId",
          "createdAt"
        ],
        "properties": {
          "secretId": {
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "WebhookEndpointWithSecret": {
        "description": "The endpoint plus the signing secret, shown only once.",
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookEndpoint"
          },
          {
            "type": "object",
            "required": [
              "secretId",
              "secret"
            ],
            "properties": {
              "secretId": {
                "type": "string"
              },
              "secret": {
                "type": "string",
                "description": "Signing secret (`whsec_` + base64), the key of the Standard Webhooks\n`webhook-signature` HMAC-SHA256. It cannot be retrieved later.\n"
              }
            }
          }
        ]
      },
      "CreateWebhookEndpointRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "Public `https` URL without credentials."
          },
          "events": {
            "description": "Event types the endpoint subscribes to; at least one.",
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "description": {
            "description": "Free-text description of the endpoint (up to 200 characters).",
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "UpdateWebhookEndpointRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "url": {
            "description": "New public `https` URL; it is checked again like at registration.",
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "events": {
            "description": "New list of subscribed event types; at least one.",
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "`null` clears it."
          },
          "status": {
            "description": "`ACTIVE` or `DISABLED`. `SUSPENDED` is set only by the platform.",
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED"
            ]
          }
        }
      },
      "WebhookTestResult": {
        "type": "object",
        "required": [
          "success",
          "latencyMs"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "description": "`true` when the endpoint answered 2xx."
          },
          "responseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "latencyMs": {
            "type": "integer",
            "minimum": 0
          },
          "error": {
            "type": "string",
            "description": "Why it failed: `http_<status>`, `timeout`, `connection`, `tls`, `url_blocked`,\n`dns_resolution_failed` or `no_active_secret`.\n"
          },
          "webhookId": {
            "type": "string",
            "description": "Sent as `webhook-id` of the test event."
          }
        }
      }
    },
    "parameters": {
      "BatchIdPath": {
        "description": "Identifier of the batch.",
        "name": "batchId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/BatchId"
        }
      },
      "TrackIdPath": {
        "name": "trackId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/TrackId"
        }
      },
      "RecipientIdPath": {
        "name": "rcptId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/RecipientId"
        }
      },
      "EvidenceIdPath": {
        "description": "Identifier of the receipt (`evidenceId`).",
        "name": "evidenceId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/EvidenceId"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Client-generated key, scoped to the tenant. Repeating a request with the same\nkey and the same body returns the original response with\n`Idempotent-Replayed: true`; the same key with a different body is rejected\nwith `422 idempotency_key_reused`.\n",
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9._:-]+$"
        },
        "example": "9f1c2e7a-5b1d-4c3e-9a77-1f2e3d4c5b6a"
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "schema": {
          "$ref": "#/components/schemas/Cursor"
        }
      },
      "Limit": {
        "description": "Maximum number of items per page, from 1 to 200 (default 50).",
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200,
          "default": 50
        }
      },
      "DomainPath": {
        "description": "Domain name registered by the tenant, for example `example.com`.",
        "name": "domain",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 253
        }
      },
      "SenderEmailPath": {
        "name": "email",
        "in": "path",
        "required": true,
        "description": "Sender address, percent-encoded.",
        "schema": {
          "type": "string",
          "format": "email"
        }
      },
      "SenderVerificationTokenQuery": {
        "name": "token",
        "in": "query",
        "required": true,
        "description": "Signed HMAC verification token delivered to the sender's mailbox.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        }
      },
      "KeyIdPath": {
        "description": "Identifier of the API key (the `keyId` part of its token).",
        "name": "keyId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9-]{1,62}$"
        }
      },
      "MdnIdPath": {
        "name": "mdnId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/MdnId"
        }
      },
      "TenantIdPath": {
        "description": "Identifier of the tenant.",
        "name": "tenantId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
        }
      },
      "PlanIdPath": {
        "description": "Identifier of the plan.",
        "name": "planId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
        }
      },
      "VerifyCodeQuery": {
        "name": "code",
        "in": "query",
        "required": false,
        "description": "Verification code printed on a receipt. Case-insensitive; spaces and dashes are ignored.",
        "schema": {
          "type": "string",
          "minLength": 4,
          "maxLength": 64
        }
      },
      "DeliveryIdPath": {
        "description": "Identifier of the webhook delivery.",
        "name": "deliveryId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "EndpointIdPath": {
        "description": "Identifier of the webhook endpoint.",
        "name": "endpointId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    "headers": {
      "IdempotentReplayed": {
        "description": "Present and `true` when the response is a replay of an earlier request.",
        "schema": {
          "type": "boolean"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request is malformed. The body is not valid JSON or not a JSON object, a field is invalid (`errors` lists each one), a header or query parameter is invalid, or the `Content-Type` is not `application/json` where a JSON body is expected (`unsupported_media` on the control plane).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The API key is not allowed to perform this operation.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "NotFound": {
        "description": "The resource does not exist or belongs to another tenant.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "The request is well formed but cannot be accepted.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limit or quota exceeded.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InternalError": {
        "description": "Unexpected failure (`internal_error`). The request may be retried; keep the `requestId` when contacting support.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in `Retry-After` when present.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "The body exceeds the allowed size (`payload_too_large`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "UnsupportedMediaType": {
        "description": "The `Content-Type` is not supported (`unsupported_media_type`); send `application/json`.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "IdempotencyInProgress": {
        "description": "A request with the same `Idempotency-Key` is still being processed (`idempotency_request_in_progress`). Retry after the number of seconds in `Retry-After`.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ControlPlaneConflict": {
        "description": "The request conflicts with the current state (duplicate, claimed domain, last key).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "BadGateway": {
        "description": "SES rejected the operation (`ses_error`) or is unavailable (`ses_unavailable`, 503 with `Retry-After`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PortalBadRequest": {
        "description": "The body is missing, malformed or lacks a required field, or the confirmation or the code is not valid.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalForbidden": {
        "description": "The request is cross-origin (`cross_origin`), the code is wrong (`invalid_code`) or receipt must be confirmed first (`confirmation_required`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalNotFound": {
        "description": "The handle, the session or the attachment is forged, malformed or unknown; every case answers the same.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalConflict": {
        "description": "The operation does not apply to this message (`otp_unavailable` or `confirmation_not_required`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalGone": {
        "description": "The access period of the link or session has ended (`expired`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalPayloadTooLarge": {
        "description": "The body exceeds the allowed size (`body_too_large`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalUnsupportedMedia": {
        "description": "The `Content-Type` is not `application/json` (`unsupported_media_type`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalRateLimited": {
        "description": "Too many requests from this address or for this recipient (`rate_limited`).",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalUnavailable": {
        "description": "A dependency is temporarily unavailable (`unavailable`), or the visit could not be recorded; nothing was confirmed. Retry after `Retry-After` seconds.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalInternalError": {
        "description": "Unexpected failure (`internal_error`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "SettingsConflict": {
        "description": "`expectedVersion` does not match the current version.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "VerifyInvalidCode": {
        "description": "The verification code does not match any receipt of this message.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "VerifyNotFound": {
        "description": "No evidence was found for the given tracking identifier.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      }
    },
    "examples": {
      "SubmitMessageRequest": {
        "summary": "Message with one inline and one uploaded attachment",
        "value": {
          "from": {
            "email": "notificaciones@acme.com",
            "name": "ACME Legal"
          },
          "to": [
            {
              "email": "juan@empresa.com"
            }
          ],
          "subject": "Notificación de mora",
          "html": "<p>Adjuntamos el estado de su obligación.</p>",
          "text": "Adjuntamos el estado de su obligación.",
          "attachments": [
            {
              "filename": "contrato.pdf",
              "contentBase64": "JVBERi0xLjQK"
            },
            {
              "attachmentId": "att_01JD90B2M4X7Q8R9S0T1V2W3X4"
            }
          ],
          "options": {
            "receipts": [
              "DELIVERY",
              "READ",
              "FAILURE"
            ],
            "retentionDays": 30,
            "attachmentsDeliveryMode": "INLINE",
            "pdf": "LAZY",
            "readMinLevel": "L3",
            "priority": "TRANSACTIONAL"
          },
          "clientTrackId": "COB-2026-000123",
          "metadata": {
            "expediente": "2026-00123"
          }
        }
      },
      "SubmitMessageResponse": {
        "summary": "Accepted; the plan ceiling capped the requested retention",
        "value": {
          "trackId": "01JD90B2M4X7Q8R9S0T1V2W3X4",
          "clientTrackId": "COB-2026-000123",
          "acceptedAt": "2026-03-02T15:04:05Z",
          "recipients": [
            {
              "rcptId": "r0",
              "email": "juan@empresa.com",
              "role": "TO",
              "status": "ACCEPTED"
            }
          ],
          "effectiveOptions": {
            "receipts": [
              "DELIVERY",
              "READ",
              "FAILURE"
            ],
            "retentionDays": 30,
            "attachmentsDeliveryMode": "INLINE",
            "pdf": "LAZY",
            "readMinLevel": "L3",
            "priority": "TRANSACTIONAL",
            "configVersion": "v7",
            "trustLevel": "TEST"
          }
        }
      }
    }
  },
  "x-error-catalog": {
    "problems": [
      {
        "code": "bad_request",
        "status": 400,
        "description": "The request is malformed."
      },
      {
        "code": "invalid_request",
        "status": 400,
        "description": "The body is not a JSON object or a required structure is missing."
      },
      {
        "code": "invalid_json",
        "status": 400,
        "description": "The body is not valid JSON."
      },
      {
        "code": "invalid_body",
        "status": 400,
        "description": "The body is malformed (not a JSON object, not valid Base64 or not readable)."
      },
      {
        "code": "missing_body",
        "status": 400,
        "description": "The request has no body, or the message has neither `html` nor `text`."
      },
      {
        "code": "body_too_large",
        "status": 400,
        "description": "The body of a public verification request exceeds the allowed size."
      },
      {
        "code": "validation_error",
        "status": 400,
        "description": "The body failed validation; `errors` lists each offending field."
      },
      {
        "code": "validation_failed",
        "status": 422,
        "description": "The body is well formed but a field is not acceptable; `errors` lists each offending field."
      },
      {
        "code": "unprocessable_entity",
        "status": 422,
        "description": "The request is well formed but cannot be accepted."
      },
      {
        "code": "unsupported_media",
        "status": 400,
        "description": "The `Content-Type` is not `application/json` (control plane)."
      },
      {
        "code": "unsupported_media_type",
        "status": 415,
        "description": "The `Content-Type` is not supported; send `application/json` (or `application/vnd.etsi.asic-e+zip` for containers)."
      },
      {
        "code": "payload_too_large",
        "status": 413,
        "description": "The body exceeds the allowed size."
      },
      {
        "code": "unauthorized",
        "status": 401,
        "description": "The request carries no valid authorization context (missing or invalid API key)."
      },
      {
        "code": "forbidden",
        "status": 403,
        "description": "The credential is not allowed to perform the operation."
      },
      {
        "code": "insufficient_scope",
        "status": 403,
        "description": "The API key does not hold any of the scopes the operation requires (`x-cem-scopes`)."
      },
      {
        "code": "scope_missing",
        "status": 403,
        "description": "The credential lacks the scope the operation requires (for administration, `platform:admin`)."
      },
      {
        "code": "not_found",
        "status": 404,
        "description": "The resource does not exist or belongs to another tenant."
      },
      {
        "code": "route_not_found",
        "status": 404,
        "description": "The route is not served by the API."
      },
      {
        "code": "method_not_allowed",
        "status": 405,
        "description": "The HTTP method is not allowed for the route; `Allow` lists the valid ones."
      },
      {
        "code": "conflict",
        "status": 409,
        "description": "The request conflicts with the current state."
      },
      {
        "code": "rate_limit_exceeded",
        "status": 429,
        "description": "The tenant exceeded its request rate; retry after `Retry-After` seconds."
      },
      {
        "code": "rate_limited",
        "status": 429,
        "description": "The public verifier rate limit was exceeded; retry after `Retry-After` seconds."
      },
      {
        "code": "internal_error",
        "status": 500,
        "description": "Unexpected failure; keep the `requestId`."
      },
      {
        "code": "service_unavailable",
        "status": 503,
        "description": "A dependency is temporarily unavailable; retry after `Retry-After` seconds when present."
      },
      {
        "code": "invalid_query_parameter",
        "status": 400,
        "description": "A query parameter is invalid; `errors` names it."
      },
      {
        "code": "invalid_query",
        "status": 400,
        "description": "The query parameters of a batch request are invalid."
      },
      {
        "code": "invalid_limit",
        "status": 400,
        "description": "`limit` is outside the allowed range."
      },
      {
        "code": "invalid_cursor",
        "status": 400,
        "description": "The `cursor` is not valid; do not build or modify cursors."
      },
      {
        "code": "invalid_precondition",
        "status": 400,
        "description": "`If-Match` is not an `ETag` returned by this API."
      },
      {
        "code": "invalid_identifier",
        "status": 400,
        "description": "An identifier in the path or the body is malformed."
      },
      {
        "code": "missing_idempotency_key",
        "status": 400,
        "description": "The `Idempotency-Key` header is required on this `POST`."
      },
      {
        "code": "idempotency_key_required",
        "status": 400,
        "description": "The `Idempotency-Key` header is required to register a webhook endpoint."
      },
      {
        "code": "invalid_idempotency_key",
        "status": 400,
        "description": "The `Idempotency-Key` does not match the allowed format."
      },
      {
        "code": "idempotency_key_reused",
        "status": 422,
        "description": "The `Idempotency-Key` was already used with a different request body."
      },
      {
        "code": "idempotency_request_in_progress",
        "status": 409,
        "description": "A request with the same `Idempotency-Key` is still being processed; retry after `Retry-After` seconds."
      },
      {
        "code": "invalid_message_options",
        "status": 400,
        "description": "The per-message `options` are invalid."
      },
      {
        "code": "message_too_large",
        "status": 413,
        "description": "The message exceeds `api.message.maxBytes`."
      },
      {
        "code": "inline_attachments_too_large",
        "status": 413,
        "description": "The inline attachments exceed `api.inline.maxBytes`."
      },
      {
        "code": "too_many_recipients",
        "status": 422,
        "description": "The total of recipients exceeds `api.recipients.max`."
      },
      {
        "code": "too_many_metadata_entries",
        "status": 422,
        "description": "The message has more `metadata` entries than allowed (one slot is reserved under Fast Onboarding)."
      },
      {
        "code": "attachment_not_found",
        "status": 422,
        "description": "A referenced `attachmentId` does not exist or belongs to another tenant."
      },
      {
        "code": "attachment_mismatch",
        "status": 422,
        "description": "The uploaded file does not match the size or the SHA-256 reserved for it."
      },
      {
        "code": "sender_not_authorized",
        "status": 403,
        "description": "The sender address is disabled or not allowed for the tenant under its sender policy."
      },
      {
        "code": "sender_not_verified",
        "status": 403,
        "description": "The sender mailbox is not verified (Fast Onboarding); `verificationSent` tells whether a verification e-mail was just sent."
      },
      {
        "code": "domain_not_verified",
        "status": 403,
        "description": "The domain of the sender is not verified and active for the tenant."
      },
      {
        "code": "domain_not_owned",
        "status": 403,
        "description": "The domain of the sender belongs to another account."
      },
      {
        "code": "message_not_found",
        "status": 404,
        "description": "The message does not exist or belongs to another tenant."
      },
      {
        "code": "recipient_not_found",
        "status": 404,
        "description": "The recipient does not exist in the message."
      },
      {
        "code": "evidence_not_found",
        "status": 404,
        "description": "The receipt does not exist or belongs to another tenant."
      },
      {
        "code": "mdn_not_found",
        "status": 404,
        "description": "The inbound MDN does not exist or belongs to another tenant."
      },
      {
        "code": "artifact_not_found",
        "status": 404,
        "description": "The artifact is not stored for the receipt."
      },
      {
        "code": "invalid_evidence_format",
        "status": 400,
        "description": "`format` is not one of `xml`, `pdf`, `eml` or `asice`."
      },
      {
        "code": "artifact_not_available",
        "status": 422,
        "description": "The requested artifact cannot be produced for this receipt (for example, the container is disabled by configuration)."
      },
      {
        "code": "evidence_purged",
        "status": 410,
        "description": "Custody ended and the artifacts were purged; the body keeps the digests."
      },
      {
        "code": "render_unavailable",
        "status": 503,
        "description": "The renderer or its keys are temporarily unavailable; retry after `Retry-After` seconds."
      },
      {
        "code": "storage_unavailable",
        "status": 503,
        "description": "Evidence storage is temporarily unavailable; retry after `Retry-After` seconds."
      },
      {
        "code": "evidence_key_missing",
        "status": 500,
        "description": "The location of the signed XML of the receipt is not recorded."
      },
      {
        "code": "legal_hold_disabled",
        "status": 403,
        "description": "The plan of the tenant does not allow legal holds."
      },
      {
        "code": "invalid_track_id",
        "status": 400,
        "description": "`trackId` is malformed."
      },
      {
        "code": "invalid_code_format",
        "status": 400,
        "description": "The verification code is malformed."
      },
      {
        "code": "invalid_verification_code",
        "status": 403,
        "description": "The verification code does not match any receipt of the message."
      },
      {
        "code": "invalid_sha256",
        "status": 400,
        "description": "`sha256` is not 64 hexadecimal characters."
      },
      {
        "code": "verification_unavailable",
        "status": 503,
        "description": "The receipt keyring cannot be read; no detail is granted (fail closed). Try again later."
      },
      {
        "code": "container_too_large",
        "status": 413,
        "description": "The container exceeds the allowed size."
      },
      {
        "code": "not_asic_container",
        "status": 415,
        "description": "The payload is not a ZIP archive (ASiC-E container)."
      },
      {
        "code": "corrupt_container",
        "status": 400,
        "description": "The container is corrupt."
      },
      {
        "code": "container_limits",
        "status": 400,
        "description": "The container exceeds the size or entry limits."
      },
      {
        "code": "duplicate_entry",
        "status": 400,
        "description": "The container has duplicate entries."
      },
      {
        "code": "unsafe_entry",
        "status": 400,
        "description": "The container has an entry with an unsafe name."
      },
      {
        "code": "unsupported_compression",
        "status": 400,
        "description": "The container uses encryption or an unsupported compression."
      },
      {
        "code": "zip_bomb",
        "status": 400,
        "description": "The compression ratio of the container is excessive."
      },
      {
        "code": "invalid_batch_request",
        "status": 400,
        "description": "The request to create the batch is invalid; `errors` lists the fields."
      },
      {
        "code": "manifest_too_large",
        "status": 413,
        "description": "The declared manifest exceeds the allowed size; split it into several batches."
      },
      {
        "code": "manifest_not_uploaded",
        "status": 422,
        "description": "The manifest has not been uploaded yet."
      },
      {
        "code": "manifest_mismatch",
        "status": 422,
        "description": "The uploaded manifest does not match the declared size and SHA-256."
      },
      {
        "code": "batch_not_found",
        "status": 404,
        "description": "The batch does not exist or belongs to another tenant."
      },
      {
        "code": "batch_not_startable",
        "status": 409,
        "description": "The batch is finished and cannot be started."
      },
      {
        "code": "batch_not_cancelable",
        "status": 409,
        "description": "The batch is finished and cannot be canceled."
      },
      {
        "code": "batch_store_error",
        "status": 503,
        "description": "The batch store failed temporarily."
      },
      {
        "code": "batch_throttled",
        "status": 503,
        "description": "The row outcomes could not be written (throttled); retry."
      },
      {
        "code": "workflow_start_error",
        "status": 503,
        "description": "The processing workflow could not be started; retry."
      },
      {
        "code": "workflow_stop_error",
        "status": 503,
        "description": "The processing workflow could not be stopped; retry."
      },
      {
        "code": "invalid_events",
        "status": 400,
        "description": "`events` must be a non-empty array of event types."
      },
      {
        "code": "invalid_url",
        "status": 400,
        "description": "`url` is missing or too long."
      },
      {
        "code": "invalid_description",
        "status": 400,
        "description": "`description` is not a string of the allowed length."
      },
      {
        "code": "invalid_status",
        "status": 400,
        "description": "`status` must be `ACTIVE` or `DISABLED`."
      },
      {
        "code": "url_blocked",
        "status": 422,
        "description": "The URL is not allowed (not `https`, credentials in the URL or a non-public address)."
      },
      {
        "code": "url_unresolvable",
        "status": 422,
        "description": "The host of the URL does not resolve."
      },
      {
        "code": "endpoint_limit_reached",
        "status": 422,
        "description": "The tenant reached `webhooks.maxEndpoints`."
      },
      {
        "code": "concurrent_update",
        "status": 409,
        "description": "The endpoint changed concurrently; retry."
      },
      {
        "code": "suppression_not_found",
        "status": 404,
        "description": "The suppression entry does not exist for the tenant."
      },
      {
        "code": "quota_store_error",
        "status": 503,
        "description": "The quota counters could not be updated temporarily."
      },
      {
        "code": "platform_admin_required",
        "status": 403,
        "description": "Only platform administrators can do this."
      },
      {
        "code": "tenant_mismatch",
        "status": 403,
        "description": "A tenant credential can only access the settings of its own tenant."
      },
      {
        "code": "tenant_not_active",
        "status": 403,
        "description": "The tenant is not active; its settings cannot be changed."
      },
      {
        "code": "plan_exists",
        "status": 409,
        "description": "The plan already exists."
      },
      {
        "code": "plans_read_only",
        "status": 501,
        "description": "This deployment has no plan store; plans are read-only."
      },
      {
        "code": "settings_rejected",
        "status": 422,
        "description": "The settings were rejected by the catalog validation (type, range, ceiling or infrastructure parameter)."
      },
      {
        "code": "settings_conflict",
        "status": 409,
        "description": "`expectedVersion` or `If-Match` does not match the current version."
      },
      {
        "code": "plan_not_found",
        "status": 404,
        "description": "The plan does not exist."
      },
      {
        "code": "tenant_exists",
        "status": 409,
        "description": "The tenant already exists."
      },
      {
        "code": "tenant_not_found",
        "status": 404,
        "description": "The tenant does not exist."
      },
      {
        "code": "tenant_deleted",
        "status": 409,
        "description": "The tenant is deleted; a deleted tenant cannot be restored."
      },
      {
        "code": "tenant_conflict",
        "status": 409,
        "description": "The tenant changed concurrently; retry."
      },
      {
        "code": "tenant_inactive",
        "status": 403,
        "description": "The tenant is not active."
      },
      {
        "code": "invalid_domain",
        "status": 422,
        "description": "The domain name is not valid."
      },
      {
        "code": "reserved_domain",
        "status": 422,
        "description": "Platform domains cannot be registered by a tenant."
      },
      {
        "code": "domain_exists",
        "status": 409,
        "description": "The domain is already registered by the tenant."
      },
      {
        "code": "domain_claimed",
        "status": 409,
        "description": "The domain is already registered by another account."
      },
      {
        "code": "domain_conflict",
        "status": 409,
        "description": "The domain changed concurrently; retry."
      },
      {
        "code": "domain_limit_reached",
        "status": 422,
        "description": "The tenant reached its domain limit."
      },
      {
        "code": "domain_not_found",
        "status": 404,
        "description": "The domain is not registered by the tenant."
      },
      {
        "code": "domain_not_registered",
        "status": 422,
        "description": "Register the domain before authorizing its senders."
      },
      {
        "code": "ses_error",
        "status": 502,
        "description": "The mail service rejected the operation."
      },
      {
        "code": "ses_unavailable",
        "status": 503,
        "description": "The mail service is temporarily unavailable; retry after `Retry-After` seconds."
      },
      {
        "code": "whole_domain_requires_verified_domain",
        "status": 422,
        "description": "`WHOLE_DOMAIN` needs at least one verified (`ACTIVE`) domain."
      },
      {
        "code": "fast_onboarding_unavailable",
        "status": 422,
        "description": "Fast Onboarding is not configured on this platform."
      },
      {
        "code": "invalid_sender",
        "status": 422,
        "description": "The sender is not a valid e-mail address."
      },
      {
        "code": "sender_not_found",
        "status": 404,
        "description": "The sender is not registered."
      },
      {
        "code": "sender_disabled",
        "status": 403,
        "description": "The sender address is disabled."
      },
      {
        "code": "sender_limit_reached",
        "status": 422,
        "description": "The tenant reached its sender limit."
      },
      {
        "code": "invalid_verification_token",
        "status": 400,
        "description": "The sender verification token is missing or invalid."
      },
      {
        "code": "verification_token_expired",
        "status": 403,
        "description": "The sender verification link has expired."
      },
      {
        "code": "api_key_not_found",
        "status": 404,
        "description": "The API key does not exist."
      },
      {
        "code": "api_key_inactive",
        "status": 409,
        "description": "The key is already revoked or expired."
      },
      {
        "code": "api_key_limit_reached",
        "status": 422,
        "description": "The tenant reached its active API key limit."
      },
      {
        "code": "last_active_key",
        "status": 409,
        "description": "The last active API key cannot be revoked; rotate it instead."
      },
      {
        "code": "invalid_environment",
        "status": 400,
        "description": "`environment` must be `live` or `test`."
      },
      {
        "code": "invalid_grace",
        "status": 422,
        "description": "`graceDays` is outside the allowed range."
      },
      {
        "code": "invalid_expiry",
        "status": 422,
        "description": "`expiresAt` must be in the future."
      },
      {
        "code": "unknown_scope",
        "status": 422,
        "description": "The request names a scope that does not exist."
      },
      {
        "code": "scope_not_grantable",
        "status": 403,
        "description": "The scope cannot be granted through the API (`platform:admin` is provisioned out of band) or exceeds what the issuing key holds."
      }
    ],
    "fields": [
      {
        "code": "required",
        "description": "A required property is missing."
      },
      {
        "code": "invalid",
        "description": "The value is not valid."
      },
      {
        "code": "invalid_value",
        "description": "The value is outside the accepted values."
      },
      {
        "code": "invalid_type",
        "description": "The value has the wrong JSON type."
      },
      {
        "code": "unknown_field",
        "description": "The property is not part of the contract (requests are strict)."
      },
      {
        "code": "unknown_property",
        "description": "The property is not part of the contract (requests are strict)."
      },
      {
        "code": "out_of_range",
        "description": "A number or a list length is outside the allowed range."
      },
      {
        "code": "too_long",
        "description": "The text exceeds the allowed length."
      },
      {
        "code": "invalid_timestamp",
        "description": "The value is not an RFC 3339 instant."
      },
      {
        "code": "invalid_identifier",
        "description": "The value is not a valid identifier."
      },
      {
        "code": "invalid_integer",
        "description": "The value is not an integer."
      },
      {
        "code": "invalid_range",
        "description": "The range is inverted (`from` must be earlier than `to`)."
      },
      {
        "code": "invalid_enum",
        "description": "The value is not one of the allowed values."
      },
      {
        "code": "invalid_email_address",
        "description": "The value is not a valid e-mail address."
      },
      {
        "code": "invalid_email",
        "description": "The address is not a valid e-mail address."
      },
      {
        "code": "invalid_digest",
        "description": "The SHA-256 digest is malformed."
      },
      {
        "code": "invalid_base64",
        "description": "The `contentBase64` value is empty or not valid Base64."
      },
      {
        "code": "invalid_filename",
        "description": "The file name is not valid (1 to 255 characters)."
      },
      {
        "code": "invalid_media_type",
        "description": "The media type is not valid."
      },
      {
        "code": "invalid_subject",
        "description": "The subject is not valid (1 to 998 characters, no control characters)."
      },
      {
        "code": "invalid_client_track_id",
        "description": "`clientTrackId` must be 1 to 128 characters without control characters."
      },
      {
        "code": "invalid_metadata_key",
        "description": "Metadata keys must be 1 to 64 characters."
      },
      {
        "code": "invalid_metadata_value",
        "description": "Metadata values must be strings of up to 512 characters."
      },
      {
        "code": "ambiguous_attachment",
        "description": "An attachment must be either inline or uploaded, not both."
      },
      {
        "code": "above_maximum",
        "description": "The setting value is above the maximum of the catalog."
      },
      {
        "code": "below_minimum",
        "description": "The setting value is below the minimum of the catalog."
      },
      {
        "code": "pattern_mismatch",
        "description": "The setting value does not match the required pattern."
      },
      {
        "code": "empty_string",
        "description": "The setting value must not be empty."
      },
      {
        "code": "empty_item",
        "description": "A list item of the setting is empty."
      },
      {
        "code": "duplicate_list_item",
        "description": "The setting list has a repeated item."
      },
      {
        "code": "invalid_list_item",
        "description": "A list item of the setting is not valid."
      },
      {
        "code": "too_few_items",
        "description": "The setting list has fewer items than allowed."
      },
      {
        "code": "too_many_items",
        "description": "The setting list has more items than allowed."
      },
      {
        "code": "invalid_duration",
        "description": "The setting value is not a valid duration."
      },
      {
        "code": "non_finite",
        "description": "The setting value is not a finite number."
      }
    ],
    "portal": [
      {
        "code": "not_found",
        "status": 404,
        "description": "The link or session is forged, malformed or unknown; every case answers the same."
      },
      {
        "code": "expired",
        "status": 410,
        "description": "The access period of the link or session has ended."
      },
      {
        "code": "cross_origin",
        "status": 403,
        "description": "The request does not come from the portal origin."
      },
      {
        "code": "method_not_allowed",
        "status": 405,
        "description": "Only `POST` is accepted."
      },
      {
        "code": "unsupported_media_type",
        "status": 415,
        "description": "The `Content-Type` must be `application/json`."
      },
      {
        "code": "body_too_large",
        "status": 413,
        "description": "The body exceeds the allowed size."
      },
      {
        "code": "missing_body",
        "status": 400,
        "description": "A JSON body is required."
      },
      {
        "code": "invalid_body",
        "status": 400,
        "description": "The body is malformed or a required field (`handle`, `session`, `index`) is missing or invalid."
      },
      {
        "code": "invalid_json",
        "status": 400,
        "description": "The body is not valid JSON."
      },
      {
        "code": "not_acknowledged",
        "status": 400,
        "description": "Explicit confirmation is required (`acknowledged: true`)."
      },
      {
        "code": "invalid_code",
        "status": 400,
        "description": "The code is not made of 8 digits."
      },
      {
        "code": "invalid_code",
        "status": 403,
        "description": "The code is wrong or has expired; request a new one."
      },
      {
        "code": "otp_not_required",
        "status": 400,
        "description": "This message does not use a one-time code."
      },
      {
        "code": "otp_unavailable",
        "status": 409,
        "description": "A code cannot be sent for this message (no registered address or mail service)."
      },
      {
        "code": "confirmation_not_required",
        "status": 409,
        "description": "The message does not require confirmation."
      },
      {
        "code": "confirmation_required",
        "status": 403,
        "description": "Confirm receipt before downloading."
      },
      {
        "code": "rate_limited",
        "status": 429,
        "description": "Too many requests; retry after `Retry-After` seconds."
      },
      {
        "code": "unavailable",
        "status": 503,
        "description": "Temporarily unavailable; retry after `Retry-After` seconds."
      },
      {
        "code": "internal_error",
        "status": 500,
        "description": "Unexpected failure."
      }
    ]
  }
}
