{
  "openapi": "3.0.3",
  "info": {
    "title": "EviPost API",
    "version": "1.0",
    "description": "REST API for submitting and querying certified physical postal communications through Namirial Notify. EviPost delivers certified postal items (equivalent to a burofax) with configurable certification levels, notarial custody, affidavit generation, and real-time push notifications. For the public Namirial Notify API environments, this V1 service is exposed under the `/v1` base path. The `servers` entries below already include that public base path. Some lower-level technical artifacts may show the underlying route without the prefix. For customer integrations, use the public URLs produced by this specification.\n"
  },
  "servers": [
    {
      "url": "https://api.evicertia.com/v1",
      "description": "Production"
    },
    {
      "url": "https://api.ecertia.com/v1",
      "description": "Pre-production / QA"
    }
  ],
  "tags": [
    {
      "name": "EviPost",
      "description": "Certified physical postal communications and their delivery evidence."
    }
  ],
  "paths": {
    "/EviPost/Submit": {
      "post": {
        "tags": [
          "EviPost"
        ],
        "summary": "Submit a certified postal communication",
        "operationId": "eviPostSubmit",
        "security": [
          {
            "basicAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-Evi-IdempotencyToken",
            "in": "header",
            "required": false,
            "description": "Optional idempotency token (GUID recommended) to prevent duplicate submissions on retry. A replay of a cached `200 OK` submission returns `202 Accepted`. Responses `400`, `401`, `408`, `409`, `429`, and `5xx` are not cached for replay.\n",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EviPostSubmitRequest"
              },
              "examples": {
                "registeredPost": {
                  "summary": "Registered postal communication",
                  "value": {
                    "LookupKey": "a2R4S25kWiu79fsbubSXkw==",
                    "Document": "<base64-encoded PDF>",
                    "RecipientName": "Juan Valido",
                    "RecipientLegalName": "Juan Valido",
                    "RecipientAddress": {
                      "StreetAddress": "Gran Via 74, 5 A",
                      "PostalCode": "28014",
                      "Locality": "Madrid",
                      "Region": "Madrid",
                      "Country": "ES"
                    },
                    "RecipientPhone": "+34677000111",
                    "RecipientEmail": "recipient@example.com",
                    "IssuerName": "Pedro Comprador",
                    "IssuerLegalName": "Pedro Valido",
                    "IssuerAddress": {
                      "StreetAddress": "C/ Gran Via, 1, 1-A",
                      "PostalCode": "28001",
                      "Locality": "Madrid",
                      "Region": "Madrid",
                      "Country": "ES"
                    },
                    "IssuerPhone": "+34677888777",
                    "IssuerEmail": "pedro.comprador@example.com",
                    "IssuerComments": "Sending in March.",
                    "Options": {
                      "PostServiceType": "Registered",
                      "Language": "es",
                      "CertificationLevel": "Advanced_EU",
                      "AffidavitProfile": "AdvancedContentOnSubmit",
                      "AffidavitsOnDemandEnabled": false,
                      "OnlineRetentionPeriod": 1,
                      "NotaryRetentionPeriod": 5,
                      "NotaryProfile": "notary-profile-id",
                      "EvidenceAccessControlMethod": "AutoChallenge",
                      "CostCentre": "dept-legal",
                      "PushNotificationUrl": "https://your-server.example.com/callbacks/evipost",
                      "PushNotificationFilter": [
                        "Processed",
                        "Sent",
                        "Delivered",
                        "Closed"
                      ],
                      "PushNotificationExtraData": "{\"myId\": \"order-12345\"}"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Postal communication accepted",
            "headers": {
              "X-Evi-IdempotencyStatus": {
                "description": "Idempotency outcome for the submission request.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "New"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EviPostSubmitResponse"
                },
                "example": {
                  "uniqueId": "69819c3e-0c0e-42b3-a792-a33b014a13a2"
                }
              }
            }
          },
          "202": {
            "description": "Idempotent replay. The same X-Evi-IdempotencyToken was used for a cached 200 OK submission. The original response body is returned; the postal communication is not resubmitted.",
            "headers": {
              "X-Evi-IdempotencyStatus": {
                "description": "Idempotency outcome for the submission request.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "Replay"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EviPostSubmitResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or business rule failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EviPostError"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed"
          },
          "403": {
            "description": "Access denied. The authenticated account is not provisioned for EviPost. Contact your Namirial Notify account manager to enable this service.\n"
          },
          "409": {
            "description": "Another Submit with the same X-Evi-IdempotencyToken is currently in flight.",
            "headers": {
              "X-Evi-IdempotencyStatus": {
                "description": "Idempotency outcome for the submission request.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "Conflict"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/EviPost/Query": {
      "get": {
        "tags": [
          "EviPost"
        ],
        "summary": "Query certified postal communications (GET)",
        "operationId": "eviPostQueryGet",
        "security": [
          {
            "basicAuth": []
          }
        ],
        "parameters": [
          {
            "name": "WithUniqueIds",
            "in": "query",
            "description": "Filter by one or more unique IDs (comma-separated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "WithLookupKeys",
            "in": "query",
            "description": "Filter by one or more lookup keys (comma-separated).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "OnState",
            "in": "query",
            "description": "Filter by current state. Contact support before using this parameter.",
            "schema": {
              "type": "string",
              "enum": [
                "Draft",
                "Submitted",
                "Processed",
                "Sent",
                "Dispatched",
                "Delivered",
                "Missing",
                "Closed",
                "Issued",
                "Failed",
                "Undelivered",
                "Disposed",
                "Cancelled"
              ]
            }
          },
          {
            "name": "WithOutcome",
            "in": "query",
            "description": "Filter by outcome. Contact support before using this parameter.",
            "schema": {
              "type": "string",
              "enum": [
                "None",
                "Delivered",
                "Dispatched",
                "Acknowledged",
                "Declined",
                "Hindered",
                "Cancelled",
                "Expired",
                "Failed",
                "Sent",
                "Rejected",
                "Undelivered",
                "Disposed"
              ]
            }
          },
          {
            "name": "OrderResultsBy",
            "in": "query",
            "description": "Sort field for results.",
            "schema": {
              "type": "string",
              "enum": [
                "CreationDate"
              ]
            }
          },
          {
            "name": "Offset",
            "in": "query",
            "description": "Number of results to skip for pagination.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Limit",
            "in": "query",
            "description": "Maximum results to return. Defaults to 100; drops to 25 when IncludeAffidavitsOnResult is true.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "name": "IncludeDocumentOnResult",
            "in": "query",
            "description": "Include the base64-encoded original document in results.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "IncludeAffidavitsOnResult",
            "in": "query",
            "description": "Include affidavit metadata in results.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "IncludeAffidavitBlobsOnResult",
            "in": "query",
            "deprecated": true,
            "description": "Deprecated. When true with IncludeAffidavitsOnResult, includes Base64 affidavit PDFs in affidavits[].bytes and limits the query to one postal communication. Set false for metadata-only results and use /AffidavitsDownload for new integrations.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Query executed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EviPostQueryResponse"
                },
                "example": {
                  "results": [
                    {
                      "evidenceId": "3977d143-a6cb-4642-abc6-a33b016cbec2",
                      "lookupKey": "a2R4S25kWiu79fsbubSXkw==",
                      "recipientName": "Juan Valido",
                      "address": {
                        "streetAddress": "Gran Via 74, 5 A",
                        "postalCode": "28014",
                        "locality": "Madrid",
                        "region": "Madrid",
                        "country": "ES"
                      },
                      "state": "Sent",
                      "stateDate": "2026-01-15T10:00:07Z",
                      "lastStateChangeDate": "2026-01-15T10:00:11Z",
                      "outcome": "None",
                      "outcomeDate": "2026-01-15T10:00:00Z",
                      "creationDate": "2026-01-15T10:00:00Z",
                      "submittedOn": "2026-01-15T10:00:00Z",
                      "processedOn": "2026-01-15T10:00:03Z",
                      "sentOn": "2026-01-15T10:00:07Z",
                      "timeToLive": 43200,
                      "costCentre": "dept-legal",
                      "affidavits": [
                        {
                          "uniqueId": "000c1f70-42ac-a3ea-149f-943879726a87",
                          "date": "2026-01-15T10:00:12Z",
                          "evidenceUniqueId": "3977d143-a6cb-4642-abc6-a33b016cbec2",
                          "description": "Certification of postal communication"
                        }
                      ]
                    }
                  ],
                  "totalMatches": 1
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed"
          },
          "403": {
            "description": "Access denied. The authenticated account is not provisioned for EviPost. Contact your Namirial Notify account manager to enable this service.\n"
          }
        }
      }
    },
    "/EviPost/Cancel": {
      "post": {
        "tags": [
          "EviPost"
        ],
        "summary": "Cancel a postal communication",
        "operationId": "eviPostCancel",
        "description": "Cancels a previously submitted EviPost that has not yet been dispatched to the postal carrier. Only the account that submitted the postal communication can cancel it. Requires the `CanUseCancel` permission in addition to the standard EviPost API permission.\n",
        "security": [
          {
            "basicAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EviPostCancelRequest"
              },
              "example": {
                "UniqueId": "69819c3e-0c0e-42b3-a792-a33b014a13a2"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EviPostCancelResponse"
                },
                "example": {
                  "uniqueId": "69819c3e-0c0e-42b3-a792-a33b014a13a2"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. The UniqueId is missing or not a valid UUID."
          },
          "401": {
            "description": "Authentication failed, or the authenticated account is not the owner of the postal communication."
          },
          "403": {
            "description": "The authenticated account lacks the required `CanUseCancel` permission, or EviPost is not enabled for this account.\n"
          },
          "404": {
            "description": "No postal communication with the given UniqueId was found."
          }
        }
      }
    },
    "/EviPost/AffidavitRequest": {
      "post": {
        "tags": [
          "EviPost"
        ],
        "summary": "Request an on-demand affidavit",
        "operationId": "eviPostAffidavitRequest",
        "description": "Generates a custom affidavit for a previously submitted EviPost. **Requires** that `AffidavitsOnDemandEnabled: true` was set in the original Submit request, and that `AffidavitProfile` was set to `AdvancedContentOnSubmit`, `AdvancedContentOnClose`, or `AdvancedContentOnSubmitAndOnClose`. The affidavit is generated asynchronously.\n",
        "security": [
          {
            "basicAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EviPostAffidavitRequest"
              },
              "example": {
                "UniqueId": "87ffa214-e773-4bd5-9b8d-a8ef00fd80f8",
                "IncludeDocument": true,
                "IncludeEvents": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Affidavit request accepted. Generation is asynchronous.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EviPostAffidavitResponse"
                },
                "example": {
                  "requestId": "79726a87000c1f7042aca3ea149f9438"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or business rule failure",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EviPostError"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    },
    "schemas": {
      "EviPostSubmitRequest": {
        "type": "object",
        "required": [
          "Document",
          "RecipientAddress"
        ],
        "properties": {
          "LookupKey": {
            "type": "string",
            "description": "Optional identifier set by the issuer. Can be used later to locate the evidence via the Query endpoint.\n"
          },
          "Document": {
            "type": "string",
            "description": "The document or letter to be sent, base64-encoded PDF."
          },
          "RecipientName": {
            "type": "string",
            "description": "Display name of the recipient."
          },
          "RecipientLegalName": {
            "type": "string",
            "description": "Legal name or corporate name of the recipient."
          },
          "RecipientAddress": {
            "$ref": "#/components/schemas/EviPostAddress"
          },
          "RecipientPhone": {
            "type": "string",
            "description": "Recipient's mobile phone number."
          },
          "RecipientEmail": {
            "type": "string",
            "format": "email",
            "description": "Email address of the recipient."
          },
          "IssuerName": {
            "type": "string",
            "description": "Display name of the sender."
          },
          "IssuerLegalName": {
            "type": "string",
            "description": "Legal name or corporate name of the sender."
          },
          "IssuerAddress": {
            "$ref": "#/components/schemas/EviPostAddress"
          },
          "IssuerPhone": {
            "type": "string",
            "description": "Issuer's mobile phone number."
          },
          "IssuerEmail": {
            "type": "string",
            "format": "email",
            "description": "Email address of the issuer."
          },
          "IssuerComments": {
            "type": "string",
            "description": "Optional additional comments from the issuer."
          },
          "Options": {
            "$ref": "#/components/schemas/EviPostOptions"
          }
        }
      },
      "EviPostAddress": {
        "type": "object",
        "required": [
          "StreetAddress",
          "PostalCode",
          "Locality",
          "Country"
        ],
        "properties": {
          "StreetAddress": {
            "type": "string",
            "description": "Street name and number."
          },
          "PostalCode": {
            "type": "string",
            "description": "Postal code."
          },
          "Locality": {
            "type": "string",
            "description": "City or town."
          },
          "Region": {
            "type": "string",
            "description": "Province or region. Required in RecipientAddress when PostServiceType is Registered. The issuer region must also be present, either supplied in IssuerAddress or filled from the site address.\n"
          },
          "Country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code (e.g. ES)."
          },
          "PostOfficeBoxAddress": {
            "type": "string",
            "description": "Post office box address, if applicable."
          }
        }
      },
      "EviPostOptions": {
        "type": "object",
        "properties": {
          "PostServiceType": {
            "type": "string",
            "description": "Controls the type of postal delivery. `Registered` sends a certified postal communication equivalent to a burofax (via the national postal operator, Correos). `Letter` sends to a printing and enveloping provider (MRW) and requires prior provisioning by support plus a `PostServiceProfile`. `LetterLite` is a lower-cost single-attempt printed certified letter, available only within mainland Spain and with the delivery-attempt and disposal options disabled. EviPost physical delivery is currently available for destinations within Spain. Defaults to `Registered` when omitted.\n",
            "enum": [
              "Registered",
              "Letter",
              "LetterLite"
            ],
            "default": "Registered"
          },
          "PostServiceProfile": {
            "type": "string",
            "description": "Profile identifier selecting a set of configurable parameters (paper type, envelope size, QR code position). Required when `PostServiceType` is `Letter`; not used for `Registered` or `LetterLite`. Must be provisioned by support before use.\n"
          },
          "CertificationLevel": {
            "type": "string",
            "description": "Legal framework and geographic variant for certification. Supported values include `Standard`, `Advanced`, and their regional variants, such as `Standard_EU` or `Advanced_EU`. Availability depends on the account. EviPost does not support QERDS certification levels.\n",
            "enum": [
              "Standard",
              "Advanced",
              "Standard_CO",
              "Standard_CR",
              "Standard_EC",
              "Standard_EU",
              "Standard_MX",
              "Standard_PE",
              "Advanced_CO",
              "Advanced_CR",
              "Advanced_EC",
              "Advanced_EU",
              "Advanced_MX",
              "Advanced_PE"
            ]
          },
          "AffidavitProfile": {
            "type": "string",
            "description": "Controls which affidavits are generated during the process.",
            "enum": [
              "None",
              "Basic",
              "AdvancedContentOnSubmit",
              "AdvancedContentOnClose",
              "AdvancedContentOnSubmitAndOnClose"
            ]
          },
          "AffidavitsOnDemandEnabled": {
            "type": "boolean",
            "description": "Enables on-demand affidavit generation via the AffidavitRequest endpoint. Requires `AffidavitProfile` to be set to one of the advanced content profiles (`AdvancedContentOnSubmit`, `AdvancedContentOnClose`, or `AdvancedContentOnSubmitAndOnClose`).\n"
          },
          "OnlineRetentionPeriod": {
            "type": "integer",
            "description": "Time in years for online evidence retention. Default is 1.",
            "default": 1
          },
          "NotaryRetentionPeriod": {
            "type": "integer",
            "description": "Years of notarial custody. Set to 5 to apply notarial retention. Set to 0 to disable. `NotaryProfile` is required when this value is greater than 0.\n"
          },
          "NotaryProfile": {
            "type": "string",
            "description": "Identifier of the notary who will carry out custody. Required when `NotaryRetentionPeriod` is greater than 0.\n"
          },
          "EvidenceAccessControlMethod": {
            "type": "string",
            "description": "Controls how recipients access the evidence record. When omitted, the account's configured default method applies. When set to `Challenge`, both `EvidenceAccessControlChallenge` and `EvidenceAccessControlChallengeResponse` must also be supplied.\n",
            "enum": [
              "AutoChallenge",
              "Public",
              "Challenge"
            ]
          },
          "EvidenceAccessControlChallenge": {
            "type": "string",
            "description": "Challenge question. Required when `EvidenceAccessControlMethod` is `Challenge`.\n"
          },
          "EvidenceAccessControlChallengeResponse": {
            "type": "string",
            "description": "Answer to the challenge question. Required when `EvidenceAccessControlMethod` is `Challenge`.\n"
          },
          "Language": {
            "type": "string",
            "description": "Language for the evidence record and generated affidavits. Defaults to the site's configured language when omitted.\n",
            "enum": [
              "en",
              "es",
              "ca",
              "it",
              "pt",
              "pt-BR",
              "fr",
              "de",
              "ro"
            ]
          },
          "CostCentre": {
            "type": "string",
            "description": "Optional billing group identifier. Groups submissions for invoicing and expense allocation.\n"
          },
          "EnableDeliveryReceipt": {
            "type": "boolean",
            "description": "For `Letter` type only. Enables delivery receipt tracking.\n"
          },
          "EnableDeliveryAttempts": {
            "type": "boolean",
            "description": "For `Letter` type only. Enables tracking of delivery attempts.\n"
          },
          "DeliveryAttemptsNumber": {
            "type": "integer",
            "description": "For `Letter` type only. Number of delivery attempts before the process ends.\n"
          },
          "CustomFields": {
            "type": "array",
            "description": "Array of custom key-value fields attached to the submission. Fields with `IsLookupKey: true` are indexed and returned in query results under `LookupKey`, concatenated with `::`.\n",
            "items": {
              "$ref": "#/components/schemas/EviPostCustomField"
            }
          },
          "PushNotificationUrl": {
            "type": "string",
            "format": "uri",
            "description": "URL to receive HTTP POST callbacks when the postal communication changes state.\n"
          },
          "PushNotificationFilter": {
            "type": "array",
            "description": "Array of state names that trigger a callback to `PushNotificationUrl`. If omitted, no callbacks are sent. `AffidavitPublished` is a platform meta-event that fires when affidavit generation completes — it is not a lifecycle state.\n",
            "items": {
              "type": "string",
              "enum": [
                "Processed",
                "Dispatched",
                "Sent",
                "Delivered",
                "Closed",
                "Cancelled",
                "Issued",
                "Disposed",
                "AffidavitPublished"
              ]
            }
          },
          "PushNotificationExtraData": {
            "type": "string",
            "description": "Free-text value included in every callback payload under `AdditionalData.ExtraData`.\n"
          },
          "DisposalDaysAmmount": {
            "type": "integer",
            "description": "Number of days after which the undelivered postal item is disposed of. Set to 0 to disable disposal. (Note: the field name retains its original spelling in the API.)\n"
          },
          "OwnerNotificationTemplate": {
            "type": "string",
            "description": "Identifier of an enabled custom template used for the issuer's status notification email. See [Using communication templates from the API](../../dev/templates.md).\n"
          },
          "OwnerNotificationTemplateValues": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Key-value pairs supplying values for the user variables declared in OwnerNotificationTemplate."
          },
          "LtaStorage": {
            "type": "boolean",
            "description": "When true, the evidence for this transaction is stored in Namirial Archive during post-close processing after tracking reaches `Closed`. Requires LTA to be enabled for the site. `OnlineRetentionPeriod` separately controls online accessibility.\n"
          }
        }
      },
      "EviPostCustomField": {
        "type": "object",
        "required": [
          "Key",
          "Label",
          "Value"
        ],
        "properties": {
          "Key": {
            "type": "string",
            "description": "Identifier of the custom field."
          },
          "Label": {
            "type": "string",
            "description": "Display label for the field."
          },
          "Value": {
            "type": "string",
            "description": "Value of the custom field."
          },
          "IsLookupKey": {
            "type": "boolean",
            "description": "If true, this value is indexed and surfaced in query results under `LookupKey`.\n"
          },
          "TypeName": {
            "type": "string",
            "description": "Field type. Currently only `Text` is supported.",
            "enum": [
              "Text"
            ]
          },
          "DefaultValue": {
            "type": "string"
          },
          "DefaultValueIsForced": {
            "type": "boolean"
          },
          "Required": {
            "type": "boolean"
          },
          "ValidationRegex": {
            "type": "string",
            "description": "Regex expression to validate the field value."
          },
          "ValidationMessage": {
            "type": "string",
            "description": "Message shown when validation fails."
          },
          "MaxLength": {
            "type": "integer",
            "description": "Maximum character length of the field value."
          }
        }
      },
      "EviPostSubmitResponse": {
        "type": "object",
        "required": [
          "uniqueId"
        ],
        "properties": {
          "uniqueId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the submitted postal communication."
          }
        }
      },
      "EviPostQueryResponse": {
        "type": "object",
        "properties": {
          "totalMatches": {
            "type": "integer",
            "description": "Total number of records matching the query filters."
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EviPostQueryResult"
            }
          }
        }
      },
      "EviPostQueryResult": {
        "type": "object",
        "description": "Individual query result object. Unlike the request body (which uses PascalCase field names), the v1 EviPost query response serialises field names in camelCase.\n",
        "properties": {
          "evidenceId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the postal communication."
          },
          "lookupKey": {
            "type": "string",
            "description": "Lookup key set at submission. If multiple CustomFields were indexed, values are concatenated with `::`.\n"
          },
          "recipientName": {
            "type": "string"
          },
          "address": {
            "type": "object",
            "description": "Recipient postal address. Returned with camelCase field names.",
            "properties": {
              "streetAddress": {
                "type": "string"
              },
              "postalCode": {
                "type": "string"
              },
              "locality": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2 country code (e.g. ES)."
              },
              "postOfficeBoxAddress": {
                "type": "string"
              }
            }
          },
          "document": {
            "type": "string",
            "description": "Base64-encoded original document. Only present when `IncludeDocumentOnResult` is true.\n"
          },
          "state": {
            "type": "string",
            "description": "Current lifecycle state. `Undelivered` records reported non-delivery but does not itself close tracking. For `Registered` and `Letter` with delivery tracking enabled, the platform accepts a later valid delivery report before closure; the operator sequence is unconfirmed. `LetterLite` cannot complete normal closure with `Delivered` once non-delivery has been recorded. A `Letter` workflow configured for disposal can continue to `Disposed`; a later failure report for `Letter` can instead lead to `Failed` before closure. Individual delivery attempts are events and do not necessarily change the state. `Unknown` may appear for transitional internal states; contact support if seen in production responses.\n",
            "enum": [
              "Draft",
              "Submitted",
              "Processed",
              "Sent",
              "Dispatched",
              "Delivered",
              "Missing",
              "Closed",
              "Issued",
              "Failed",
              "Undelivered",
              "Disposed",
              "Cancelled"
            ]
          },
          "stateDate": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the last state change."
          },
          "lastStateChangeDate": {
            "type": "string",
            "format": "date-time"
          },
          "outcome": {
            "type": "string",
            "description": "Result recorded so far; it may change while the communication is open. Treat this as the final postal result when `state` is `Closed`. `Undelivered` does not by itself identify an item awaiting collection or a return-to-sender action. `Unknown` may appear for transitional internal states; contact support if seen in production responses.\n",
            "enum": [
              "None",
              "Delivered",
              "Dispatched",
              "Acknowledged",
              "Declined",
              "Hindered",
              "Cancelled",
              "Expired",
              "Failed",
              "Sent",
              "Rejected",
              "Undelivered",
              "Disposed"
            ]
          },
          "outcomeDate": {
            "type": "string",
            "format": "date-time"
          },
          "creationDate": {
            "type": "string",
            "format": "date-time"
          },
          "submittedOn": {
            "type": "string",
            "format": "date-time"
          },
          "processedOn": {
            "type": "string",
            "format": "date-time"
          },
          "dispatchedOn": {
            "type": "string",
            "format": "date-time"
          },
          "sentOn": {
            "type": "string",
            "format": "date-time"
          },
          "deliveredOn": {
            "type": "string",
            "format": "date-time"
          },
          "closedOn": {
            "type": "string",
            "format": "date-time"
          },
          "issuedOn": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the postal item was issued."
          },
          "timeToLive": {
            "type": "integer",
            "description": "Tracking lifetime of the postal item, in minutes."
          },
          "costCentre": {
            "type": "string",
            "description": "Cost-centre label recorded with the transaction for internal billing allocation."
          },
          "onlineRetentionPeriod": {
            "type": "integer"
          },
          "notaryRetentionPeriod": {
            "type": "integer"
          },
          "notaryProfile": {
            "type": "string"
          },
          "sourceChannel": {
            "type": "string",
            "enum": [
              "Web",
              "Api",
              "Smtp"
            ]
          },
          "enableDeliveryReceipt": {
            "type": "boolean",
            "description": "For `Letter` type. Whether delivery receipt tracking is enabled."
          },
          "deliveryAttemptsNumber": {
            "type": "integer",
            "description": "For `Letter` type. Number of delivery attempts configured before the process ends."
          },
          "disposalDaysAmmount": {
            "type": "integer",
            "description": "Number of days after which an undelivered postal item is disposed of. (Note: the field name retains its original spelling in the API.)\n"
          },
          "affidavits": {
            "type": "array",
            "description": "Affidavit entries. Present when `IncludeAffidavitsOnResult` is true; bytes is populated only when the deprecated `IncludeAffidavitBlobsOnResult` option is also true.\n",
            "items": {
              "$ref": "#/components/schemas/EviPostAffidavit"
            }
          }
        }
      },
      "EviPostAffidavit": {
        "type": "object",
        "description": "Affidavit metadata and optional legacy Base64 content associated with a postal communication.",
        "properties": {
          "uniqueId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the affidavit."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp of the affidavit."
          },
          "evidenceUniqueId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the evidence this affidavit belongs to."
          },
          "partyUniqueId": {
            "type": "string",
            "format": "uuid",
            "description": "Identifier of the related delivery/party, when applicable."
          },
          "bytes": {
            "type": "string",
            "format": "byte",
            "nullable": true,
            "deprecated": true,
            "description": "Base64-encoded affidavit PDF. Populated only when the deprecated IncludeAffidavitBlobsOnResult option is true."
          },
          "description": {
            "type": "string",
            "description": "Human-readable description of the affidavit."
          },
          "kind": {
            "type": "string",
            "description": "Technical identifier of the affidavit kind, when available."
          },
          "additionalData": {
            "type": "object",
            "description": "Additional affidavit metadata as key-value pairs.",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "EviPostAffidavitRequest": {
        "type": "object",
        "required": [
          "UniqueId"
        ],
        "properties": {
          "UniqueId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique ID of the EviPost to generate an affidavit for."
          },
          "IncludeDocument": {
            "type": "boolean",
            "description": "If true, the document is included in the affidavit."
          },
          "IncludeEvents": {
            "type": "boolean",
            "description": "If true, detailed event information is included in the affidavit.\n"
          }
        }
      },
      "EviPostAffidavitResponse": {
        "type": "object",
        "required": [
          "requestId"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Identifier of the affidavit generation request."
          }
        }
      },
      "EviPostError": {
        "type": "object",
        "properties": {
          "responseStatus": {
            "type": "object",
            "properties": {
              "errorCode": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "errors": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "EviPostCancelRequest": {
        "type": "object",
        "required": [
          "UniqueId"
        ],
        "properties": {
          "UniqueId": {
            "type": "string",
            "format": "uuid",
            "description": "The unique ID of the postal communication to cancel, as returned at submission."
          }
        }
      },
      "EviPostCancelResponse": {
        "type": "object",
        "properties": {
          "uniqueId": {
            "type": "string",
            "format": "uuid",
            "description": "The unique ID of the cancelled postal communication."
          }
        }
      }
    }
  }
}