{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "API de la plataforma CEM",
    "version": "0.1.0",
    "summary": "Correo electrónico certificado: envío, seguimiento y evidencia.",
    "description": "API HTTP pública de la plataforma CEM.\n\nConvenciones:\n\n* Todo endpoint del tenant se autentica con una clave de API enviada como bearer token.\n* Todo `POST` que crea un recurso exige la cabecera `Idempotency-Key`.\n* Los errores usan `application/problem+json` (RFC 9457) con un `code` estable y legible por máquina.\n* Las listas se paginan con un `cursor` opaco; una respuesta sin `nextCursor` es la última página.\n* Las marcas de tiempo siguen RFC 3339 en UTC. Los resúmenes SHA-256 van en hexadecimal minúscula.\n* Los clientes deben ignorar las propiedades de respuesta que no conozcan; las nuevas\n  propiedades opcionales no constituyen un cambio incompatible.\n",
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.{domain}",
      "description": "API del tenant",
      "variables": {
        "domain": {
          "default": "miplataforma.com"
        }
      }
    },
    {
      "url": "http://127.0.0.1:{port}",
      "description": "Pila local",
      "variables": {
        "port": {
          "default": "8080"
        }
      }
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Messages",
      "x-displayName": "Mensajes",
      "description": "Envíe mensajes certificados y consulte su estado."
    },
    {
      "name": "Attachments",
      "x-displayName": "Adjuntos",
      "description": "Suba adjuntos grandes antes de enviar un mensaje."
    },
    {
      "name": "Events",
      "x-displayName": "Eventos",
      "description": "Cambios de estado, por mensaje o como un feed de sondeo."
    },
    {
      "name": "Evidence",
      "x-displayName": "Evidencia",
      "description": "Acuses sellados y sus artefactos."
    },
    {
      "name": "Settings",
      "x-displayName": "Configuración",
      "description": "Catálogo de configuración y sobrescrituras por nivel."
    },
    {
      "name": "Webhooks",
      "x-displayName": "Webhooks",
      "description": "Entrega de eventos a los endpoints del tenant."
    },
    {
      "name": "Suppressions",
      "x-displayName": "Supresiones",
      "description": "Direcciones a las que la plataforma no enviará correo."
    },
    {
      "name": "Batches",
      "x-displayName": "Lotes",
      "description": "Envío masivo a partir de un manifiesto cargado."
    },
    {
      "name": "Verification",
      "x-displayName": "Verificación",
      "description": "Verificación pública, sin autenticación, de la evidencia."
    },
    {
      "name": "Portal",
      "x-displayName": "Portal del destinatario",
      "description": "API pública del portal de contenido seguro que usan los destinatarios de adjuntos `SECURE_LINK`: vista previa, confirmación de recepción y descargas prefirmadas. Se sirve en el host del portal, acepta solo solicitudes `POST` del mismo origen con cuerpo JSON y responde los errores como `{error, message}`."
    }
  ],
  "paths": {
    "/v1/api-keys": {
      "get": {
        "operationId": "listApiKeys",
        "tags": [
          "Settings"
        ],
        "summary": "Listar las claves de API del tenant",
        "description": "Solo metadatos; nunca se devuelven secretos ni hashes.",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "Las claves.",
            "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": "Emitir una clave de API",
        "description": "El secreto y el `token` completo aparecen únicamente en esta respuesta; la plataforma solo almacena\nun SHA-256 del secreto. Una clave nunca puede tener alcances (scopes) que su emisor no posea, y\n`platform:admin` jamás se concede a través de la API.\n",
        "x-cem-owner-wp": "70",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "La clave con su secreto.",
            "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": "Rotar una clave de API",
        "description": "Emite una clave de reemplazo con la misma etiqueta, los mismos alcances y la misma vigencia, y retira la clave anterior:\nde inmediato, o transcurridos `graceDays` días para que los clientes cambien sin interrupción.\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": "Días que la clave anterior sigue funcionando después de emitida su reemplazo (0 a 30). Con `0` se retira de inmediato.",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 30,
                    "default": 0
                  },
                  "environment": {
                    "description": "Entorno del token de reemplazo: `live` o `test`.",
                    "type": "string",
                    "enum": [
                      "live",
                      "test"
                    ],
                    "default": "live"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "La nueva clave; `rotatedFrom` indica la anterior.",
            "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": "Revocar una clave de API",
        "description": "Idempotente. La última clave activa de un tenant no se puede revocar (`409 last_active_key`); en su lugar, rótela.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/KeyIdPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Revocada."
          },
          "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": "Reservar un adjunto y obtener una carga prefirmada",
        "description": "Para adjuntos que no caben en línea. Suba el archivo con la solicitud\ndevuelta y luego referencie `attachmentId` en `POST /v1/messages`. Las cargas sin usar\nse eliminan transcurridos `retention.staging.days` días.\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": "Carga reservada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAttachmentResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "description": "Supera `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": "Registrar un lote y obtener la carga del manifiesto",
        "description": "Reserva un lote y devuelve una solicitud prefirmada para cargar el manifiesto\n(CSV o JSONL). Cárguelo y luego invoque `POST /v1/batches/{batchId}/start`.\nCada fila sigue el mismo flujo que `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": "Repetición de una solicitud anterior con la misma `Idempotency-Key`.",
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateBatchResponse"
                }
              }
            }
          },
          "201": {
            "description": "Lote creado.",
            "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": "Manifiesto más grande que el tamaño permitido (`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": "Iniciar el procesamiento de un manifiesto cargado",
        "description": "Verifica que el manifiesto cargado coincida con el tamaño y el SHA-256 declarados e\ninicia el procesamiento. Iniciar un lote que ya está en ejecución responde `200`.\n",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Ya está en ejecución.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "202": {
            "description": "Procesamiento iniciado.",
            "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": "El lote ya terminó (`batch_not_startable`).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Manifiesto ausente o distinto de lo declarado (`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": "Cancelar un lote",
        "description": "Detiene la ejecución; ninguna fila se procesa después de registrada la cancelación.\nCancelar un lote ya cancelado responde `200`.\n",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Ya estaba cancelado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "202": {
            "description": "Cancelado.",
            "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": "El lote ya terminó (`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": "Consultar el estado y el avance de un lote",
        "description": "Estado, contadores y avance. Cuando el lote ha terminado, `downloads`\ntrae enlaces prefirmados al reporte y a las filas rechazadas.\n",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El lote.",
            "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": "Listar el resultado de cada fila",
        "description": "Filas en el orden del manifiesto, con paginación por cursor.",
        "x-cem-owner-wp": "73",
        "parameters": [
          {
            "$ref": "#/components/parameters/BatchIdPath"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Solo las filas con este resultado.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCEPTED",
                "REJECTED"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "name": "limit",
            "description": "Número máximo de filas por página, de 1 a 1000 (por defecto 100).",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de filas.",
            "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": "Registrar un dominio de envío",
        "description": "Crea la identidad de SES (Easy DKIM RSA-2048, MAIL FROM personalizado `bounce.{domain}`), la asocia al\ntenant de SES y al conjunto de configuración del tenant, y devuelve los registros DNS exactos que deben publicarse.\nEl dominio permanece en `PENDING` hasta que SES verifica DKIM (consulta automática, máximo 72 horas),\nluego pasa a `ACTIVE`, o a `FAILED` con un diagnóstico. Un dominio `FAILED` o eliminado se puede\nregistrar de nuevo. El registro no es idempotente: una segunda llamada responde `409 domain_exists`.\n",
        "x-cem-owner-wp": "70",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainRegistration"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "El dominio con su asistente de DNS.",
            "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": "Listar los dominios del tenant",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "Todos los dominios registrados con su estado.",
            "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": "Consultar un dominio con sus registros DNS y su estado",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El dominio.",
            "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": "Elegir si publicará los registros opcionales SPF y DMARC",
        "description": "Con `publishSpfDmarc: true`, los registros opcionales `SPF` y `DMARC` también se comprueban en el\nDNS público (en esta llamada y en cada verificación) y se reportan con advertencias; con `false` (el\nvalor por defecto) ni se comprueban ni se exigen. Nunca cambia el estado del dominio: solo\nDKIM condiciona el paso a `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": "El dominio con su asistente de DNS actualizado.",
            "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": "Eliminar un dominio",
        "description": "Elimina la identidad de SES y retira el dominio; deja de poder usarse para enviar.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Eliminado."
          },
          "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": "Comprobar los registros DNS ahora",
        "description": "Consulta a SES el estado actual de DKIM y de MAIL FROM y actualiza el dominio. Se puede repetir sin riesgo.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El dominio después de la comprobación.",
            "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": "Listar los eventos de un mensaje",
        "description": "Del más antiguo al más reciente.",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "name": "rcpt",
            "in": "query",
            "description": "Solo los eventos de este destinatario.",
            "schema": {
              "$ref": "#/components/schemas/RecipientId"
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag de una respuesta anterior; si coincide, se responde `304` sin cuerpo.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de eventos.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventPage"
                }
              }
            }
          },
          "304": {
            "description": "Sin cambios desde el ETag enviado en `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": "Sondear los eventos del tenant",
        "description": "Feed de conciliación: todo evento que el tenant recibiría por webhook, en un\norden estable. Almacene el último `nextCursor` y páselo como `after`. Ningún cambio de estado\ndepende únicamente de los webhooks.\n",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "Cursor devuelto por la llamada anterior; omítalo para comenzar desde el evento retenido más antiguo.",
            "schema": {
              "$ref": "#/components/schemas/Cursor"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Eventos posteriores al cursor. Una página vacía conserva el mismo cursor.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `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": "Listar los acuses sellados de un mensaje",
        "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 de una respuesta anterior; si coincide, se responde `304` sin cuerpo.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Acuses con sus resúmenes. Se conservan después de la purga, cuando `status` es `EXPIRED`.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceList"
                }
              }
            }
          },
          "304": {
            "description": "Sin cambios desde el ETag enviado en `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": "Consultar o descargar el último acuse acumulativo de un destinatario",
        "description": "Endpoint principal de evidencia para un destinatario. Sin `format`, devuelve la representación\nJSON del acuse de cabecera vigente (`chainHeadEvidenceId`), con los enlaces a los\nartefactos y la posición en la cadena. Con `?format=asice|xml|pdf|eml`, redirige\n(`302`) a una URL prefirmada de corta vida (o responde `202` con `Retry-After`\nmientras se genera el contenedor o el PDF diferido). El último contenedor ASiC-E\nincluye el XML raíz acumulativo junto con el XML de cada acuse anterior en\n`previous/` (y el PDF acumulativo cuando `receipts.pdf.mode` es `EAGER`).\n",
        "x-cem-owner-wp": "98",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/RecipientIdPath"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Si se indica, redirige (`302`) a una URL de descarga prefirmada de este formato de artefacto en lugar de devolver JSON.",
            "schema": {
              "$ref": "#/components/schemas/EvidenceFormat"
            }
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag de una respuesta anterior; si coincide, se responde `304` sin cuerpo.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metadatos, enlaces y posición en la cadena del último acuse acumulativo.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Evidence"
                }
              }
            }
          },
          "202": {
            "description": "El artefacto solicitado (`format`) se está generando o espera su sello de tiempo.\nReintente transcurridos los segundos indicados en `Retry-After`.\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": "Redirección al artefacto solicitado (`format`).",
            "headers": {
              "Location": {
                "description": "URL prefirmada de corta vida (`CEM_PRESIGNED_URL_TTL_SECONDS`, 300 s por defecto).",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "Cache-Control": {
                "description": "Siempre `no-store`.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "304": {
            "description": "Sin cambios desde el ETag enviado en `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": "La custodia terminó; solo quedan los resúmenes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "422": {
            "description": "El formato de artefacto solicitado no se puede producir para este acuse.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "El almacenamiento o el renderizador no está disponible temporalmente; puede venir `Retry-After`.",
            "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": "Listar la cadena de acuses acumulativos de un destinatario",
        "description": "Devuelve todos los acuses del destinatario ordenados por `position`, con\n`receiptKey`, resúmenes, `covers`, `coveredSeq` y `latest` (`true` en la cabeza\nvigente de la cadena). Al descargar `GET /v1/evidence/{evidenceId}/asice` de un acuse\nanterior ya reemplazado, su contenedor se regenera bajo demanda a partir de los XML bloqueados.\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 de una respuesta anterior; si coincide, se responde `304` sin cuerpo.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cadena ordenada de acuses del destinatario.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceList"
                }
              }
            }
          },
          "304": {
            "description": "Sin cambios desde el ETag enviado en `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": "Listar los MDN entrantes registrados para un destinatario",
        "description": "Devuelve las Message Disposition Notifications (RFC 8098) autenticadas recibidas\npara el destinatario, con la fortaleza de autenticación (`STRONG` o `WEAK`) y los\nmetadatos de la disposición. El `.eml` original se descarga con `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 de una respuesta anterior; si coincide, se responde `304` sin cuerpo.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "MDN entrantes registrados para el destinatario.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MdnList"
                }
              }
            }
          },
          "304": {
            "description": "Sin cambios desde el ETag enviado en `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": "Descargar el .eml original de un MDN entrante",
        "description": "Redirige (`302`) a una URL prefirmada de corta vida del `.eml` almacenado de una\nMessage Disposition Notification entrante. Responde `410` una vez transcurrido el\nperíodo de retención.\n",
        "x-cem-owner-wp": "98",
        "parameters": [
          {
            "$ref": "#/components/parameters/MdnIdPath"
          }
        ],
        "responses": {
          "302": {
            "description": "Redirección al `.eml` original del MDN.",
            "headers": {
              "Location": {
                "description": "URL prefirmada de corta vida (`CEM_PRESIGNED_URL_TTL_SECONDS`, 300 s por defecto).",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "Cache-Control": {
                "description": "Siempre `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": "La custodia terminó; solo quedan los resúmenes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "El almacenamiento de evidencia no está disponible temporalmente; puede venir `Retry-After`.",
            "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": "Descargar un artefacto de un acuse",
        "description": "Redirige a una URL prefirmada de corta vida. Un PDF diferido (y el contenedor ASiC-E\nque lo incluye) se genera en la primera solicitud: la llamada espera un tiempo acotado a\nque termine el renderizado y, si no está listo, responde `202` con `Retry-After`; repita la\nllamada transcurridos esos segundos. Un contenedor ASiC-E de un acuse cuyo sello de tiempo\naún está pendiente también responde `202`. Pasado el período de retención, los artefactos ya no existen\npero sus resúmenes se siguen devolviendo en el cuerpo del `410` y en\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": "Redirección al artefacto.",
            "headers": {
              "Location": {
                "description": "URL prefirmada de corta vida (`CEM_PRESIGNED_URL_TTL_SECONDS`, 300 s por defecto).",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "Cache-Control": {
                "description": "Siempre `no-store`.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "202": {
            "description": "El artefacto se está generando (o espera su sello de tiempo). Reintente transcurridos\nlos segundos indicados en `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`: el renderizado está en curso; `TSA_PENDING`: aún falta agregar el sello de tiempo.",
                      "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": "La custodia terminó; solo quedan los resúmenes.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "422": {
            "description": "El artefacto no se puede producir para este acuse (por ejemplo, el contenedor está deshabilitado por configuración).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "El almacenamiento o el renderizador no está disponible temporalmente; puede venir `Retry-After`.",
            "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": "Conservar un acuse más allá de su período de retención",
        "description": "Aplica una retención legal (legal hold) a todos los artefactos del acuse. La purga lo omite hasta\nque se libere la retención. Requiere `retention.legalHold.enabled`: cuando el plan del\ntenant la deshabilita, la llamada responde `403`. Es idempotente: repetirla responde `200` con\nel estado vigente; un nuevo `reason` reemplaza al registrado.\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": "La retención está aplicada.",
            "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": "Ya fue purgado.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "El libro mayor o la bóveda no está disponible temporalmente; puede venir `Retry-After`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-cem-scopes": [
          "evidence:write"
        ]
      },
      "delete": {
        "operationId": "releaseLegalHold",
        "tags": [
          "Evidence"
        ],
        "summary": "Liberar la retención legal de un acuse",
        "description": "Elimina la retención legal de todos los artefactos del acuse; la purga se reanuda en el\n`expiresAt` normal. Liberar está permitido incluso si `retention.legalHold.enabled` se\ndesactivó después. Es idempotente: liberar un acuse sin retención responde `200`.\n",
        "x-cem-owner-wp": "37",
        "parameters": [
          {
            "$ref": "#/components/parameters/EvidenceIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El acuse no tiene retención legal.",
            "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": "Ya fue purgado.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceGone"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "description": "El libro mayor o la bóveda no está disponible temporalmente; puede venir `Retry-After`.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-cem-scopes": [
          "evidence:write"
        ]
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "submitMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Enviar un mensaje certificado",
        "description": "Acepta un mensaje para entrega certificada. No se envía nada antes de que la solicitud quede\nregistrada de forma durable, de modo que un `202` significa que el mensaje se procesará exactamente una vez.\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": "Aceptado para entrega.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitMessageResponse"
                },
                "examples": {
                  "default": {
                    "$ref": "#/components/examples/SubmitMessageResponse"
                  }
                }
              }
            }
          },
          "200": {
            "description": "Repetición de una solicitud ya aceptada con la misma `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": "El mensaje supera `api.inline.maxBytes` o `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": "Listar los mensajes del tenant",
        "description": "Del más reciente al más antiguo. Combine `from`/`to` con `status`, o busque por `clientTrackId`.",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "name": "clientTrackId",
            "description": "Solo el mensaje enviado con este `clientTrackId` (hasta 128 caracteres).",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Aceptados en este instante o después.",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Aceptados antes de este instante.",
            "schema": {
              "$ref": "#/components/schemas/Timestamp"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Solo los mensajes con al menos un destinatario en este estado.",
            "schema": {
              "$ref": "#/components/schemas/RecipientStatus"
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag de una respuesta anterior; si coincide, se responde `304` sin cuerpo.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de mensajes.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagePage"
                }
              }
            }
          },
          "304": {
            "description": "Sin cambios desde el ETag enviado en `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": "Consultar un mensaje y el estado de cada destinatario",
        "description": "Devuelve los metadatos del mensaje, el estado de entrega e interacción por destinatario y el resumen\n`certification` de cada destinatario (`state`, `pendingEvents`, `expectedBy`,\n`latestReceipt`). El `ETag` cambia cada vez que cambia cualquier campo de la representación, incluido\n`certification`; envíe `If-None-Match` para recibir `304 Not Modified` cuando no hay cambios.\n",
        "x-cem-owner-wp": "41",
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "description": "ETag de una respuesta anterior; si coincide, se responde `304` sin cuerpo.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "El mensaje.",
            "headers": {
              "ETag": {
                "description": "Validador de esta representación, para `If-None-Match`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          },
          "304": {
            "description": "Sin cambios desde el ETag enviado en `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": "Abrir un enlace seguro y describir el mensaje",
        "description": "Público. Lo invoca la página del portal con el handle que leyó del fragmento de la URL. Todavía no\nse entrega nada: la respuesta indica si el destinatario debe confirmar la recepción (`CLICK`) o\ningresar un código enviado por correo (`OTP`) antes de poder descargar los adjuntos. En modo `OTP`\nsolo se revelan el remitente y el número de archivos. Las solicitudes deben provenir del origen del portal.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalHandleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Estado del enlace.",
            "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": "Enviar por correo el código de un solo uso al destinatario",
        "description": "Público. Solo para enlaces en modo `OTP`. Envía un código de 8 dígitos, válido por unos minutos, al\nbuzón registrado para el destinatario. El código tiene límite de frecuencia por dirección y por destinatario.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalHandleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Código enviado.",
            "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": "Confirmar la recepción y abrir una sesión de descarga",
        "description": "Público. Registra la confirmación explícita de recepción (una confirmación humana `L4` en la\nevidencia) y devuelve una sesión de corta vida. En modo `CLICK` envíe `acknowledged: true`; en modo\n`OTP` envíe el `code`. Si la confirmación no se puede registrar, la solicitud falla\n(`503`) para que no se pierda evidencia.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalConfirmRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recepción confirmada; la sesión puede descargar.",
            "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": "Obtener una descarga prefirmada de un adjunto",
        "description": "Público. Con una sesión confirmada (o cualquier sesión cuando no se exige confirmación),\nregistra la descarga junto con el SHA-256 del archivo y devuelve una URL prefirmada de corta vida.\nLa página solo sigue URL cuyo host esté en su lista de permitidos.\n",
        "x-cem-owner-wp": "64",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalDownloadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Descarga prefirmada.",
            "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": "Consultar la política de remitentes y el interruptor de Fast Onboarding",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "La política vigente (`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": "Cambiar la política de remitentes y/o Fast Onboarding",
        "description": "Escribe sobrescrituras a nivel de tenant (aparecen en el historial de configuración). `WHOLE_DOMAIN` requiere al\nmenos un dominio `ACTIVE`. Fast Onboarding envía a través del dominio compartido de la plataforma, con la\ndirección original en `Reply-To`, mientras el dominio propio del tenant no está verificado.\n",
        "x-cem-owner-wp": "70",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SenderPolicyUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "La política después del cambio.",
            "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": "Listar los remitentes autorizados",
        "x-cem-owner-wp": "70",
        "responses": {
          "200": {
            "description": "Los remitentes y la política vigente.",
            "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": "Consultar un remitente y su estado de verificación",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/SenderEmailPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El remitente, con `verification.status` (PENDING, VERIFIED o 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": "Autorizar o actualizar una dirección de remitente",
        "description": "La dirección debe pertenecer a un dominio registrado por el tenant (o, con Fast Onboarding, a un\ndominio que nadie más posea). Un cuerpo vacío autoriza al remitente; `enabled: false` lo bloquea\nbajo cualquier política. Con Fast Onboarding, se envía un enlace firmado de un solo uso para verificar el buzón\na la dirección real (o se reenvía mediante `sendVerification: true`). `201` cuando se crea, `200` cuando se actualiza.\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": "Actualizado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sender"
                }
              }
            }
          },
          "201": {
            "description": "Creado.",
            "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": "Eliminar una dirección de remitente",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/SenderEmailPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Eliminado."
          },
          "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": "Confirmar la propiedad del buzón para Fast Onboarding",
        "description": "Público. Valida el token firmado enviado al correo electrónico real del remitente y marca como verificado\nel registro de remitente del tenant (`SENDER#`) con su vencimiento configurado.\n",
        "x-cem-owner-wp": "70",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/SenderVerificationTokenQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Buzón verificado correctamente.",
            "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": "Consultar el catálogo de parámetros",
        "description": "Tipos, rangos, valores por defecto y los niveles en los que se puede sobrescribir cada parámetro, filtrados\nsegún lo que el invocador puede ver: las credenciales de tenant no ven los parámetros de infraestructura.\nCada elemento indica en qué niveles puede editar este invocador a través de la API (`editableLevels`;\nvacío significa solo lectura, por ejemplo los parámetros de nivel plataforma para un tenant), de modo que una consola pueda reflejar\nlas reglas de validación sin codificarlas de forma fija.\n",
        "x-cem-owner-wp": "42",
        "responses": {
          "200": {
            "description": "El catálogo.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/SettingsCatalog"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "caller": {
                          "type": "object",
                          "description": "A quién corresponde la credencial.",
                          "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": "Primer segmento de la clave, usado para agrupar los parámetros."
                              },
                              "editableLevels": {
                                "type": "array",
                                "items": {
                                  "$ref": "#/components/schemas/SettingLevel"
                                }
                              },
                              "readOnly": {
                                "type": "boolean"
                              },
                              "messageOverridable": {
                                "type": "boolean",
                                "description": "El valor establecido a nivel de tenant es el valor por defecto de la opción a nivel de mensaje."
                              },
                              "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": "Consultar la configuración de un tenant",
        "description": "Una credencial de tenant solo puede leer su propio tenant; un administrador de la plataforma, cualquiera.\nCon `effective=true` se devuelve cada clave visible con su valor resuelto, el nivel\nque lo estableció, la explicación (`reason`), el valor solicitado originalmente y, cuando un techo\nde un nivel superior lo limitó, qué nivel lo impuso. El `ETag` es la versión de la configuración.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "name": "effective",
            "in": "query",
            "description": "Devuelve además el valor resuelto de cada clave y el nivel del que proviene.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sobrescrituras a nivel de tenant y, si se solicita, los valores efectivos.",
            "headers": {
              "ETag": {
                "description": "Entity tag fuerte de la versión de la configuración, por ejemplo `\"v3\"`. Envíelo como `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": "Niveles que contribuyeron, desde DEFAULT hacia arriba.",
                                "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": "Reemplazar las sobrescrituras a nivel de tenant",
        "description": "Se valida contra el catálogo y los techos del plan y de la plataforma.\nCrea una nueva versión auditada (autor, fecha, comentario). No es retroactivo salvo que el catálogo\nlo indique. Los parámetros de infraestructura se rechazan (`infra_parameter`).\nConcurrencia optimista: envíe `expectedVersion` en el cuerpo o el `ETag` de una lectura previa\ncomo `If-Match`; una discrepancia responde `409` con el `ETag` vigente. Cuando están ambos, deben\ncoincidir.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "description": "`ETag` de la versión que se reemplaza, por ejemplo `\"v3\"`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Nueva versión almacenada, con los valores resueltos y lo que cambió.",
            "headers": {
              "ETag": {
                "description": "Entity tag fuerte de la nueva versión.",
                "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": "Diferencia de valor anterior a nuevo respecto de la versión previa.",
                          "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": "Listar las versiones de la configuración del tenant",
        "description": "Del más reciente al más antiguo. Cada versión indica quién la cambió (`updatedBy`), cuándo (`updatedAt`), el\nmotivo (`comment`) y la diferencia de valor anterior a nuevo respecto de la versión previa (`changes`).\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de versiones.",
            "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": "Listar los planes comerciales",
        "description": "Solo administradores de la plataforma (alcance `platform:admin`). Lista los planes configurados en el\ndespliegue (`source: config`, solo lectura) y los creados mediante esta API\n(`source: api`).\n",
        "x-cem-owner-wp": "42",
        "responses": {
          "200": {
            "description": "Los planes con la versión de su configuración.",
            "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": "Crear un plan comercial",
        "description": "Solo administradores de la plataforma. Almacena el plan en la tabla de configuración; los planes configurados\nen el despliegue conservan sus identificadores reservados. Un plan nuevo no tiene sobrescrituras hasta que se\nescribe su configuración; se pueden crear tenants en él o trasladarlos a él de inmediato.\n",
        "x-cem-owner-wp": "42",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "planId",
                  "name"
                ],
                "additionalProperties": false,
                "properties": {
                  "planId": {
                    "description": "Identificador del nuevo plan: letras minúsculas, dígitos y guiones.",
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "name": {
                    "description": "Nombre visible del plan (1 a 100 caracteres).",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "description": "Descripción libre del plan (hasta 500 caracteres).",
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "El plan almacenado.",
            "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": "Consultar la configuración de un plan",
        "description": "Solo administradores de la plataforma. El `ETag` es la versión de la configuración.",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/PlanIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Sobrescrituras a nivel de plan.",
            "headers": {
              "ETag": {
                "description": "Entity tag fuerte de la versión de la configuración.",
                "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": "Reemplazar las sobrescrituras a nivel de plan",
        "description": "Solo administradores de la plataforma. Se valida contra los techos de la plataforma; en los parámetros\nnuméricos, el valor del plan es a su vez el techo de sus tenants. Mismas reglas de concurrencia\nque la actualización del tenant.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/PlanIdPath"
          },
          {
            "name": "If-Match",
            "description": "`ETag` de la versión de la configuración que se reemplaza, p. ej. `\"v3\"`.",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Nueva versión almacenada.",
            "headers": {
              "ETag": {
                "description": "Entity tag fuerte de la nueva versión.",
                "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": "Listar las versiones de la configuración del plan",
        "description": "Solo administradores de la plataforma. Del más reciente al más antiguo, con los cambios de valor anterior a nuevo.",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/PlanIdPath"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de versiones.",
            "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": "Asignar un plan a un tenant",
        "description": "Solo administradores de la plataforma. Se conservan las sobrescrituras del tenant; las que superan los techos de\nel nuevo plan se listan en `clampedKeys` y se resuelven al techo. Concurrencia optimista\nsobre el registro del tenant mediante `expectedVersion` o `If-Match`.\n",
        "x-cem-owner-wp": "42",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          },
          {
            "name": "If-Match",
            "description": "`ETag` de la versión del registro del tenant devuelta por una lectura previa. Alternativa a `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 que se asigna al tenant. Debe existir.",
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "expectedVersion": {
                    "description": "Versión del registro del tenant que leyó el invocador; el cambio falla con `409` si la versión vigente es distinta.",
                    "type": "integer",
                    "minimum": 0
                  },
                  "comment": {
                    "description": "Motivo del cambio (hasta 500 caracteres).",
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Plan asignado.",
            "headers": {
              "ETag": {
                "description": "Entity tag fuerte de la versión del registro del tenant.",
                "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": "Listar las direcciones suprimidas del tenant",
        "description": "Solo las entradas del tenant que invoca, ordenadas por `emailSha256`. Las entradas de toda la\nplataforma nunca se listan. No se devuelven las entradas vencidas. Las direcciones se\nalmacenan como resúmenes SHA-256 de la dirección en minúsculas.\n",
        "x-cem-owner-wp": "72",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de entradas.",
            "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": "Suprimir una dirección manualmente",
        "description": "Agrega (o renueva) una entrada `MANUAL` para el tenant. Sin `ttlDays`, la\nentrada no vence. Los mensajes a una dirección suprimida no se envían y el\ndestinatario termina en `SUPPRESSED`.\n",
        "x-cem-owner-wp": "72",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddSuppressionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "La entrada.",
            "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": "Eliminar una entrada de supresión",
        "description": "Elimina la entrada del tenant almacenada bajo el resumen de la dirección.",
        "x-cem-owner-wp": "72",
        "parameters": [
          {
            "name": "emailSha256",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Sha256"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Eliminado."
          },
          "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": "Crear un tenant (administrador de la plataforma)",
        "description": "Crea un tenant `ACTIVE`. Con `apiKey` (un objeto, posiblemente vacío) se emite la primera clave\ny se devuelve una sola vez en la respuesta; por defecto tiene todos los alcances de tenant para que este pueda\nconfigurarse por sí mismo (dominios, remitentes, claves). El plan debe existir (`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": "Nombre visible del tenant (1 a 120 caracteres).",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "planId": {
                    "description": "Plan con el que inicia el tenant. Debe existir.",
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "tenantId": {
                    "type": "string",
                    "description": "Se genera cuando se omite.",
                    "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
                  },
                  "apiKey": {
                    "$ref": "#/components/schemas/ApiKeyRequestOptional"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "El tenant, con `apiKey` cuando se solicitó.",
            "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": "Listar los tenants (administrador de la plataforma)",
        "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": "Una página de 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": "Consultar un tenant (administrador de la plataforma)",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El tenant, incluso uno eliminado.",
            "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": "Suspender, reactivar o eliminar un tenant (administrador de la plataforma)",
        "description": "`SUSPENDED` y `DELETED` hacen que el autorizador rechace las claves del tenant. `DELETED` es terminal\ny además elimina las identidades de SES del tenant. Repetir el estado actual no produce ningún efecto.\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": "Motivo del cambio (hasta 500 caracteres).",
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "El tenant después del cambio.",
            "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": "Emitir una clave de API para un tenant (administrador de la plataforma)",
        "description": "Vía de recuperación para un tenant que perdió todas sus credenciales. El secreto se muestra una sola vez.",
        "x-cem-owner-wp": "70",
        "parameters": [
          {
            "$ref": "#/components/parameters/TenantIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "La clave con su secreto.",
            "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": "Punto de entrada de verificación para personas y códigos QR, y estado del seguimiento con negociación de contenido",
        "description": "URL pública de verificación para personas y códigos QR (`https://verify.<platform_domain>/v/{trackId}`).\n\n* **Navegadores y lectores de QR (`Accept: text/html`)**: CloudFront sirve directamente la aplicación web\n  estática del verificador en `/v/{trackId}`, la cual elimina cualquier `code` de la barra de direcciones y\n  consulta el endpoint JSON canónico `GET /public/v1/verify/track/{trackId}`. Si un\n  navegador llega directamente al origen de la API HTTP con `Accept: text/html` y\n  `CEM_VERIFY_WEB_BASE_URL` está configurado, la API valida `trackId` (ULID) y el\n  `code` opcional, y responde `302 Found` a `{verify_web_base_url}/v/{trackId}` (moviendo `code` al\n  fragmento `#code=...`).\n* **Clientes de API (`Accept: application/json`)**: CloudFront responde `307 Temporary Redirect`\n  a `/public/v1/verify/track/{trackId}` (conservando `?code=...`), y el origen de la API HTTP\n  devuelve `200 application/json` (`VerifyTrackResponse`).\n",
        "x-cem-owner-wp": "38",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/VerifyCodeQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Estado del acuse y resúmenes para el identificador de seguimiento (clientes JSON).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyTrackResponse"
                }
              }
            }
          },
          "302": {
            "description": "Redirección al verificador web público cuando `Accept` prefiere `text/html` en el origen de la API."
          },
          "307": {
            "description": "Redirección en el borde de CloudFront a `/public/v1/verify/track/{trackId}` para `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": "Estado de verificación JSON canónico y resúmenes por identificador de seguimiento",
        "description": "Endpoint JSON canónico público para clientes programáticos y para el verificador web. Siempre devuelve\n`application/json` (o `application/problem+json` en caso de error) y nunca redirige a HTML.\nDevuelve el estado de sellado del acuse y los resúmenes SHA-256 de los artefactos sin datos personales; al enviar\n`code` se habilitan metadatos ampliados (marca de tiempo, identificador de la clave del firmante, vínculo de la cadena, retención) solo para el\nacuse correspondiente.\n",
        "x-cem-owner-wp": "38",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/TrackIdPath"
          },
          {
            "$ref": "#/components/parameters/VerifyCodeQuery"
          }
        ],
        "responses": {
          "200": {
            "description": "Estado del acuse y resúmenes para el identificador de seguimiento.",
            "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": "Comprobar si un resumen pertenece a una evidencia emitida",
        "description": "Público. El invocador calcula el SHA-256 localmente y envía solo el resumen.\nFunciona también después del período de retención, contra el índice de resúmenes.\n",
        "x-cem-owner-wp": "38",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyHashRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resultado de la búsqueda; `match` es `false` cuando no se encontró nada.",
            "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": "Validar un contenedor de evidencia ASiC-E",
        "description": "Público. Valida la firma, la cadena de certificados, el sello de tiempo RFC 3161, la prueba\nde inclusión y la coherencia con el índice de resúmenes. El contenedor no se almacena.\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": "Validación realizada; lea `result` para conocer el desenlace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyContainerResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "413": {
            "description": "Mayor de 5 MB.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "No es un contenedor ASiC-E.",
            "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": "Reenviar una entrega de webhook",
        "description": "Vuelve a encolar la entrega con el mismo `webhook-id`, de modo que un consumidor que\ndeduplica la reconozca. Permitido para entregas en `FAILED`,\n`PARKED` o `DELIVERED`.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryIdPath"
          }
        ],
        "responses": {
          "202": {
            "description": "Encolada de nuevo.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "La entrega aún se está intentando.",
            "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": "Consultar una entrega de webhook",
        "description": "Estado de la cadena de intentos de un evento hacia un endpoint. Las filas de entrega se\nconservan durante `retention.webhookDeliveries.days` días; después, la llamada responde `404`.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "La entrega.",
            "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": "Listar las entregas de un endpoint",
        "description": "Del más reciente al más antiguo. Use `status=FAILED` para encontrar lo que se puede reenviar.",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "name": "endpointId",
            "description": "Identificador del endpoint de webhook.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Solo las entregas en este estado.",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "DELIVERED",
                "FAILED",
                "PARKED"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de entregas.",
            "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": "Reenviar un rango de entregas de un endpoint",
        "description": "Vuelve a encolar las entregas del endpoint que están en `status` y fueron creadas dentro de\n`from`..`to`, conservando su `webhook-id`. Se reenvían como máximo `limit` entregas por\nllamada, distribuidas en el tiempo para proteger el endpoint; cuando se devuelve `nextCursor`, llame de nuevo\ncon él para continuar. Las entregas de un endpoint suspendido permanecen en `PARKED` hasta que se recupere.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "name": "endpointId",
            "description": "Identificador del endpoint de webhook.",
            "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": "Estado de las entregas que se reenviarán. Por defecto, `FAILED`.",
                    "enum": [
                      "FAILED",
                      "PARKED",
                      "DELIVERED"
                    ]
                  },
                  "from": {
                    "$ref": "#/components/schemas/Timestamp"
                  },
                  "to": {
                    "$ref": "#/components/schemas/Timestamp"
                  },
                  "limit": {
                    "description": "Número máximo de entregas que reenvía esta llamada, de 1 a 1000 (por defecto 500).",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "default": 500
                  },
                  "cursor": {
                    "$ref": "#/components/schemas/Cursor"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Encolada de nuevo.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "replayed",
                    "skipped"
                  ],
                  "properties": {
                    "replayed": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "skipped": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Entregas examinadas pero fuera del rango solicitado."
                    },
                    "nextCursor": {
                      "$ref": "#/components/schemas/Cursor"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "El endpoint está deshabilitado o el estado no se puede reenviar.",
            "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": "Registrar un endpoint de webhook",
        "description": "Registra un endpoint HTTPS que recibe los eventos suscritos. La URL se verifica en el\nregistro: solo `https`, sin credenciales en la URL, y todas las direcciones a las que resuelve el host\ndeben ser públicas (sin rangos privados, de loopback, de enlace local ni de metadatos); la misma verificación se ejecuta\nde nuevo en cada entrega. El `secret` de firma se devuelve **solo en esta respuesta** y en\nuna rotación; guárdelo ahora. El número de endpoints activos está limitado por\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": "Repetición de una solicitud anterior con la misma `Idempotency-Key`. El endpoint se devuelve\nsin su secreto, que se mostró en la respuesta original.\n",
            "headers": {
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "201": {
            "description": "Endpoint registrado.",
            "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": "La URL no está permitida o no se resuelve (`url_blocked`, `url_unresolvable`), se alcanzó el\nlímite de endpoints (`endpoint_limit_reached`) o la clave se usó con un\ncuerpo distinto (`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": "Listar los endpoints de webhook",
        "description": "Ordenados por `endpointId`. Los valores de los secretos nunca se devuelven.",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Una página de 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": "Consultar un endpoint de webhook",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El endpoint, sin los valores de los secretos.",
            "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": "Modificar un endpoint de webhook",
        "description": "Cambia la URL (se verifica de nuevo), los eventos suscritos, la descripción o el estado.\nEstablecer `status` en `ACTIVE` en un endpoint `SUSPENDED` cierra su cortacircuitos (circuit breaker): el\ncontador de fallos se reinicia y se liberan las entregas retenidas mientras estuvo suspendido.\n`SUSPENDED` lo establece únicamente la plataforma y no se puede solicitar.\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": "El endpoint actualizado.",
            "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": "El endpoint cambió de forma concurrente (`concurrent_update`); reintente.",
            "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": "Eliminar un endpoint de webhook",
        "description": "Detiene todas las entregas al endpoint. El historial de entregas se conserva hasta que venza.",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Eliminado."
          },
          "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": "Rotar el secreto de firma de un endpoint",
        "description": "Genera un nuevo secreto, que se devuelve solo aquí. El secreto anterior sigue firmando durante la\nventana de solapamiento (`expiresAt` de su entrada en `secrets`), de modo que las entregas llevan una firma\npor cada secreto vigente y el consumidor puede cambiar sin interrupción.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "El endpoint y el nuevo secreto.",
            "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": "El endpoint cambió de forma concurrente (`concurrent_update`); reintente.",
            "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": "Enviar un evento de prueba a un endpoint",
        "description": "Envía ahora un evento `webhook.test` firmado y espera la respuesta. Usa las mismas\nverificaciones de dirección, la misma firma y el mismo tiempo de espera que las entregas reales, nunca se reintenta y no\nmodifica el cortacircuitos ni el historial de entregas. Un ping fallido responde `200` con\n`success: false`.\n",
        "x-cem-owner-wp": "40",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndpointIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "Resultado del 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": "Clave de API del tenant. El tenant y el identificador de la clave forman parte del token; la plataforma solo\nalmacena un SHA-256 del secreto.\n"
      }
    },
    "schemas": {
      "CreateAttachmentRequest": {
        "type": "object",
        "required": [
          "filename",
          "bytes",
          "sha256"
        ],
        "additionalProperties": false,
        "properties": {
          "filename": {
            "description": "Nombre del archivo (1 a 255 caracteres).",
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "mediaType": {
            "description": "Tipo de medio del archivo (hasta 127 caracteres).",
            "type": "string",
            "maxLength": 127
          },
          "bytes": {
            "type": "integer",
            "description": "Tamaño exacto del archivo; la carga se rechaza si difiere.",
            "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": "Solicitud prefirmada que el cliente debe ejecutar tal cual. El tamaño y la suma de verificación forman parte\nde la firma: el almacenamiento rechaza un cuerpo que no coincida con ellos.\n",
            "required": [
              "method",
              "url",
              "headers"
            ],
            "properties": {
              "method": {
                "type": "string",
                "const": "PUT"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "description": "Cabeceras que se envían tal cual, incluida `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`: un `SubmitMessageRequest` por línea. `CSV`: fila de encabezado con una\ncolumna `to` obligatoria; las listas usan `;`.\n",
            "enum": [
              "CSV",
              "JSONL"
            ]
          },
          "bytes": {
            "type": "integer",
            "description": "Tamaño exacto del manifiesto; la carga se rechaza si difiere.",
            "minimum": 1
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256"
          },
          "name": {
            "description": "Nombre del lote, que se repite en los reportes y en el evento `batch.completed` (1 a 128 caracteres).",
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "priority": {
            "type": "string",
            "description": "Carril de despacho de las filas que no establecen `options.priority`.",
            "enum": [
              "BULK",
              "TRANSACTIONAL"
            ],
            "default": "BULK"
          },
          "defaults": {
            "type": "object",
            "description": "Valores aplicados a cada fila salvo que la fila los establezca (`options` y\n`metadata` se combinan). Acepta `from`, `replyTo`, `subject`, `html`,\n`text`, `attachments`, `options` y `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": "Solicitud prefirmada que el cliente debe ejecutar tal cual.",
            "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": "Filas no procesadas (por ejemplo, fragmentos que fallaron).",
                "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": "Enlaces prefirmados al reporte, presentes una vez que el lote ha terminado.",
            "properties": {
              "report": {
                "$ref": "#/components/schemas/BatchDownload"
              },
              "errors": {
                "$ref": "#/components/schemas/BatchDownload"
              }
            }
          }
        }
      },
      "BatchItem": {
        "type": "object",
        "required": [
          "row",
          "status"
        ],
        "properties": {
          "row": {
            "type": "integer",
            "description": "Posición del registro en el manifiesto, desde 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": "Código de rechazo (los mismos códigos que `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": "ULID generado por el servidor que identifica un mensaje.",
        "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
        "examples": [
          "01JD90B2M4X7Q8R9S0T1V2W3X4"
        ]
      },
      "RecipientId": {
        "type": "string",
        "description": "Posición del destinatario dentro de su mensaje (`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": "Resumen SHA-256, en hexadecimal minúscula.",
        "pattern": "^[0-9a-f]{64}$",
        "examples": [
          "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
        ]
      },
      "Timestamp": {
        "type": "string",
        "format": "date-time",
        "description": "Instante RFC 3339 en UTC.",
        "examples": [
          "2026-03-02T15:04:05Z"
        ]
      },
      "Cursor": {
        "type": "string",
        "description": "Token de paginación opaco. No lo analice ni lo construya.",
        "minLength": 1,
        "maxLength": 1024
      },
      "ReceiptType": {
        "type": "string",
        "description": "Tipo de acuse certificado.",
        "enum": [
          "SUBMISSION",
          "DELIVERY",
          "READ",
          "DOWNLOAD",
          "FAILURE",
          "DELAY",
          "OPEN",
          "CLOSURE"
        ]
      },
      "ReadLevel": {
        "type": "string",
        "description": "Fortaleza de la señal de lectura. `L0` sin señal, `L1` precarga automática o escáner de\nseguridad (no concluyente), `L2` apertura probable a través de un proxy de imágenes, `L3` interacción\nhumana probable, `L4` confirmada en el portal.\n",
        "enum": [
          "L0",
          "L1",
          "L2",
          "L3",
          "L4"
        ]
      },
      "RecipientStatus": {
        "type": "string",
        "description": "Estado de entrega de un destinatario. La interacción (`ReadLevel`) es una dimensión aparte.",
        "enum": [
          "ACCEPTED",
          "REJECTED",
          "QUEUED",
          "HELD_FOR_SCAN",
          "SUPPRESSED",
          "ON_HOLD",
          "RENDERED",
          "SENDING",
          "SENT",
          "DELIVERED",
          "DELAYED",
          "BOUNCED",
          "REJECTED_SES",
          "COMPLAINED"
        ]
      },
      "TrustLevel": {
        "type": "string",
        "description": "`TEST` cuando el firmante o la autoridad de sellado de tiempo no es un tercero de confianza\n(certificado autofirmado, TSA interna). Esa evidencia no tiene valor legal.\n",
        "enum": [
          "TEST",
          "PRODUCTION"
        ]
      },
      "Problem": {
        "type": "object",
        "description": "Detalles del problema según RFC 9457.",
        "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": "Código de error estable y legible por máquina. Todos los códigos que puede responder la API, con su estado HTTP y su causa, están en la extensión `x-error-catalog` de este documento.",
            "pattern": "^[a-z][a-z0-9_]*$",
            "examples": [
              "idempotency_key_reused"
            ]
          },
          "requestId": {
            "type": "string"
          },
          "verificationSent": {
            "type": "boolean",
            "description": "Solo en `403 sender_not_verified` (Fast Onboarding): `true` cuando este intento acaba de disparar\nel correo de verificación al buzón del remitente, `false` cuando se limitó la frecuencia o no estaba disponible.\n"
          },
          "verificationRetryAfterSeconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Solo con verificationSent=false cuando se limitó la frecuencia: segundos que faltan para poder enviar otro correo."
          },
          "errors": {
            "type": "array",
            "description": "Errores de validación por campo.",
            "items": {
              "type": "object",
              "required": [
                "pointer",
                "code"
              ],
              "properties": {
                "pointer": {
                  "type": "string",
                  "description": "JSON Pointer (RFC 6901) al valor que causa el error."
                },
                "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": "Ciclo de vida administrativo de un tenant. `DELETED` es 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": "Referencia opaca que aparece en la evidencia pública en lugar del identificador del tenant."
          },
          "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": "`*` concede todos los alcances (scopes) de tenant. `platform:admin` nunca se concede a través de la API.\nUna operación se autoriza cuando la clave posee al menos uno de los alcances listados en el\n`x-cem-scopes` de la operación (varias operaciones aceptan alternativas, por ejemplo\n`evidence:read` o `messages:read`); `*` satisface todas las operaciones excepto la administración\nde la plataforma, que exige `platform:admin` de forma explícita.\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": "Nombre que identifica la clave, por ejemplo el sistema que la usará (1 a 80 caracteres).",
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "scopes": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "description": "Por defecto, `messages:read` y `messages:write`. Nunca más de lo que posee la clave que la emite.",
            "items": {
              "$ref": "#/components/schemas/ApiKeyScope"
            }
          },
          "environment": {
            "description": "Entorno del token: `live` o `test`. Pasa a ser el prefijo del token generado.",
            "type": "string",
            "enum": [
              "live",
              "test"
            ],
            "default": "live"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          }
        }
      },
      "ApiKeyRequestOptional": {
        "type": "object",
        "additionalProperties": false,
        "description": "Como `ApiKeyRequest` para la primera clave de un tenant; `label` es por defecto `initial` y `scopes` son por defecto todos los alcances de tenant.",
        "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": "Metadatos de una clave. El secreto y su hash nunca se vuelven a devolver.",
        "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": "La clave que firmó esta solicitud."
          }
        }
      },
      "ApiKeyIssued": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiKey"
          },
          {
            "type": "object",
            "required": [
              "environment",
              "secret",
              "token"
            ],
            "properties": {
              "environment": {
                "type": "string",
                "enum": [
                  "live",
                  "test"
                ]
              },
              "secret": {
                "type": "string",
                "description": "Se muestra solo en esta respuesta."
              },
              "token": {
                "type": "string",
                "description": "`cem_{live|test}_{tenant}_{keyId}_{secret}`, la credencial bearer. Se muestra solo en esta respuesta."
              },
              "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, rotados por SES) y `MAIL_FROM_MX`/`MAIL_FROM_SPF` (subdominio de MAIL FROM\npersonalizado) son obligatorios. `SPF` (apex) y `DMARC` son propuestas opcionales calculadas a partir de lo que\nel DNS público del dominio ya publica; nunca condicionan el paso a `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": "Necesario para que el dominio pase a `ACTIVE`. Los registros recomendados no se comprueban."
          },
          "verified": {
            "type": "boolean"
          },
          "advice": {
            "type": "string",
            "description": "Orientación para los registros opcionales `SPF` y `DMARC`."
          },
          "existing": {
            "type": [
              "string",
              "null"
            ],
            "description": "Solo registros opcionales. El registro que el dominio ya publica (`null` cuando no hay ninguno o cuando\nno se pudo consultar el DNS público). Para `SPF` con un registro existente, `value` es ese\nregistro ya combinado con `include:amazonses.com`; para `DMARC` es el registro existente.\n"
          },
          "warnings": {
            "type": "array",
            "description": "Solo registros opcionales.",
            "items": {
              "$ref": "#/components/schemas/DnsWarning"
            }
          },
          "dnsLookups": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Solo `SPF`. Consultas DNS que requiere el registro combinado (`include`, `a`, `mx`, `exists`, `redirect`, `ptr`, recursivas); `null` cuando se desconoce."
          },
          "lookupLimit": {
            "type": "integer",
            "description": "Solo `SPF`. Límite de RFC 7208 (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": "El tenant indicó que publicará los registros opcionales SPF/DMARC; entonces se comprueban en el DNS público."
          },
          "dnsCheck": {
            "type": "string",
            "description": "`UNAVAILABLE` cuando no se pudo consultar el DNS público; el asistente muestra entonces sus propuestas estáticas.",
            "enum": [
              "OK",
              "UNAVAILABLE"
            ]
          },
          "dedicatedSubdomain": {
            "type": [
              "string",
              "null"
            ],
            "description": "Subdominio sugerido (`cert.{domain}`) mientras el tenant no publique SPF/DMARC."
          },
          "subdomainAdvice": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DomainUpdate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "publishSpfDmarc"
        ],
        "properties": {
          "publishSpfDmarc": {
            "description": "`true` para comprobar también los registros opcionales `SPF` y `DMARC` en el DNS público; `false` para dejar de comprobarlos.",
            "type": "boolean"
          }
        }
      },
      "DomainRegistration": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "domain"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "description": "Nombre de host simple, por ejemplo `example.com`. Los nombres internacionalizados se almacenan como punycode.",
            "maxLength": 253
          }
        }
      },
      "Domain": {
        "type": "object",
        "required": [
          "domain",
          "status",
          "dkimMode",
          "smtpEnabled",
          "dnsRecords",
          "verification",
          "sending",
          "version"
        ],
        "properties": {
          "domain": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "`PENDING` hasta que DKIM se verifica (hasta 72 horas), luego `ACTIVE`, o `FAILED` con `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": "Momento en que un dominio que sigue en `PENDING` se declara `FAILED`."
              }
            }
          },
          "sending": {
            "type": "object",
            "description": "Qué dominio de From usará el correo en este momento.",
            "required": [
              "mode",
              "fromDomain"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "description": "`FAST_ONBOARDING` reescribe el From a través del dominio compartido de la plataforma hasta que se verifique el dominio propio del tenant.",
                "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`: solo las direcciones registradas como remitentes pueden usar el tenant; `WHOLE_DOMAIN`: cualquier\ndirección de un dominio verificado (los remitentes registrados aún se pueden deshabilitar).\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": "La plataforma tiene configurado un dominio de envío compartido."
          },
          "fastOnboardingDomain": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SenderPolicyUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "policy": {
            "$ref": "#/components/schemas/SenderPolicyName"
          },
          "fastOnboarding": {
            "description": "Activa o desactiva Fast Onboarding: mientras el dominio propio del tenant no esté verificado, el correo sale por el dominio compartido de la plataforma.",
            "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` bloquea al remitente bajo cualquier política. Por defecto, `true`.",
            "type": "boolean",
            "default": true
          },
          "displayName": {
            "description": "Nombre visible del remitente (hasta 200 caracteres).",
            "type": "string",
            "maxLength": 200
          },
          "sendVerification": {
            "type": "boolean",
            "description": "Dispara el envío de un correo firmado de verificación de buzón a la dirección real del remitente."
          }
        }
      },
      "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": "Tipo de cambio de estado. Los webhooks usan los mismos nombres.",
        "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": "Referencia a un acuse sellado.",
        "required": [
          "type",
          "evidenceId",
          "sha256"
        ],
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ReceiptType"
          },
          "evidenceId": {
            "$ref": "#/components/schemas/EvidenceId"
          },
          "sha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Resumen del XML de evidencia firmado."
          },
          "links": {
            "type": "object",
            "description": "Dónde obtener cada artefacto (URL de la API que requieren autenticación).",
            "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": "Página pública de verificación."
              }
            }
          }
        }
      },
      "Event": {
        "type": "object",
        "description": "Un cambio de estado inmutable. `id` es estable entre reintentos de webhook y sondeos,\npor lo que sirve para deduplicar; `sequence` ordena los eventos de un mismo mensaje.\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": "Detalles propios de cada tipo; consulte los esquemas de webhook para ver cada forma."
          },
          "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`: la evidencia firmada; `pdf`: su versión legible por personas; `eml`: el\nmensaje tal como se envió; `asice`: el contenedor autoverificable con todos ellos.\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": "Resumen del XML de evidencia firmado."
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          },
          "status": {
            "type": "string",
            "description": "`SEALED`: firmado y con sello de tiempo; `TSA_PENDING`: firmado, falta agregar el sello de\ntiempo; `EXPIRED`: terminó la custodia y los artefactos fueron purgados.\n",
            "enum": [
              "SEALED",
              "TSA_PENDING",
              "EXPIRED"
            ]
          },
          "previousEvidenceId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EvidenceId"
              }
            ],
            "description": "Acuse anterior del mismo destinatario al que se refiere este."
          },
          "signer": {
            "type": "object",
            "properties": {
              "providerId": {
                "type": "string",
                "examples": [
                  "keystore:dev-default"
                ]
              },
              "kid": {
                "type": "string"
              }
            }
          },
          "timestamp": {
            "type": "object",
            "description": "Presente una vez que la evidencia lleva un sello de tiempo RFC 3161.",
            "properties": {
              "providerId": {
                "type": "string",
                "examples": [
                  "rfc3161:freetsa"
                ]
              },
              "genTime": {
                "$ref": "#/components/schemas/Timestamp"
              }
            }
          },
          "artifacts": {
            "type": "array",
            "description": "Resúmenes de todos los artefactos, disponibles incluso después de la purga.",
            "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` cuando el artefacto aún no se ha generado (PDF diferido) o fue purgado."
                }
              }
            }
          },
          "expiresAt": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              }
            ],
            "description": "Fin de la custodia. La purga nunca ocurre antes de este instante."
          },
          "legalHold": {
            "type": "boolean"
          },
          "position": {
            "type": "integer",
            "description": "Posición monótona, desde 1, de este acuse en la cadena acumulativa del destinatario.",
            "minimum": 1
          },
          "receiptKey": {
            "type": "string",
            "description": "Clave principal de acuse que satisface este acuse (por ejemplo, `DELIVERY`, `READ#L3`, `OPEN#MDN`)."
          },
          "satisfies": {
            "type": "array",
            "description": "Todas las claves de acuse que satisface este acuse acumulativo.",
            "items": {
              "type": "string"
            }
          },
          "covers": {
            "type": "array",
            "description": "Identificadores de evento cubiertos por primera vez por este acuse (incluidos los eventos que solo constan en el libro mayor).",
            "items": {
              "type": "string"
            }
          },
          "coveredSeq": {
            "type": "integer",
            "description": "Mayor secuencia de eventos por destinatario (`evtSeq`) cubierta por este acuse.",
            "minimum": 0
          },
          "signed": {
            "type": "boolean",
            "description": "`false` cuando se emitió como un registro informativo sin firma (`constancia sin firma`)."
          },
          "latest": {
            "type": "boolean",
            "description": "`true` cuando este acuse es la cabeza vigente de la cadena acumulativa del destinatario."
          },
          "final": {
            "type": "boolean",
            "description": "`true` cuando la cadena del destinatario está cerrada (`CLOSURE` o `FAILURE` terminal)."
          },
          "links": {
            "type": "object",
            "description": "Enlaces directos de la API, con autenticación, a los artefactos de este acuse.",
            "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": "Identificador de un MDN entrante registrado para un destinatario.",
        "minLength": 1,
        "maxLength": 128,
        "pattern": "^[A-Za-z0-9._:-]+$",
        "examples": [
          "mdn_01JD90B2M4X7Q8R9S0T1V2W3X4_r0_01"
        ]
      },
      "MdnRecord": {
        "type": "object",
        "description": "Message Disposition Notification entrante autenticada (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": "Resumen del `.eml` original almacenado del MDN."
          },
          "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": "Acuse que incluyó este MDN por primera vez, una vez sellado."
          },
          "emlUrl": {
            "type": "string",
            "format": "uri",
            "description": "URL de la API con autenticación (`GET /v1/mdn/{mdnId}/eml`) que redirige al `.eml` almacenado."
          }
        }
      },
      "MdnList": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MdnRecord"
            }
          }
        }
      },
      "LegalHoldRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "description": "Texto libre que queda registrado en la pista de auditoría.",
            "maxLength": 500
          }
        }
      },
      "EvidenceGone": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Problem"
          },
          {
            "type": "object",
            "description": "Lo que el índice de verificación aún sabe de la evidencia purgada.",
            "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": "Adjunto incluido en el cuerpo de la solicitud (sujeto a `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": "Se deduce del nombre del archivo cuando se omite.",
            "maxLength": 127
          }
        }
      },
      "UploadedAttachment": {
        "type": "object",
        "description": "Adjunto cargado previamente mediante `POST /v1/attachments`.",
        "required": [
          "attachmentId"
        ],
        "additionalProperties": false,
        "properties": {
          "attachmentId": {
            "$ref": "#/components/schemas/AttachmentId"
          }
        }
      },
      "MessageOptions": {
        "type": "object",
        "description": "Sobrescrituras de la configuración por mensaje. Cada una se resuelve frente a los\nniveles de tenant, plan y plataforma y se limita por sus techos; los valores realmente\naplicados se devuelven en `effectiveOptions`.\n",
        "additionalProperties": false,
        "properties": {
          "receipts": {
            "type": "array",
            "description": "Sobrescribe `receipts.types`.",
            "items": {
              "$ref": "#/components/schemas/ReceiptType"
            },
            "uniqueItems": true,
            "minItems": 1
          },
          "retentionDays": {
            "type": "integer",
            "description": "Sobrescribe `retention.evidence.days`.",
            "minimum": 1,
            "maximum": 3650
          },
          "attachmentsDeliveryMode": {
            "type": "string",
            "description": "Sobrescribe `attachments.deliveryMode`. Con `HYBRID`, el umbral de tamaño en línea es el ajuste `attachments.hybrid.inlineMaxBytes` (plan/tenant), limitado por el valor de la plataforma.",
            "enum": [
              "INLINE",
              "SECURE_LINK",
              "HYBRID"
            ]
          },
          "pdf": {
            "type": "string",
            "description": "Sobrescribe `receipts.pdf.mode`.",
            "enum": [
              "LAZY",
              "EAGER",
              "OFF"
            ]
          },
          "readMinLevel": {
            "type": "string",
            "description": "Sobrescribe `receipts.read.minLevel`.",
            "enum": [
              "L2",
              "L3",
              "L4"
            ]
          },
          "priority": {
            "type": "string",
            "description": "Carril de despacho.",
            "enum": [
              "TRANSACTIONAL",
              "BULK"
            ]
          },
          "emailReceiptsToSender": {
            "type": "boolean",
            "description": "Sobrescribe `receipts.emailToSender`."
          },
          "trackOpens": {
            "type": "boolean",
            "description": "Sobrescribe `tracking.opens`."
          },
          "trackClicks": {
            "type": "boolean",
            "description": "Sobrescribe `tracking.clicks`."
          },
          "requestMdn": {
            "type": "boolean",
            "description": "Sobrescribe `tracking.mdn.request`."
          },
          "portalConfirmation": {
            "type": "string",
            "description": "Sobrescribe `tracking.portal.confirmation`.",
            "enum": [
              "OFF",
              "CLICK",
              "OTP"
            ]
          }
        }
      },
      "EffectiveOptions": {
        "type": "object",
        "description": "Opciones aplicadas al mensaje tras resolver todos los niveles de configuración.",
        "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": "Versión de la configuración efectiva con la que se procesó el mensaje."
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          }
        }
      },
      "SubmitMessageRequest": {
        "type": "object",
        "required": [
          "from",
          "to",
          "subject"
        ],
        "additionalProperties": false,
        "anyOf": [
          {
            "required": [
              "html"
            ]
          },
          {
            "required": [
              "text"
            ]
          }
        ],
        "properties": {
          "from": {
            "description": "Dirección del remitente. Debe ser un remitente autorizado del tenant según la política de remitentes.",
            "$ref": "#/components/schemas/EmailAddress"
          },
          "to": {
            "type": "array",
            "description": "Cada destinatario se envía, se rastrea y se certifica individualmente.",
            "items": {
              "$ref": "#/components/schemas/EmailAddress"
            },
            "minItems": 1,
            "maxItems": 50
          },
          "cc": {
            "description": "Destinatarios en copia, hasta 50.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailAddress"
            },
            "maxItems": 50
          },
          "bcc": {
            "type": "array",
            "description": "Un destinatario en copia oculta nunca aparece en la evidencia de otro destinatario.",
            "items": {
              "$ref": "#/components/schemas/EmailAddress"
            },
            "maxItems": 50
          },
          "replyTo": {
            "description": "Dirección que recibe las respuestas, cuando es distinta del remitente.",
            "$ref": "#/components/schemas/EmailAddress"
          },
          "subject": {
            "description": "Asunto del mensaje (1 a 998 caracteres, sin caracteres de control).",
            "type": "string",
            "minLength": 1,
            "maxLength": 998
          },
          "html": {
            "description": "Cuerpo en HTML. Se requiere al menos uno de `html` o `text`.",
            "type": "string"
          },
          "text": {
            "description": "Cuerpo en texto plano. Se requiere al menos uno de `html` o `text`.",
            "type": "string"
          },
          "attachments": {
            "description": "Adjuntos del mensaje, hasta 50: en línea (`filename` y `contentBase64`) o cargados previamente (`attachmentId`).",
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/InlineAttachment"
                },
                {
                  "$ref": "#/components/schemas/UploadedAttachment"
                }
              ]
            },
            "maxItems": 50
          },
          "options": {
            "$ref": "#/components/schemas/MessageOptions"
          },
          "clientTrackId": {
            "type": "string",
            "description": "Referencia propia del invocador; se puede buscar con `GET /v1/messages?clientTrackId=`.",
            "minLength": 1,
            "maxLength": 128
          },
          "metadata": {
            "type": "object",
            "description": "Pares clave/valor libres que se devuelven tal cual en las consultas y en los 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` cuando un worker de despacho murió entre entregar el mensaje al\nservicio de correo y registrarlo, por lo que el reintento pudo haberlo enviado dos veces.\n"
          },
          "failure": {
            "type": "object",
            "description": "Presente cuando el destinatario terminó en un estado de fallo.",
            "properties": {
              "reason": {
                "type": "string",
                "description": "Motivo legible por máquina, por ejemplo `hard_bounce`, `suppressed`, `no_mx`."
              },
              "diagnosticCode": {
                "type": "string",
                "description": "Diagnóstico literal devuelto por el servidor remoto, cuando lo hay."
              }
            }
          },
          "certification": {
            "$ref": "#/components/schemas/RecipientCertification"
          }
        }
      },
      "CertificationState": {
        "type": "string",
        "enum": [
          "NONE",
          "PENDING",
          "SEALED",
          "TSA_PENDING"
        ],
        "description": "Resumen de certificación por destinatario: `NONE` (sin acuse emitido y sin disparador pendiente),\n`PENDING` (eventos disparadores sin cubrir que esperan la ventana de asentamiento o al worker de sellado),\n`SEALED` (el último acuse está sellado y no hay nuevos eventos disparadores pendientes), o\n`TSA_PENDING` (el último acuse está firmado en `XAdES-BASELINE-B` y espera el sello de tiempo RFC 3161).\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": "Cantidad de eventos del libro mayor del destinatario que aún no cubre un acuse sellado."
          },
          "expectedBy": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Timestamp"
              },
              {
                "type": "null"
              }
            ],
            "description": "Marca de tiempo ISO-8601 UTC estimada del próximo sellado, o `null` cuando no es estimable o no hay nada pendiente."
          },
          "latestReceipt": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CertificationLatestReceipt"
              },
              {
                "type": "null"
              }
            ],
            "description": "Último acuse emitido en la cadena del destinatario, o `null` cuando aún no existe ninguno."
          }
        }
      },
      "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": "Se incrementa en cada transición de estado del mensaje; úselo para ordenar los eventos.",
            "minimum": 0
          },
          "statusSummary": {
            "type": "object",
            "description": "Cantidad de destinatarios que se encuentran actualmente en cada estado.",
            "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": "Handle de acceso del enlace que recibió el destinatario. Llega en el fragmento de la URL de la página del portal (nunca en la cadena de consulta), de modo que el navegador no lo envía a ningún servidor hasta que la página lo publica en un cuerpo JSON.",
        "pattern": "^[a-z0-9]{1,12}\\.[A-Za-z0-9_-]{8,1000}$"
      },
      "PortalSessionToken": {
        "type": "string",
        "description": "Sesión de corta vida emitida por el portal; solo autoriza descargas del mismo mensaje.",
        "minLength": 1
      },
      "PortalPerson": {
        "type": "object",
        "description": "Remitente del mensaje.",
        "required": [
          "name",
          "address"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "PortalAttachment": {
        "type": "object",
        "description": "Un adjunto ofrecido para descarga.",
        "required": [
          "index",
          "filename",
          "contentType",
          "sizeBytes"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 65534,
            "description": "Posición del adjunto; es el valor que se envía como `index` para descargarlo."
          },
          "filename": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PortalMessage": {
        "type": "object",
        "description": "Lo que se le muestra al destinatario sobre el mensaje.",
        "required": [
          "subject",
          "sender",
          "attachments"
        ],
        "properties": {
          "subject": {
            "type": "string"
          },
          "sender": {
            "$ref": "#/components/schemas/PortalPerson"
          },
          "sentAt": {
            "description": "Cuándo se envió el mensaje; `null` cuando se desconoce.",
            "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": "Estado del enlace. `state` es `ready` cuando no se exige confirmación (se incluyen el mensaje y una sesión), `confirm` cuando el destinatario debe hacer clic para confirmar la recepción (se incluye el mensaje; la sesión la emite `/portal/v1/confirm`) y `otp` cuando se exige un código de un solo uso (solo se muestra una vista previa hasta verificar el código).",
        "required": [
          "state",
          "mode",
          "expiresAt"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "ready",
              "confirm",
              "otp"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              false,
              "CLICK",
              "OTP"
            ],
            "description": "Modo de confirmación aplicado al mensaje (`tracking.portal.confirmation`)."
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "focus": {
            "description": "Adjunto al que llegó el destinatario, cuando el enlace apunta a uno; en caso contrario, `null`.",
            "oneOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "$ref": "#/components/schemas/PortalMessage"
          },
          "preview": {
            "type": "object",
            "description": "Presente en modo `otp` en lugar de `message`.",
            "required": [
              "sender",
              "attachmentCount"
            ],
            "properties": {
              "sender": {
                "$ref": "#/components/schemas/PortalPerson"
              },
              "attachmentCount": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "maskedEmail": {
            "description": "Buzón al que se envía el código, parcialmente oculto (`a***@e***.com`); `null` cuando no hay ninguno registrado.",
            "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": "Siempre `true`; los fallos se responden con un error."
          },
          "maskedEmail": {
            "type": "string",
            "description": "Buzón al que se envió el código, parcialmente oculto."
          }
        }
      },
      "PortalConfirmRequest": {
        "type": "object",
        "required": [
          "handle"
        ],
        "properties": {
          "handle": {
            "$ref": "#/components/schemas/PortalHandle"
          },
          "acknowledged": {
            "type": "boolean",
            "description": "`true` cuando el destinatario hizo clic para confirmar la recepción (modo `CLICK`). Es obligatorio salvo que se envíe `code`."
          },
          "code": {
            "type": "string",
            "pattern": "^[0-9]{8}$",
            "description": "Código de un solo uso enviado por correo al destinatario (modo `OTP`)."
          }
        }
      },
      "PortalConfirmResponse": {
        "type": "object",
        "description": "Recepción confirmada (queda registrada como confirmación humana, nivel `L4`) y sesión confirmada emitida.",
        "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` del adjunto que se descarga, tal como figura en `message.attachments`."
          }
        }
      },
      "PortalDownloadResponse": {
        "type": "object",
        "required": [
          "url",
          "expiresAt",
          "filename",
          "sizeBytes",
          "sha256"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "URL de descarga prefirmada, de corta vida."
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "filename": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0
          },
          "sha256": {
            "$ref": "#/components/schemas/Sha256"
          }
        }
      },
      "PortalError": {
        "type": "object",
        "description": "Error del portal. A diferencia de la API del tenant, el portal no usa `application/problem+json`: el cuerpo es este objeto neutro y nunca incluye detalles internos.",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Código estable y legible por máquina (la lista `portal` del `x-error-catalog`).",
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "message": {
            "type": "string",
            "description": "Texto neutro para el destinatario."
          }
        }
      },
      "SettingLevel": {
        "type": "string",
        "description": "Nivel de la jerarquía de configuración, del menos específico al más específico.",
        "enum": [
          "DEFAULT",
          "PLATFORM",
          "PLAN",
          "TENANT",
          "MESSAGE"
        ]
      },
      "SettingValue": {
        "description": "Valor de un parámetro; su tipo JSON lo da la entrada del catálogo.",
        "oneOf": [
          {
            "type": "boolean"
          },
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": [
                "string",
                "number"
              ]
            }
          }
        ]
      },
      "SettingDefinition": {
        "type": "object",
        "description": "Una entrada del catálogo tipado. Una clave que no está en el catálogo no existe.",
        "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": "Niveles en los que se puede sobrescribir el parámetro.",
            "items": {
              "$ref": "#/components/schemas/SettingLevel"
            },
            "uniqueItems": true
          },
          "retroactive": {
            "type": "boolean",
            "description": "Indica si un cambio se aplica a lo que ya existe."
          },
          "infra": {
            "type": "boolean",
            "description": "`true` cuando cambiarlo requiere un despliegue de infraestructura."
          },
          "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": "Mapa de clave del catálogo a valor. Las claves desconocidas se rechazan.",
        "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": "Bloqueo optimista; la actualización falla con `409` si la versión vigente es distinta.",
            "minimum": 0
          },
          "comment": {
            "description": "Motivo del cambio, registrado en el historial de configuración (hasta 500 caracteres).",
            "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": "Presente con `effective=true`. Valor resuelto de cada clave del catálogo.",
            "additionalProperties": {
              "type": "object",
              "required": [
                "value",
                "source"
              ],
              "properties": {
                "value": {
                  "$ref": "#/components/schemas/SettingValue"
                },
                "source": {
                  "$ref": "#/components/schemas/SettingLevel"
                },
                "ceiling": {
                  "type": "object",
                  "description": "Presente cuando un nivel superior limitó el valor.",
                  "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": "Resumen de la dirección en minúsculas."
          },
          "scope": {
            "type": "string",
            "enum": [
              "TENANT",
              "GLOBAL"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "HARD_BOUNCE",
              "SOFT_BOUNCE",
              "COMPLAINT",
              "MANUAL"
            ]
          },
          "createdAt": {
            "$ref": "#/components/schemas/Timestamp"
          },
          "expiresAt": {
            "description": "Nulo cuando la entrada no vence.",
            "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": "Dirección que se suprime. Se almacena como resumen SHA-256 de la dirección en minúsculas.",
            "type": "string",
            "format": "email",
            "maxLength": 320
          },
          "ttlDays": {
            "type": "integer",
            "description": "Vigencia de la entrada; si se omite, no vence.",
            "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`: firmado y con sello de tiempo; `TSA_PENDING`: firmado, falta agregar el sello de\ntiempo; `EXPIRED`: terminó la custodia y los artefactos fueron purgados.\n",
            "enum": [
              "SEALED",
              "TSA_PENDING",
              "EXPIRED"
            ]
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          },
          "sha256": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sha256"
              }
            ],
            "description": "Resumen del XML de evidencia firmado."
          },
          "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": "Estado de verificación pública y resúmenes de un mensaje con seguimiento.",
        "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": "Resumen calculado por el cliente; el archivo en sí nunca sale del dispositivo."
          }
        }
      },
      "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": "Qué artefacto de la evidencia tiene este resumen.",
            "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` mientras la plataforma conserva los artefactos, `PURGED` cuando solo queda el índice de resúmenes.",
            "enum": [
              "HELD",
              "PURGED"
            ]
          }
        }
      },
      "VerifyHashResponse": {
        "type": "object",
        "description": "No se devuelven datos personales, sea cual sea el resultado.",
        "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": "Indicación global, según 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": "Indica si los resúmenes coinciden con lo que emitió la plataforma."
              }
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VerifyContainerIssue"
            }
          },
          "report": {
            "type": "object",
            "description": "Dónde obtener el informe de validación completo según ETSI TS 119 102-2.",
            "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": "Una cadena de intentos de un evento hacia un endpoint del tenant.",
        "required": [
          "deliveryId",
          "endpointId",
          "eventId",
          "eventType",
          "status",
          "attempts"
        ],
        "properties": {
          "deliveryId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "endpointId": {
            "type": "string"
          },
          "eventId": {
            "type": "string",
            "description": "Se envía como `webhook-id`; estable entre reintentos y reenvíos."
          },
          "eventType": {
            "$ref": "#/components/schemas/EventType"
          },
          "status": {
            "type": "string",
            "description": "`PENDING`: en espera o reintentando; `DELIVERED`: confirmada con 2xx; `FAILED`:\nreintentos agotados (se puede reenviar); `PARKED`: endpoint suspendido por su\ncortacircuitos (circuit 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": "Una suscripción de webhook del tenant. Los valores de los secretos nunca forman parte de ella.",
        "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`: recibe eventos; `DISABLED`: el tenant lo desactivó; `SUSPENDED`:\nel cortacircuitos lo pausó tras fallos repetidos; las entregas quedan retenidas y\nel endpoint se sondea hasta que responda.\n",
            "enum": [
              "ACTIVE",
              "SUSPENDED",
              "DISABLED"
            ]
          },
          "consecutiveFailures": {
            "type": "integer",
            "minimum": 0
          },
          "secrets": {
            "type": "array",
            "description": "Metadatos de los secretos de firma que existen; los más antiguos están en retiro.",
            "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": "El endpoint más el secreto de firma, que se muestra una sola vez.",
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookEndpoint"
          },
          {
            "type": "object",
            "required": [
              "secretId",
              "secret"
            ],
            "properties": {
              "secretId": {
                "type": "string"
              },
              "secret": {
                "type": "string",
                "description": "Secreto de firma (`whsec_` + base64), la clave del HMAC-SHA256 de `webhook-signature` según Standard Webhooks.\nNo se puede recuperar después.\n"
              }
            }
          }
        ]
      },
      "CreateWebhookEndpointRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "URL pública `https` sin credenciales."
          },
          "events": {
            "description": "Tipos de evento a los que se suscribe el endpoint; al menos uno.",
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "description": {
            "description": "Descripción libre del endpoint (hasta 200 caracteres).",
            "type": "string",
            "maxLength": 200
          }
        }
      },
      "UpdateWebhookEndpointRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "url": {
            "description": "Nueva URL pública `https`; se verifica de nuevo como en el registro.",
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "events": {
            "description": "Nueva lista de tipos de evento suscritos; al menos uno.",
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "`null` la borra."
          },
          "status": {
            "description": "`ACTIVE` o `DISABLED`. `SUSPENDED` lo establece únicamente la plataforma.",
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISABLED"
            ]
          }
        }
      },
      "WebhookTestResult": {
        "type": "object",
        "required": [
          "success",
          "latencyMs"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "description": "`true` cuando el endpoint respondió 2xx."
          },
          "responseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599
          },
          "latencyMs": {
            "type": "integer",
            "minimum": 0
          },
          "error": {
            "type": "string",
            "description": "Por qué falló: `http_<status>`, `timeout`, `connection`, `tls`, `url_blocked`,\n`dns_resolution_failed` o `no_active_secret`.\n"
          },
          "webhookId": {
            "type": "string",
            "description": "Se envía como `webhook-id` del evento de prueba."
          }
        }
      }
    },
    "parameters": {
      "BatchIdPath": {
        "description": "Identificador del lote.",
        "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": "Identificador del acuse (`evidenceId`).",
        "name": "evidenceId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/EvidenceId"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Clave generada por el cliente, con alcance al tenant. Repetir una solicitud con la misma\nclave y el mismo cuerpo devuelve la respuesta original con\n`Idempotent-Replayed: true`; la misma clave con un cuerpo distinto se rechaza\ncon `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": "Número máximo de elementos por página, de 1 a 200 (por defecto 50).",
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200,
          "default": 50
        }
      },
      "DomainPath": {
        "description": "Nombre del dominio registrado por el tenant, por ejemplo `example.com`.",
        "name": "domain",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 253
        }
      },
      "SenderEmailPath": {
        "name": "email",
        "in": "path",
        "required": true,
        "description": "Dirección del remitente, codificada con porcentaje (percent-encoding).",
        "schema": {
          "type": "string",
          "format": "email"
        }
      },
      "SenderVerificationTokenQuery": {
        "name": "token",
        "in": "query",
        "required": true,
        "description": "Token de verificación HMAC firmado, entregado al buzón del remitente.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        }
      },
      "KeyIdPath": {
        "description": "Identificador de la clave de API (la parte `keyId` de su 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": "Identificador del tenant.",
        "name": "tenantId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-]{1,62}$"
        }
      },
      "PlanIdPath": {
        "description": "Identificador del 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": "Código de verificación impreso en un acuse. No distingue mayúsculas de minúsculas; se ignoran los espacios y los guiones.",
        "schema": {
          "type": "string",
          "minLength": 4,
          "maxLength": 64
        }
      },
      "DeliveryIdPath": {
        "description": "Identificador de la entrega de webhook.",
        "name": "deliveryId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "EndpointIdPath": {
        "description": "Identificador del endpoint de webhook.",
        "name": "endpointId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      }
    },
    "headers": {
      "IdempotentReplayed": {
        "description": "Presente y con valor `true` cuando la respuesta es una repetición de una solicitud anterior.",
        "schema": {
          "type": "boolean"
        }
      },
      "RetryAfter": {
        "description": "Segundos que se deben esperar antes de reintentar.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "La solicitud está mal formada. El cuerpo no es JSON válido o no es un objeto JSON, un campo no es válido (`errors` lista cada uno), una cabecera o un parámetro de consulta no es válido, o el `Content-Type` no es `application/json` donde se espera un cuerpo JSON (`unsupported_media` en el plano de control).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Clave de API ausente o no válida.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Forbidden": {
        "description": "La clave de API no tiene permiso para realizar esta operación.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "NotFound": {
        "description": "El recurso no existe o pertenece a otro tenant.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unprocessable": {
        "description": "La solicitud está bien formada pero no se puede aceptar.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Se superó el límite de tasa o la cuota.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InternalError": {
        "description": "Fallo inesperado (`internal_error`). La solicitud se puede reintentar; conserve el `requestId` al contactar a soporte.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "Una dependencia (almacenamiento, libro mayor, bóveda, renderizador o servicio de correo) no está disponible temporalmente. Reintente transcurridos los segundos indicados en `Retry-After` cuando venga.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "El cuerpo supera el tamaño permitido (`payload_too_large`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "UnsupportedMediaType": {
        "description": "El `Content-Type` no es compatible (`unsupported_media_type`); envíe `application/json`.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "IdempotencyInProgress": {
        "description": "Una solicitud con la misma `Idempotency-Key` aún se está procesando (`idempotency_request_in_progress`). Reintente transcurridos los segundos indicados en `Retry-After`.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "ControlPlaneConflict": {
        "description": "La solicitud entra en conflicto con el estado actual (duplicado, dominio reclamado, última clave).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "BadGateway": {
        "description": "SES rechazó la operación (`ses_error`) o no está disponible (`ses_unavailable`, 503 con `Retry-After`).",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "PortalBadRequest": {
        "description": "El cuerpo falta, está mal formado o carece de un campo obligatorio, o la confirmación o el código no son válidos.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalForbidden": {
        "description": "La solicitud es de otro origen (`cross_origin`), el código es incorrecto (`invalid_code`) o primero debe confirmarse la recepción (`confirmation_required`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalNotFound": {
        "description": "El handle, la sesión o el adjunto es falso, está mal formado o es desconocido; todos los casos responden igual.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalConflict": {
        "description": "La operación no aplica a este mensaje (`otp_unavailable` o `confirmation_not_required`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalGone": {
        "description": "Terminó el período de acceso del enlace o de la sesión (`expired`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalPayloadTooLarge": {
        "description": "El cuerpo supera el tamaño permitido (`body_too_large`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalUnsupportedMedia": {
        "description": "El `Content-Type` no es `application/json` (`unsupported_media_type`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalRateLimited": {
        "description": "Demasiadas solicitudes desde esta dirección o para este destinatario (`rate_limited`).",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalUnavailable": {
        "description": "Una dependencia no está disponible temporalmente (`unavailable`), o no se pudo registrar la visita; no se confirmó nada. Reintente transcurridos los segundos indicados en `Retry-After`.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "PortalInternalError": {
        "description": "Fallo inesperado (`internal_error`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PortalError"
            }
          }
        }
      },
      "SettingsConflict": {
        "description": "`expectedVersion` no coincide con la versión vigente.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "VerifyInvalidCode": {
        "description": "El código de verificación no coincide con ningún acuse de este mensaje.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "VerifyNotFound": {
        "description": "No se encontró evidencia para el identificador de seguimiento indicado.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      }
    },
    "examples": {
      "SubmitMessageRequest": {
        "summary": "Mensaje con un adjunto en línea y uno cargado",
        "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": "Aceptado; el techo del plan limitó la retención solicitada",
        "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": "La solicitud está mal formada."
      },
      {
        "code": "invalid_request",
        "status": 400,
        "description": "El cuerpo no es un objeto JSON o falta una estructura obligatoria."
      },
      {
        "code": "invalid_json",
        "status": 400,
        "description": "El cuerpo no es JSON válido."
      },
      {
        "code": "invalid_body",
        "status": 400,
        "description": "El cuerpo está mal formado (no es un objeto JSON, no es Base64 válido o no se puede leer)."
      },
      {
        "code": "missing_body",
        "status": 400,
        "description": "La solicitud no trae cuerpo, o el mensaje no tiene ni `html` ni `text`."
      },
      {
        "code": "body_too_large",
        "status": 400,
        "description": "El cuerpo de una solicitud de verificación pública supera el tamaño permitido."
      },
      {
        "code": "validation_error",
        "status": 400,
        "description": "El cuerpo no pasó la validación; `errors` lista cada campo con problema."
      },
      {
        "code": "validation_failed",
        "status": 422,
        "description": "El cuerpo está bien formado pero un campo no es aceptable; `errors` lista cada campo con problema."
      },
      {
        "code": "unprocessable_entity",
        "status": 422,
        "description": "La solicitud está bien formada pero no se puede aceptar."
      },
      {
        "code": "unsupported_media",
        "status": 400,
        "description": "El `Content-Type` no es `application/json` (plano de control)."
      },
      {
        "code": "unsupported_media_type",
        "status": 415,
        "description": "El `Content-Type` no es compatible; envíe `application/json` (o `application/vnd.etsi.asic-e+zip` para contenedores)."
      },
      {
        "code": "payload_too_large",
        "status": 413,
        "description": "El cuerpo supera el tamaño permitido."
      },
      {
        "code": "unauthorized",
        "status": 401,
        "description": "La solicitud no trae un contexto de autorización válido (clave de API ausente o no válida)."
      },
      {
        "code": "forbidden",
        "status": 403,
        "description": "La credencial no tiene permiso para realizar la operación."
      },
      {
        "code": "insufficient_scope",
        "status": 403,
        "description": "La clave de API no posee ninguno de los alcances que exige la operación (`x-cem-scopes`)."
      },
      {
        "code": "scope_missing",
        "status": 403,
        "description": "La credencial no tiene el alcance que exige la operación (para administración, `platform:admin`)."
      },
      {
        "code": "not_found",
        "status": 404,
        "description": "El recurso no existe o pertenece a otro tenant."
      },
      {
        "code": "route_not_found",
        "status": 404,
        "description": "La API no sirve esa ruta."
      },
      {
        "code": "method_not_allowed",
        "status": 405,
        "description": "El método HTTP no está permitido para la ruta; `Allow` lista los válidos."
      },
      {
        "code": "conflict",
        "status": 409,
        "description": "La solicitud entra en conflicto con el estado actual."
      },
      {
        "code": "rate_limit_exceeded",
        "status": 429,
        "description": "El tenant superó su tasa de solicitudes; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "rate_limited",
        "status": 429,
        "description": "Se superó el límite de tasa del verificador público; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "internal_error",
        "status": 500,
        "description": "Fallo inesperado; conserve el `requestId`."
      },
      {
        "code": "service_unavailable",
        "status": 503,
        "description": "Una dependencia no está disponible temporalmente; reintente transcurridos los segundos de `Retry-After` cuando venga."
      },
      {
        "code": "invalid_query_parameter",
        "status": 400,
        "description": "Un parámetro de consulta no es válido; `errors` lo nombra."
      },
      {
        "code": "invalid_query",
        "status": 400,
        "description": "Los parámetros de consulta de una solicitud de lote no son válidos."
      },
      {
        "code": "invalid_limit",
        "status": 400,
        "description": "`limit` está fuera del rango permitido."
      },
      {
        "code": "invalid_cursor",
        "status": 400,
        "description": "El `cursor` no es válido; no construya ni modifique cursores."
      },
      {
        "code": "invalid_precondition",
        "status": 400,
        "description": "`If-Match` no es un `ETag` devuelto por esta API."
      },
      {
        "code": "invalid_identifier",
        "status": 400,
        "description": "Un identificador de la ruta o del cuerpo está mal formado."
      },
      {
        "code": "missing_idempotency_key",
        "status": 400,
        "description": "La cabecera `Idempotency-Key` es obligatoria en este `POST`."
      },
      {
        "code": "idempotency_key_required",
        "status": 400,
        "description": "La cabecera `Idempotency-Key` es obligatoria para registrar un endpoint de webhook."
      },
      {
        "code": "invalid_idempotency_key",
        "status": 400,
        "description": "La `Idempotency-Key` no cumple el formato permitido."
      },
      {
        "code": "idempotency_key_reused",
        "status": 422,
        "description": "La `Idempotency-Key` ya se usó con un cuerpo de solicitud distinto."
      },
      {
        "code": "idempotency_request_in_progress",
        "status": 409,
        "description": "Una solicitud con la misma `Idempotency-Key` aún se está procesando; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "invalid_message_options",
        "status": 400,
        "description": "Las `options` del mensaje no son válidas."
      },
      {
        "code": "message_too_large",
        "status": 413,
        "description": "El mensaje supera `api.message.maxBytes`."
      },
      {
        "code": "inline_attachments_too_large",
        "status": 413,
        "description": "Los adjuntos en línea superan `api.inline.maxBytes`."
      },
      {
        "code": "too_many_recipients",
        "status": 422,
        "description": "El total de destinatarios supera `api.recipients.max`."
      },
      {
        "code": "too_many_metadata_entries",
        "status": 422,
        "description": "El mensaje tiene más entradas de `metadata` de las permitidas (con Fast Onboarding se reserva una)."
      },
      {
        "code": "attachment_not_found",
        "status": 422,
        "description": "Un `attachmentId` referenciado no existe o pertenece a otro tenant."
      },
      {
        "code": "attachment_mismatch",
        "status": 422,
        "description": "El archivo cargado no coincide con el tamaño o el SHA-256 reservados para él."
      },
      {
        "code": "sender_not_authorized",
        "status": 403,
        "description": "La dirección del remitente está deshabilitada o no está permitida para el tenant según su política de remitentes."
      },
      {
        "code": "sender_not_verified",
        "status": 403,
        "description": "El buzón del remitente no está verificado (Fast Onboarding); `verificationSent` indica si se acaba de enviar un correo de verificación."
      },
      {
        "code": "domain_not_verified",
        "status": 403,
        "description": "El dominio del remitente no está verificado y activo para el tenant."
      },
      {
        "code": "domain_not_owned",
        "status": 403,
        "description": "El dominio del remitente pertenece a otra cuenta."
      },
      {
        "code": "message_not_found",
        "status": 404,
        "description": "El mensaje no existe o pertenece a otro tenant."
      },
      {
        "code": "recipient_not_found",
        "status": 404,
        "description": "El destinatario no existe en el mensaje."
      },
      {
        "code": "evidence_not_found",
        "status": 404,
        "description": "El acuse no existe o pertenece a otro tenant."
      },
      {
        "code": "mdn_not_found",
        "status": 404,
        "description": "El MDN entrante no existe o pertenece a otro tenant."
      },
      {
        "code": "artifact_not_found",
        "status": 404,
        "description": "El artefacto no está almacenado para el acuse."
      },
      {
        "code": "invalid_evidence_format",
        "status": 400,
        "description": "`format` no es `xml`, `pdf`, `eml` ni `asice`."
      },
      {
        "code": "artifact_not_available",
        "status": 422,
        "description": "El artefacto solicitado no se puede producir para este acuse (por ejemplo, el contenedor está deshabilitado por configuración)."
      },
      {
        "code": "evidence_purged",
        "status": 410,
        "description": "La custodia terminó y los artefactos fueron purgados; el cuerpo conserva los resúmenes."
      },
      {
        "code": "render_unavailable",
        "status": 503,
        "description": "El renderizador o sus llaves no están disponibles temporalmente; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "storage_unavailable",
        "status": 503,
        "description": "El almacenamiento de evidencia no está disponible temporalmente; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "evidence_key_missing",
        "status": 500,
        "description": "No consta la ubicación del XML firmado del acuse."
      },
      {
        "code": "legal_hold_disabled",
        "status": 403,
        "description": "El plan del tenant no permite retenciones legales."
      },
      {
        "code": "invalid_track_id",
        "status": 400,
        "description": "`trackId` está mal formado."
      },
      {
        "code": "invalid_code_format",
        "status": 400,
        "description": "El código de verificación está mal formado."
      },
      {
        "code": "invalid_verification_code",
        "status": 403,
        "description": "El código de verificación no coincide con ningún acuse del mensaje."
      },
      {
        "code": "invalid_sha256",
        "status": 400,
        "description": "`sha256` no tiene 64 caracteres hexadecimales."
      },
      {
        "code": "verification_unavailable",
        "status": 503,
        "description": "No se puede leer el llavero de códigos de los acuses; no se concede ningún detalle (falla cerrado). Intente de nuevo más tarde."
      },
      {
        "code": "container_too_large",
        "status": 413,
        "description": "El contenedor supera el tamaño permitido."
      },
      {
        "code": "not_asic_container",
        "status": 415,
        "description": "El contenido no es un archivo ZIP (contenedor ASiC-E)."
      },
      {
        "code": "corrupt_container",
        "status": 400,
        "description": "El contenedor está corrupto."
      },
      {
        "code": "container_limits",
        "status": 400,
        "description": "El contenedor supera los límites de tamaño o de entradas."
      },
      {
        "code": "duplicate_entry",
        "status": 400,
        "description": "El contenedor tiene entradas duplicadas."
      },
      {
        "code": "unsafe_entry",
        "status": 400,
        "description": "El contenedor tiene una entrada con un nombre inseguro."
      },
      {
        "code": "unsupported_compression",
        "status": 400,
        "description": "El contenedor usa cifrado o una compresión no compatible."
      },
      {
        "code": "zip_bomb",
        "status": 400,
        "description": "La tasa de compresión del contenedor es excesiva."
      },
      {
        "code": "invalid_batch_request",
        "status": 400,
        "description": "La solicitud para crear el lote no es válida; `errors` lista los campos."
      },
      {
        "code": "manifest_too_large",
        "status": 413,
        "description": "El manifiesto declarado supera el tamaño permitido; divídalo en varios lotes."
      },
      {
        "code": "manifest_not_uploaded",
        "status": 422,
        "description": "El manifiesto aún no se ha cargado."
      },
      {
        "code": "manifest_mismatch",
        "status": 422,
        "description": "El manifiesto cargado no coincide con el tamaño y el SHA-256 declarados."
      },
      {
        "code": "batch_not_found",
        "status": 404,
        "description": "El lote no existe o pertenece a otro tenant."
      },
      {
        "code": "batch_not_startable",
        "status": 409,
        "description": "El lote ya terminó y no se puede iniciar."
      },
      {
        "code": "batch_not_cancelable",
        "status": 409,
        "description": "El lote ya terminó y no se puede cancelar."
      },
      {
        "code": "batch_store_error",
        "status": 503,
        "description": "El almacén de lotes falló temporalmente."
      },
      {
        "code": "batch_throttled",
        "status": 503,
        "description": "No se pudieron escribir los resultados de las filas (limitación de capacidad); reintente."
      },
      {
        "code": "workflow_start_error",
        "status": 503,
        "description": "No se pudo iniciar el flujo de procesamiento; reintente."
      },
      {
        "code": "workflow_stop_error",
        "status": 503,
        "description": "No se pudo detener el flujo de procesamiento; reintente."
      },
      {
        "code": "invalid_events",
        "status": 400,
        "description": "`events` debe ser una lista no vacía de tipos de evento."
      },
      {
        "code": "invalid_url",
        "status": 400,
        "description": "Falta `url` o es demasiado larga."
      },
      {
        "code": "invalid_description",
        "status": 400,
        "description": "`description` no es una cadena de la longitud permitida."
      },
      {
        "code": "invalid_status",
        "status": 400,
        "description": "`status` debe ser `ACTIVE` o `DISABLED`."
      },
      {
        "code": "url_blocked",
        "status": 422,
        "description": "La URL no está permitida (no es `https`, lleva credenciales o es una dirección no pública)."
      },
      {
        "code": "url_unresolvable",
        "status": 422,
        "description": "El host de la URL no se resuelve."
      },
      {
        "code": "endpoint_limit_reached",
        "status": 422,
        "description": "El tenant alcanzó `webhooks.maxEndpoints`."
      },
      {
        "code": "concurrent_update",
        "status": 409,
        "description": "El endpoint cambió de forma concurrente; reintente."
      },
      {
        "code": "suppression_not_found",
        "status": 404,
        "description": "La entrada de supresión no existe para el tenant."
      },
      {
        "code": "quota_store_error",
        "status": 503,
        "description": "No se pudieron actualizar temporalmente los contadores de cuota."
      },
      {
        "code": "platform_admin_required",
        "status": 403,
        "description": "Solo los administradores de la plataforma pueden hacerlo."
      },
      {
        "code": "tenant_mismatch",
        "status": 403,
        "description": "Una credencial de tenant solo puede acceder a la configuración de su propio tenant."
      },
      {
        "code": "tenant_not_active",
        "status": 403,
        "description": "El tenant no está activo; su configuración no se puede cambiar."
      },
      {
        "code": "plan_exists",
        "status": 409,
        "description": "El plan ya existe."
      },
      {
        "code": "plans_read_only",
        "status": 501,
        "description": "Este despliegue no tiene almacén de planes; los planes son de solo lectura."
      },
      {
        "code": "settings_rejected",
        "status": 422,
        "description": "La validación del catálogo rechazó la configuración (tipo, rango, techo o parámetro de infraestructura)."
      },
      {
        "code": "settings_conflict",
        "status": 409,
        "description": "`expectedVersion` o `If-Match` no coincide con la versión vigente."
      },
      {
        "code": "plan_not_found",
        "status": 404,
        "description": "El plan no existe."
      },
      {
        "code": "tenant_exists",
        "status": 409,
        "description": "El tenant ya existe."
      },
      {
        "code": "tenant_not_found",
        "status": 404,
        "description": "El tenant no existe."
      },
      {
        "code": "tenant_deleted",
        "status": 409,
        "description": "El tenant está eliminado; un tenant eliminado no se puede restaurar."
      },
      {
        "code": "tenant_conflict",
        "status": 409,
        "description": "El tenant cambió de forma concurrente; reintente."
      },
      {
        "code": "tenant_inactive",
        "status": 403,
        "description": "El tenant no está activo."
      },
      {
        "code": "invalid_domain",
        "status": 422,
        "description": "El nombre de dominio no es válido."
      },
      {
        "code": "reserved_domain",
        "status": 422,
        "description": "Los dominios de la plataforma no los puede registrar un tenant."
      },
      {
        "code": "domain_exists",
        "status": 409,
        "description": "El dominio ya está registrado por el tenant."
      },
      {
        "code": "domain_claimed",
        "status": 409,
        "description": "El dominio ya está registrado por otra cuenta."
      },
      {
        "code": "domain_conflict",
        "status": 409,
        "description": "El dominio cambió de forma concurrente; reintente."
      },
      {
        "code": "domain_limit_reached",
        "status": 422,
        "description": "El tenant alcanzó su límite de dominios."
      },
      {
        "code": "domain_not_found",
        "status": 404,
        "description": "El dominio no está registrado por el tenant."
      },
      {
        "code": "domain_not_registered",
        "status": 422,
        "description": "Registre el dominio antes de autorizar a sus remitentes."
      },
      {
        "code": "ses_error",
        "status": 502,
        "description": "El servicio de correo rechazó la operación."
      },
      {
        "code": "ses_unavailable",
        "status": 503,
        "description": "El servicio de correo no está disponible temporalmente; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "whole_domain_requires_verified_domain",
        "status": 422,
        "description": "`WHOLE_DOMAIN` necesita al menos un dominio verificado (`ACTIVE`)."
      },
      {
        "code": "fast_onboarding_unavailable",
        "status": 422,
        "description": "Fast Onboarding no está configurado en esta plataforma."
      },
      {
        "code": "invalid_sender",
        "status": 422,
        "description": "El remitente no es una dirección de correo válida."
      },
      {
        "code": "sender_not_found",
        "status": 404,
        "description": "El remitente no está registrado."
      },
      {
        "code": "sender_disabled",
        "status": 403,
        "description": "La dirección del remitente está deshabilitada."
      },
      {
        "code": "sender_limit_reached",
        "status": 422,
        "description": "El tenant alcanzó su límite de remitentes."
      },
      {
        "code": "invalid_verification_token",
        "status": 400,
        "description": "El token de verificación del remitente falta o no es válido."
      },
      {
        "code": "verification_token_expired",
        "status": 403,
        "description": "El enlace de verificación del remitente venció."
      },
      {
        "code": "api_key_not_found",
        "status": 404,
        "description": "La clave de API no existe."
      },
      {
        "code": "api_key_inactive",
        "status": 409,
        "description": "La clave ya está revocada o vencida."
      },
      {
        "code": "api_key_limit_reached",
        "status": 422,
        "description": "El tenant alcanzó su límite de claves de API activas."
      },
      {
        "code": "last_active_key",
        "status": 409,
        "description": "No se puede revocar la última clave de API activa; en su lugar, rótela."
      },
      {
        "code": "invalid_environment",
        "status": 400,
        "description": "`environment` debe ser `live` o `test`."
      },
      {
        "code": "invalid_grace",
        "status": 422,
        "description": "`graceDays` está fuera del rango permitido."
      },
      {
        "code": "invalid_expiry",
        "status": 422,
        "description": "`expiresAt` debe estar en el futuro."
      },
      {
        "code": "unknown_scope",
        "status": 422,
        "description": "La solicitud nombra un alcance que no existe."
      },
      {
        "code": "scope_not_grantable",
        "status": 403,
        "description": "El alcance no se puede conceder a través de la API (`platform:admin` se aprovisiona por otra vía) o excede lo que posee la clave que lo emite."
      }
    ],
    "fields": [
      {
        "code": "required",
        "description": "Falta una propiedad obligatoria."
      },
      {
        "code": "invalid",
        "description": "El valor no es válido."
      },
      {
        "code": "invalid_value",
        "description": "El valor está fuera de los valores aceptados."
      },
      {
        "code": "invalid_type",
        "description": "El valor tiene un tipo JSON incorrecto."
      },
      {
        "code": "unknown_field",
        "description": "La propiedad no forma parte del contrato (las solicitudes son estrictas)."
      },
      {
        "code": "unknown_property",
        "description": "La propiedad no forma parte del contrato (las solicitudes son estrictas)."
      },
      {
        "code": "out_of_range",
        "description": "Un número o la longitud de una lista está fuera del rango permitido."
      },
      {
        "code": "too_long",
        "description": "El texto supera la longitud permitida."
      },
      {
        "code": "invalid_timestamp",
        "description": "El valor no es un instante RFC 3339."
      },
      {
        "code": "invalid_identifier",
        "description": "El valor no es un identificador válido."
      },
      {
        "code": "invalid_integer",
        "description": "El valor no es un entero."
      },
      {
        "code": "invalid_range",
        "description": "El rango está invertido (`from` debe ser anterior a `to`)."
      },
      {
        "code": "invalid_enum",
        "description": "El valor no es uno de los valores permitidos."
      },
      {
        "code": "invalid_email_address",
        "description": "El valor no es una dirección de correo válida."
      },
      {
        "code": "invalid_email",
        "description": "La dirección no es una dirección de correo válida."
      },
      {
        "code": "invalid_digest",
        "description": "El resumen SHA-256 está mal formado."
      },
      {
        "code": "invalid_base64",
        "description": "El valor de `contentBase64` está vacío o no es Base64 válido."
      },
      {
        "code": "invalid_filename",
        "description": "El nombre del archivo no es válido (1 a 255 caracteres)."
      },
      {
        "code": "invalid_media_type",
        "description": "El tipo de medio no es válido."
      },
      {
        "code": "invalid_subject",
        "description": "El asunto no es válido (1 a 998 caracteres, sin caracteres de control)."
      },
      {
        "code": "invalid_client_track_id",
        "description": "`clientTrackId` debe tener de 1 a 128 caracteres sin caracteres de control."
      },
      {
        "code": "invalid_metadata_key",
        "description": "Las claves de metadata deben tener de 1 a 64 caracteres."
      },
      {
        "code": "invalid_metadata_value",
        "description": "Los valores de metadata deben ser cadenas de hasta 512 caracteres."
      },
      {
        "code": "ambiguous_attachment",
        "description": "Un adjunto debe ser en línea o cargado previamente, no ambos."
      },
      {
        "code": "above_maximum",
        "description": "El valor del parámetro supera el máximo del catálogo."
      },
      {
        "code": "below_minimum",
        "description": "El valor del parámetro es menor que el mínimo del catálogo."
      },
      {
        "code": "pattern_mismatch",
        "description": "El valor del parámetro no cumple el patrón exigido."
      },
      {
        "code": "empty_string",
        "description": "El valor del parámetro no puede estar vacío."
      },
      {
        "code": "empty_item",
        "description": "Un elemento de la lista del parámetro está vacío."
      },
      {
        "code": "duplicate_list_item",
        "description": "La lista del parámetro tiene un elemento repetido."
      },
      {
        "code": "invalid_list_item",
        "description": "Un elemento de la lista del parámetro no es válido."
      },
      {
        "code": "too_few_items",
        "description": "La lista del parámetro tiene menos elementos de los permitidos."
      },
      {
        "code": "too_many_items",
        "description": "La lista del parámetro tiene más elementos de los permitidos."
      },
      {
        "code": "invalid_duration",
        "description": "El valor del parámetro no es una duración válida."
      },
      {
        "code": "non_finite",
        "description": "El valor del parámetro no es un número finito."
      }
    ],
    "portal": [
      {
        "code": "not_found",
        "status": 404,
        "description": "El enlace o la sesión es falso, está mal formado o es desconocido; todos los casos responden igual."
      },
      {
        "code": "expired",
        "status": 410,
        "description": "Terminó el período de acceso del enlace o de la sesión."
      },
      {
        "code": "cross_origin",
        "status": 403,
        "description": "La solicitud no proviene del origen del portal."
      },
      {
        "code": "method_not_allowed",
        "status": 405,
        "description": "Solo se acepta `POST`."
      },
      {
        "code": "unsupported_media_type",
        "status": 415,
        "description": "El `Content-Type` debe ser `application/json`."
      },
      {
        "code": "body_too_large",
        "status": 413,
        "description": "El cuerpo supera el tamaño permitido."
      },
      {
        "code": "missing_body",
        "status": 400,
        "description": "Se requiere un cuerpo JSON."
      },
      {
        "code": "invalid_body",
        "status": 400,
        "description": "El cuerpo está mal formado o falta un campo obligatorio (`handle`, `session`, `index`) o no es válido."
      },
      {
        "code": "invalid_json",
        "status": 400,
        "description": "El cuerpo no es JSON válido."
      },
      {
        "code": "not_acknowledged",
        "status": 400,
        "description": "Se requiere confirmación explícita (`acknowledged: true`)."
      },
      {
        "code": "invalid_code",
        "status": 400,
        "description": "El código no consta de 8 dígitos."
      },
      {
        "code": "invalid_code",
        "status": 403,
        "description": "El código es incorrecto o venció; solicite uno nuevo."
      },
      {
        "code": "otp_not_required",
        "status": 400,
        "description": "Este mensaje no usa un código de un solo uso."
      },
      {
        "code": "otp_unavailable",
        "status": 409,
        "description": "No se puede enviar un código para este mensaje (no hay dirección registrada o servicio de correo)."
      },
      {
        "code": "confirmation_not_required",
        "status": 409,
        "description": "El mensaje no requiere confirmación."
      },
      {
        "code": "confirmation_required",
        "status": 403,
        "description": "Confirme la recepción antes de descargar."
      },
      {
        "code": "rate_limited",
        "status": 429,
        "description": "Demasiadas solicitudes; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "unavailable",
        "status": 503,
        "description": "No disponible temporalmente; reintente transcurridos los segundos de `Retry-After`."
      },
      {
        "code": "internal_error",
        "status": 500,
        "description": "Fallo inesperado."
      }
    ]
  }
}
