{
  "openapi": "3.1.0",
  "info": {
    "title": "MailGateAPI",
    "version": "1.0.0",
    "description": "Transactional email and received messages. Live email and receiving depend on the deployment’s Amazon SES configuration. Test email uses reserved simulator addresses and never sends real mail. All response timestamps are ISO 8601 UTC unless explicitly stated."
  },
  "servers": [
    {
      "url": "https://mailgateapi.com/api/v1"
    }
  ],
  "externalDocs": {
    "url": "https://mailgateapi.com/docs/api"
  },
  "security": [
    {
      "BearerKey": []
    }
  ],
  "tags": [
    {
      "name": "Email"
    },
    {
      "name": "Inbox"
    },
    {
      "name": "Webhooks"
    }
  ],
  "x-mailgate-limits": {
    "authentication": {
      "invalidRequestsPerIpPerMinute": 60,
      "requestsPerWorkspaceAndModePerMinute": 600
    },
    "emailApi": {
      "requestsPerIpPerMinute": 120,
      "requestBytes": 6291456
    },
    "message": {
      "recipients": 50,
      "bodyBytes": 1048576,
      "attachments": 10,
      "attachmentBytesCombined": 3145728,
      "maxScheduleDays": 30
    },
    "batch": {
      "messages": 100,
      "recipientsCombined": 500,
      "decodedBytesCombined": 5242880
    }
  },
  "paths": {
    "/emails": {
      "post": {
        "operationId": "sendEmail",
        "tags": [
          "Email"
        ],
        "summary": "Queue an email",
        "description": "The bearer key selects the workspace and key mode. Use only the configured simulator sender and recipients in Test mode. Live mode requires an authorized sender domain and a configured Amazon SES connection.",
        "responses": {
          "202": {
            "description": "Submission recorded. The message may be queued or scheduled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailAdmission"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "415": {
            "$ref": "#/components/responses/MediaType"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-mailgate-permission": "send",
        "x-mailgate-key-modes": [
          "test",
          "live"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmail"
              },
              "example": {
                "from": "noreply@simulator.mailgate.test",
                "to": "delivered@simulator.mailgate.test",
                "subject": "My first test",
                "text": "Hello from the MailGateAPI simulator."
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listEmails",
        "tags": [
          "Email"
        ],
        "summary": "List emails",
        "description": "Returns emails in the key’s workspace and mode, newest first. Follow links.next for the next page.",
        "responses": {
          "200": {
            "description": "Page of email records.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Email"
                      }
                    },
                    "links": {
                      "type": "object",
                      "properties": {
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uri"
                        }
                      },
                      "required": [
                        "next"
                      ]
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "per_page": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 100
                        }
                      },
                      "required": [
                        "per_page"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "links",
                    "meta"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          }
        },
        "x-mailgate-permission": "read",
        "x-mailgate-key-modes": [
          "test",
          "live"
        ],
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Page size.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from the previous response.",
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          }
        ]
      }
    },
    "/emails/batch": {
      "post": {
        "operationId": "sendEmailBatch",
        "tags": [
          "Email"
        ],
        "summary": "Queue an email batch",
        "description": "Submissions are admitted atomically. Submit up to 100 messages with at most 500 total recipients and 5 MiB of decoded body and attachment bytes combined. The bearer key selects the workspace and key mode. Use only the configured simulator sender and recipients in Test mode. Live mode requires an authorized sender domain and a configured Amazon SES connection.",
        "responses": {
          "202": {
            "description": "Batch recorded in request order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EmailAdmission"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "415": {
            "$ref": "#/components/responses/MediaType"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-mailgate-permission": "send",
        "x-mailgate-key-modes": [
          "test",
          "live"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SendEmail"
                },
                "minItems": 1,
                "maxItems": 100
              },
              "example": [
                {
                  "from": "noreply@simulator.mailgate.test",
                  "to": "delivered@simulator.mailgate.test",
                  "subject": "My first test",
                  "text": "Hello from the MailGateAPI simulator."
                }
              ]
            }
          }
        }
      }
    },
    "/emails/{id}": {
      "get": {
        "operationId": "getEmail",
        "tags": [
          "Email"
        ],
        "summary": "Get an email",
        "description": "Read an email and its per-recipient delivery state in the key’s workspace and mode. Response timestamps are UTC.",
        "responses": {
          "200": {
            "description": "Email record.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Email"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "x-mailgate-permission": "read",
        "x-mailgate-key-modes": [
          "test",
          "live"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/EmailId"
          }
        ]
      }
    },
    "/emails/{id}/cancel": {
      "post": {
        "operationId": "cancelEmail",
        "tags": [
          "Email"
        ],
        "summary": "Cancel a scheduled email",
        "description": "An email is cancelable only if it is scheduled and sending has yet to start. Repeating a successful cancellation returns the canceled email.",
        "responses": {
          "200": {
            "description": "Canceled email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Email"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        },
        "x-mailgate-permission": "send",
        "x-mailgate-key-modes": [
          "test",
          "live"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/EmailId"
          }
        ]
      }
    },
    "/inbox": {
      "get": {
        "operationId": "listInbox",
        "tags": [
          "Inbox"
        ],
        "summary": "List received messages",
        "description": "Requires a Full access Live key. Page size is 25. Follow next_page_url to advance.",
        "responses": {
          "200": {
            "description": "Page of inbox messages.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InboxSummary"
                      }
                    },
                    "next_page_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uri"
                    }
                  },
                  "required": [
                    "data",
                    "next_page_url"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "x-mailgate-permission": "read",
        "x-mailgate-key-modes": [
          "live"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "One-based page number.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ]
      }
    },
    "/inbox/{message}": {
      "get": {
        "operationId": "getInboxMessage",
        "tags": [
          "Inbox"
        ],
        "summary": "Get a received message",
        "description": "Requires a Full access Live key. Use returned signed URLs within five minutes to download attachments.",
        "responses": {
          "200": {
            "description": "Inbox message and attachment URLs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/InboxMessage"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "x-mailgate-permission": "read",
        "x-mailgate-key-modes": [
          "live"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/InboxMessage"
          }
        ]
      }
    },
    "/inbox/{message}/attachments/{attachment}": {
      "get": {
        "operationId": "downloadInboxAttachment",
        "tags": [
          "Inbox"
        ],
        "summary": "Download an inbox attachment",
        "description": "Pass the complete, unmodified download_url from message detail with the Full access Live bearer key. A matching workspace and current URL signature are required.",
        "x-mailgate-permission": "read",
        "x-mailgate-key-modes": [
          "live"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/InboxMessage"
          },
          {
            "$ref": "#/components/parameters/InboxAttachment"
          },
          {
            "name": "expires",
            "in": "query",
            "required": true,
            "description": "Expiration timestamp from the signed URL, in Unix seconds.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "signature",
            "in": "query",
            "required": true,
            "description": "Signature from the signed URL.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Attachment bytes.",
            "headers": {
              "Content-Disposition": {
                "description": "Attachment filename.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "webhooks": {
    "emailEvent": {
      "post": {
        "operationId": "receiveEmailEvent",
        "tags": [
          "Webhooks"
        ],
        "summary": "Receive an event at a configured HTTPS endpoint",
        "description": "Configure separate Test and Live webhook endpoints in your dashboard. Verify the signature before parsing the body. Use the displayed secret as text and deduplicate by event ID. The receiving application can return any 2xx after recording the event. Failed attempts retry after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours.",
        "security": [],
        "parameters": [
          {
            "name": "X-Mailgate-Event-Id",
            "in": "header",
            "required": true,
            "description": "Stable event ID, also present in the body.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "X-Mailgate-Timestamp",
            "in": "header",
            "required": true,
            "description": "Timestamp of this attempt in Unix seconds.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          {
            "name": "X-Mailgate-Signature",
            "in": "header",
            "required": true,
            "description": "v1= followed by lowercase hex HMAC-SHA256 over the header timestamp, a period and the exact request body bytes. The key is the displayed endpoint secret.",
            "schema": {
              "type": "string",
              "pattern": "^v1=[0-9a-f]{64}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "The customer endpoint acknowledged receipt."
          },
          "default": {
            "description": "Delivery failed and may be retried."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "MailGateAPI workspace key",
        "description": "Send Authorization: Bearer <workspace key>. Test keys start with mg_test_ and Live keys with mg_live_. Sending access grants send. Full access grants send and read. Inbox requires Full access and Live mode."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional key scoped to the workspace, mode and operation. Retrying the same normalized request returns the original IDs. A different request with that key returns 409.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255,
          "pattern": "^[!-~]+$"
        }
      },
      "EmailId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The email ID returned on admission.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "InboxMessage": {
        "name": "message",
        "in": "path",
        "required": true,
        "description": "Inbox message ID.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "InboxAttachment": {
        "name": "attachment",
        "in": "path",
        "required": true,
        "description": "Attachment ID from the signed download URL.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing, invalid or revoked bearer key. Code: invalid_api_key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "WWW-Authenticate": {
            "description": "Authentication scheme.",
            "schema": {
              "type": "string",
              "const": "Bearer"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Insufficient permissions or an unsupported key mode. Code: insufficient_permissions or forbidden.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "The requested resource is unavailable in this workspace and mode. Code: not_found.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with the current state. Code: conflict.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooLarge": {
        "description": "The JSON body is greater than 6 MiB. Code: payload_too_large.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "MediaType": {
        "description": "Send an application/json body. Code: unsupported_media_type.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Invalid": {
        "description": "Request validation failed. Code: validation_failed. Inspect error.fields for field errors.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooMany": {
        "description": "The request rate limit or sending allowance was reached. Code: rate_limit_exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "description": "Seconds before retrying, when supplied.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      },
      "Unavailable": {
        "description": "Delivery in the requested mode is unavailable. Code: service_unavailable.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "description": "Seconds before retrying, when supplied.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Machine-readable error identifier."
              },
              "message": {
                "type": "string"
              },
              "fields": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "description": "Validation messages keyed by field."
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "MailboxList": {
        "oneOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Address with ASCII local part, optionally with display name. Limit is 512 UTF-8 bytes."
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "description": "Address with ASCII local part, optionally with display name. Limit is 512 UTF-8 bytes."
            },
            "maxItems": 50
          },
          {
            "type": "null"
          }
        ]
      },
      "Attachment": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string",
            "minLength": 3,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9 _.()\\-]*\\.[A-Za-z0-9]{1,10}$",
            "description": "ASCII basename with a file extension. Two consecutive periods are prohibited."
          },
          "content": {
            "type": "string",
            "minLength": 4,
            "maxLength": 4194304,
            "contentEncoding": "base64",
            "description": "Canonical standard base64-encoded bytes, with padding when required."
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ],
            "default": "application/octet-stream",
            "maxLength": 78,
            "description": "MIME media type."
          }
        },
        "required": [
          "filename",
          "content"
        ],
        "additionalProperties": false
      },
      "SendEmail": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Address with ASCII local part, optionally with display name. Limit is 512 UTF-8 bytes."
          },
          "to": {
            "$ref": "#/components/schemas/MailboxList"
          },
          "cc": {
            "$ref": "#/components/schemas/MailboxList"
          },
          "bcc": {
            "$ref": "#/components/schemas/MailboxList"
          },
          "reply_to": {
            "$ref": "#/components/schemas/MailboxList"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 998,
            "description": "One line, up to 998 UTF-8 bytes."
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "UTF-8 plain text."
          },
          "html": {
            "type": [
              "string",
              "null"
            ],
            "description": "UTF-8 HTML."
          },
          "scheduled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "ISO 8601 with timezone. Schedule in the next 30 days. Subsecond times are rounded up to the next second."
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/Attachment"
            },
            "maxItems": 10,
            "description": "Up to 3 MiB of decoded attachment bytes per message."
          }
        },
        "required": [
          "from",
          "subject"
        ],
        "additionalProperties": false,
        "anyOf": [
          {
            "required": [
              "text"
            ],
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          {
            "required": [
              "html"
            ],
            "properties": {
              "html": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        ],
        "description": "Provide 1 to 50 unique recipients across to, cc and bcc, and at least one non-empty body. Text and HTML together may contain up to 1 MiB of UTF-8."
      },
      "EmailAdmission": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "scheduled"
            ]
          }
        },
        "required": [
          "id",
          "mode",
          "status"
        ],
        "examples": [
          {
            "id": "019ac981-24bd-704d-90e4-9bcd1d8d045e",
            "mode": "test",
            "status": "queued"
          }
        ]
      },
      "EmailRecipient": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "format": "email"
          },
          "kind": {
            "type": "string",
            "enum": [
              "to",
              "cc",
              "bcc"
            ]
          },
          "status": {
            "type": "string",
            "description": "Current recipient state. Simulator outcomes are simulated_delivered, simulated_bounced and simulated_complained."
          },
          "accepted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "address",
          "kind",
          "status",
          "accepted_at",
          "delivered_at"
        ]
      },
      "Email": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "status": {
            "type": "string",
            "description": "Aggregate message state. Individual recipient states appear in recipients."
          },
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "Address with ASCII local part, optionally with display name. Limit is 512 UTF-8 bytes."
          },
          "subject": {
            "type": "string"
          },
          "scheduled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailRecipient"
            }
          }
        },
        "required": [
          "id",
          "mode",
          "status",
          "from",
          "subject",
          "scheduled_at",
          "created_at",
          "recipients"
        ]
      },
      "InboxSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "sender": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "attachments_count": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "sender",
          "recipient",
          "subject",
          "received_at",
          "attachments_count"
        ]
      },
      "InboxMessage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "sender": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "body": {
            "type": [
              "string",
              "null"
            ],
            "description": "Normalized plain text."
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "attachments_omitted": {
            "type": "boolean"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "type": "string"
                },
                "size": {
                  "type": "integer",
                  "minimum": 0
                },
                "download_url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Expires in five minutes. Requires authorization."
                }
              },
              "required": [
                "filename",
                "size",
                "download_url"
              ]
            }
          }
        },
        "required": [
          "id",
          "sender",
          "recipient",
          "subject",
          "body",
          "received_at",
          "attachments_omitted",
          "attachments"
        ]
      },
      "WebhookEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "message.delivered",
              "message.delayed",
              "message.hard_bounce",
              "message.soft_bounce",
              "message.complaint",
              "message.rejected",
              "message.rendering_failure",
              "recipient.suppressed",
              "recipient.unsubscribed"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time MailGateAPI recorded the event."
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time the underlying event occurred."
          },
          "data": {
            "type": "object",
            "properties": {
              "message_id": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uuid"
              },
              "recipient": {
                "type": "string",
                "format": "email"
              }
            },
            "required": [
              "message_id",
              "recipient"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "mode",
          "created_at",
          "occurred_at",
          "data"
        ]
      }
    }
  }
}
