{
  "openapi": "3.1.0",
  "info": {
    "title": "Delivery API",
    "version": "1.0",
    "license": {
      "name": "Digital Post Platform API License Agreement",
      "url": "/api/api-license"
    },
    "description": "Enables the submission of message deliveries through either S3-based integration or multipart/form-data upload.\nA delivery consists of one or more envelopes that define the recipients,\nmessage content, and how recipients can interact with the message.\n\nDeliveries can be created in two ways:\n- **S3-based:** The sender uploads envelopes and content to their own S3 bucket and provides the\n  connection details in the request. The platform retrieves the content directly from the bucket.\n- **Multipart/form-data:** The sender uploads envelopes and content as multipart form data over\n  HTTPS. The platform stores the content in a platform-managed S3 bucket.\n\nRegardless of the submission method, the platform validates the envelopes, scans content for\nviruses, and encrypts each file with a unique key. The platform guarantees that either all\nrecipients of an envelope receive the message or none do.\n\nOptionally, S3 content may be encrypted by the sender using AES-256 with a client-managed key. A\ndelivery report is available to track processing progress and identify issues related to specific\nenvelopes.\n\nSee [Delivery](../../../documentation/delivery.md)\n"
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://{domain}",
      "variables": {
        "domain": {
          "default": "",
          "description": "The API server domain."
        }
      }
    }
  ],
  "paths": {
    "/delivery/v1/messages/{externalTransactionId}": {
      "post": {
        "summary": "Create delivery via multipart/form-data",
        "description": "Uploads files as multipart form data to a platform-managed S3 bucket and initiates delivery\nof the contained envelopes.\n\nThe `deliveryId` for deliveries created via this endpoint is a composite value formed as\n`{senderOrganizationId}_{externalTransactionId}`, derived from the request parameters.\nFor example, given `senderOrganizationId=3` and `externalTransactionId=My-Delivery`, the\nresulting `deliveryId` is `3_My-Delivery`.\n\nTo check delivery progress, use [Get delivery report](getdeliveryreport) to retrieve\ninformation about this delivery. Use the composite `deliveryId` described above as the\n`deliveryId` path parameter.\n",
        "operationId": "CreateMessageBundle",
        "parameters": [
          {
            "name": "externalTransactionId",
            "in": "path",
            "description": "A unique ID representing the delivery. This value must be unique across deliveries for a given sender organization and is used to correlate the multipart form data with the delivery report. For deliveries created via this endpoint, the `deliveryId` is formed as `{senderOrganizationId}_{externalTransactionId}`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "senderOrganizationId",
            "in": "query",
            "description": "The ID of the organization sending the message.When omitted, the sender organization is\nautomatically resolved from the authenticated user's account. When provided, the value is\nvalidated to ensure the caller has access to the specified organization.\n\nThis organization is used for billing purposes. Usage generated by this delivery is counted\ntoward the specified organization's billing totals. The billed organization may be different\nfrom the sender's own organization as defined in the envelope.\n",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "A text that describes the delivery. Optional name or tag for the delivery.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "additionalProperties": {
                  "description": "Message envelope or message file/content.\nMessage envelopes are identified by the content type: application/vnd+e-boks.emf+json\n\nA message envelope references the names of the parts that act as the body and\nattachments of the message.\n",
                  "type": "string",
                  "format": "binary"
                }
              },
              "encoding": {
                "additionalProperties": {
                  "contentType": "application/vnd+e-boks.emf+json, application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.oasis.opendocument.presentation, application/vnd.oasis.opendocument.spreadsheet, application/vnd.oasis.opendocument.text, application/vnd+e-boks.signingrequest+json, application/rtf, text/plain, text/rtf, image/png, image/jpeg, image/bmp, image/gif, image/tiff"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "curl",
            "source": "# Replace <server> with your server URL from the server selector above\ncurl -i -X POST \\\n  '<server>/delivery/v1/messages/{externalTransactionId}?senderOrganizationId=3' \\\n  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \\\n  -H 'Content-Type: multipart/form-data' \\\n  --form 'an-envelope=@\"/my-files/an-envelope.json\";type=application/vnd+e-boks.emf+json' \\\n  --form 'another-envelope=@\"/my-files/another-envelope.json\";type=application/vnd+e-boks.emf+json' \\\n  --form 'some-content=@\"/my-files/content1.pdf\";type=application/pdf' \\\n  --form 'other-content=@\"/my-files/content2.txt\";type=text/plain'\n"
          }
        ],
        "responses": {
          "200": {
            "description": "Files uploaded and delivery started successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transactionId": {
                      "type": "integer",
                      "example": 0
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request if the content type is invalid, the multipart form data is improperly\nformatted, or `externalTransactionId` is missing or empty.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "description": "The provided external transaction ID already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "description": "Delivery request received but failed to start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/delivery/v1/deliveries": {
      "post": {
        "summary": "Create delivery via S3",
        "description": "Creates a delivery and initiates delivery of the contained envelopes.\n\nThe `deliveryId` returned in the response uniquely identifies the delivery.\n\nTo check delivery progress, use [Get delivery report](getdeliveryreport) to retrieve\ninformation about the delivery. Use the `deliveryId` from the response as the `deliveryId`\npath parameter.\n",
        "operationId": "CreateDelivery",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "s3ServiceUrl",
                  "s3BucketName",
                  "s3AccessKeyId",
                  "s3SecretKey",
                  "s3Prefix",
                  "s3EnvelopePrefix"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "A text that describes the delivery. Optional name or tag for the delivery."
                  },
                  "senderOrganizationId": {
                    "description": "The ID of the organization sending the message. When omitted, the sender organization is\nautomatically resolved from the authenticated user's account. When provided, the value is\nvalidated to ensure the caller has access to the specified organization.\n\nThis organization is used for billing purposes. Usage generated by this delivery is counted\ntoward the specified organization's billing totals. The billed organization may be different\nfrom the sender's own organization as defined in the envelope.\n",
                    "type": "integer",
                    "format": "int64"
                  },
                  "s3ServiceUrl": {
                    "type": "string",
                    "description": "The endpoint for the service hosting the S3 bucket.",
                    "maxLength": 200
                  },
                  "s3BucketName": {
                    "type": "string",
                    "description": "The name of the S3 bucket.",
                    "maxLength": 50
                  },
                  "s3AccessKeyId": {
                    "type": "string",
                    "description": "The access key ID for accessing the bucket.",
                    "maxLength": 50
                  },
                  "s3SecretKey": {
                    "type": "string",
                    "description": "The secret key for accessing the bucket.",
                    "maxLength": 50
                  },
                  "s3Prefix": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "The key prefix for all objects the platform should consider in the bucket.\nThis may be an empty string.\n"
                  },
                  "s3EnvelopePrefix": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "The key prefix for all objects that contain an envelope. This prefix is relative to\n`s3Prefix`, which means the platform treats all objects with keys prefixed by\n`{s3Prefix}{s3EnvelopePrefix}` as envelopes.\n\nNote: The recommended value for `s3EnvelopePrefix` is `envelopes/`.\n"
                  },
                  "encryptionKey": {
                    "type": "string",
                    "maxLength": 256,
                    "description": "Base64-encoded AES-256 key that has been used to encrypt each S3 object. See\n[Encryption during delivery](/documentation/delivery#encryption-during-delivery)\nfor details.\n"
                  },
                  "s3UrlStyle": {
                    "type": "string",
                    "description": "The URL style used by the platform when accessing S3 objects.",
                    "enum": [
                      "PathStyle",
                      "VirtualHostedStyle"
                    ],
                    "default": "VirtualHostedStyle"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The delivery has been created and delivery of messages to recipients will start soon.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deliveryId": {
                      "type": "string",
                      "maxLength": 95
                    }
                  }
                },
                "examples": {
                  "Create delivery example": {
                    "$ref": "#/components/examples/CreateDeliveryExample"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation errors or missing S3 details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "description": "Delivery request received but failed to start.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List deliveries",
        "operationId": "ListDeliveries",
        "description": "Retrieves a paginated list of deliveries for the authenticated user's accessible\norganizations. Optionally filter by a specific sender organization. Pagination\nmetadata is returned in the response headers.\n",
        "parameters": [
          {
            "name": "senderOrganizationId",
            "in": "query",
            "description": "Optional filter by sender organization. If omitted, deliveries for all accessible organizations are returned.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "The page of deliveries to retrieve, with 0 being the first page.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The maximum number of deliveries to include in the retrieved page.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deliveries retrieved.",
            "headers": {
              "pagination-total": {
                "description": "The total number of deliveries.",
                "schema": {
                  "type": "integer"
                }
              },
              "pagination-page": {
                "description": "The requested page number.",
                "schema": {
                  "type": "integer"
                }
              },
              "pagination-pagesize": {
                "description": "The requested page size.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "report": {
                      "type": "array",
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "required": [
                          "createdDate",
                          "deliveryId",
                          "status",
                          "totalEnvelopes",
                          "deliveredEnvelopes",
                          "failedEnvelopes"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "The name given to the delivery when it was created."
                          },
                          "createdDate": {
                            "type": "string",
                            "format": "date-time",
                            "description": "The time the delivery was created."
                          },
                          "deliveryId": {
                            "type": "string",
                            "description": "The identifier of the delivery."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "Processing",
                              "Completed"
                            ]
                          },
                          "totalEnvelopes": {
                            "type": "integer",
                            "description": "The total number of known envelopes in the delivery. This number may increase\nwhile the status is `Processing` until all envelopes in the delivery have been\nidentified.\n"
                          },
                          "deliveredEnvelopes": {
                            "type": "integer",
                            "description": "The number of envelopes that have been delivered to their recipients. An\nenvelope with multiple recipients counts as one delivered envelope, regardless\nof the number of recipients.\n"
                          },
                          "failedEnvelopes": {
                            "type": "integer",
                            "description": "The number of envelopes that have failed. A single envelope with multiple recipients that cannot be delivered counts as `one` failed envelope, regardless of the number of recipients.\n"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters, such as invalid `page` or `pageSize` values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/delivery/v1/deliveries/{deliveryId}": {
      "get": {
        "summary": "Get delivery report",
        "operationId": "GetDeliveryReport",
        "description": "Retrieves the delivery report for a specific delivery, including its current status,\nenvelope counts, and a log of any issues encountered during processing.\n\nThe `deliveryId` depends on how the delivery was created:\n- **S3-based delivery:** Use the `deliveryId` returned by\n  [Create delivery via S3](createdelivery).\n- **Multipart/form-data:** Use the composite value\n  `{senderOrganizationId}_{externalTransactionId}` derived from the request parameters of\n  [Create delivery via multipart/form-data](createmessagebundle).\n\nThe report can be polled while the delivery status is `Processing`. Once the status changes\nto `Completed`, the report reflects the final outcome of all envelopes.\n",
        "parameters": [
          {
            "name": "deliveryId",
            "in": "path",
            "description": "The identifier of the delivery.",
            "required": true,
            "style": "simple",
            "schema": {
              "type": "string",
              "maxLength": 95
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Zero-based page index for paginating log entries.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The number of log entries per page. The upper limit is configurable and currently set to 2500.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 2500,
              "minimum": 1,
              "maximum": 2500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery report retrieved.",
            "headers": {
              "Pagination-Total": {
                "description": "The total number of log entries.",
                "schema": {
                  "type": "integer"
                }
              },
              "Pagination-Page": {
                "description": "The current page number.",
                "schema": {
                  "type": "integer"
                }
              },
              "Pagination-PageSize": {
                "description": "The number of items per page.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryReport"
                },
                "examples": {
                  "InProgressDelivery": {
                    "$ref": "#/components/examples/GetDeliveryReportExample_InProgress"
                  },
                  "CompletedDelivery": {
                    "$ref": "#/components/examples/GetDeliveryReportExample_Completed"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination parameters. Returned when `page` is less than 0 or `pageSize` is outside the valid range (1�2500).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "No delivery found for the provided ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/delivery/v1/deliveries/{deliveryId}/confirmations": {
      "get": {
        "summary": "Get delivery confirmations",
        "operationId": "GetDeliveryConfirmations",
        "description": "Retrieves a paginated list of delivery confirmations for the envelopes in a delivery.\n\nA confirmation represents that a message has been successfully delivered to an active, non-interim\nmailbox.\n A message is considered confirmed once all of the following criteria are met:\n- The message has been added to a mailbox that is not interim.\n- The message's delivery date has elapsed.\n- The message delivery has been successfully completed.\n",
        "parameters": [
          {
            "name": "deliveryId",
            "in": "path",
            "description": "The identifier of the delivery.",
            "required": true,
            "style": "simple",
            "schema": {
              "type": "string",
              "maxLength": 95
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Zero-based page index for paginating confirmations.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The number of confirmations per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20,
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery confirmations retrieved.",
            "headers": {
              "Pagination-Total": {
                "description": "The total number of delivery confirmations.",
                "schema": {
                  "type": "integer"
                }
              },
              "Pagination-Page": {
                "description": "The current page number.",
                "schema": {
                  "type": "integer"
                }
              },
              "Pagination-PageSize": {
                "description": "The number of items per page.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "confirmations"
                  ],
                  "properties": {
                    "confirmations": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeliveryConfirmation"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination parameters. Returned when `page` is less than 0, or when\n`pageSize` is 0 or greater than 50.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "InvalidPaginationExample": {
                    "summary": "Invalid pagination parameters",
                    "value": {
                      "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
                      "title": "Bad Request",
                      "status": 400,
                      "detail": "Invalid pagination parameters",
                      "instance": "urn:trace:00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01",
                      "traceId": "00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "No delivery found for the provided ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "NotFoundExample": {
                    "summary": "Unknown delivery identifier",
                    "value": {
                      "type": "https://tools.ietf.org/html/rfc9110#section-15.5.5",
                      "title": "Not Found",
                      "status": 404,
                      "detail": "No delivery found for the provided Id",
                      "instance": "urn:trace:00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01",
                      "traceId": "00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01"
                    }
                  }
                }
              }
            }
          },
          "410": {
            "description": "The delivery exists but its confirmations are no longer available because the retention\nperiod has elapsed.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "GoneExample": {
                    "summary": "Retention period has elapsed",
                    "value": {
                      "type": "https://tools.ietf.org/html/rfc9110#section-15.5.11",
                      "title": "Gone",
                      "status": 410,
                      "detail": "Delivery confirmations are no longer available due to retention policy",
                      "instance": "urn:trace:00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01",
                      "traceId": "00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DeliveryReport": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "report"
        ],
        "properties": {
          "report": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "createdDate",
              "status",
              "deliveredEnvelopes",
              "totalEnvelopes",
              "logs"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "The name given to the delivery when it was created."
              },
              "createdDate": {
                "type": "string",
                "format": "date-time",
                "description": "The time the delivery was created."
              },
              "status": {
                "type": "string",
                "description": "The status of the delivery request.",
                "enum": [
                  "Processing",
                  "Completed"
                ]
              },
              "deliveredEnvelopes": {
                "type": "integer",
                "description": "The number of envelopes that have been delivered to their recipients.\nNote: an envelope with multiple recipients counts as one.\n"
              },
              "totalEnvelopes": {
                "type": "integer",
                "description": "The total number of envelopes in the delivery.\nIf the delivery is still processing, this value may not yet be final, but indicates\nthe number of envelopes that have been identified so far.\n"
              },
              "logs": {
                "type": "array",
                "description": "A list of errors and other potentially important information regarding the delivery itself or the delivery of an\nenvelope.\n",
                "items": {
                  "$ref": "#/components/schemas/EnvelopeDelivery"
                }
              }
            }
          }
        }
      },
      "EnvelopeDelivery": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "level",
          "key",
          "description"
        ],
        "properties": {
          "envelopeId": {
            "type": "string",
            "description": "The identifier of the envelope, or message ID, to which this entry relates. This field is optional if the log entry applies to the delivery as a whole rather than to a specific envelope."
          },
          "delivered": {
            "type": "boolean",
            "description": "Whether the envelope was delivered.This field is optional if the log entry applies to the delivery as a whole rather than to a specific envelope.\nNote: there may be multiple log entries for the same envelope.\n"
          },
          "level": {
            "type": "string",
            "description": "The significance of this entry.",
            "enum": [
              "Warning",
              "Error"
            ]
          },
          "key": {
            "type": "string",
            "description": "A key describing this entry.",
            "enum": [
              "EnvelopeDelivered",
              "EnvelopeAlreadyDelivered",
              "EnvelopeContentMissing",
              "EnvelopeContentMediaTypeNotAuthorized",
              "EnvelopeContentFileExtensionsNotAuthorized",
              "RecipientNotSubscribed",
              "RecipientNotFound",
              "SenderNotAuthorized",
              "SenderNotFound",
              "UnableToRegisterSigningRequest",
              "VirusDetected",
              "DeliveryFault",
              "InvalidEnvelope",
              "S3CopyFailed",
              "UnabletoConnectAmazonS3",
              "EnvelopeAlreadyDeliveredWithOtherDelivery",
              "EnvelopeBeingProcessedInOtherDelivery",
              "NoEnvelopesFound",
              "S3AccessDenied",
              "NotFound",
              "ToLarge",
              "UnauthorizedMediaType",
              "InvalidEncryptionMarker",
              "CouldNotBeDecrypted",
              "InvalidEncryptionKeyEncoding",
              "CouldNotReadInitializationVector",
              "InvalidHash"
            ],
            "x-enumDescriptions": {
              "EnvelopeDelivered": "The envelope was successfully delivered to the intended recipient.",
              "EnvelopeAlreadyDelivered": "This envelope had already been delivered earlier, so it was not delivered again.",
              "EnvelopeContentMissing": "The envelope was missing its main content or required files.",
              "EnvelopeContentMediaTypeNotAuthorized": "The envelope contained content in a format that is not allowed by the system.",
              "EnvelopeContentFileExtensionsNotAuthorized": "The envelope included a file type that is not allowed by the system.",
              "RecipientNotSubscribed": "The recipient exists, but is not registered or enabled to receive this type of envelope.",
              "RecipientNotFound": "The system could not find the intended recipient of the envelope.",
              "SenderNotAuthorized": "The sender is not allowed to send this envelope.",
              "SenderNotFound": "The system could not find the sender of the envelope.",
              "UnableToRegisterSigningRequest": "The system could not create the signing or approval request needed for this envelope.",
              "VirusDetected": "A virus or unsafe file was found in the envelope.",
              "DeliveryFault": "Something went wrong while processing or delivering the envelope.",
              "InvalidEnvelope": "The envelope was not in the correct format or was missing required information.",
              "S3CopyFailed": "The system failed while copying files related to the envelope in cloud storage.",
              "UnabletoConnectAmazonS3": "The system could not connect to Amazon S3, where envelope files are stored.",
              "EnvelopeAlreadyDeliveredWithOtherDelivery": "This envelope was already delivered as part of another delivery request, so it cannot be sent again with the same envelope ID.",
              "EnvelopeBeingProcessedInOtherDelivery": "This envelope is already being processed in another delivery request, so it cannot be handled again at the same time.",
              "NoEnvelopesFound": "No envelopes were found to process in the specified location.",
              "S3AccessDenied": "The system tried to access cloud storage for the envelope files, but permission was denied.",
              "NotFound": "The envelope file was not found in the S3 bucket.",
              "ToLarge": "The envelope file is too large and exceeds the allowed size limit.",
              "UnauthorizedMediaType": "The envelope file format or content type is not allowed by the system.",
              "InvalidEncryptionMarker": "While decrypting an envelope or file, the system found an unknown encryption marker, so the content could not be decrypted.",
              "CouldNotBeDecrypted": "The envelope could not be decrypted, so its content could not be read.",
              "InvalidEncryptionKeyEncoding": "The encryption key format is invalid or corrupted, so it could not be used.",
              "CouldNotReadInitializationVector": "The system could not read the initialization vector needed to decrypt the envelope.",
              "InvalidHash": "The envelope content failed the integrity check, which means the content may be corrupted or altered."
            }
          },
          "description": {
            "type": "string",
            "description": "An English explanation of the problem."
          }
        }
      },
      "DeliveryConfirmation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "senderMessageId",
          "identity",
          "confirmedAt"
        ],
        "properties": {
          "senderMessageId": {
            "type": "string",
            "description": "The external message identifier supplied by the sender."
          },
          "identity": {
            "type": "string",
            "description": "The recipient identity as described by the sender."
          },
          "confirmedAt": {
            "type": "string",
            "format": "date-time",
            "description": "The UTC timestamp when delivery was confirmed."
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "description": "A URI reference that identifies the problem type."
          },
          "title": {
            "type": "string",
            "description": "A short, human-readable summary of the problem type."
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "minimum": 100,
            "maximum": 599,
            "description": "The HTTP status code generated by the origin server for this occurrence of the problem.\n"
          },
          "detail": {
            "type": "string",
            "description": "A human-readable explanation specific to this occurrence of the problem."
          },
          "instance": {
            "type": "string",
            "description": "A URI reference that identifies the specific occurrence of the problem."
          },
          "traceId": {
            "type": "string",
            "description": "Correlation identifier for troubleshooting this specific error occurrence."
          }
        }
      },
      "ValidationProblemDetails": {
        "description": "Describes the reason a request could not be successfully processed.",
        "required": [
          "errors"
        ],
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "errors": {
            "type": "object",
            "description": "A dictionary of validation errors where each key is a field name, and the value is a list of error messages associated with that field.\n",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "readOnly": true
          }
        },
        "allOf": [
          {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        ]
      }
    },
    "examples": {
      "CreateDeliveryExample": {
        "summary": "Create delivery response",
        "value": {
          "deliveryId": "480ec910-de1b-4ce3-b1e9-f44584b1adf4"
        }
      },
      "GetDeliveryReportExample_InProgress": {
        "summary": "Delivery report of an in-progress delivery",
        "value": {
          "report": {
            "name": "My delivery",
            "createdDate": "2024-06-12T13:22:53.005Z",
            "status": "Processing",
            "deliveredEnvelopes": 562,
            "totalEnvelopes": 2000000,
            "logs": [
              {
                "envelopeId": "account-statement-2024-06-01-76c1ad85-0eff-4847-b221-0ae4a38c9357",
                "delivered": false,
                "level": "Information",
                "key": "RecipientNotSubscribed",
                "description": "The first recipient on the envelope is not subscribed to the sender (sender ID: 36)."
              }
            ]
          }
        }
      },
      "GetDeliveryReportExample_Completed": {
        "summary": "Delivery report for a completed delivery",
        "value": {
          "report": {
            "name": "Delivery10085",
            "createdDate": "2020-12-01T06:15:00Z",
            "status": "Completed",
            "deliveredEnvelopes": 2,
            "totalEnvelopes": 2,
            "logs": []
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "BearerToken"
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            },
            "examples": {
              "UnauthorizedExample": {
                "summary": "Unauthorized access attempt",
                "value": {
                  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.2",
                  "title": "Unauthorized",
                  "status": 401,
                  "detail": "Missing or invalid authentication token.",
                  "instance": "urn:trace:00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01",
                  "traceId": "00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01"
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            },
            "examples": {
              "ForbiddenExample": {
                "summary": "Forbidden access attempt",
                "value": {
                  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.4",
                  "title": "Forbidden",
                  "status": 403,
                  "detail": "Caller does not have permission to access the requested resource.",
                  "instance": "urn:trace:00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01",
                  "traceId": "00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01"
                }
              }
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal server error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            },
            "examples": {
              "InternalServerErrorExample": {
                "summary": "Internal server error",
                "value": {
                  "type": "https://tools.ietf.org/html/rfc9110#section-15.6.1",
                  "title": "Internal Server Error",
                  "status": 500,
                  "detail": "An unexpected error occurred while processing the request.",
                  "instance": "urn:trace:00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01",
                  "traceId": "00-6a216b56000000006a31ae4716a1dbd4-6283538c2625a8e3-01"
                }
              }
            }
          }
        }
      }
    }
  }
}