{
  "openapi": "3.1.0",
  "info": {
    "title": "SendTrix API",
    "version": "1.0",
    "summary": "Email API and SMTP relay with per-provider traffic shaping",
    "description": "The SendTrix API sends transactional and marketing email and gives you delivery data back.\n\n## Base URL and authentication\nAll requests go to the server URL shown below over HTTPS. Authenticate with an API key in the `Authorization` header:\n\n```\nAuthorization: Bearer st_live_xxxxxxxxxxxxxxxx\n```\n\nCreate keys in the dashboard under **API & SMTP**. Each key has scopes (`send`, `events`), an optional IP allow-list and its own limits.\nKeys starting with `st_test_` run every check and capture the message in your Test inbox, but never deliver it.\n\n## Requests and responses\nSend JSON with `Content-Type: application/json`. Every response is JSON. Errors always have an `error` message and, where it helps, a stable `code` you can branch on (see **Error codes**).\n\n## Idempotency\nAdd an `Idempotency-Key` header (up to 100 characters, for example your order id) to `POST /v1/send`. If the same key is sent again within 24 hours, the original response is returned with `Idempotent-Replayed: true` and no second email is sent.\n\n## Recipient guard\nAddresses on disposable domains, placeholder domains (example.com, test.com) and mistyped provider domains (gmial.com, hotmial.com) are refused before sending, added to your suppression list with the reason, and returned in the `invalid` array. If every recipient is refused you get `422 bad_recipient`.\n\n## Rate limits\n`POST /v1/send`: 600 requests per second per key. `POST /v1/send/batch` and `POST /v1/validate`: 20 per second per key. Other endpoints: 300 per minute per IP. Over the limit you get `429` with a `Retry-After` header. Sending volume limits (hourly, daily, monthly) come from your plan.\n\n## Webhooks\nDelivery, bounce, complaint, open, click and unsubscribe events are pushed to your webhook URLs, signed with HMAC-SHA256 in the `X-SendTrix-Signature` header. Configure them in the dashboard under **Webhooks**.",
    "contact": {
      "name": "SendTrix developer support",
      "email": "support@sendtrix.io",
      "url": "https://sendtrix.io/developers/"
    },
    "termsOfService": "https://sendtrix.io/legal/terms/",
    "x-logo": {
      "url": "https://sendtrix.io/assets/icon-512.png",
      "altText": "SendTrix",
      "backgroundColor": "#FBF8F2"
    }
  },
  "externalDocs": {
    "description": "API reference and guides",
    "url": "https://sendtrix.io/docs/api/"
  },
  "servers": [
    {
      "url": "https://api.sendtrixapi.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Sending",
      "description": "Send single messages, personalised batches and scheduled email."
    },
    {
      "name": "Templates",
      "description": "Read the templates published in your dashboard."
    },
    {
      "name": "Events",
      "description": "Delivery data: delivered, bounced, deferred, complained, opened, clicked, unsubscribed."
    },
    {
      "name": "Suppressions",
      "description": "Addresses that will not be emailed again: bounces, complaints, unsubscribes, refused recipients and manual entries."
    },
    {
      "name": "Preferences",
      "description": "What recipients chose in the preference centre."
    },
    {
      "name": "Validation",
      "description": "Check an address before you add it to a list."
    }
  ],
  "x-error-codes": [
    {
      "status": 400,
      "code": "invalid_request",
      "description": "The body failed validation. `details` lists the fields."
    },
    {
      "status": 400,
      "code": "send_at_too_far",
      "description": "`send_at` is more than 7 days ahead."
    },
    {
      "status": 400,
      "code": "stream_unknown",
      "description": "The `stream` does not exist on your account."
    },
    {
      "status": 400,
      "code": "template_unpublished",
      "description": "The template exists but has no published version."
    },
    {
      "status": 400,
      "code": "template_incomplete",
      "description": "The template is missing a subject or body."
    },
    {
      "status": 400,
      "code": "too_many_recipients",
      "description": "More recipients than your plan allows in one message."
    },
    {
      "status": 400,
      "code": "idempotency_key_invalid",
      "description": "`Idempotency-Key` is longer than 100 characters or contains spaces."
    },
    {
      "status": 401,
      "code": "unauthorized",
      "description": "Missing, unknown or revoked API key."
    },
    {
      "status": 402,
      "code": "no_credits",
      "description": "Your prepaid credits are used up."
    },
    {
      "status": 403,
      "code": "account_suspended",
      "description": "The account is suspended. Contact support."
    },
    {
      "status": 403,
      "code": "domain_unverified",
      "description": "The From domain is added but its DNS records are not verified yet."
    },
    {
      "status": 403,
      "code": "domain_unknown",
      "description": "The From domain is not added to your account."
    },
    {
      "status": 403,
      "code": "domain_not_owned",
      "description": "The From domain belongs to another account."
    },
    {
      "status": 403,
      "code": "sandbox",
      "description": "Sandbox accounts can only send to verified addresses."
    },
    {
      "status": 403,
      "code": "feature_off",
      "description": "The feature is not part of your plan."
    },
    {
      "status": 403,
      "code": "key_scope",
      "description": "The API key does not have the scope this endpoint needs."
    },
    {
      "status": 403,
      "code": "access_blocked",
      "description": "The request breaks the key's access rules (IP allow-list, allowed domains)."
    },
    {
      "status": 404,
      "code": "template_unknown",
      "description": "No template with this id."
    },
    {
      "status": 409,
      "code": "idempotency_in_progress",
      "description": "An earlier request with the same `Idempotency-Key` is still running. Retry in a moment to get its result."
    },
    {
      "status": 422,
      "code": "bad_recipient",
      "description": "Every recipient was refused by the recipient guard (typo, placeholder or disposable domain). `invalid` lists each address with the reason."
    },
    {
      "status": 422,
      "code": "all_suppressed",
      "description": "Every recipient is on your suppression list."
    },
    {
      "status": 422,
      "code": "content_blocked",
      "description": "The content matched a blocked pattern (for example a known phishing URL)."
    },
    {
      "status": 422,
      "code": "provider_blocked",
      "description": "The recipient's mailbox provider currently refuses mail from your route."
    },
    {
      "status": 429,
      "code": "hourly_limit",
      "description": "Hourly sending limit reached."
    },
    {
      "status": 429,
      "code": "daily_limit",
      "description": "Daily sending limit reached."
    },
    {
      "status": 429,
      "code": "monthly_limit",
      "description": "Monthly sending limit reached. Upgrade or enable overage."
    },
    {
      "status": 429,
      "code": "rate_limited",
      "description": "Too many API requests. Back off and retry after the `Retry-After` header."
    },
    {
      "status": 502,
      "code": "node_error",
      "description": "The message could not be handed to a sending server. Safe to retry with the same `Idempotency-Key`."
    },
    {
      "status": 503,
      "code": "node_offline",
      "description": "No sending server is available for your route right now. Retry with backoff."
    }
  ],
  "paths": {
    "/v1/send": {
      "post": {
        "tags": [
          "Sending"
        ],
        "summary": "Send an email",
        "description": "One message to up to 1000 recipients. Add `send_at` to schedule (max 7 days ahead), `stream` to pick a message stream, `topic` to honour preference-centre opt-outs, or `template_id` + `variables` to use a template.\n\nRequires the `send` scope.",
        "operationId": "post_v_send",
        "x-scope": "send",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Message"
              },
              "example": {
                "from": {
                  "email": "hello@mail.example.com",
                  "name": "Example"
                },
                "to": [
                  "alice@gmail.com"
                ],
                "subject": "Your receipt",
                "html": "<p>Thanks for your order!</p>",
                "text": "Thanks for your order!",
                "tags": [
                  "receipt"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted for delivery (or scheduled, or captured for a test key)",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when this is a replay of an earlier request with the same Idempotency-Key"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "502": {
            "$ref": "#/components/responses/E502"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        }
      }
    },
    "/v1/send/batch": {
      "post": {
        "tags": [
          "Sending"
        ],
        "summary": "Send personalised copies (batch)",
        "description": "Common fields once, then up to 500 `messages` each with its own `to` and `variables`.\n\nRequires the `send` scope.",
        "operationId": "post_v_send_batch",
        "x-scope": "send",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "messages"
                ],
                "properties": {
                  "from": {
                    "$ref": "#/components/schemas/Address"
                  },
                  "subject": {
                    "type": "string"
                  },
                  "html": {
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  },
                  "template_id": {
                    "type": "string"
                  },
                  "stream": {
                    "type": "string"
                  },
                  "topic": {
                    "type": "string"
                  },
                  "messages": {
                    "type": "array",
                    "maxItems": 500,
                    "items": {
                      "type": "object",
                      "required": [
                        "to"
                      ],
                      "properties": {
                        "to": {
                          "type": "string",
                          "format": "email"
                        },
                        "variables": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "from": {
                  "email": "hello@mail.example.com"
                },
                "subject": "Hi {{name}}",
                "text": "Hello {{name}}",
                "messages": [
                  {
                    "to": "a@gmail.com",
                    "variables": {
                      "name": "Ann"
                    }
                  },
                  {
                    "to": "b@yahoo.com",
                    "variables": {
                      "name": "Bob"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted per message",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "502": {
            "$ref": "#/components/responses/E502"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        }
      }
    },
    "/v1/scheduled": {
      "get": {
        "tags": [
          "Sending"
        ],
        "summary": "List scheduled sends",
        "description": "Requires the `send` scope.",
        "operationId": "get_v_scheduled",
        "x-scope": "send",
        "responses": {
          "200": {
            "description": "Scheduled messages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/scheduled/{id}": {
      "delete": {
        "tags": [
          "Sending"
        ],
        "summary": "Cancel a scheduled send",
        "description": "Requires the `send` scope.",
        "operationId": "delete_v_scheduled_id_",
        "x-scope": "send",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/templates": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "List published templates",
        "description": "Requires the `send` scope.",
        "operationId": "get_v_templates",
        "x-scope": "send",
        "responses": {
          "200": {
            "description": "Templates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "Delivery events (delivered, bounced, opened, …)",
        "description": "Requires the `events` scope.",
        "operationId": "get_v_events",
        "x-scope": "events",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "delivered",
                "bounce",
                "deferred",
                "complaint",
                "open",
                "click",
                "unsubscribe"
              ]
            }
          },
          {
            "name": "message_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "rcpt",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "domain",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/suppressions": {
      "get": {
        "tags": [
          "Suppressions"
        ],
        "summary": "List suppressed addresses",
        "description": "Requires the `send` scope.",
        "operationId": "get_v_suppressions",
        "x-scope": "send",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Suppressed addresses",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Suppression"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "post": {
        "tags": [
          "Suppressions"
        ],
        "summary": "Add addresses to the suppression list",
        "description": "Requires the `send` scope.",
        "operationId": "post_v_suppressions",
        "x-scope": "send",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "emails"
                ],
                "properties": {
                  "emails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 10000
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "unsubscribe"
                    ]
                  }
                }
              },
              "example": {
                "emails": [
                  "old@example.com"
                ],
                "reason": "manual"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Added",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/suppressions/{email}": {
      "delete": {
        "tags": [
          "Suppressions"
        ],
        "summary": "Remove an address from the suppression list",
        "description": "Requires the `send` scope.",
        "operationId": "delete_v_suppressions_email_",
        "x-scope": "send",
        "parameters": [
          {
            "name": "email",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/preferences": {
      "get": {
        "tags": [
          "Preferences"
        ],
        "summary": "Preference-centre changes since a time",
        "description": "Requires the `send` scope.",
        "operationId": "get_v_preferences",
        "x-scope": "send",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/preferences/{email}": {
      "get": {
        "tags": [
          "Preferences"
        ],
        "summary": "One recipient's preferences",
        "description": "Requires the `send` scope.",
        "operationId": "get_v_preferences_email_",
        "x-scope": "send",
        "parameters": [
          {
            "name": "email",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preferences",
            "content": {
              "application/json": {
                "example": {
                  "email": "a@gmail.com",
                  "unsubscribed": false,
                  "topics_off": [
                    "promo"
                  ],
                  "frequency": "less"
                },
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/v1/validate": {
      "post": {
        "tags": [
          "Validation"
        ],
        "summary": "Validate an email address",
        "description": "Requires the `send` scope.",
        "operationId": "post_v_validate",
        "x-scope": "send",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "email": "someone@gmial.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Validation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key from the dashboard (API & SMTP). st_live_ keys send, st_test_ keys capture."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 100,
          "pattern": "^\\S+$"
        },
        "description": "Your unique id for this send. Repeats within 24 hours return the first response and send nothing.",
        "example": "order-48213-confirmation"
      }
    },
    "responses": {
      "E400": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E401": {
        "description": "Missing or invalid API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E402": {
        "description": "Out of credits",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E403": {
        "description": "Not allowed: domain, scope, IP or account state",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E409": {
        "description": "Same Idempotency-Key still being processed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E422": {
        "description": "Recipients or content refused",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E429": {
        "description": "Rate or volume limit reached",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait"
          }
        }
      },
      "E502": {
        "description": "Could not hand over to a sending server",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E503": {
        "description": "No sending server available",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable code, see Error codes"
          },
          "details": {
            "type": "object",
            "description": "Field errors for 400 invalid_request"
          },
          "invalid": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvalidRecipient"
            }
          }
        },
        "example": {
          "error": "Domain mail.example.com is not verified",
          "code": "domain_unverified"
        }
      },
      "Address": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "example": "orders@mail.example.com"
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "example": "Northwind"
          }
        }
      },
      "Recipient": {
        "oneOf": [
          {
            "type": "string",
            "format": "email"
          },
          {
            "$ref": "#/components/schemas/Address"
          }
        ],
        "description": "An address string or an object with email and name"
      },
      "Attachment": {
        "type": "object",
        "required": [
          "filename",
          "content"
        ],
        "properties": {
          "filename": {
            "type": "string",
            "example": "invoice-48213.pdf"
          },
          "content": {
            "type": "string",
            "format": "byte",
            "description": "File content, base64 encoded"
          },
          "contentType": {
            "type": "string",
            "example": "application/pdf"
          }
        }
      },
      "InvalidRecipient": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "enum": [
              "syntax",
              "placeholder",
              "typo_domain",
              "tld_typo",
              "disposable"
            ]
          },
          "reason": {
            "type": "string"
          },
          "suggestion": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "example": {
          "email": "ana@gmial.com",
          "code": "typo_domain",
          "reason": "Mistyped provider domain",
          "suggestion": "gmail.com"
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "from",
          "to"
        ],
        "description": "Give `subject` with `html` and/or `text`, or a `template_id`.",
        "properties": {
          "from": {
            "$ref": "#/components/schemas/Address"
          },
          "to": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/Recipient"
            },
            "description": "Each recipient gets their own copy; they do not see each other"
          },
          "cc": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Recipient"
            }
          },
          "bcc": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Recipient"
            }
          },
          "replyTo": {
            "type": "string",
            "format": "email"
          },
          "subject": {
            "type": "string",
            "maxLength": 998,
            "description": "Supports {{variables}}"
          },
          "html": {
            "type": "string",
            "description": "HTML body, up to 10 MB. Supports {{variables}}"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body. Generated from html if left out"
          },
          "template_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ],
            "description": "Slug or id of a published template"
          },
          "variables": {
            "type": "object",
            "additionalProperties": true,
            "description": "Values for {{placeholders}} in subject, html, text or the template",
            "example": {
              "first_name": "Ana",
              "order": "48213"
            }
          },
          "stream": {
            "type": "string",
            "description": "Message stream, for example transactional or marketing. Streams can use separate IPs and settings"
          },
          "topic": {
            "type": "string",
            "pattern": "^[a-z0-9_-]+$",
            "description": "Preference-centre topic. Recipients who opted out of it are skipped"
          },
          "campaign": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]+$",
            "maxLength": 60,
            "description": "Groups bulk sends so they can be reported on, paused or cancelled"
          },
          "unsubscribe": {
            "type": "boolean",
            "description": "Add List-Unsubscribe and one-click headers (on by default for marketing streams)"
          },
          "send_at": {
            "type": "string",
            "format": "date-time",
            "description": "Schedule up to 7 days ahead (ISO 8601 with offset)"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 1000
            },
            "description": "Custom headers. Names must start with X-",
            "example": {
              "X-Order-Id": "48213"
            }
          },
          "tags": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Free labels, returned in events and webhooks"
          },
          "attachments": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/Attachment"
            }
          }
        }
      },
      "SendResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Message id, used in events and logs"
          },
          "held": {
            "type": "boolean",
            "description": "The account is under automatic review: the message waits in the queue (up to 72 hours) until the review clears"
          },
          "deferred_until": {
            "type": "string",
            "format": "date-time",
            "description": "New-account daily limit reached: the message sends at this time"
          },
          "notice": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "scheduled",
              "captured"
            ]
          },
          "accepted": {
            "type": "integer",
            "description": "Recipients queued"
          },
          "rejected": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "suppressed": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Skipped because they are on your suppression list"
          },
          "invalid": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvalidRecipient"
            }
          },
          "send_at": {
            "type": "string",
            "format": "date-time"
          },
          "test": {
            "type": "boolean"
          }
        },
        "example": {
          "id": "st_01JF8Q4ZC4H7",
          "status": "queued",
          "accepted": 1,
          "rejected": [],
          "suppressed": [],
          "invalid": [
            {
              "email": "bob@mailinator.com",
              "code": "disposable",
              "reason": "Disposable mailbox domain",
              "suggestion": null
            }
          ]
        }
      },
      "Event": {
        "type": "object",
        "properties": {
          "ts": {
            "type": "string",
            "format": "date-time"
          },
          "bot": {
            "type": "string",
            "enum": [
              "",
              "google_proxy",
              "apple",
              "scanner",
              "prefetch"
            ],
            "description": "Opens and clicks only. Empty = likely a person. google_proxy = Gmail or Yahoo image proxy (a real open). apple = Apple Mail Privacy Protection. scanner = security gateway or script. prefetch = too fast after sending for a person."
          },
          "machine_open": {
            "type": "boolean",
            "description": "Opens only: fetched automatically, not read"
          },
          "type": {
            "type": "string",
            "enum": [
              "delivered",
              "bounce",
              "transient",
              "deferred",
              "complaint",
              "open",
              "click",
              "unsubscribe"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "domain": {
            "type": "string",
            "description": "Sending domain"
          },
          "rcpt": {
            "type": "string"
          },
          "rcpt_domain": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "example": "gmail"
          },
          "source_ip": {
            "type": "string",
            "description": "Your sending IP"
          },
          "dsn_status": {
            "type": "string",
            "example": "5.1.1"
          },
          "dsn_diag": {
            "type": "string",
            "description": "The receiving server's own reply"
          },
          "bounce_cat": {
            "type": "string",
            "example": "bad-mailbox"
          },
          "queued_ms": {
            "type": "integer"
          }
        }
      },
      "Suppression": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "email": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "enum": [
              "bounce",
              "complaint",
              "unsubscribe",
              "manual",
              "invalid"
            ]
          },
          "detail": {
            "type": [
              "string",
              "null"
            ],
            "example": "typo_domain: Mistyped provider domain (did you mean gmail.com?)"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Validation": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "result": {
            "type": "string",
            "enum": [
              "valid",
              "risky",
              "invalid"
            ]
          },
          "checks": {
            "type": "object",
            "properties": {
              "syntax": {
                "type": "boolean"
              },
              "mx": {
                "type": "boolean"
              },
              "mx_hosts": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "disposable": {
                "type": "boolean"
              },
              "role": {
                "type": "boolean"
              }
            }
          },
          "did_you_mean": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  }
}