{
  "openapi": "3.1.0",
  "info": {
    "title": "Minket API",
    "version": "1.0.0",
    "description": "The native API. Authenticate with `Authorization: Bearer <api key>`. Keys are live (`minket_live_…`) or test (`minket_test_…`); test keys accept, render and store mail and simulate events without delivering. Every list is cursor-paginated with `limit`, `after` and `before`. Errors share one shape (`error.code`, `error.message`, `error.retryable`)."
  },
  "servers": [
    {
      "url": "https://api.minket.com"
    }
  ],
  "tags": [
    {
      "name": "Emails"
    },
    {
      "name": "Attachments"
    },
    {
      "name": "Uploads"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Domains"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Events"
    },
    {
      "name": "Inbound"
    },
    {
      "name": "Mailboxes"
    },
    {
      "name": "Suppressions"
    },
    {
      "name": "Contacts"
    },
    {
      "name": "Segments"
    },
    {
      "name": "Topics"
    },
    {
      "name": "Broadcasts"
    },
    {
      "name": "Automations"
    },
    {
      "name": "Keys"
    },
    {
      "name": "Logs"
    },
    {
      "name": "Members"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key such as minket_live_… (live) or minket_test_… (test)."
      }
    },
    "schemas": {
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "validation_error",
                  "missing_required_field",
                  "invalid_parameter",
                  "invalid_attachment",
                  "invalid_from_address",
                  "invalid_region",
                  "invalid_idempotency_key",
                  "invalid_idempotent_request",
                  "concurrent_idempotent_requests",
                  "missing_api_key",
                  "invalid_api_key",
                  "restricted_api_key",
                  "invalid_access",
                  "not_found",
                  "method_not_allowed",
                  "rate_limit_exceeded",
                  "daily_quota_exceeded",
                  "monthly_quota_exceeded",
                  "security_error",
                  "application_error",
                  "internal_server_error",
                  "unauthorized",
                  "forbidden",
                  "conflict",
                  "invalid_state",
                  "payload_too_large",
                  "organization_suspended",
                  "signup_closed",
                  "invalid_sign_in_code",
                  "account_blocked",
                  "unsupported_media_type",
                  "domain_not_verified",
                  "domain_authentication_failed",
                  "mailbox_unavailable",
                  "stream_rule_violation",
                  "content_blocked",
                  "sending_paused",
                  "test_mode_only",
                  "not_implemented",
                  "upstream_unavailable",
                  "outcome_unknown"
                ],
                "description": "A stable error code, for example validation_error."
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean",
                "description": "Safe to retry with the same idempotency key."
              },
              "request_id": {
                "type": "string"
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "path",
                    "message"
                  ]
                }
              }
            },
            "required": [
              "code",
              "message",
              "retryable"
            ]
          }
        },
        "required": [
          "error"
        ],
        "description": "The body of every non-2xx response."
      },
      "SendEmailRequest": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 3,
            "maxLength": 998,
            "description": "An email address, optionally with a display name as `Name <address>`."
          },
          "to": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 3,
                "maxLength": 998,
                "description": "An email address, optionally with a display name as `Name <address>`."
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 998,
                  "description": "An email address, optionally with a display name as `Name <address>`."
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "One address, or an array of up to 50."
          },
          "cc": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 3,
                "maxLength": 998,
                "description": "An email address, optionally with a display name as `Name <address>`."
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 998,
                  "description": "An email address, optionally with a display name as `Name <address>`."
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "One address, or an array of up to 50."
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 3,
                "maxLength": 998,
                "description": "An email address, optionally with a display name as `Name <address>`."
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 998,
                  "description": "An email address, optionally with a display name as `Name <address>`."
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "One address, or an array of up to 50."
          },
          "reply_to": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 3,
                "maxLength": 998,
                "description": "An email address, optionally with a display name as `Name <address>`."
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 998,
                  "description": "An email address, optionally with a display name as `Name <address>`."
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "One address, or an array of up to 50."
          },
          "subject": {
            "type": "string",
            "maxLength": 998
          },
          "html": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "template": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "description": "Template id or alias."
              },
              "version": {
                "type": "integer",
                "minimum": 1,
                "description": "Defaults to the published version."
              },
              "variables": {
                "type": "object",
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            },
            "required": [
              "id"
            ]
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Custom headers. Structural headers (From, To, Subject, ...) cannot be set here."
          },
          "attachments": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "filename": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    "content": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "Buffer"
                              ]
                            },
                            "data": {
                              "type": "array",
                              "items": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 255
                              }
                            }
                          },
                          "required": [
                            "type",
                            "data"
                          ]
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 255
                          }
                        }
                      ]
                    },
                    "content_type": {
                      "type": "string",
                      "maxLength": 255,
                      "pattern": "^[\\w.+-]+\\/[\\w.+-]+(?:\\s*;.*)?$"
                    },
                    "content_id": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "disposition": {
                      "type": "string",
                      "enum": [
                        "attachment",
                        "inline"
                      ]
                    }
                  },
                  "required": [
                    "filename",
                    "content"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "filename": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    "content_id": {
                      "type": "string",
                      "maxLength": 255
                    },
                    "disposition": {
                      "type": "string",
                      "enum": [
                        "attachment",
                        "inline"
                      ]
                    }
                  },
                  "required": [
                    "id"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string",
                      "maxLength": 2048,
                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                    },
                    "filename": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    "content_type": {
                      "type": "string",
                      "maxLength": 255,
                      "pattern": "^[\\w.+-]+\\/[\\w.+-]+(?:\\s*;.*)?$"
                    },
                    "content_id": {
                      "type": "string",
                      "maxLength": 255
                    }
                  },
                  "required": [
                    "path"
                  ]
                }
              ]
            },
            "maxItems": 20
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,256}$"
                },
                "value": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_-]{1,256}$"
                }
              },
              "required": [
                "name",
                "value"
              ],
              "description": "A name/value tag attached to the email and returned in events."
            },
            "maxItems": 50
          },
          "scheduled_at": {
            "type": "string",
            "maxLength": 100,
            "description": "ISO 8601 or natural language (`in 1 hour`), at most 30 days ahead."
          },
          "stream": {
            "type": "string",
            "enum": [
              "transactional",
              "marketing"
            ],
            "description": "Defaults to the stream of the from domain."
          },
          "topic_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Marketing: the topic this email belongs to; unsubscribe links point at it."
          },
          "via": {
            "type": "object",
            "properties": {
              "mailbox": {
                "type": "string",
                "description": "A UUID."
              }
            },
            "required": [
              "mailbox"
            ],
            "description": "Send through a connected mailbox instead of a domain."
          },
          "idempotency_key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Alternative to the Idempotency-Key header."
          },
          "tracking": {
            "type": "object",
            "properties": {
              "opens": {
                "type": "boolean"
              },
              "clicks": {
                "type": "boolean"
              }
            }
          }
        },
        "required": [
          "to"
        ]
      },
      "Email": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "environment_id": {
            "type": "string",
            "description": "A UUID."
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "stream": {
            "type": "string",
            "enum": [
              "transactional",
              "marketing"
            ],
            "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
          },
          "source": {
            "type": "string",
            "enum": [
              "api",
              "smtp",
              "broadcast",
              "automation",
              "console",
              "inbound"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "scheduled",
              "sent",
              "delivered",
              "delivery_delayed",
              "opened",
              "clicked",
              "bounced",
              "complained",
              "failed",
              "canceled",
              "suppressed"
            ]
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reply_to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": "string"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value"
              ]
            }
          },
          "template": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "A UUID."
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "version"
            ]
          },
          "topic_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "via": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "mailbox": {
                "type": "string",
                "description": "A UUID."
              }
            },
            "required": [
              "mailbox"
            ]
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "A UUID."
                },
                "filename": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "content_type": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                },
                "content_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "disposition": {
                  "type": "string",
                  "enum": [
                    "attachment",
                    "inline"
                  ]
                }
              },
              "required": [
                "id",
                "filename",
                "content_type",
                "size",
                "content_id",
                "disposition"
              ]
            }
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "ses",
                  "resend",
                  "gmail",
                  "microsoft",
                  "smtp",
                  "test"
                ]
              },
              "region": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "region"
            ]
          },
          "broadcast_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "automation_run_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "check": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "hosts": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "check",
                "message"
              ]
            }
          },
          "scheduled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "environment_id",
          "mode",
          "stream",
          "source",
          "status",
          "from",
          "to",
          "cc",
          "bcc",
          "reply_to",
          "subject",
          "headers",
          "tags",
          "template",
          "topic_id",
          "via",
          "attachments",
          "message_id",
          "provider",
          "broadcast_id",
          "automation_run_id",
          "warnings",
          "scheduled_at",
          "sent_at",
          "created_at",
          "updated_at"
        ]
      },
      "Domain": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "domain"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": "string"
          },
          "stream": {
            "type": "string",
            "enum": [
              "transactional",
              "marketing"
            ],
            "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
          },
          "status": {
            "type": "string",
            "enum": [
              "not_started",
              "pending",
              "verified",
              "partially_verified",
              "failed"
            ]
          },
          "sending": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "receiving": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "authentication": {
            "type": "string",
            "enum": [
              "passing",
              "failing",
              "unknown"
            ]
          },
          "primary": {
            "type": "object",
            "properties": {
              "region": {
                "type": "string",
                "enum": [
                  "us-east-1",
                  "us-west-2"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "not_started",
                  "pending",
                  "verified",
                  "partially_verified",
                  "failed"
                ]
              },
              "dkim_status": {
                "type": "string",
                "enum": [
                  "not_started",
                  "pending",
                  "verified",
                  "failed",
                  "temporary_failure"
                ]
              },
              "mail_from_status": {
                "type": "string",
                "enum": [
                  "not_started",
                  "pending",
                  "verified",
                  "failed",
                  "temporary_failure"
                ]
              },
              "mail_from_domain": {
                "type": "string"
              },
              "configuration_set": {
                "type": "string"
              }
            },
            "required": [
              "region",
              "status",
              "dkim_status",
              "mail_from_status",
              "mail_from_domain",
              "configuration_set"
            ]
          },
          "secondary": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "region": {
                "type": "string",
                "enum": [
                  "us-east-1",
                  "us-west-2"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "not_started",
                  "pending",
                  "verified",
                  "partially_verified",
                  "failed"
                ]
              },
              "dkim_status": {
                "type": "string",
                "enum": [
                  "not_started",
                  "pending",
                  "verified",
                  "failed",
                  "temporary_failure"
                ]
              },
              "mail_from_status": {
                "type": "string",
                "enum": [
                  "not_started",
                  "pending",
                  "verified",
                  "failed",
                  "temporary_failure"
                ]
              },
              "mail_from_domain": {
                "type": "string"
              },
              "configuration_set": {
                "type": "string"
              }
            },
            "required": [
              "region",
              "status",
              "dkim_status",
              "mail_from_status",
              "mail_from_domain",
              "configuration_set"
            ]
          },
          "dmarc": {
            "type": "object",
            "properties": {
              "policy": {
                "type": "string",
                "enum": [
                  "missing",
                  "none",
                  "quarantine",
                  "reject"
                ]
              },
              "record": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "pass_rate_30d": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "policy",
              "record",
              "pass_rate_30d"
            ]
          },
          "tracking": {
            "type": "object",
            "properties": {
              "domain": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "not_started",
                  "pending",
                  "verified",
                  "failed",
                  "temporary_failure"
                ]
              },
              "opens": {
                "type": "boolean"
              },
              "clicks": {
                "type": "boolean"
              }
            },
            "required": [
              "domain",
              "status",
              "opens",
              "clicks"
            ]
          },
          "auto_dns": {
            "type": "boolean"
          },
          "cloudflare_zone_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "A UUID."
                },
                "purpose": {
                  "type": "string",
                  "enum": [
                    "dkim",
                    "mail_from_mx",
                    "mail_from_spf",
                    "dmarc",
                    "tracking",
                    "receiving_mx",
                    "bimi",
                    "verification",
                    "arc"
                  ]
                },
                "region": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "us-east-1",
                    "us-west-2",
                    null
                  ]
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "CNAME",
                    "TXT",
                    "MX"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "priority": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "ttl": {
                  "type": "string",
                  "enum": [
                    "Auto"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "not_started",
                    "pending",
                    "verified",
                    "failed",
                    "temporary_failure"
                  ]
                },
                "managed": {
                  "type": "boolean"
                },
                "last_checked_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time",
                  "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                },
                "last_error": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "purpose",
                "region",
                "type",
                "name",
                "value",
                "priority",
                "ttl",
                "status",
                "managed",
                "last_checked_at",
                "last_error"
              ]
            }
          },
          "reputation": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "postmaster"
                ]
              },
              "domain_reputation": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "high",
                  "medium",
                  "low",
                  "bad",
                  null
                ]
              },
              "spam_rate": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "captured_at": {
                "type": "string",
                "format": "date-time",
                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
              }
            },
            "required": [
              "source",
              "domain_reputation",
              "spam_rate",
              "captured_at"
            ]
          },
          "last_checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "name",
          "stream",
          "status",
          "sending",
          "receiving",
          "authentication",
          "primary",
          "secondary",
          "dmarc",
          "tracking",
          "auto_dns",
          "cloudflare_zone_id",
          "records",
          "reputation",
          "last_checked_at",
          "created_at",
          "updated_at"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "webhook"
            ]
          },
          "environment_id": {
            "type": "string",
            "description": "A UUID."
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "enum": [
                "email.sent",
                "email.scheduled",
                "email.delivered",
                "email.delivery_delayed",
                "email.complained",
                "email.bounced",
                "email.opened",
                "email.clicked",
                "email.received",
                "email.failed",
                "email.suppressed",
                "email.canceled",
                "contact.created",
                "contact.updated",
                "contact.deleted",
                "domain.created",
                "domain.updated",
                "domain.deleted",
                "broadcast.started",
                "broadcast.completed",
                "automation.completed",
                "automation.failed"
              ]
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled",
              "auto_disabled"
            ]
          },
          "secret": {
            "type": "string"
          },
          "stats": {
            "type": "object",
            "properties": {
              "delivered_24h": {
                "type": "integer"
              },
              "failed_24h": {
                "type": "integer"
              },
              "last_success_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
              },
              "last_failure_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
              }
            },
            "required": [
              "delivered_24h",
              "failed_24h",
              "last_success_at",
              "last_failure_at"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "environment_id",
          "mode",
          "url",
          "description",
          "events",
          "status",
          "stats",
          "created_at",
          "updated_at"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "delivery"
            ]
          },
          "webhook_id": {
            "type": "string",
            "description": "A UUID."
          },
          "event_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "event_type": {
            "type": "string",
            "enum": [
              "email.sent",
              "email.scheduled",
              "email.delivered",
              "email.delivery_delayed",
              "email.complained",
              "email.bounced",
              "email.opened",
              "email.clicked",
              "email.received",
              "email.failed",
              "email.suppressed",
              "email.canceled",
              "contact.created",
              "contact.updated",
              "contact.deleted",
              "domain.created",
              "domain.updated",
              "domain.deleted",
              "broadcast.started",
              "broadcast.completed",
              "automation.completed",
              "automation.failed"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed",
              "exhausted"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "next_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "last_status_code": {
            "type": [
              "integer",
              "null"
            ]
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "attempt_log": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "attempt": {
                  "type": "integer"
                },
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                },
                "status_code": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "response": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "duration_ms": {
                  "type": "integer"
                }
              },
              "required": [
                "attempt",
                "at",
                "status_code",
                "error",
                "response",
                "duration_ms"
              ]
            },
            "maxItems": 20
          },
          "replay_of_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "webhook_id",
          "event_id",
          "event_type",
          "message_id",
          "status",
          "attempts",
          "next_attempt_at",
          "last_status_code",
          "last_error",
          "attempt_log",
          "replay_of_id",
          "created_at",
          "updated_at"
        ]
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "email.sent",
              "email.scheduled",
              "email.delivered",
              "email.delivery_delayed",
              "email.complained",
              "email.bounced",
              "email.opened",
              "email.clicked",
              "email.received",
              "email.failed",
              "email.suppressed",
              "email.canceled",
              "contact.created",
              "contact.updated",
              "contact.deleted",
              "domain.created",
              "domain.updated",
              "domain.deleted",
              "broadcast.started",
              "broadcast.completed",
              "automation.completed",
              "automation.failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "data": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "id",
          "mode",
          "type",
          "created_at",
          "data"
        ]
      },
      "Inbound": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "inbound"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reply_to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "received_for": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": "string"
          },
          "message_id": {
            "type": "string"
          },
          "in_reply_to": {
            "type": [
              "string",
              "null"
            ]
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "A UUID."
                },
                "object": {
                  "type": "string",
                  "enum": [
                    "attachment"
                  ]
                },
                "filename": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "content_type": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                },
                "content_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "disposition": {
                  "type": "string",
                  "enum": [
                    "attachment",
                    "inline"
                  ]
                },
                "download_url": {
                  "type": "string"
                },
                "expires_at": {
                  "type": "string",
                  "format": "date-time",
                  "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                }
              },
              "required": [
                "id",
                "object",
                "filename",
                "content_type",
                "size",
                "content_id",
                "disposition"
              ]
            }
          },
          "verdicts": {
            "type": "object",
            "properties": {
              "spf": {
                "type": "string",
                "enum": [
                  "pass",
                  "fail",
                  "softfail",
                  "neutral",
                  "none",
                  "temperror",
                  "permerror"
                ]
              },
              "dkim": {
                "type": "string",
                "enum": [
                  "pass",
                  "fail",
                  "none",
                  "temperror",
                  "permerror"
                ]
              },
              "dmarc": {
                "type": "string",
                "enum": [
                  "pass",
                  "fail",
                  "none",
                  "temperror",
                  "permerror"
                ]
              },
              "spam": {
                "type": "string",
                "enum": [
                  "pass",
                  "fail",
                  "unknown"
                ]
              },
              "virus": {
                "type": "string",
                "enum": [
                  "pass",
                  "fail",
                  "unknown"
                ]
              }
            },
            "required": [
              "spf",
              "dkim",
              "dmarc",
              "spam",
              "virus"
            ]
          },
          "spam": {
            "type": "boolean"
          },
          "virus": {
            "type": "boolean"
          },
          "size": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "received",
              "routed",
              "forwarded",
              "dropped",
              "quarantined"
            ]
          },
          "routing": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "webhook",
                    "forward",
                    "store"
                  ]
                },
                "target": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "done",
                    "failed",
                    "skipped"
                  ]
                },
                "error": {
                  "type": "string"
                },
                "email_id": {
                  "type": "string",
                  "description": "A UUID."
                }
              },
              "required": [
                "kind",
                "target",
                "status"
              ]
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "message_too_large",
                "malformed",
                "headers_too_large",
                "too_many_parts",
                "too_deep",
                "nested_messages_kept",
                "attachments_truncated",
                "addresses_truncated",
                "virus",
                "spam",
                "forward_loop",
                "dmarc_refused"
              ]
            }
          },
          "raw": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "download_url": {
                "type": "string"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time",
                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
              }
            },
            "required": [
              "download_url",
              "expires_at"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "domain_id",
          "from",
          "to",
          "cc",
          "bcc",
          "reply_to",
          "received_for",
          "subject",
          "message_id",
          "in_reply_to",
          "attachments",
          "verdicts",
          "spam",
          "virus",
          "size",
          "status",
          "routing",
          "issues",
          "created_at"
        ]
      },
      "Mailbox": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "mailbox"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "provider": {
            "type": "string",
            "enum": [
              "gmail",
              "microsoft",
              "smtp"
            ]
          },
          "address": {
            "type": "string"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "needs_reconnect",
              "disabled"
            ]
          },
          "saves_sent_copy": {
            "type": "boolean"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "provider",
          "address",
          "display_name",
          "status",
          "saves_sent_copy",
          "last_used_at",
          "last_error",
          "created_at"
        ]
      },
      "Contact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "contact"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "email": {
            "type": "string"
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "unsubscribed": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "unsubscribed",
              "bounced",
              "complained",
              "sunset"
            ]
          },
          "properties": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 1000
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "A UUID."
                },
                "subscription": {
                  "type": "string",
                  "enum": [
                    "opt_in",
                    "opt_out"
                  ]
                }
              },
              "required": [
                "id",
                "subscription"
              ]
            }
          },
          "segment_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "A UUID."
            }
          },
          "last_sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "last_opened_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "last_clicked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "email",
          "first_name",
          "last_name",
          "unsubscribed",
          "status",
          "properties",
          "topics",
          "segment_ids",
          "last_sent_at",
          "last_opened_at",
          "last_clicked_at",
          "created_at",
          "updated_at"
        ]
      },
      "Segment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "segment"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "static",
              "dynamic"
            ]
          },
          "rules": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "all": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "maxLength": 120,
                          "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                        },
                        "op": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "neq",
                            "contains",
                            "not_contains",
                            "starts_with",
                            "ends_with",
                            "gt",
                            "gte",
                            "lt",
                            "lte",
                            "is_set",
                            "is_not_set",
                            "in",
                            "not_in",
                            "before",
                            "after",
                            "within_days",
                            "not_within_days"
                          ]
                        },
                        "value": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "field",
                        "op"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 50
                  }
                },
                "required": [
                  "all"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "any": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "maxLength": 120,
                          "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                        },
                        "op": {
                          "type": "string",
                          "enum": [
                            "eq",
                            "neq",
                            "contains",
                            "not_contains",
                            "starts_with",
                            "ends_with",
                            "gt",
                            "gte",
                            "lt",
                            "lte",
                            "is_set",
                            "is_not_set",
                            "in",
                            "not_in",
                            "before",
                            "after",
                            "within_days",
                            "not_within_days"
                          ]
                        },
                        "value": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "field",
                        "op"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 50
                  }
                },
                "required": [
                  "any"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "contacts_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "name",
          "kind",
          "rules",
          "contacts_count",
          "created_at",
          "updated_at"
        ]
      },
      "Topic": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "topic"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "default_subscription": {
            "type": "string",
            "enum": [
              "opt_in",
              "opt_out"
            ]
          },
          "public_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "name",
          "description",
          "default_subscription",
          "public_name",
          "created_at"
        ]
      },
      "Broadcast": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "broadcast"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "name": {
            "type": "string"
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "reply_to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "segment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "topic_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "scheduled",
              "queued",
              "sending",
              "testing",
              "sent",
              "canceled",
              "failed",
              "paused"
            ]
          },
          "document": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "version": {
                "type": "number",
                "enum": [
                  1
                ]
              },
              "settings": {
                "type": "object",
                "properties": {
                  "width": {
                    "type": "integer",
                    "minimum": 320,
                    "maximum": 800,
                    "default": 600
                  },
                  "background": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$",
                    "default": "#f4f4f5"
                  },
                  "font": {
                    "type": "string",
                    "enum": [
                      "system",
                      "serif",
                      "mono"
                    ],
                    "default": "system"
                  },
                  "footer": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "default": {
                  "width": 600,
                  "background": "#f4f4f5",
                  "font": "system"
                }
              },
              "blocks": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "heading"
                          ]
                        },
                        "level": {
                          "type": "string",
                          "enum": [
                            "1",
                            "2",
                            "3"
                          ],
                          "default": "1"
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 20000
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "paragraph"
                          ]
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 20000
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "image"
                          ]
                        },
                        "src": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2048,
                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                            },
                            {
                              "type": "string",
                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                            }
                          ]
                        },
                        "alt": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "href": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2048,
                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                            },
                            {
                              "type": "string",
                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                            }
                          ]
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 16,
                          "maximum": 1200
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "src",
                        "alt"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "button"
                          ]
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "href": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2048,
                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                            },
                            {
                              "type": "string",
                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                            }
                          ]
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "label",
                        "href"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "divider"
                          ]
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "spacer"
                          ]
                        },
                        "height": {
                          "type": "integer",
                          "minimum": 4,
                          "maximum": 200
                        }
                      },
                      "required": [
                        "type",
                        "height"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "html"
                          ]
                        },
                        "html": {
                          "type": "string",
                          "maxLength": 200000
                        }
                      },
                      "required": [
                        "type",
                        "html"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "columns"
                          ]
                        },
                        "columns": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "blocks": {
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "heading"
                                          ]
                                        },
                                        "level": {
                                          "type": "string",
                                          "enum": [
                                            "1",
                                            "2",
                                            "3"
                                          ],
                                          "default": "1"
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 20000
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "text"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "paragraph"
                                          ]
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 20000
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "text"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "image"
                                          ]
                                        },
                                        "src": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "alt": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "href": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "width": {
                                          "type": "integer",
                                          "minimum": 16,
                                          "maximum": 1200
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "src",
                                        "alt"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "button"
                                          ]
                                        },
                                        "label": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        },
                                        "href": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "label",
                                        "href"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "divider"
                                          ]
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "spacer"
                                          ]
                                        },
                                        "height": {
                                          "type": "integer",
                                          "minimum": 4,
                                          "maximum": 200
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "height"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "html"
                                          ]
                                        },
                                        "html": {
                                          "type": "string",
                                          "maxLength": 200000
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "html"
                                      ]
                                    }
                                  ]
                                },
                                "maxItems": 20
                              }
                            },
                            "required": [
                              "blocks"
                            ]
                          },
                          "minItems": 2,
                          "maxItems": 3
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "columns"
                      ]
                    }
                  ]
                },
                "minItems": 1,
                "maxItems": 200
              }
            },
            "required": [
              "version",
              "blocks"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "throttle_per_minute": {
            "type": "integer"
          },
          "ab_test": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "variants": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "enum": [
                        "a",
                        "b"
                      ]
                    },
                    "subject": {
                      "type": "string",
                      "maxLength": 998
                    }
                  },
                  "required": [
                    "key",
                    "subject"
                  ]
                }
              },
              "sample_percent": {
                "type": "integer",
                "minimum": 5,
                "maximum": 50
              },
              "window_minutes": {
                "type": "integer",
                "minimum": 15,
                "maximum": 1440
              },
              "metric": {
                "type": "string",
                "enum": [
                  "opens",
                  "clicks"
                ],
                "default": "opens"
              },
              "winner": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "a",
                  "b",
                  null
                ]
              },
              "decided_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
              },
              "window_ends_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
              },
              "results": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "enum": [
                        "a",
                        "b"
                      ]
                    },
                    "subject": {
                      "type": "string"
                    },
                    "recipients": {
                      "type": "integer"
                    },
                    "sent": {
                      "type": "integer"
                    },
                    "opened": {
                      "type": "integer"
                    },
                    "clicked": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "key",
                    "subject",
                    "recipients",
                    "sent",
                    "opened",
                    "clicked"
                  ]
                }
              }
            },
            "required": [
              "variants",
              "sample_percent",
              "window_minutes",
              "winner",
              "decided_at",
              "window_ends_at",
              "results"
            ]
          },
          "stats": {
            "type": "object",
            "properties": {
              "recipients": {
                "type": "integer"
              },
              "sent": {
                "type": "integer"
              },
              "delivered": {
                "type": "integer"
              },
              "opened": {
                "type": "integer"
              },
              "clicked": {
                "type": "integer"
              },
              "bounced": {
                "type": "integer"
              },
              "complained": {
                "type": "integer"
              },
              "unsubscribed": {
                "type": "integer"
              },
              "skipped": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "pending": {
                "type": "integer"
              }
            },
            "required": [
              "recipients",
              "sent",
              "delivered",
              "opened",
              "clicked",
              "bounced",
              "complained",
              "unsubscribed",
              "skipped",
              "failed",
              "pending"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "scheduled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "mode",
          "name",
          "from",
          "reply_to",
          "subject",
          "preview_text",
          "segment_id",
          "topic_id",
          "status",
          "document",
          "html",
          "text",
          "throttle_per_minute",
          "ab_test",
          "stats",
          "error",
          "scheduled_at",
          "started_at",
          "sent_at",
          "created_at",
          "updated_at"
        ]
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "template"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": "string"
          },
          "alias": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published"
            ]
          },
          "engine": {
            "type": "string",
            "enum": [
              "blocks",
              "html"
            ]
          },
          "current_version": {
            "type": "integer"
          },
          "published_version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "reply_to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "document": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "version": {
                "type": "number",
                "enum": [
                  1
                ]
              },
              "settings": {
                "type": "object",
                "properties": {
                  "width": {
                    "type": "integer",
                    "minimum": 320,
                    "maximum": 800,
                    "default": 600
                  },
                  "background": {
                    "type": "string",
                    "pattern": "^#[0-9a-fA-F]{6}$",
                    "default": "#f4f4f5"
                  },
                  "font": {
                    "type": "string",
                    "enum": [
                      "system",
                      "serif",
                      "mono"
                    ],
                    "default": "system"
                  },
                  "footer": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "default": {
                  "width": 600,
                  "background": "#f4f4f5",
                  "font": "system"
                }
              },
              "blocks": {
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "heading"
                          ]
                        },
                        "level": {
                          "type": "string",
                          "enum": [
                            "1",
                            "2",
                            "3"
                          ],
                          "default": "1"
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 20000
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "paragraph"
                          ]
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 20000
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "image"
                          ]
                        },
                        "src": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2048,
                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                            },
                            {
                              "type": "string",
                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                            }
                          ]
                        },
                        "alt": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "href": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2048,
                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                            },
                            {
                              "type": "string",
                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                            }
                          ]
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 16,
                          "maximum": 1200
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "src",
                        "alt"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "button"
                          ]
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "href": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2048,
                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                            },
                            {
                              "type": "string",
                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                            }
                          ]
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "label",
                        "href"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "divider"
                          ]
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "spacer"
                          ]
                        },
                        "height": {
                          "type": "integer",
                          "minimum": 4,
                          "maximum": 200
                        }
                      },
                      "required": [
                        "type",
                        "height"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "html"
                          ]
                        },
                        "html": {
                          "type": "string",
                          "maxLength": 200000
                        }
                      },
                      "required": [
                        "type",
                        "html"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "columns"
                          ]
                        },
                        "columns": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "blocks": {
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "heading"
                                          ]
                                        },
                                        "level": {
                                          "type": "string",
                                          "enum": [
                                            "1",
                                            "2",
                                            "3"
                                          ],
                                          "default": "1"
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 20000
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "text"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "paragraph"
                                          ]
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 20000
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "text"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "image"
                                          ]
                                        },
                                        "src": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "alt": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "href": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "width": {
                                          "type": "integer",
                                          "minimum": 16,
                                          "maximum": 1200
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "src",
                                        "alt"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "button"
                                          ]
                                        },
                                        "label": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        },
                                        "href": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "label",
                                        "href"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "divider"
                                          ]
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "spacer"
                                          ]
                                        },
                                        "height": {
                                          "type": "integer",
                                          "minimum": 4,
                                          "maximum": 200
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "height"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "html"
                                          ]
                                        },
                                        "html": {
                                          "type": "string",
                                          "maxLength": 200000
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "html"
                                      ]
                                    }
                                  ]
                                },
                                "maxItems": 20
                              }
                            },
                            "required": [
                              "blocks"
                            ]
                          },
                          "minItems": 2,
                          "maxItems": 3
                        },
                        "style": {
                          "type": "object",
                          "properties": {
                            "color": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$"
                            },
                            "align": {
                              "type": "string",
                              "enum": [
                                "left",
                                "center",
                                "right"
                              ]
                            },
                            "padding": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 80
                            }
                          }
                        }
                      },
                      "required": [
                        "type",
                        "columns"
                      ]
                    }
                  ]
                },
                "minItems": 1,
                "maxItems": 200
              }
            },
            "required": [
              "version",
              "blocks"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "variables": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^[a-z][a-z0-9_.]*$"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean"
                  ]
                },
                "fallback_value": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "required": {
                  "type": "boolean"
                }
              },
              "required": [
                "key",
                "type",
                "fallback_value",
                "required"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "name",
          "alias",
          "status",
          "engine",
          "current_version",
          "published_version",
          "subject",
          "from",
          "reply_to",
          "document",
          "html",
          "text",
          "variables",
          "created_at",
          "updated_at",
          "published_at"
        ]
      },
      "Suppression": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "suppression"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "email": {
            "type": "string"
          },
          "stream": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "transactional",
              "marketing",
              null
            ],
            "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
          },
          "reason": {
            "type": "string",
            "enum": [
              "hard_bounce",
              "complaint",
              "unsubscribe",
              "one_click",
              "manual",
              "sunset",
              "imported"
            ]
          },
          "source": {
            "type": "string"
          },
          "email_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "email",
          "stream",
          "reason",
          "source",
          "email_id",
          "created_at",
          "expires_at"
        ]
      },
      "Automation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "automation"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "paused",
              "archived"
            ]
          },
          "current_version": {
            "type": "integer"
          },
          "published_version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "trigger": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "custom_event"
                    ]
                  },
                  "event": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  }
                },
                "required": [
                  "kind",
                  "event"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "contact_created"
                    ]
                  }
                },
                "required": [
                  "kind"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "contact_updated"
                    ]
                  },
                  "properties": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 50,
                      "pattern": "^[a-z][a-z0-9_]*$"
                    }
                  }
                },
                "required": [
                  "kind"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "topic_subscribed"
                    ]
                  },
                  "topic_id": {
                    "type": "string",
                    "description": "A UUID."
                  }
                },
                "required": [
                  "kind",
                  "topic_id"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "segment_entered"
                    ]
                  },
                  "segment_id": {
                    "type": "string",
                    "description": "A UUID."
                  }
                },
                "required": [
                  "kind",
                  "segment_id"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "email_event"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "email.sent",
                      "email.scheduled",
                      "email.delivered",
                      "email.delivery_delayed",
                      "email.complained",
                      "email.bounced",
                      "email.opened",
                      "email.clicked",
                      "email.received",
                      "email.failed",
                      "email.suppressed",
                      "email.canceled",
                      "contact.created",
                      "contact.updated",
                      "contact.deleted",
                      "domain.created",
                      "domain.updated",
                      "domain.deleted",
                      "broadcast.started",
                      "broadcast.completed",
                      "automation.completed",
                      "automation.failed"
                    ]
                  },
                  "tag": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "value"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "type"
                ]
              }
            ]
          },
          "definition": {
            "type": "object",
            "properties": {
              "trigger": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "custom_event"
                        ]
                      },
                      "event": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100
                      }
                    },
                    "required": [
                      "kind",
                      "event"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "contact_created"
                        ]
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "contact_updated"
                        ]
                      },
                      "properties": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[a-z][a-z0-9_]*$"
                        }
                      }
                    },
                    "required": [
                      "kind"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "topic_subscribed"
                        ]
                      },
                      "topic_id": {
                        "type": "string",
                        "description": "A UUID."
                      }
                    },
                    "required": [
                      "kind",
                      "topic_id"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "segment_entered"
                        ]
                      },
                      "segment_id": {
                        "type": "string",
                        "description": "A UUID."
                      }
                    },
                    "required": [
                      "kind",
                      "segment_id"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "email_event"
                        ]
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "email.sent",
                          "email.scheduled",
                          "email.delivered",
                          "email.delivery_delayed",
                          "email.complained",
                          "email.bounced",
                          "email.opened",
                          "email.clicked",
                          "email.received",
                          "email.failed",
                          "email.suppressed",
                          "email.canceled",
                          "contact.created",
                          "contact.updated",
                          "contact.deleted",
                          "domain.created",
                          "domain.updated",
                          "domain.deleted",
                          "broadcast.started",
                          "broadcast.completed",
                          "automation.completed",
                          "automation.failed"
                        ]
                      },
                      "tag": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "value"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "type"
                    ]
                  }
                ]
              },
              "filter": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "all": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "maxLength": 120,
                              "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                            },
                            "op": {
                              "type": "string",
                              "enum": [
                                "eq",
                                "neq",
                                "contains",
                                "not_contains",
                                "starts_with",
                                "ends_with",
                                "gt",
                                "gte",
                                "lt",
                                "lte",
                                "is_set",
                                "is_not_set",
                                "in",
                                "not_in",
                                "before",
                                "after",
                                "within_days",
                                "not_within_days"
                              ]
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "boolean"
                                },
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "op"
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "all"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "any": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "maxLength": 120,
                              "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                            },
                            "op": {
                              "type": "string",
                              "enum": [
                                "eq",
                                "neq",
                                "contains",
                                "not_contains",
                                "starts_with",
                                "ends_with",
                                "gt",
                                "gte",
                                "lt",
                                "lte",
                                "is_set",
                                "is_not_set",
                                "in",
                                "not_in",
                                "before",
                                "after",
                                "within_days",
                                "not_within_days"
                              ]
                            },
                            "value": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "boolean"
                                },
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "field",
                            "op"
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 50
                      }
                    },
                    "required": [
                      "any"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null
              },
              "allow_reentry": {
                "type": "boolean",
                "default": false
              },
              "start": {
                "type": "string",
                "minLength": 1,
                "maxLength": 50,
                "pattern": "^[A-Za-z0-9_-]+$"
              },
              "steps": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "send_email"
                          ]
                        },
                        "template_id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "variables": {
                          "type": "object",
                          "additionalProperties": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 1000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              }
                            ]
                          }
                        },
                        "from": {
                          "type": "string",
                          "maxLength": 320
                        },
                        "subject": {
                          "type": "string",
                          "maxLength": 998
                        },
                        "reply_to": {
                          "type": "string",
                          "maxLength": 320
                        },
                        "stream": {
                          "type": "string",
                          "enum": [
                            "transactional",
                            "marketing"
                          ]
                        },
                        "topic_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "description": "A UUID."
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "template_id",
                        "next"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "wait"
                          ]
                        },
                        "duration": {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "unit": {
                              "type": "string",
                              "enum": [
                                "minutes",
                                "hours",
                                "days"
                              ]
                            }
                          },
                          "required": [
                            "amount",
                            "unit"
                          ]
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "duration",
                        "next"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "wait_for_event"
                          ]
                        },
                        "event": {
                          "type": "string",
                          "enum": [
                            "email.opened",
                            "email.clicked",
                            "custom_event"
                          ]
                        },
                        "custom_event": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "timeout": {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "unit": {
                              "type": "string",
                              "enum": [
                                "minutes",
                                "hours",
                                "days"
                              ]
                            }
                          },
                          "required": [
                            "amount",
                            "unit"
                          ]
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "timeout_next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "event",
                        "timeout",
                        "next",
                        "timeout_next"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "branch"
                          ]
                        },
                        "condition": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "all": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "field": {
                                        "type": "string",
                                        "maxLength": 120,
                                        "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                      },
                                      "op": {
                                        "type": "string",
                                        "enum": [
                                          "eq",
                                          "neq",
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "gt",
                                          "gte",
                                          "lt",
                                          "lte",
                                          "is_set",
                                          "is_not_set",
                                          "in",
                                          "not_in",
                                          "before",
                                          "after",
                                          "within_days",
                                          "not_within_days"
                                        ]
                                      },
                                      "value": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "boolean"
                                          },
                                          {
                                            "type": "array",
                                            "items": {
                                              "type": "string"
                                            }
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "field",
                                      "op"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 50
                                }
                              },
                              "required": [
                                "all"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "any": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "field": {
                                        "type": "string",
                                        "maxLength": 120,
                                        "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                      },
                                      "op": {
                                        "type": "string",
                                        "enum": [
                                          "eq",
                                          "neq",
                                          "contains",
                                          "not_contains",
                                          "starts_with",
                                          "ends_with",
                                          "gt",
                                          "gte",
                                          "lt",
                                          "lte",
                                          "is_set",
                                          "is_not_set",
                                          "in",
                                          "not_in",
                                          "before",
                                          "after",
                                          "within_days",
                                          "not_within_days"
                                        ]
                                      },
                                      "value": {
                                        "anyOf": [
                                          {
                                            "type": "string"
                                          },
                                          {
                                            "type": "number"
                                          },
                                          {
                                            "type": "boolean"
                                          },
                                          {
                                            "type": "array",
                                            "items": {
                                              "type": "string"
                                            }
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "field",
                                      "op"
                                    ]
                                  },
                                  "minItems": 1,
                                  "maxItems": 50
                                }
                              },
                              "required": [
                                "any"
                              ]
                            }
                          ]
                        },
                        "engagement": {
                          "type": "object",
                          "properties": {
                            "event": {
                              "type": "string",
                              "enum": [
                                "email.opened",
                                "email.clicked"
                              ]
                            },
                            "step_id": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "minLength": 1,
                              "maxLength": 50,
                              "pattern": "^[A-Za-z0-9_-]+$",
                              "default": null
                            }
                          },
                          "required": [
                            "event"
                          ]
                        },
                        "yes": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "no": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "yes",
                        "no"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "update_contact"
                          ]
                        },
                        "first_name": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 200
                        },
                        "last_name": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 200
                        },
                        "unsubscribed": {
                          "type": "boolean"
                        },
                        "properties": {
                          "type": "object",
                          "additionalProperties": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 1000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "next"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "segment"
                          ]
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "add",
                            "remove"
                          ]
                        },
                        "segment_id": {
                          "type": "string",
                          "description": "A UUID."
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "action",
                        "segment_id",
                        "next"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "topic"
                          ]
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "subscribe",
                            "unsubscribe"
                          ]
                        },
                        "topic_id": {
                          "type": "string",
                          "description": "A UUID."
                        },
                        "next": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "action",
                        "topic_id",
                        "next"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "delete_contact"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "type"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50,
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "exit"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "type"
                      ]
                    }
                  ]
                },
                "minItems": 1,
                "maxItems": 100
              }
            },
            "required": [
              "trigger",
              "start",
              "steps"
            ]
          },
          "stats": {
            "type": "object",
            "properties": {
              "runs_total": {
                "type": "integer"
              },
              "runs_active": {
                "type": "integer"
              },
              "runs_completed": {
                "type": "integer"
              },
              "runs_failed": {
                "type": "integer"
              }
            },
            "required": [
              "runs_total",
              "runs_active",
              "runs_completed",
              "runs_failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "name",
          "status",
          "current_version",
          "published_version",
          "trigger",
          "definition",
          "stats",
          "created_at",
          "updated_at"
        ]
      },
      "AutomationRun": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "run"
            ]
          },
          "automation_id": {
            "type": "string",
            "description": "A UUID."
          },
          "version": {
            "type": "integer"
          },
          "contact_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "trigger_event_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "waiting",
              "completed",
              "exited",
              "failed",
              "stopped"
            ]
          },
          "current_step_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "wait_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "step_id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "running",
                    "waiting",
                    "completed",
                    "skipped",
                    "failed"
                  ]
                },
                "started_at": {
                  "type": "string",
                  "format": "date-time",
                  "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                },
                "finished_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time",
                  "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                },
                "output": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "additionalProperties": {}
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "step_id",
                "type",
                "status",
                "started_at",
                "finished_at",
                "output",
                "error"
              ]
            }
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "automation_id",
          "version",
          "contact_id",
          "trigger_event_id",
          "mode",
          "status",
          "current_step_id",
          "wait_until",
          "error",
          "steps",
          "started_at",
          "finished_at"
        ]
      },
      "Key": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A UUID."
          },
          "object": {
            "type": "string",
            "enum": [
              "key"
            ]
          },
          "project_id": {
            "type": "string",
            "description": "A UUID."
          },
          "environment_id": {
            "type": "string",
            "description": "A UUID."
          },
          "name": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "scope": {
            "type": "string",
            "enum": [
              "full_access",
              "sending_access",
              "inbound_read"
            ]
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A UUID."
          },
          "rate_limit_per_second": {
            "type": "integer"
          },
          "display": {
            "type": "string"
          },
          "token": {
            "type": "string"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
          }
        },
        "required": [
          "id",
          "object",
          "project_id",
          "environment_id",
          "name",
          "mode",
          "scope",
          "domain_id",
          "rate_limit_per_second",
          "display",
          "last_used_at",
          "created_at",
          "revoked_at"
        ]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/v1/emails/metrics": {
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "Get email metrics",
        "description": "Totals for a range (by default today and the six days before it), and with `dimensions` rows by `period` (in `timezone`, at `granularity`), `domain`, `email` or `broadcast`. Counts cover the key's project, environment and mode: `received` emails accepted, events by type and bounce kind, opens and clicks with their unique emails, and unsubscribes from an email's own links. Rates are percentages with one decimal. Lists take commas or repeated parameters.",
        "operationId": "getEmailMetrics",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "required": false,
            "name": "start_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "required": false,
            "name": "end_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "required": false,
            "name": "timezone",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "hourly",
                "daily",
                "weekly",
                "monthly"
              ]
            },
            "required": false,
            "name": "granularity",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4000
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "maxItems": 100
                }
              ],
              "description": "Comma-separated, or the parameter repeated"
            },
            "required": false,
            "description": "Comma-separated, or the parameter repeated",
            "name": "metrics",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4000
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "maxItems": 100
                }
              ],
              "description": "Comma-separated, or the parameter repeated"
            },
            "required": false,
            "description": "Comma-separated, or the parameter repeated",
            "name": "dimensions",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4000
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "maxItems": 100
                }
              ],
              "description": "Comma-separated, or the parameter repeated"
            },
            "required": false,
            "description": "Comma-separated, or the parameter repeated",
            "name": "domain_id",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4000
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "maxItems": 100
                }
              ],
              "description": "Comma-separated, or the parameter repeated"
            },
            "required": false,
            "description": "Comma-separated, or the parameter repeated",
            "name": "email_id",
            "in": "query"
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 4000
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "maxItems": 100
                }
              ],
              "description": "Comma-separated, or the parameter repeated"
            },
            "required": false,
            "description": "Comma-separated, or the parameter repeated",
            "name": "broadcast_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "metrics"
                      ]
                    },
                    "start_date": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "end_date": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "metrics": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "received",
                          "delivered",
                          "complained",
                          "suppressed",
                          "bounced",
                          "bounced_transient",
                          "bounced_permanent",
                          "bounced_undetermined",
                          "opened",
                          "clicked",
                          "unsubscribed",
                          "delivery_delayed",
                          "failed",
                          "sent",
                          "unique_opened",
                          "unique_clicked",
                          "delivery_rate",
                          "open_rate",
                          "click_rate",
                          "bounce_rate",
                          "complaint_rate",
                          "unsubscribe_rate"
                        ]
                      }
                    },
                    "dimensions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "period",
                          "domain",
                          "email",
                          "broadcast"
                        ]
                      }
                    },
                    "granularity": {
                      "type": "string",
                      "enum": [
                        "hourly",
                        "daily",
                        "weekly",
                        "monthly"
                      ]
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "received": {
                          "type": "number"
                        },
                        "delivered": {
                          "type": "number"
                        },
                        "complained": {
                          "type": "number"
                        },
                        "suppressed": {
                          "type": "number"
                        },
                        "bounced": {
                          "type": "number"
                        },
                        "bounced_transient": {
                          "type": "number"
                        },
                        "bounced_permanent": {
                          "type": "number"
                        },
                        "bounced_undetermined": {
                          "type": "number"
                        },
                        "opened": {
                          "type": "number"
                        },
                        "clicked": {
                          "type": "number"
                        },
                        "unsubscribed": {
                          "type": "number"
                        },
                        "delivery_delayed": {
                          "type": "number"
                        },
                        "failed": {
                          "type": "number"
                        },
                        "sent": {
                          "type": "number"
                        },
                        "unique_opened": {
                          "type": "number"
                        },
                        "unique_clicked": {
                          "type": "number"
                        },
                        "delivery_rate": {
                          "type": "number"
                        },
                        "open_rate": {
                          "type": "number"
                        },
                        "click_rate": {
                          "type": "number"
                        },
                        "bounce_rate": {
                          "type": "number"
                        },
                        "complaint_rate": {
                          "type": "number"
                        },
                        "unsubscribe_rate": {
                          "type": "number"
                        }
                      }
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "received": {
                            "type": "number"
                          },
                          "delivered": {
                            "type": "number"
                          },
                          "complained": {
                            "type": "number"
                          },
                          "suppressed": {
                            "type": "number"
                          },
                          "bounced": {
                            "type": "number"
                          },
                          "bounced_transient": {
                            "type": "number"
                          },
                          "bounced_permanent": {
                            "type": "number"
                          },
                          "bounced_undetermined": {
                            "type": "number"
                          },
                          "opened": {
                            "type": "number"
                          },
                          "clicked": {
                            "type": "number"
                          },
                          "unsubscribed": {
                            "type": "number"
                          },
                          "delivery_delayed": {
                            "type": "number"
                          },
                          "failed": {
                            "type": "number"
                          },
                          "sent": {
                            "type": "number"
                          },
                          "unique_opened": {
                            "type": "number"
                          },
                          "unique_clicked": {
                            "type": "number"
                          },
                          "delivery_rate": {
                            "type": "number"
                          },
                          "open_rate": {
                            "type": "number"
                          },
                          "click_rate": {
                            "type": "number"
                          },
                          "bounce_rate": {
                            "type": "number"
                          },
                          "complaint_rate": {
                            "type": "number"
                          },
                          "unsubscribe_rate": {
                            "type": "number"
                          },
                          "period": {
                            "type": "string"
                          },
                          "domain_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "domain_name": {
                            "type": "string"
                          },
                          "email_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "broadcast_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "broadcast_name": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "object",
                    "start_date",
                    "end_date",
                    "metrics",
                    "dimensions",
                    "granularity",
                    "totals"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/emails": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "Send an email",
        "description": "Queues one email. Send `Idempotency-Key` (or `idempotency_key`) to make retries safe for 24 hours; a repeated key returns the original response.",
        "operationId": "sendEmail",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmailRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "email"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "scheduled",
                        "sent",
                        "delivered",
                        "delivery_delayed",
                        "opened",
                        "clicked",
                        "bounced",
                        "complained",
                        "failed",
                        "canceled",
                        "suppressed"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "idempotent_replay": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "status",
                    "scheduled_at",
                    "idempotent_replay"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "List emails",
        "operationId": "listEmails",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 320
            },
            "required": false,
            "name": "to",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "required": false,
            "name": "subject",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "scheduled",
                "sent",
                "delivered",
                "delivery_delayed",
                "opened",
                "clicked",
                "bounced",
                "complained",
                "failed",
                "canceled",
                "suppressed"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "transactional",
                "marketing"
              ],
              "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
            },
            "required": false,
            "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe.",
            "name": "stream",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "live",
                "test"
              ]
            },
            "required": false,
            "name": "mode",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 513,
              "description": "`name:value`"
            },
            "required": false,
            "description": "`name:value`",
            "name": "tag",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
            },
            "required": false,
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z.",
            "name": "from_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
            },
            "required": false,
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z.",
            "name": "to_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "broadcast_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "email"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "environment_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "live",
                              "test"
                            ]
                          },
                          "stream": {
                            "type": "string",
                            "enum": [
                              "transactional",
                              "marketing"
                            ],
                            "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "api",
                              "smtp",
                              "broadcast",
                              "automation",
                              "console",
                              "inbound"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "scheduled",
                              "sent",
                              "delivered",
                              "delivery_delayed",
                              "opened",
                              "clicked",
                              "bounced",
                              "complained",
                              "failed",
                              "canceled",
                              "suppressed"
                            ]
                          },
                          "from": {
                            "type": "string"
                          },
                          "to": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "cc": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "bcc": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reply_to": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "subject": {
                            "type": "string"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "name",
                                "value"
                              ]
                            }
                          },
                          "template": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "A UUID."
                              },
                              "version": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "id",
                              "version"
                            ]
                          },
                          "topic_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "via": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "mailbox": {
                                "type": "string",
                                "description": "A UUID."
                              }
                            },
                            "required": [
                              "mailbox"
                            ]
                          },
                          "attachments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "A UUID."
                                },
                                "filename": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "content_type": {
                                  "type": "string"
                                },
                                "size": {
                                  "type": "integer"
                                },
                                "content_id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "disposition": {
                                  "type": "string",
                                  "enum": [
                                    "attachment",
                                    "inline"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "filename",
                                "content_type",
                                "size",
                                "content_id",
                                "disposition"
                              ]
                            }
                          },
                          "message_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "provider": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "name": {
                                "type": "string",
                                "enum": [
                                  "ses",
                                  "resend",
                                  "gmail",
                                  "microsoft",
                                  "smtp",
                                  "test"
                                ]
                              },
                              "region": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "name",
                              "region"
                            ]
                          },
                          "broadcast_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "automation_run_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "warnings": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "check": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                },
                                "hosts": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              },
                              "required": [
                                "check",
                                "message"
                              ]
                            }
                          },
                          "scheduled_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "sent_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "environment_id",
                          "mode",
                          "stream",
                          "source",
                          "status",
                          "from",
                          "to",
                          "cc",
                          "bcc",
                          "reply_to",
                          "subject",
                          "tags",
                          "template",
                          "topic_id",
                          "via",
                          "attachments",
                          "message_id",
                          "provider",
                          "broadcast_id",
                          "automation_run_id",
                          "warnings",
                          "scheduled_at",
                          "sent_at",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/emails/batch": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "Send up to 100 emails",
        "description": "Each item is validated and queued on its own; the response carries a result per item.",
        "operationId": "sendBatch",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SendEmailRequest"
                },
                "minItems": 1,
                "maxItems": 100,
                "description": "Up to 100 emails; each item gets its own result."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "batch"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "index": {
                                "type": "integer"
                              },
                              "id": {
                                "type": "string",
                                "description": "A UUID."
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "queued",
                                  "scheduled",
                                  "sent",
                                  "delivered",
                                  "delivery_delayed",
                                  "opened",
                                  "clicked",
                                  "bounced",
                                  "complained",
                                  "failed",
                                  "canceled",
                                  "suppressed"
                                ]
                              }
                            },
                            "required": [
                              "index",
                              "id",
                              "status"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "index": {
                                "type": "integer"
                              },
                              "error": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "retryable": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "code",
                                  "message",
                                  "retryable"
                                ]
                              }
                            },
                            "required": [
                              "index",
                              "error"
                            ]
                          }
                        ]
                      }
                    },
                    "accepted": {
                      "type": "integer"
                    },
                    "rejected": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "accepted",
                    "rejected"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/emails/{id}": {
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "Get an email",
        "description": "Includes html and text while content is retained (30 days).",
        "operationId": "getEmail",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Email"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Emails"
        ],
        "summary": "Reschedule a scheduled email",
        "operationId": "rescheduleEmail",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scheduled_at": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": [
                  "scheduled_at"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "email"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "scheduled",
                        "sent",
                        "delivered",
                        "delivery_delayed",
                        "opened",
                        "clicked",
                        "bounced",
                        "complained",
                        "failed",
                        "canceled",
                        "suppressed"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/emails/{id}/cancel": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "Cancel a scheduled email",
        "operationId": "cancelEmail",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "email"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "scheduled",
                        "sent",
                        "delivered",
                        "delivery_delayed",
                        "opened",
                        "clicked",
                        "bounced",
                        "complained",
                        "failed",
                        "canceled",
                        "suppressed"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/emails/{id}/events": {
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "Get an email's event timeline",
        "operationId": "listEmailEvents",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "type": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "data": {
                            "type": "object",
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "id",
                          "type",
                          "created_at",
                          "data"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/emails/{id}/attachments": {
      "get": {
        "tags": [
          "Emails"
        ],
        "summary": "List an email's attachments with download URLs",
        "operationId": "listEmailAttachments",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "attachment"
                            ]
                          },
                          "filename": {
                            "type": "string"
                          },
                          "content_type": {
                            "type": "string"
                          },
                          "size": {
                            "type": "integer"
                          },
                          "sha256": {
                            "type": "string"
                          },
                          "download_url": {
                            "type": "string"
                          },
                          "expires_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "last_used_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "filename",
                          "content_type",
                          "size",
                          "sha256",
                          "created_at",
                          "last_used_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uploads": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Create a presigned upload",
        "description": "Returns a presigned S3 PUT URL valid for 15 minutes. Upload the bytes, then pass the id as upload_id to POST /v1/attachments or POST /v1/contacts/import.",
        "operationId": "createUpload",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "enum": [
                      "attachment",
                      "import"
                    ]
                  },
                  "filename": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "content_type": {
                    "type": "string",
                    "maxLength": 255,
                    "pattern": "^[\\w.+-]+\\/[\\w.+-]+(?:\\s*;.*)?$"
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 52428800
                  }
                },
                "required": [
                  "purpose",
                  "filename",
                  "content_type",
                  "size"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "upload"
                      ]
                    },
                    "purpose": {
                      "type": "string",
                      "enum": [
                        "attachment",
                        "import"
                      ]
                    },
                    "upload_url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "completed",
                        "consumed"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "purpose",
                    "upload_url",
                    "expires_at",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uploads/{id}": {
      "get": {
        "tags": [
          "Uploads"
        ],
        "summary": "Get an upload's status",
        "operationId": "getUpload",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "upload"
                      ]
                    },
                    "purpose": {
                      "type": "string",
                      "enum": [
                        "attachment",
                        "import"
                      ]
                    },
                    "upload_url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "completed",
                        "consumed"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "purpose",
                    "upload_url",
                    "expires_at",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/attachments": {
      "post": {
        "tags": [
          "Attachments"
        ],
        "summary": "Store a reusable attachment (inline up to 4 MB, or from an upload)",
        "operationId": "createAttachment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "filename": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      "content": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "Buffer"
                                ]
                              },
                              "data": {
                                "type": "array",
                                "items": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 255
                                }
                              }
                            },
                            "required": [
                              "type",
                              "data"
                            ]
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 255
                            }
                          }
                        ]
                      },
                      "content_type": {
                        "type": "string",
                        "maxLength": 255,
                        "pattern": "^[\\w.+-]+\\/[\\w.+-]+(?:\\s*;.*)?$"
                      }
                    },
                    "required": [
                      "filename",
                      "content"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "upload_id": {
                        "type": "string",
                        "description": "A UUID."
                      }
                    },
                    "required": [
                      "upload_id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "attachment"
                      ]
                    },
                    "filename": {
                      "type": "string"
                    },
                    "content_type": {
                      "type": "string"
                    },
                    "size": {
                      "type": "integer"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "download_url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "last_used_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "filename",
                    "content_type",
                    "size",
                    "sha256",
                    "created_at",
                    "last_used_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Attachments"
        ],
        "summary": "List reusable attachments",
        "operationId": "listAttachments",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "attachment"
                            ]
                          },
                          "filename": {
                            "type": "string"
                          },
                          "content_type": {
                            "type": "string"
                          },
                          "size": {
                            "type": "integer"
                          },
                          "sha256": {
                            "type": "string"
                          },
                          "download_url": {
                            "type": "string"
                          },
                          "expires_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "last_used_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "filename",
                          "content_type",
                          "size",
                          "sha256",
                          "created_at",
                          "last_used_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/attachments/{id}": {
      "get": {
        "tags": [
          "Attachments"
        ],
        "summary": "Get a reusable attachment with a download URL",
        "operationId": "getAttachment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "attachment"
                      ]
                    },
                    "filename": {
                      "type": "string"
                    },
                    "content_type": {
                      "type": "string"
                    },
                    "size": {
                      "type": "integer"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "download_url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "last_used_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "filename",
                    "content_type",
                    "size",
                    "sha256",
                    "created_at",
                    "last_used_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Attachments"
        ],
        "summary": "Delete a reusable attachment",
        "operationId": "deleteAttachment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "attachment"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains": {
      "post": {
        "tags": [
          "Domains"
        ],
        "summary": "Add a sending or receiving domain",
        "description": "Creates the SES identity in the primary region (and the secondary with `failover`), returns the DNS records, and writes them automatically when the zone is on a connected Cloudflare account.",
        "operationId": "createDomain",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 253,
                    "description": "A domain name, for example mail.example.com."
                  },
                  "stream": {
                    "type": "string",
                    "enum": [
                      "transactional",
                      "marketing"
                    ],
                    "default": "transactional",
                    "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
                  },
                  "receiving": {
                    "type": "boolean",
                    "default": false
                  },
                  "failover": {
                    "type": "boolean",
                    "default": false
                  },
                  "auto_dns": {
                    "type": "boolean",
                    "default": true
                  },
                  "mail_from_subdomain": {
                    "type": "string",
                    "maxLength": 63,
                    "pattern": "^[a-z0-9]+$",
                    "default": "bounce",
                    "description": "Primary region MAIL FROM label; the secondary region uses `<label>2`."
                  },
                  "tracking": {
                    "type": "object",
                    "properties": {
                      "subdomain": {
                        "type": "string",
                        "maxLength": 63,
                        "pattern": "^[a-z0-9]+$",
                        "default": "links"
                      },
                      "opens": {
                        "type": "boolean",
                        "default": false
                      },
                      "clicks": {
                        "type": "boolean",
                        "default": false
                      }
                    },
                    "default": {
                      "subdomain": "links",
                      "opens": false,
                      "clicks": false
                    }
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Domains"
        ],
        "summary": "List domains",
        "operationId": "listDomains",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "domain"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "name": {
                            "type": "string"
                          },
                          "stream": {
                            "type": "string",
                            "enum": [
                              "transactional",
                              "marketing"
                            ],
                            "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "not_started",
                              "pending",
                              "verified",
                              "partially_verified",
                              "failed"
                            ]
                          },
                          "sending": {
                            "type": "string",
                            "enum": [
                              "enabled",
                              "disabled"
                            ]
                          },
                          "receiving": {
                            "type": "string",
                            "enum": [
                              "enabled",
                              "disabled"
                            ]
                          },
                          "authentication": {
                            "type": "string",
                            "enum": [
                              "passing",
                              "failing",
                              "unknown"
                            ]
                          },
                          "primary": {
                            "type": "object",
                            "properties": {
                              "region": {
                                "type": "string",
                                "enum": [
                                  "us-east-1",
                                  "us-west-2"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "pending",
                                  "verified",
                                  "partially_verified",
                                  "failed"
                                ]
                              },
                              "dkim_status": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "pending",
                                  "verified",
                                  "failed",
                                  "temporary_failure"
                                ]
                              },
                              "mail_from_status": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "pending",
                                  "verified",
                                  "failed",
                                  "temporary_failure"
                                ]
                              },
                              "mail_from_domain": {
                                "type": "string"
                              },
                              "configuration_set": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "region",
                              "status",
                              "dkim_status",
                              "mail_from_status",
                              "mail_from_domain",
                              "configuration_set"
                            ]
                          },
                          "secondary": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "region": {
                                "type": "string",
                                "enum": [
                                  "us-east-1",
                                  "us-west-2"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "pending",
                                  "verified",
                                  "partially_verified",
                                  "failed"
                                ]
                              },
                              "dkim_status": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "pending",
                                  "verified",
                                  "failed",
                                  "temporary_failure"
                                ]
                              },
                              "mail_from_status": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "pending",
                                  "verified",
                                  "failed",
                                  "temporary_failure"
                                ]
                              },
                              "mail_from_domain": {
                                "type": "string"
                              },
                              "configuration_set": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "region",
                              "status",
                              "dkim_status",
                              "mail_from_status",
                              "mail_from_domain",
                              "configuration_set"
                            ]
                          },
                          "dmarc": {
                            "type": "object",
                            "properties": {
                              "policy": {
                                "type": "string",
                                "enum": [
                                  "missing",
                                  "none",
                                  "quarantine",
                                  "reject"
                                ]
                              },
                              "record": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "pass_rate_30d": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "minimum": 0,
                                "maximum": 1
                              }
                            },
                            "required": [
                              "policy",
                              "record",
                              "pass_rate_30d"
                            ]
                          },
                          "tracking": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "not_started",
                                  "pending",
                                  "verified",
                                  "failed",
                                  "temporary_failure"
                                ]
                              },
                              "opens": {
                                "type": "boolean"
                              },
                              "clicks": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "domain",
                              "status",
                              "opens",
                              "clicks"
                            ]
                          },
                          "auto_dns": {
                            "type": "boolean"
                          },
                          "cloudflare_zone_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reputation": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "source": {
                                "type": "string",
                                "enum": [
                                  "postmaster"
                                ]
                              },
                              "domain_reputation": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "high",
                                  "medium",
                                  "low",
                                  "bad",
                                  null
                                ]
                              },
                              "spam_rate": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "captured_at": {
                                "type": "string",
                                "format": "date-time",
                                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                              }
                            },
                            "required": [
                              "source",
                              "domain_reputation",
                              "spam_rate",
                              "captured_at"
                            ]
                          },
                          "last_checked_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "name",
                          "stream",
                          "status",
                          "sending",
                          "receiving",
                          "authentication",
                          "primary",
                          "secondary",
                          "dmarc",
                          "tracking",
                          "auto_dns",
                          "cloudflare_zone_id",
                          "reputation",
                          "last_checked_at",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{id}": {
      "get": {
        "tags": [
          "Domains"
        ],
        "summary": "Get a domain with its DNS records",
        "operationId": "getDomain",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Domains"
        ],
        "summary": "Update a domain",
        "description": "Moving DMARC to `quarantine` or `reject` is a console action; the API can set `none`.",
        "operationId": "updateDomain",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "stream": {
                    "type": "string",
                    "enum": [
                      "transactional",
                      "marketing"
                    ],
                    "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
                  },
                  "receiving": {
                    "type": "boolean"
                  },
                  "failover": {
                    "type": "boolean"
                  },
                  "auto_dns": {
                    "type": "boolean"
                  },
                  "sending": {
                    "type": "boolean"
                  },
                  "tracking": {
                    "type": "object",
                    "properties": {
                      "opens": {
                        "type": "boolean"
                      },
                      "clicks": {
                        "type": "boolean"
                      }
                    }
                  },
                  "dmarc_policy": {
                    "type": "string",
                    "enum": [
                      "none",
                      "quarantine",
                      "reject"
                    ]
                  },
                  "bimi": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "logo_url": {
                        "type": "string",
                        "maxLength": 2048,
                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                      },
                      "certificate_url": {
                        "type": "string",
                        "maxLength": 2048,
                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                      }
                    },
                    "required": [
                      "logo_url"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Domains"
        ],
        "summary": "Remove a domain",
        "description": "Deletes the SES identities and managed DNS records. Emails already sent keep their history.",
        "operationId": "deleteDomain",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "domain"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "pending",
                        "verified",
                        "partially_verified",
                        "failed"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{id}/verify": {
      "post": {
        "tags": [
          "Domains"
        ],
        "summary": "Check DNS and SES verification now",
        "operationId": "verifyDomain",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "domain"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "not_started",
                        "pending",
                        "verified",
                        "partially_verified",
                        "failed"
                      ]
                    },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "purpose": {
                            "type": "string",
                            "enum": [
                              "dkim",
                              "mail_from_mx",
                              "mail_from_spf",
                              "dmarc",
                              "tracking",
                              "receiving_mx",
                              "bimi",
                              "verification",
                              "arc"
                            ]
                          },
                          "region": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "us-east-1",
                              "us-west-2",
                              null
                            ]
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "CNAME",
                              "TXT",
                              "MX"
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "priority": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "ttl": {
                            "type": "string",
                            "enum": [
                              "Auto"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "not_started",
                              "pending",
                              "verified",
                              "failed",
                              "temporary_failure"
                            ]
                          },
                          "managed": {
                            "type": "boolean"
                          },
                          "last_checked_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "last_error": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "purpose",
                          "region",
                          "type",
                          "name",
                          "value",
                          "priority",
                          "ttl",
                          "status",
                          "managed",
                          "last_checked_at",
                          "last_error"
                        ]
                      }
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status",
                    "records"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{id}/dmarc": {
      "get": {
        "tags": [
          "Domains"
        ],
        "summary": "List DMARC aggregate reports for a domain",
        "operationId": "listDomainDmarcReports",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "dmarc_report"
                            ]
                          },
                          "domain_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "reporter": {
                            "type": "string"
                          },
                          "report_id": {
                            "type": "string"
                          },
                          "begin": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "end": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "policy": {
                            "type": "object",
                            "properties": {
                              "p": {
                                "type": "string"
                              },
                              "sp": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "adkim": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "aspf": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "pct": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "p",
                              "sp",
                              "adkim",
                              "aspf",
                              "pct"
                            ]
                          },
                          "messages": {
                            "type": "integer"
                          },
                          "passing": {
                            "type": "integer"
                          },
                          "sources": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "ip": {
                                  "type": "string"
                                },
                                "count": {
                                  "type": "integer"
                                },
                                "disposition": {
                                  "type": "string"
                                },
                                "spf": {
                                  "type": "string"
                                },
                                "dkim": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "ip",
                                "count",
                                "disposition",
                                "spf",
                                "dkim"
                              ]
                            }
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "domain_id",
                          "reporter",
                          "report_id",
                          "begin",
                          "end",
                          "policy",
                          "messages",
                          "passing",
                          "sources",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{id}/reputation": {
      "get": {
        "tags": [
          "Domains"
        ],
        "summary": "Postmaster and seed-test history for a domain",
        "description": "Says whether Google Postmaster Tools and seed inboxes are set up, since both need setup and volume before they show anything.",
        "operationId": "getDomainReputation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "reputation"
                      ]
                    },
                    "postmaster": {
                      "type": "object",
                      "properties": {
                        "configured": {
                          "type": "boolean"
                        },
                        "has_data": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "configured",
                        "has_data"
                      ]
                    },
                    "seed": {
                      "type": "object",
                      "properties": {
                        "configured": {
                          "type": "boolean"
                        },
                        "inboxes": {
                          "type": "integer"
                        },
                        "pending": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "configured",
                        "inboxes",
                        "pending"
                      ]
                    },
                    "snapshots": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "domain_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "postmaster",
                              "dmarc",
                              "seed"
                            ]
                          },
                          "captured_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "data": {
                            "type": "object",
                            "additionalProperties": {}
                          }
                        },
                        "required": [
                          "id",
                          "domain_id",
                          "source",
                          "captured_at",
                          "data"
                        ]
                      }
                    },
                    "seed_tests": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "domain_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "provider": {
                            "type": "string",
                            "enum": [
                              "gmail",
                              "outlook",
                              "yahoo"
                            ]
                          },
                          "placement": {
                            "type": "string",
                            "enum": [
                              "inbox",
                              "spam",
                              "promotions",
                              "missing"
                            ]
                          },
                          "email_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "checked_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "domain_id",
                          "provider",
                          "placement",
                          "email_id",
                          "checked_at"
                        ]
                      }
                    }
                  },
                  "required": [
                    "object",
                    "postmaster",
                    "seed",
                    "snapshots",
                    "seed_tests"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{id}/seedtest": {
      "post": {
        "tags": [
          "Domains"
        ],
        "summary": "Run an inbox placement test now",
        "description": "Sends a test to each configured seed inbox; placement is read within the hour. Answers with the latest results.",
        "operationId": "runSeedTest",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "domain_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "provider": {
                            "type": "string",
                            "enum": [
                              "gmail",
                              "outlook",
                              "yahoo"
                            ]
                          },
                          "placement": {
                            "type": "string",
                            "enum": [
                              "inbox",
                              "spam",
                              "promotions",
                              "missing"
                            ]
                          },
                          "email_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "checked_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "domain_id",
                          "provider",
                          "placement",
                          "email_id",
                          "checked_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook endpoint",
        "description": "Deliveries are signed svix-style (svix-id, svix-timestamp, svix-signature). Private, loopback and link-local URLs are refused. Test keys create test endpoints, which receive the events test keys simulate.",
        "operationId": "createWebhook",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "live",
                      "test"
                    ],
                    "default": "live"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "email.sent",
                        "email.scheduled",
                        "email.delivered",
                        "email.delivery_delayed",
                        "email.complained",
                        "email.bounced",
                        "email.opened",
                        "email.clicked",
                        "email.received",
                        "email.failed",
                        "email.suppressed",
                        "email.canceled",
                        "contact.created",
                        "contact.updated",
                        "contact.deleted",
                        "domain.created",
                        "domain.updated",
                        "domain.deleted",
                        "broadcast.started",
                        "broadcast.completed",
                        "automation.completed",
                        "automation.failed"
                      ]
                    },
                    "minItems": 1
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created; `secret` is returned once",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "Endpoints of the key's environment; test keys see test endpoints only.",
        "operationId": "listWebhooks",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a webhook endpoint",
        "operationId": "getWebhook",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook endpoint",
        "description": "`events: null` subscribes to every event type. Enabling an endpoint that was disabled automatically clears its failure history.",
        "operationId": "updateWebhook",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 200
                  },
                  "events": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string",
                      "enum": [
                        "email.sent",
                        "email.scheduled",
                        "email.delivered",
                        "email.delivery_delayed",
                        "email.complained",
                        "email.bounced",
                        "email.opened",
                        "email.clicked",
                        "email.received",
                        "email.failed",
                        "email.suppressed",
                        "email.canceled",
                        "contact.created",
                        "contact.updated",
                        "contact.deleted",
                        "domain.created",
                        "domain.updated",
                        "domain.deleted",
                        "broadcast.started",
                        "broadcast.completed",
                        "automation.completed",
                        "automation.failed"
                      ]
                    },
                    "minItems": 1
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "enabled",
                      "disabled"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "description": "Its deliveries are deleted with it.",
        "operationId": "deleteWebhook",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "webhook"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/rotate": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate the signing secret",
        "description": "The previous secret keeps signing for 24 hours so receivers can switch without a gap.",
        "operationId": "rotateWebhookSecret",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "webhook"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "secret": {
                      "type": "string"
                    },
                    "previous_secret_expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "secret",
                    "previous_secret_expires_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List deliveries to an endpoint",
        "operationId": "listWebhookDeliveries",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "succeeded",
                "failed",
                "exhausted"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "email.sent",
                "email.scheduled",
                "email.delivered",
                "email.delivery_delayed",
                "email.complained",
                "email.bounced",
                "email.opened",
                "email.clicked",
                "email.received",
                "email.failed",
                "email.suppressed",
                "email.canceled",
                "contact.created",
                "contact.updated",
                "contact.deleted",
                "domain.created",
                "domain.updated",
                "domain.deleted",
                "broadcast.started",
                "broadcast.completed",
                "automation.completed",
                "automation.failed"
              ]
            },
            "required": false,
            "name": "event_type",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookDelivery"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/deliveries/{deliveryId}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a delivery with its attempt log",
        "operationId": "getWebhookDelivery",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "deliveryId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/replay": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Replay deliveries",
        "description": "Sends the deliveries again with their original `message_id`, so receivers that deduplicate by `svix-id` see the same message. Give `delivery_ids`, or `since` for every failed delivery since then (up to 100 per call).",
        "operationId": "replayWebhookDeliveries",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "delivery_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "maxItems": 100
                  },
                  "since": {
                    "type": "string",
                    "format": "date-time",
                    "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "replay"
                      ]
                    },
                    "queued": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "queued"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/{id}/test": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test event",
        "description": "An example event of the type, signed like any other and attempted once. Test events are not part of the event feed.",
        "operationId": "testWebhook",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "email.sent",
                      "email.scheduled",
                      "email.delivered",
                      "email.delivery_delayed",
                      "email.complained",
                      "email.bounced",
                      "email.opened",
                      "email.clicked",
                      "email.received",
                      "email.failed",
                      "email.suppressed",
                      "email.canceled",
                      "contact.created",
                      "contact.updated",
                      "contact.deleted",
                      "domain.created",
                      "domain.updated",
                      "domain.deleted",
                      "broadcast.started",
                      "broadcast.completed",
                      "automation.completed",
                      "automation.failed"
                    ]
                  }
                },
                "required": [
                  "type"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "delivery"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    }
                  },
                  "required": [
                    "object",
                    "id"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "List events",
        "description": "Cursor-paginated feed of the key's events, newest first: the same objects webhooks deliver, for the key's mode and environment plus project-level events. Events younger than a few seconds are left out, so tailing with `before` never skips one.",
        "operationId": "listEvents",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 1000,
              "description": "Comma-separated event types."
            },
            "required": false,
            "description": "Comma-separated event types.",
            "name": "types",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "email_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "contact_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
            },
            "required": false,
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z.",
            "name": "since",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/{id}": {
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "Get an event",
        "operationId": "getEvent",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound/routes": {
      "get": {
        "tags": [
          "Inbound"
        ],
        "summary": "List inbound routing rules",
        "operationId": "listInboundRoutes",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "route"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "domain_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "match": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "address"
                                    ]
                                  },
                                  "local_part": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64,
                                    "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                                  }
                                },
                                "required": [
                                  "type",
                                  "local_part"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "plus"
                                    ]
                                  },
                                  "local_part": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64,
                                    "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                                  }
                                },
                                "required": [
                                  "type",
                                  "local_part"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "catchall"
                                    ]
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          },
                          "action": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "webhook"
                                    ]
                                  },
                                  "webhook_id": {
                                    "type": "string",
                                    "description": "A UUID."
                                  }
                                },
                                "required": [
                                  "type",
                                  "webhook_id"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "forward"
                                    ]
                                  },
                                  "to": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "description": "An email address without display name."
                                    },
                                    "minItems": 1,
                                    "maxItems": 5
                                  }
                                },
                                "required": [
                                  "type",
                                  "to"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "store"
                                    ]
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              }
                            ]
                          },
                          "spam_handling": {
                            "type": "string",
                            "enum": [
                              "flag",
                              "drop",
                              "quarantine"
                            ]
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "domain_id",
                          "match",
                          "action",
                          "spam_handling",
                          "enabled",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Inbound"
        ],
        "summary": "Create an inbound routing rule",
        "description": "An exact address, a plus-address base (`support` matches `support+anything@`) or the catch-all, to a webhook endpoint of the project, confirmed forwarding addresses, or storage only. Mail no rule matches goes to every endpoint subscribed to `email.received`.",
        "operationId": "createInboundRoute",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain_id": {
                    "type": "string",
                    "description": "A UUID."
                  },
                  "match": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "address"
                            ]
                          },
                          "local_part": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                          }
                        },
                        "required": [
                          "type",
                          "local_part"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "plus"
                            ]
                          },
                          "local_part": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                          }
                        },
                        "required": [
                          "type",
                          "local_part"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "catchall"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ]
                      }
                    ]
                  },
                  "action": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "webhook"
                            ]
                          },
                          "webhook_id": {
                            "type": "string",
                            "description": "A UUID."
                          }
                        },
                        "required": [
                          "type",
                          "webhook_id"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "forward"
                            ]
                          },
                          "to": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "An email address without display name."
                            },
                            "minItems": 1,
                            "maxItems": 5
                          }
                        },
                        "required": [
                          "type",
                          "to"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "store"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ]
                      }
                    ]
                  },
                  "spam_handling": {
                    "type": "string",
                    "enum": [
                      "flag",
                      "drop",
                      "quarantine"
                    ],
                    "default": "flag"
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true
                  }
                },
                "required": [
                  "domain_id",
                  "match",
                  "action"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "route"
                      ]
                    },
                    "project_id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "domain_id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "match": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "address"
                              ]
                            },
                            "local_part": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                            }
                          },
                          "required": [
                            "type",
                            "local_part"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "plus"
                              ]
                            },
                            "local_part": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                            }
                          },
                          "required": [
                            "type",
                            "local_part"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "catchall"
                              ]
                            }
                          },
                          "required": [
                            "type"
                          ]
                        }
                      ]
                    },
                    "action": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "webhook"
                              ]
                            },
                            "webhook_id": {
                              "type": "string",
                              "description": "A UUID."
                            }
                          },
                          "required": [
                            "type",
                            "webhook_id"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "forward"
                              ]
                            },
                            "to": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": "An email address without display name."
                              },
                              "minItems": 1,
                              "maxItems": 5
                            }
                          },
                          "required": [
                            "type",
                            "to"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "store"
                              ]
                            }
                          },
                          "required": [
                            "type"
                          ]
                        }
                      ]
                    },
                    "spam_handling": {
                      "type": "string",
                      "enum": [
                        "flag",
                        "drop",
                        "quarantine"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "project_id",
                    "domain_id",
                    "match",
                    "action",
                    "spam_handling",
                    "enabled",
                    "created_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound/routes/{id}": {
      "patch": {
        "tags": [
          "Inbound"
        ],
        "summary": "Update an inbound routing rule",
        "operationId": "updateInboundRoute",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "match": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "address"
                            ]
                          },
                          "local_part": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                          }
                        },
                        "required": [
                          "type",
                          "local_part"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "plus"
                            ]
                          },
                          "local_part": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                          }
                        },
                        "required": [
                          "type",
                          "local_part"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "catchall"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ]
                      }
                    ]
                  },
                  "action": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "webhook"
                            ]
                          },
                          "webhook_id": {
                            "type": "string",
                            "description": "A UUID."
                          }
                        },
                        "required": [
                          "type",
                          "webhook_id"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "forward"
                            ]
                          },
                          "to": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "description": "An email address without display name."
                            },
                            "minItems": 1,
                            "maxItems": 5
                          }
                        },
                        "required": [
                          "type",
                          "to"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "store"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ]
                      }
                    ]
                  },
                  "spam_handling": {
                    "type": "string",
                    "enum": [
                      "flag",
                      "drop",
                      "quarantine"
                    ]
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "route"
                      ]
                    },
                    "project_id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "domain_id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "match": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "address"
                              ]
                            },
                            "local_part": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                            }
                          },
                          "required": [
                            "type",
                            "local_part"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "plus"
                              ]
                            },
                            "local_part": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
                            }
                          },
                          "required": [
                            "type",
                            "local_part"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "catchall"
                              ]
                            }
                          },
                          "required": [
                            "type"
                          ]
                        }
                      ]
                    },
                    "action": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "webhook"
                              ]
                            },
                            "webhook_id": {
                              "type": "string",
                              "description": "A UUID."
                            }
                          },
                          "required": [
                            "type",
                            "webhook_id"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "forward"
                              ]
                            },
                            "to": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "description": "An email address without display name."
                              },
                              "minItems": 1,
                              "maxItems": 5
                            }
                          },
                          "required": [
                            "type",
                            "to"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "store"
                              ]
                            }
                          },
                          "required": [
                            "type"
                          ]
                        }
                      ]
                    },
                    "spam_handling": {
                      "type": "string",
                      "enum": [
                        "flag",
                        "drop",
                        "quarantine"
                      ]
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "project_id",
                    "domain_id",
                    "match",
                    "action",
                    "spam_handling",
                    "enabled",
                    "created_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Inbound"
        ],
        "summary": "Delete an inbound routing rule",
        "operationId": "deleteInboundRoute",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "route"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound": {
      "get": {
        "tags": [
          "Inbound"
        ],
        "summary": "List received messages",
        "operationId": "listInbound",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "domain_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 320
            },
            "required": false,
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 320
            },
            "required": false,
            "name": "to",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "received",
                "routed",
                "forwarded",
                "dropped",
                "quarantined"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean"
            },
            "required": false,
            "name": "spam",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "inbound"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "domain_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "from": {
                            "type": "string"
                          },
                          "to": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "cc": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "bcc": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reply_to": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "received_for": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "subject": {
                            "type": "string"
                          },
                          "message_id": {
                            "type": "string"
                          },
                          "in_reply_to": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "attachments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "A UUID."
                                },
                                "object": {
                                  "type": "string",
                                  "enum": [
                                    "attachment"
                                  ]
                                },
                                "filename": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "content_type": {
                                  "type": "string"
                                },
                                "size": {
                                  "type": "integer"
                                },
                                "content_id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "disposition": {
                                  "type": "string",
                                  "enum": [
                                    "attachment",
                                    "inline"
                                  ]
                                },
                                "download_url": {
                                  "type": "string"
                                },
                                "expires_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                                }
                              },
                              "required": [
                                "id",
                                "object",
                                "filename",
                                "content_type",
                                "size",
                                "content_id",
                                "disposition"
                              ]
                            }
                          },
                          "verdicts": {
                            "type": "object",
                            "properties": {
                              "spf": {
                                "type": "string",
                                "enum": [
                                  "pass",
                                  "fail",
                                  "softfail",
                                  "neutral",
                                  "none",
                                  "temperror",
                                  "permerror"
                                ]
                              },
                              "dkim": {
                                "type": "string",
                                "enum": [
                                  "pass",
                                  "fail",
                                  "none",
                                  "temperror",
                                  "permerror"
                                ]
                              },
                              "dmarc": {
                                "type": "string",
                                "enum": [
                                  "pass",
                                  "fail",
                                  "none",
                                  "temperror",
                                  "permerror"
                                ]
                              },
                              "spam": {
                                "type": "string",
                                "enum": [
                                  "pass",
                                  "fail",
                                  "unknown"
                                ]
                              },
                              "virus": {
                                "type": "string",
                                "enum": [
                                  "pass",
                                  "fail",
                                  "unknown"
                                ]
                              }
                            },
                            "required": [
                              "spf",
                              "dkim",
                              "dmarc",
                              "spam",
                              "virus"
                            ]
                          },
                          "spam": {
                            "type": "boolean"
                          },
                          "virus": {
                            "type": "boolean"
                          },
                          "size": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "received",
                              "routed",
                              "forwarded",
                              "dropped",
                              "quarantined"
                            ]
                          },
                          "routing": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "webhook",
                                    "forward",
                                    "store"
                                  ]
                                },
                                "target": {
                                  "type": "string"
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "pending",
                                    "done",
                                    "failed",
                                    "skipped"
                                  ]
                                },
                                "error": {
                                  "type": "string"
                                },
                                "email_id": {
                                  "type": "string",
                                  "description": "A UUID."
                                }
                              },
                              "required": [
                                "kind",
                                "target",
                                "status"
                              ]
                            }
                          },
                          "issues": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "message_too_large",
                                "malformed",
                                "headers_too_large",
                                "too_many_parts",
                                "too_deep",
                                "nested_messages_kept",
                                "attachments_truncated",
                                "addresses_truncated",
                                "virus",
                                "spam",
                                "forward_loop",
                                "dmarc_refused"
                              ]
                            }
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "domain_id",
                          "from",
                          "to",
                          "cc",
                          "bcc",
                          "reply_to",
                          "received_for",
                          "subject",
                          "message_id",
                          "in_reply_to",
                          "attachments",
                          "verdicts",
                          "spam",
                          "virus",
                          "size",
                          "status",
                          "routing",
                          "issues",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound/{id}": {
      "get": {
        "tags": [
          "Inbound"
        ],
        "summary": "Get a received message with its parsed content and verdicts",
        "description": "`html` carries inline images as data URIs unless `html_format=cid`. `raw.download_url` downloads the message as received until `raw.expires_at` (an hour at most).",
        "operationId": "getInbound",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "data_uri",
                "cid"
              ],
              "default": "data_uri"
            },
            "required": false,
            "name": "html_format",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Inbound"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound/{id}/attachments": {
      "get": {
        "tags": [
          "Inbound"
        ],
        "summary": "List a received message's attachments with download URLs",
        "operationId": "listInboundAttachments",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "attachment"
                            ]
                          },
                          "filename": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "content_type": {
                            "type": "string"
                          },
                          "size": {
                            "type": "integer"
                          },
                          "content_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "disposition": {
                            "type": "string",
                            "enum": [
                              "attachment",
                              "inline"
                            ]
                          },
                          "download_url": {
                            "type": "string"
                          },
                          "expires_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "filename",
                          "content_type",
                          "size",
                          "content_id",
                          "disposition",
                          "download_url",
                          "expires_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound/{id}/attachments/{attachmentId}": {
      "get": {
        "tags": [
          "Inbound"
        ],
        "summary": "Get one attachment with a download URL",
        "operationId": "getInboundAttachment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "attachmentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "attachment"
                      ]
                    },
                    "filename": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "content_type": {
                      "type": "string"
                    },
                    "size": {
                      "type": "integer"
                    },
                    "content_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "disposition": {
                      "type": "string",
                      "enum": [
                        "attachment",
                        "inline"
                      ]
                    },
                    "download_url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "filename",
                    "content_type",
                    "size",
                    "content_id",
                    "disposition",
                    "download_url",
                    "expires_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound/{id}/forward": {
      "post": {
        "tags": [
          "Inbound"
        ],
        "summary": "Forward a received message",
        "description": "Only mail SES scanned as spam `pass` (and not a virus), only to addresses confirmed in the console, and never past three platform forwards. From becomes the receiving address and Reply-To the sender. Send `Idempotency-Key` to make retries safe.",
        "operationId": "forwardInbound",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "An email address without display name."
                    },
                    "minItems": 1,
                    "maxItems": 5
                  },
                  "from": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 998,
                    "description": "An email address, optionally with a display name as `Name <address>`."
                  },
                  "passthrough": {
                    "type": "boolean",
                    "default": true
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 1048576
                  },
                  "html": {
                    "type": "string",
                    "maxLength": 1048576
                  }
                },
                "required": [
                  "to"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "email"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "scheduled",
                        "sent",
                        "delivered",
                        "delivery_delayed",
                        "opened",
                        "clicked",
                        "bounced",
                        "complained",
                        "failed",
                        "canceled",
                        "suppressed"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "idempotent_replay": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "status",
                    "scheduled_at",
                    "idempotent_replay"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/emails/{id}/share": {
      "post": {
        "tags": [
          "Emails"
        ],
        "summary": "Share an email",
        "description": "A link on `links.` that shows the email's headers and content to whoever has it, until `expires_at` (`expires_in`: up to and by default 48 hours). The content opens in a sandboxed frame: no scripts or forms. The link cannot be revoked; it only expires.",
        "operationId": "shareEmail",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expires_in": {
                    "type": "string",
                    "maxLength": 40
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "email",
                        "inbound"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "url",
                    "expires_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/inbound/{id}/share": {
      "post": {
        "tags": [
          "Inbound"
        ],
        "summary": "Share a received message",
        "description": "A link on `links.` that shows the email's headers and content to whoever has it, until `expires_at` (`expires_in`: up to and by default 48 hours). The content opens in a sandboxed frame: no scripts or forms. The link cannot be revoked; it only expires.",
        "operationId": "shareInbound",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expires_in": {
                    "type": "string",
                    "maxLength": 40
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "email",
                        "inbound"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "url",
                    "expires_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/mailboxes": {
      "get": {
        "tags": [
          "Mailboxes"
        ],
        "summary": "List connected mailboxes",
        "operationId": "listMailboxes",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Mailbox"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Mailboxes"
        ],
        "summary": "Connect a mailbox",
        "description": "SMTP mailboxes are verified with a test login (and IMAP for Sent copies) and stored at once; Gmail and Microsoft return a consent URL, valid for 10 minutes, and the mailbox appears after the person consents. Connecting the same SMTP address or account again reconnects the mailbox in place. `return_url` must share its origin with the project's OAuth redirect URI or the console.",
        "operationId": "createMailbox",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "provider": {
                        "type": "string",
                        "enum": [
                          "smtp"
                        ]
                      },
                      "address": {
                        "type": "string",
                        "description": "An email address without display name."
                      },
                      "display_name": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "smtp": {
                        "type": "object",
                        "properties": {
                          "host": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 253
                          },
                          "port": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 65535
                          },
                          "username": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          "password": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "secure": {
                            "type": "string",
                            "enum": [
                              "tls",
                              "starttls"
                            ],
                            "default": "starttls"
                          }
                        },
                        "required": [
                          "host",
                          "port",
                          "username",
                          "password"
                        ]
                      },
                      "imap": {
                        "type": "object",
                        "properties": {
                          "host": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 253
                          },
                          "port": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 65535,
                            "default": 993
                          },
                          "username": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          "password": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "sent_folder": {
                            "type": "string",
                            "maxLength": 200,
                            "default": "Sent"
                          }
                        },
                        "required": [
                          "host",
                          "username",
                          "password"
                        ]
                      }
                    },
                    "required": [
                      "provider",
                      "address",
                      "smtp"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "provider": {
                        "type": "string",
                        "enum": [
                          "gmail",
                          "microsoft"
                        ]
                      },
                      "return_url": {
                        "type": "string",
                        "maxLength": 2048,
                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                      }
                    },
                    "required": [
                      "provider"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created or consent URL",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Mailbox"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "object": {
                          "type": "string",
                          "enum": [
                            "oauth"
                          ]
                        },
                        "url": {
                          "type": "string"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                        }
                      },
                      "required": [
                        "object",
                        "url",
                        "expires_at"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/mailboxes/{id}": {
      "get": {
        "tags": [
          "Mailboxes"
        ],
        "summary": "Get a mailbox",
        "operationId": "getMailbox",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Mailbox"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Mailboxes"
        ],
        "summary": "Disconnect a mailbox",
        "operationId": "deleteMailbox",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "mailbox"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Create a contact",
        "description": "Properties must be defined first; topics and static segments must exist. The consent ledger records the subscription, and an unsubscribed contact's address is suppressed on the marketing stream.",
        "operationId": "createContact",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "An email address without display name."
                  },
                  "first_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "last_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "unsubscribed": {
                    "type": "boolean"
                  },
                  "properties": {
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 1000
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "segments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "A UUID."
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "maxItems": 50
                  },
                  "topics": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "A UUID."
                        },
                        "subscription": {
                          "type": "string",
                          "enum": [
                            "opt_in",
                            "opt_out"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "subscription"
                      ]
                    },
                    "maxItems": 50
                  },
                  "source": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "List contacts",
        "description": "Newest first. `email` matches part of the address.",
        "operationId": "listContacts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 320
            },
            "required": false,
            "name": "email",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "segment_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "topic_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "unsubscribed",
                "bounced",
                "complained",
                "sunset"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "contact"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "email": {
                            "type": "string"
                          },
                          "first_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "unsubscribed": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "unsubscribed",
                              "bounced",
                              "complained",
                              "sunset"
                            ]
                          },
                          "properties": {
                            "type": "object",
                            "additionalProperties": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "boolean"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "last_sent_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "last_opened_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "last_clicked_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "email",
                          "first_name",
                          "last_name",
                          "unsubscribed",
                          "status",
                          "properties",
                          "last_sent_at",
                          "last_opened_at",
                          "last_clicked_at",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/import": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Import contacts from CSV",
        "description": "Up to 4 MB inline as base64 `content`, up to 50 MB through `POST /v1/uploads` (purpose `import`) and `upload_id`. Processed in the background; poll the import for its counts and row errors.",
        "operationId": "importContacts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "maxLength": 5592410
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "A UUID."
                  },
                  "column_map": {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string",
                        "default": "email"
                      },
                      "first_name": {
                        "type": "string"
                      },
                      "last_name": {
                        "type": "string"
                      },
                      "unsubscribed": {
                        "type": "string"
                      },
                      "properties": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "object",
                          "properties": {
                            "column": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "column"
                          ]
                        }
                      }
                    },
                    "default": {
                      "email": "email"
                    }
                  },
                  "on_conflict": {
                    "type": "string",
                    "enum": [
                      "upsert",
                      "skip"
                    ],
                    "default": "upsert"
                  },
                  "segments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "A UUID."
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "maxItems": 50
                  },
                  "topics": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "A UUID."
                        },
                        "subscription": {
                          "type": "string",
                          "enum": [
                            "opt_in",
                            "opt_out"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "subscription"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "contact_import"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "in_progress",
                        "completed",
                        "failed"
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "created": {
                          "type": "integer"
                        },
                        "updated": {
                          "type": "integer"
                        },
                        "skipped": {
                          "type": "integer"
                        },
                        "failed": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "total",
                        "created",
                        "updated",
                        "skipped",
                        "failed"
                      ]
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "row": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "row",
                          "message"
                        ]
                      }
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "completed_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "status",
                    "counts",
                    "error",
                    "errors",
                    "created_at",
                    "completed_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "List imports",
        "operationId": "listImports",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "in_progress",
                "completed",
                "failed"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "contact_import"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "in_progress",
                              "completed",
                              "failed"
                            ]
                          },
                          "counts": {
                            "type": "object",
                            "properties": {
                              "total": {
                                "type": "integer"
                              },
                              "created": {
                                "type": "integer"
                              },
                              "updated": {
                                "type": "integer"
                              },
                              "skipped": {
                                "type": "integer"
                              },
                              "failed": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "total",
                              "created",
                              "updated",
                              "skipped",
                              "failed"
                            ]
                          },
                          "error": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "errors": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "row": {
                                  "type": "integer"
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "row",
                                "message"
                              ]
                            }
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "completed_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "status",
                          "counts",
                          "error",
                          "errors",
                          "created_at",
                          "completed_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/import/{id}": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "Get an import",
        "operationId": "getImport",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "contact_import"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "queued",
                        "in_progress",
                        "completed",
                        "failed"
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "created": {
                          "type": "integer"
                        },
                        "updated": {
                          "type": "integer"
                        },
                        "skipped": {
                          "type": "integer"
                        },
                        "failed": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "total",
                        "created",
                        "updated",
                        "skipped",
                        "failed"
                      ]
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "row": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "row",
                          "message"
                        ]
                      }
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "completed_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "status",
                    "counts",
                    "error",
                    "errors",
                    "created_at",
                    "completed_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/export": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Export contacts as CSV",
        "description": "A presigned download of up to 200,000 contacts, valid until `expires_at` (an hour at most).",
        "operationId": "exportContacts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "segment_id": {
                    "type": "string",
                    "description": "A UUID."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "unsubscribed",
                      "bounced",
                      "complained",
                      "sunset"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "export"
                      ]
                    },
                    "download_url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "object",
                    "download_url",
                    "expires_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/events": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Send a custom event for a contact",
        "description": "Recorded in the contact's history; starts any automation triggered by this event.",
        "operationId": "sendContactEvent",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "contact_id": {
                    "type": "string",
                    "description": "A UUID."
                  },
                  "email": {
                    "type": "string",
                    "description": "An email address without display name."
                  },
                  "payload": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "event"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "event"
                      ]
                    },
                    "event": {
                      "type": "string"
                    },
                    "runs_started": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "event",
                    "runs_started"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/properties": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "List contact properties",
        "operationId": "listContactProperties",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "contact_property"
                            ]
                          },
                          "key": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "boolean",
                              "date"
                            ]
                          },
                          "fallback_value": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 1000
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "key",
                          "type",
                          "fallback_value",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Define a contact property",
        "operationId": "createContactProperty",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50,
                    "pattern": "^[a-z][a-z0-9_]*$"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "string",
                      "number",
                      "boolean",
                      "date"
                    ]
                  },
                  "fallback_value": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "key",
                  "type"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "contact_property"
                      ]
                    },
                    "key": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "string",
                        "number",
                        "boolean",
                        "date"
                      ]
                    },
                    "fallback_value": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 1000
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "key",
                    "type",
                    "fallback_value",
                    "created_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/properties/{id}": {
      "delete": {
        "tags": [
          "Contacts"
        ],
        "summary": "Delete a contact property",
        "description": "Removes the property's value from every contact.",
        "operationId": "deleteContactProperty",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "contact_property"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/{id}": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "Get a contact (by id or email)",
        "operationId": "getContact",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Contacts"
        ],
        "summary": "Update a contact",
        "description": "Properties merge (null removes one); `segments` replaces the contact's static segments; `topics` sets the listed topics.",
        "operationId": "updateContact",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "first_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "last_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  },
                  "unsubscribed": {
                    "type": "boolean"
                  },
                  "properties": {
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 1000
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "segments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "A UUID."
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "maxItems": 50
                  },
                  "topics": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "A UUID."
                        },
                        "subscription": {
                          "type": "string",
                          "enum": [
                            "opt_in",
                            "opt_out"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "subscription"
                      ]
                    },
                    "maxItems": 50
                  },
                  "source": {
                    "type": "string",
                    "maxLength": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Contacts"
        ],
        "summary": "Delete a contact",
        "description": "Suppressions for the address stay.",
        "operationId": "deleteContact",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "contact"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/{id}/consent": {
      "get": {
        "tags": [
          "Contacts"
        ],
        "summary": "Consent ledger for a contact",
        "operationId": "listContactConsent",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "consent"
                            ]
                          },
                          "contact_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "topic_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "action": {
                            "type": "string",
                            "enum": [
                              "subscribe",
                              "unsubscribe",
                              "double_optin_sent",
                              "double_optin_confirmed",
                              "import",
                              "sunset",
                              "resubscribe"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "api",
                              "console",
                              "import",
                              "preference_center",
                              "one_click",
                              "list_unsubscribe",
                              "double_opt_in",
                              "automation",
                              "system"
                            ]
                          },
                          "ip": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "user_agent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "evidence": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "additionalProperties": {}
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "contact_id",
                          "topic_id",
                          "action",
                          "source",
                          "ip",
                          "user_agent",
                          "evidence",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/contacts/{id}/optin": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "summary": "Send a double opt-in confirmation",
        "description": "Emails the contact a link that confirms their subscription (to `topic_id`, or to marketing mail). The link expires after 72 hours. Sent through the send pipeline from a domain of the project.",
        "operationId": "sendContactOptin",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 998,
                    "description": "An email address, optionally with a display name as `Name <address>`."
                  },
                  "subject": {
                    "type": "string",
                    "maxLength": 998
                  },
                  "reply_to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 998,
                        "description": "An email address, optionally with a display name as `Name <address>`."
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 998,
                          "description": "An email address, optionally with a display name as `Name <address>`."
                        },
                        "minItems": 1,
                        "maxItems": 50
                      }
                    ],
                    "description": "One address, or an array of up to 50."
                  },
                  "topic_id": {
                    "type": "string",
                    "description": "A UUID."
                  }
                },
                "required": [
                  "from"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "optin"
                      ]
                    },
                    "contact_id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "topic_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "A UUID."
                    },
                    "email_id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "object",
                    "contact_id",
                    "topic_id",
                    "email_id",
                    "expires_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/segments": {
      "post": {
        "tags": [
          "Segments"
        ],
        "summary": "Create a segment",
        "description": "`static` segments hold members you add; `dynamic` ones match their rules whenever they are read.",
        "operationId": "createSegment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "static",
                      "dynamic"
                    ],
                    "default": "static"
                  },
                  "rules": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "all": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string",
                                  "maxLength": 120,
                                  "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                },
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "eq",
                                    "neq",
                                    "contains",
                                    "not_contains",
                                    "starts_with",
                                    "ends_with",
                                    "gt",
                                    "gte",
                                    "lt",
                                    "lte",
                                    "is_set",
                                    "is_not_set",
                                    "in",
                                    "not_in",
                                    "before",
                                    "after",
                                    "within_days",
                                    "not_within_days"
                                  ]
                                },
                                "value": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "field",
                                "op"
                              ]
                            },
                            "minItems": 1,
                            "maxItems": 50
                          }
                        },
                        "required": [
                          "all"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "any": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string",
                                  "maxLength": 120,
                                  "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                },
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "eq",
                                    "neq",
                                    "contains",
                                    "not_contains",
                                    "starts_with",
                                    "ends_with",
                                    "gt",
                                    "gte",
                                    "lt",
                                    "lte",
                                    "is_set",
                                    "is_not_set",
                                    "in",
                                    "not_in",
                                    "before",
                                    "after",
                                    "within_days",
                                    "not_within_days"
                                  ]
                                },
                                "value": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "field",
                                "op"
                              ]
                            },
                            "minItems": 1,
                            "maxItems": 50
                          }
                        },
                        "required": [
                          "any"
                        ]
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Segments"
        ],
        "summary": "List segments",
        "operationId": "listSegments",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Segment"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/segments/{id}": {
      "get": {
        "tags": [
          "Segments"
        ],
        "summary": "Get a segment",
        "operationId": "getSegment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Segments"
        ],
        "summary": "Update a segment",
        "description": "Renames it or, for a dynamic segment, replaces its rules. The kind is fixed.",
        "operationId": "updateSegment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "static",
                      "dynamic"
                    ],
                    "default": "static"
                  },
                  "rules": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "all": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string",
                                  "maxLength": 120,
                                  "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                },
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "eq",
                                    "neq",
                                    "contains",
                                    "not_contains",
                                    "starts_with",
                                    "ends_with",
                                    "gt",
                                    "gte",
                                    "lt",
                                    "lte",
                                    "is_set",
                                    "is_not_set",
                                    "in",
                                    "not_in",
                                    "before",
                                    "after",
                                    "within_days",
                                    "not_within_days"
                                  ]
                                },
                                "value": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "field",
                                "op"
                              ]
                            },
                            "minItems": 1,
                            "maxItems": 50
                          }
                        },
                        "required": [
                          "all"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "any": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string",
                                  "maxLength": 120,
                                  "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                },
                                "op": {
                                  "type": "string",
                                  "enum": [
                                    "eq",
                                    "neq",
                                    "contains",
                                    "not_contains",
                                    "starts_with",
                                    "ends_with",
                                    "gt",
                                    "gte",
                                    "lt",
                                    "lte",
                                    "is_set",
                                    "is_not_set",
                                    "in",
                                    "not_in",
                                    "before",
                                    "after",
                                    "within_days",
                                    "not_within_days"
                                  ]
                                },
                                "value": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "field",
                                "op"
                              ]
                            },
                            "minItems": 1,
                            "maxItems": 50
                          }
                        },
                        "required": [
                          "any"
                        ]
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Segment"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Segments"
        ],
        "summary": "Delete a segment",
        "operationId": "deleteSegment",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "segment"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/segments/{id}/contacts": {
      "get": {
        "tags": [
          "Segments"
        ],
        "summary": "List a segment's contacts",
        "operationId": "listSegmentContacts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "contact"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "email": {
                            "type": "string"
                          },
                          "first_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "unsubscribed": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "unsubscribed",
                              "bounced",
                              "complained",
                              "sunset"
                            ]
                          },
                          "properties": {
                            "type": "object",
                            "additionalProperties": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 1000
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "boolean"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "last_sent_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "last_opened_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "last_clicked_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "email",
                          "first_name",
                          "last_name",
                          "unsubscribed",
                          "status",
                          "properties",
                          "last_sent_at",
                          "last_opened_at",
                          "last_clicked_at",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Segments"
        ],
        "summary": "Add contacts to a static segment",
        "operationId": "addSegmentContacts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contact_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "maxItems": 1000
                  },
                  "emails": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "An email address without display name."
                    },
                    "maxItems": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "segment"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "added": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "added"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Segments"
        ],
        "summary": "Remove contacts from a static segment",
        "operationId": "removeSegmentContacts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contact_ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "maxItems": 1000
                  },
                  "emails": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "An email address without display name."
                    },
                    "maxItems": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "segment"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "removed": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "removed"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/topics": {
      "post": {
        "tags": [
          "Topics"
        ],
        "summary": "Create a topic",
        "description": "`default_subscription` is what contacts without a choice of their own receive; it is fixed at creation.",
        "operationId": "createTopic",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "default_subscription": {
                    "type": "string",
                    "enum": [
                      "opt_in",
                      "opt_out"
                    ]
                  },
                  "public_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  }
                },
                "required": [
                  "name",
                  "default_subscription"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Topic"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Topics"
        ],
        "summary": "List topics",
        "operationId": "listTopics",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Topic"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/topics/{id}": {
      "get": {
        "tags": [
          "Topics"
        ],
        "summary": "Get a topic",
        "operationId": "getTopic",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Topic"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Topics"
        ],
        "summary": "Update a topic",
        "operationId": "updateTopic",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "default_subscription": {
                    "type": "string",
                    "enum": [
                      "opt_in",
                      "opt_out"
                    ]
                  },
                  "public_name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Topic"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Topics"
        ],
        "summary": "Delete a topic",
        "operationId": "deleteTopic",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "topic"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts": {
      "post": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Create a broadcast",
        "description": "A draft: from an address on a marketing domain, a subject (or an A/B test of two), a block document or HTML with contact properties as variables, and a segment or topic.",
        "operationId": "createBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "from": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 998,
                    "description": "An email address, optionally with a display name as `Name <address>`."
                  },
                  "reply_to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 998,
                        "description": "An email address, optionally with a display name as `Name <address>`."
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 998,
                          "description": "An email address, optionally with a display name as `Name <address>`."
                        },
                        "minItems": 1,
                        "maxItems": 50
                      }
                    ],
                    "description": "One address, or an array of up to 50."
                  },
                  "subject": {
                    "type": "string",
                    "maxLength": 998
                  },
                  "preview_text": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "segment_id": {
                    "type": "string",
                    "description": "A UUID."
                  },
                  "topic_id": {
                    "type": "string",
                    "description": "A UUID."
                  },
                  "document": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "number",
                        "enum": [
                          1
                        ]
                      },
                      "settings": {
                        "type": "object",
                        "properties": {
                          "width": {
                            "type": "integer",
                            "minimum": 320,
                            "maximum": 800,
                            "default": 600
                          },
                          "background": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "default": "#f4f4f5"
                          },
                          "font": {
                            "type": "string",
                            "enum": [
                              "system",
                              "serif",
                              "mono"
                            ],
                            "default": "system"
                          },
                          "footer": {
                            "type": "string",
                            "maxLength": 2000
                          }
                        },
                        "default": {
                          "width": 600,
                          "background": "#f4f4f5",
                          "font": "system"
                        }
                      },
                      "blocks": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "heading"
                                  ]
                                },
                                "level": {
                                  "type": "string",
                                  "enum": [
                                    "1",
                                    "2",
                                    "3"
                                  ],
                                  "default": "1"
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "paragraph"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "image"
                                  ]
                                },
                                "src": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "alt": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 16,
                                  "maximum": 1200
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "src",
                                "alt"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "button"
                                  ]
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "label",
                                "href"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "divider"
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "spacer"
                                  ]
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 4,
                                  "maximum": 200
                                }
                              },
                              "required": [
                                "type",
                                "height"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "html"
                                  ]
                                },
                                "html": {
                                  "type": "string",
                                  "maxLength": 200000
                                }
                              },
                              "required": [
                                "type",
                                "html"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "columns"
                                  ]
                                },
                                "columns": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "blocks": {
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "heading"
                                                  ]
                                                },
                                                "level": {
                                                  "type": "string",
                                                  "enum": [
                                                    "1",
                                                    "2",
                                                    "3"
                                                  ],
                                                  "default": "1"
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "paragraph"
                                                  ]
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "image"
                                                  ]
                                                },
                                                "src": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "alt": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "width": {
                                                  "type": "integer",
                                                  "minimum": 16,
                                                  "maximum": 1200
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "src",
                                                "alt"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "button"
                                                  ]
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "label",
                                                "href"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "divider"
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "spacer"
                                                  ]
                                                },
                                                "height": {
                                                  "type": "integer",
                                                  "minimum": 4,
                                                  "maximum": 200
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "height"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "html"
                                                  ]
                                                },
                                                "html": {
                                                  "type": "string",
                                                  "maxLength": 200000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "html"
                                              ]
                                            }
                                          ]
                                        },
                                        "maxItems": 20
                                      }
                                    },
                                    "required": [
                                      "blocks"
                                    ]
                                  },
                                  "minItems": 2,
                                  "maxItems": 3
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "columns"
                              ]
                            }
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 200
                      }
                    },
                    "required": [
                      "version",
                      "blocks"
                    ]
                  },
                  "html": {
                    "type": "string",
                    "maxLength": 1048576
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 1048576
                  },
                  "throttle_per_minute": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "ab_test": {
                    "type": "object",
                    "properties": {
                      "variants": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "enum": [
                                "a",
                                "b"
                              ]
                            },
                            "subject": {
                              "type": "string",
                              "maxLength": 998
                            }
                          },
                          "required": [
                            "key",
                            "subject"
                          ]
                        }
                      },
                      "sample_percent": {
                        "type": "integer",
                        "minimum": 5,
                        "maximum": 50
                      },
                      "window_minutes": {
                        "type": "integer",
                        "minimum": 15,
                        "maximum": 1440
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "opens",
                          "clicks"
                        ],
                        "default": "opens"
                      }
                    },
                    "required": [
                      "variants",
                      "sample_percent",
                      "window_minutes"
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Broadcast"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "List broadcasts",
        "operationId": "listBroadcasts",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "broadcast"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "live",
                              "test"
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "from": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reply_to": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "subject": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "preview_text": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "segment_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "topic_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "scheduled",
                              "queued",
                              "sending",
                              "testing",
                              "sent",
                              "canceled",
                              "failed",
                              "paused"
                            ]
                          },
                          "throttle_per_minute": {
                            "type": "integer"
                          },
                          "ab_test": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "variants": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string",
                                      "enum": [
                                        "a",
                                        "b"
                                      ]
                                    },
                                    "subject": {
                                      "type": "string",
                                      "maxLength": 998
                                    }
                                  },
                                  "required": [
                                    "key",
                                    "subject"
                                  ]
                                }
                              },
                              "sample_percent": {
                                "type": "integer",
                                "minimum": 5,
                                "maximum": 50
                              },
                              "window_minutes": {
                                "type": "integer",
                                "minimum": 15,
                                "maximum": 1440
                              },
                              "metric": {
                                "type": "string",
                                "enum": [
                                  "opens",
                                  "clicks"
                                ],
                                "default": "opens"
                              },
                              "winner": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "enum": [
                                  "a",
                                  "b",
                                  null
                                ]
                              },
                              "decided_at": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time",
                                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                              },
                              "window_ends_at": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date-time",
                                "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                              },
                              "results": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string",
                                      "enum": [
                                        "a",
                                        "b"
                                      ]
                                    },
                                    "subject": {
                                      "type": "string"
                                    },
                                    "recipients": {
                                      "type": "integer"
                                    },
                                    "sent": {
                                      "type": "integer"
                                    },
                                    "opened": {
                                      "type": "integer"
                                    },
                                    "clicked": {
                                      "type": "integer"
                                    }
                                  },
                                  "required": [
                                    "key",
                                    "subject",
                                    "recipients",
                                    "sent",
                                    "opened",
                                    "clicked"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "variants",
                              "sample_percent",
                              "window_minutes",
                              "winner",
                              "decided_at",
                              "window_ends_at",
                              "results"
                            ]
                          },
                          "stats": {
                            "type": "object",
                            "properties": {
                              "recipients": {
                                "type": "integer"
                              },
                              "sent": {
                                "type": "integer"
                              },
                              "delivered": {
                                "type": "integer"
                              },
                              "opened": {
                                "type": "integer"
                              },
                              "clicked": {
                                "type": "integer"
                              },
                              "bounced": {
                                "type": "integer"
                              },
                              "complained": {
                                "type": "integer"
                              },
                              "unsubscribed": {
                                "type": "integer"
                              },
                              "skipped": {
                                "type": "integer"
                              },
                              "failed": {
                                "type": "integer"
                              },
                              "pending": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "recipients",
                              "sent",
                              "delivered",
                              "opened",
                              "clicked",
                              "bounced",
                              "complained",
                              "unsubscribed",
                              "skipped",
                              "failed",
                              "pending"
                            ]
                          },
                          "error": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "scheduled_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "started_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "sent_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "mode",
                          "name",
                          "from",
                          "reply_to",
                          "subject",
                          "preview_text",
                          "segment_id",
                          "topic_id",
                          "status",
                          "throttle_per_minute",
                          "ab_test",
                          "stats",
                          "error",
                          "scheduled_at",
                          "started_at",
                          "sent_at",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts/{id}": {
      "get": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Get a broadcast, with its progress and analytics",
        "operationId": "getBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Broadcast"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Update a draft broadcast",
        "operationId": "updateBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "from": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 998,
                    "description": "An email address, optionally with a display name as `Name <address>`."
                  },
                  "reply_to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 998,
                        "description": "An email address, optionally with a display name as `Name <address>`."
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 998,
                          "description": "An email address, optionally with a display name as `Name <address>`."
                        },
                        "minItems": 1,
                        "maxItems": 50
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "One address, or an array of up to 50."
                  },
                  "subject": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 998
                  },
                  "preview_text": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 500
                  },
                  "segment_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A UUID."
                  },
                  "topic_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A UUID."
                  },
                  "document": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "version": {
                        "type": "number",
                        "enum": [
                          1
                        ]
                      },
                      "settings": {
                        "type": "object",
                        "properties": {
                          "width": {
                            "type": "integer",
                            "minimum": 320,
                            "maximum": 800,
                            "default": 600
                          },
                          "background": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "default": "#f4f4f5"
                          },
                          "font": {
                            "type": "string",
                            "enum": [
                              "system",
                              "serif",
                              "mono"
                            ],
                            "default": "system"
                          },
                          "footer": {
                            "type": "string",
                            "maxLength": 2000
                          }
                        },
                        "default": {
                          "width": 600,
                          "background": "#f4f4f5",
                          "font": "system"
                        }
                      },
                      "blocks": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "heading"
                                  ]
                                },
                                "level": {
                                  "type": "string",
                                  "enum": [
                                    "1",
                                    "2",
                                    "3"
                                  ],
                                  "default": "1"
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "paragraph"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "image"
                                  ]
                                },
                                "src": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "alt": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 16,
                                  "maximum": 1200
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "src",
                                "alt"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "button"
                                  ]
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "label",
                                "href"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "divider"
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "spacer"
                                  ]
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 4,
                                  "maximum": 200
                                }
                              },
                              "required": [
                                "type",
                                "height"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "html"
                                  ]
                                },
                                "html": {
                                  "type": "string",
                                  "maxLength": 200000
                                }
                              },
                              "required": [
                                "type",
                                "html"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "columns"
                                  ]
                                },
                                "columns": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "blocks": {
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "heading"
                                                  ]
                                                },
                                                "level": {
                                                  "type": "string",
                                                  "enum": [
                                                    "1",
                                                    "2",
                                                    "3"
                                                  ],
                                                  "default": "1"
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "paragraph"
                                                  ]
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "image"
                                                  ]
                                                },
                                                "src": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "alt": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "width": {
                                                  "type": "integer",
                                                  "minimum": 16,
                                                  "maximum": 1200
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "src",
                                                "alt"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "button"
                                                  ]
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "label",
                                                "href"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "divider"
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "spacer"
                                                  ]
                                                },
                                                "height": {
                                                  "type": "integer",
                                                  "minimum": 4,
                                                  "maximum": 200
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "height"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "html"
                                                  ]
                                                },
                                                "html": {
                                                  "type": "string",
                                                  "maxLength": 200000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "html"
                                              ]
                                            }
                                          ]
                                        },
                                        "maxItems": 20
                                      }
                                    },
                                    "required": [
                                      "blocks"
                                    ]
                                  },
                                  "minItems": 2,
                                  "maxItems": 3
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "columns"
                              ]
                            }
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 200
                      }
                    },
                    "required": [
                      "version",
                      "blocks"
                    ]
                  },
                  "html": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1048576
                  },
                  "text": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 1048576
                  },
                  "throttle_per_minute": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "ab_test": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "variants": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "enum": [
                                "a",
                                "b"
                              ]
                            },
                            "subject": {
                              "type": "string",
                              "maxLength": 998
                            }
                          },
                          "required": [
                            "key",
                            "subject"
                          ]
                        }
                      },
                      "sample_percent": {
                        "type": "integer",
                        "minimum": 5,
                        "maximum": 50
                      },
                      "window_minutes": {
                        "type": "integer",
                        "minimum": 15,
                        "maximum": 1440
                      },
                      "metric": {
                        "type": "string",
                        "enum": [
                          "opens",
                          "clicks"
                        ],
                        "default": "opens"
                      }
                    },
                    "required": [
                      "variants",
                      "sample_percent",
                      "window_minutes"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Broadcast"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Delete a draft broadcast",
        "description": "Drafts, canceled and failed broadcasts; a scheduled one is canceled first.",
        "operationId": "deleteBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "broadcast"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts/{id}/send": {
      "post": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Send or schedule a broadcast",
        "description": "Sends a draft now or at `scheduled_at`, and resumes a paused one. When sending starts the audience is resolved to a recipient snapshot (subscribed, not suppressed); consent and suppression are checked again for each recipient, and sends are throttled per domain.",
        "operationId": "sendBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scheduled_at": {
                    "type": "string",
                    "maxLength": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "broadcast"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "scheduled",
                        "queued",
                        "sending",
                        "testing",
                        "sent",
                        "canceled",
                        "failed",
                        "paused"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts/{id}/cancel": {
      "post": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Cancel a scheduled or sending broadcast",
        "operationId": "cancelBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "broadcast"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "scheduled",
                        "queued",
                        "sending",
                        "testing",
                        "sent",
                        "canceled",
                        "failed",
                        "paused"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts/{id}/duplicate": {
      "post": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Duplicate a broadcast",
        "description": "A new draft named `<name> (copy)` with the broadcast's sender, subject, audience, content, throttle and A/B test settings, whatever its status. Nothing about sending carries over.",
        "operationId": "duplicateBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Broadcast"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts/{id}/test": {
      "post": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "Send a test copy to up to five addresses",
        "description": "Separate emails with the broadcast's current content, outside its analytics. Addresses that are contacts get their own variables.",
        "operationId": "testBroadcast",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "An email address without display name."
                    },
                    "minItems": 1,
                    "maxItems": 5
                  }
                },
                "required": [
                  "to"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "broadcast"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "scheduled",
                        "queued",
                        "sending",
                        "testing",
                        "sent",
                        "canceled",
                        "failed",
                        "paused"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts/{id}/recipients": {
      "get": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "List a broadcast's recipients and their status",
        "description": "Newest contact first. `event` keeps the recipients whose email had that event (`unsubscribed`: who left since; `suppressed`: skipped or refused as suppressed) and adds `count` for opens and clicks, `clicked_links` for clicks and `bounce_type` for bounces. `email` matches part of the address.",
        "operationId": "listBroadcastRecipients",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "sent",
                "skipped",
                "failed"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "sent",
                "delivered",
                "opened",
                "clicked",
                "bounced",
                "complained",
                "unsubscribed",
                "suppressed"
              ]
            },
            "required": false,
            "name": "event",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "required": false,
            "name": "email",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "permanent",
                "transient",
                "undetermined"
              ]
            },
            "required": false,
            "name": "bounce_type",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "contact_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "email": {
                            "type": "string"
                          },
                          "email_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "variant": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "a",
                              "b",
                              null
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "sent",
                              "skipped",
                              "failed"
                            ]
                          },
                          "skipped_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sent_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "count": {
                            "type": "integer"
                          },
                          "clicked_links": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string"
                                },
                                "clicks": {
                                  "type": "integer"
                                }
                              },
                              "required": [
                                "url",
                                "clicks"
                              ]
                            }
                          },
                          "bounce_type": {
                            "type": "string",
                            "enum": [
                              "permanent",
                              "transient",
                              "undetermined"
                            ]
                          }
                        },
                        "required": [
                          "contact_id",
                          "email",
                          "email_id",
                          "variant",
                          "status",
                          "skipped_reason",
                          "sent_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/broadcasts/{id}/links": {
      "get": {
        "tags": [
          "Broadcasts"
        ],
        "summary": "List the links a broadcast's recipients clicked",
        "description": "Most clicked first, with `clicks` (each recipient once a day per link) and `unique_clicks` (recipients). Page with a link's `id` as `after` or `before`.",
        "operationId": "listBroadcastLinks",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,9}\\.[0-9a-f]{32}$"
            },
            "required": false,
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,9}\\.[0-9a-f]{32}$"
            },
            "required": false,
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^\\d{1,9}\\.[0-9a-f]{32}$"
                          },
                          "url": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          },
                          "unique_clicks": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "url",
                          "clicks",
                          "unique_clicks"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates": {
      "post": {
        "tags": [
          "Templates"
        ],
        "summary": "Create a hosted template",
        "description": "Block documents are rendered by the platform; `html` accepts pre-rendered markup (React Email compiled by the CLI) with {{variables}}. The platform never executes caller code.",
        "operationId": "createTemplate",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "alias": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100,
                    "pattern": "^[a-z0-9_-]+$"
                  },
                  "subject": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 998
                  },
                  "from": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 3,
                    "maxLength": 998,
                    "description": "An email address, optionally with a display name as `Name <address>`."
                  },
                  "reply_to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 998,
                        "description": "An email address, optionally with a display name as `Name <address>`."
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 998,
                          "description": "An email address, optionally with a display name as `Name <address>`."
                        },
                        "minItems": 1,
                        "maxItems": 50
                      }
                    ],
                    "description": "One address, or an array of up to 50."
                  },
                  "document": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "number",
                        "enum": [
                          1
                        ]
                      },
                      "settings": {
                        "type": "object",
                        "properties": {
                          "width": {
                            "type": "integer",
                            "minimum": 320,
                            "maximum": 800,
                            "default": 600
                          },
                          "background": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "default": "#f4f4f5"
                          },
                          "font": {
                            "type": "string",
                            "enum": [
                              "system",
                              "serif",
                              "mono"
                            ],
                            "default": "system"
                          },
                          "footer": {
                            "type": "string",
                            "maxLength": 2000
                          }
                        },
                        "default": {
                          "width": 600,
                          "background": "#f4f4f5",
                          "font": "system"
                        }
                      },
                      "blocks": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "heading"
                                  ]
                                },
                                "level": {
                                  "type": "string",
                                  "enum": [
                                    "1",
                                    "2",
                                    "3"
                                  ],
                                  "default": "1"
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "paragraph"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "image"
                                  ]
                                },
                                "src": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "alt": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 16,
                                  "maximum": 1200
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "src",
                                "alt"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "button"
                                  ]
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "label",
                                "href"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "divider"
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "spacer"
                                  ]
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 4,
                                  "maximum": 200
                                }
                              },
                              "required": [
                                "type",
                                "height"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "html"
                                  ]
                                },
                                "html": {
                                  "type": "string",
                                  "maxLength": 200000
                                }
                              },
                              "required": [
                                "type",
                                "html"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "columns"
                                  ]
                                },
                                "columns": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "blocks": {
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "heading"
                                                  ]
                                                },
                                                "level": {
                                                  "type": "string",
                                                  "enum": [
                                                    "1",
                                                    "2",
                                                    "3"
                                                  ],
                                                  "default": "1"
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "paragraph"
                                                  ]
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "image"
                                                  ]
                                                },
                                                "src": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "alt": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "width": {
                                                  "type": "integer",
                                                  "minimum": 16,
                                                  "maximum": 1200
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "src",
                                                "alt"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "button"
                                                  ]
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "label",
                                                "href"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "divider"
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "spacer"
                                                  ]
                                                },
                                                "height": {
                                                  "type": "integer",
                                                  "minimum": 4,
                                                  "maximum": 200
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "height"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "html"
                                                  ]
                                                },
                                                "html": {
                                                  "type": "string",
                                                  "maxLength": 200000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "html"
                                              ]
                                            }
                                          ]
                                        },
                                        "maxItems": 20
                                      }
                                    },
                                    "required": [
                                      "blocks"
                                    ]
                                  },
                                  "minItems": 2,
                                  "maxItems": 3
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "columns"
                              ]
                            }
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 200
                      }
                    },
                    "required": [
                      "version",
                      "blocks"
                    ]
                  },
                  "html": {
                    "type": "string",
                    "maxLength": 1048576
                  },
                  "text": {
                    "type": "string"
                  },
                  "variables": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[a-z][a-z0-9_.]*$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "string",
                            "number",
                            "boolean"
                          ]
                        },
                        "fallback_value": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "key",
                        "type",
                        "fallback_value"
                      ]
                    },
                    "maxItems": 100
                  },
                  "publish": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "List templates",
        "operationId": "listTemplates",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "template"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "name": {
                            "type": "string"
                          },
                          "alias": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "published"
                            ]
                          },
                          "engine": {
                            "type": "string",
                            "enum": [
                              "blocks",
                              "html"
                            ]
                          },
                          "current_version": {
                            "type": "integer"
                          },
                          "published_version": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "subject": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "from": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reply_to": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "variables": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64,
                                  "pattern": "^[a-z][a-z0-9_.]*$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "boolean"
                                  ]
                                },
                                "fallback_value": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "required": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "key",
                                "type",
                                "fallback_value",
                                "required"
                              ]
                            }
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "published_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "name",
                          "alias",
                          "status",
                          "engine",
                          "current_version",
                          "published_version",
                          "subject",
                          "from",
                          "reply_to",
                          "variables",
                          "created_at",
                          "updated_at",
                          "published_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "Get a template (by id or alias)",
        "operationId": "getTemplate",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Templates"
        ],
        "summary": "Update a template (creates a new draft version)",
        "operationId": "updateTemplate",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "alias": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 100,
                    "pattern": "^[a-z0-9_-]+$"
                  },
                  "subject": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 998
                  },
                  "from": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 3,
                    "maxLength": 998,
                    "description": "An email address, optionally with a display name as `Name <address>`."
                  },
                  "reply_to": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 998,
                        "description": "An email address, optionally with a display name as `Name <address>`."
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 998,
                          "description": "An email address, optionally with a display name as `Name <address>`."
                        },
                        "minItems": 1,
                        "maxItems": 50
                      }
                    ],
                    "description": "One address, or an array of up to 50."
                  },
                  "document": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "type": "number",
                        "enum": [
                          1
                        ]
                      },
                      "settings": {
                        "type": "object",
                        "properties": {
                          "width": {
                            "type": "integer",
                            "minimum": 320,
                            "maximum": 800,
                            "default": 600
                          },
                          "background": {
                            "type": "string",
                            "pattern": "^#[0-9a-fA-F]{6}$",
                            "default": "#f4f4f5"
                          },
                          "font": {
                            "type": "string",
                            "enum": [
                              "system",
                              "serif",
                              "mono"
                            ],
                            "default": "system"
                          },
                          "footer": {
                            "type": "string",
                            "maxLength": 2000
                          }
                        },
                        "default": {
                          "width": 600,
                          "background": "#f4f4f5",
                          "font": "system"
                        }
                      },
                      "blocks": {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "heading"
                                  ]
                                },
                                "level": {
                                  "type": "string",
                                  "enum": [
                                    "1",
                                    "2",
                                    "3"
                                  ],
                                  "default": "1"
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "paragraph"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "maxLength": 20000
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "text"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "image"
                                  ]
                                },
                                "src": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "alt": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 16,
                                  "maximum": 1200
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "src",
                                "alt"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "button"
                                  ]
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "href": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                    }
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "label",
                                "href"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "divider"
                                  ]
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "spacer"
                                  ]
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 4,
                                  "maximum": 200
                                }
                              },
                              "required": [
                                "type",
                                "height"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "html"
                                  ]
                                },
                                "html": {
                                  "type": "string",
                                  "maxLength": 200000
                                }
                              },
                              "required": [
                                "type",
                                "html"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "columns"
                                  ]
                                },
                                "columns": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "blocks": {
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "heading"
                                                  ]
                                                },
                                                "level": {
                                                  "type": "string",
                                                  "enum": [
                                                    "1",
                                                    "2",
                                                    "3"
                                                  ],
                                                  "default": "1"
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "paragraph"
                                                  ]
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "maxLength": 20000
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "image"
                                                  ]
                                                },
                                                "src": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "alt": {
                                                  "type": "string",
                                                  "maxLength": 500
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "width": {
                                                  "type": "integer",
                                                  "minimum": 16,
                                                  "maximum": 1200
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "src",
                                                "alt"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "button"
                                                  ]
                                                },
                                                "label": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 200
                                                },
                                                "href": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "maxLength": 2048,
                                                      "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                    },
                                                    {
                                                      "type": "string",
                                                      "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                    }
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "label",
                                                "href"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "divider"
                                                  ]
                                                },
                                                "style": {
                                                  "type": "object",
                                                  "properties": {
                                                    "color": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "background": {
                                                      "type": "string",
                                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                                    },
                                                    "align": {
                                                      "type": "string",
                                                      "enum": [
                                                        "left",
                                                        "center",
                                                        "right"
                                                      ]
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 80
                                                    }
                                                  }
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "spacer"
                                                  ]
                                                },
                                                "height": {
                                                  "type": "integer",
                                                  "minimum": 4,
                                                  "maximum": 200
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "height"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "html"
                                                  ]
                                                },
                                                "html": {
                                                  "type": "string",
                                                  "maxLength": 200000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "html"
                                              ]
                                            }
                                          ]
                                        },
                                        "maxItems": 20
                                      }
                                    },
                                    "required": [
                                      "blocks"
                                    ]
                                  },
                                  "minItems": 2,
                                  "maxItems": 3
                                },
                                "style": {
                                  "type": "object",
                                  "properties": {
                                    "color": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "background": {
                                      "type": "string",
                                      "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": [
                                        "left",
                                        "center",
                                        "right"
                                      ]
                                    },
                                    "padding": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 80
                                    }
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "columns"
                              ]
                            }
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 200
                      }
                    },
                    "required": [
                      "version",
                      "blocks"
                    ]
                  },
                  "html": {
                    "type": "string",
                    "maxLength": 1048576
                  },
                  "text": {
                    "type": "string"
                  },
                  "variables": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64,
                          "pattern": "^[a-z][a-z0-9_.]*$"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "string",
                            "number",
                            "boolean"
                          ]
                        },
                        "fallback_value": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "key",
                        "type",
                        "fallback_value"
                      ]
                    },
                    "maxItems": 100
                  },
                  "publish": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "template"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "current_version": {
                      "type": "integer"
                    },
                    "published_version": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "current_version",
                    "published_version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Templates"
        ],
        "summary": "Delete a template",
        "operationId": "deleteTemplate",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "template"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/publish": {
      "post": {
        "tags": [
          "Templates"
        ],
        "summary": "Publish the current draft version",
        "operationId": "publishTemplate",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "template"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "current_version": {
                      "type": "integer"
                    },
                    "published_version": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "current_version",
                    "published_version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/duplicate": {
      "post": {
        "tags": [
          "Templates"
        ],
        "summary": "Duplicate a template",
        "operationId": "duplicateTemplate",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "template"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "current_version": {
                      "type": "integer"
                    },
                    "published_version": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "current_version",
                    "published_version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/versions": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "List a template's versions",
        "operationId": "listTemplateVersions",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "version": {
                            "type": "integer"
                          },
                          "subject": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "document": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "version": {
                                "type": "number",
                                "enum": [
                                  1
                                ]
                              },
                              "settings": {
                                "type": "object",
                                "properties": {
                                  "width": {
                                    "type": "integer",
                                    "minimum": 320,
                                    "maximum": 800,
                                    "default": 600
                                  },
                                  "background": {
                                    "type": "string",
                                    "pattern": "^#[0-9a-fA-F]{6}$",
                                    "default": "#f4f4f5"
                                  },
                                  "font": {
                                    "type": "string",
                                    "enum": [
                                      "system",
                                      "serif",
                                      "mono"
                                    ],
                                    "default": "system"
                                  },
                                  "footer": {
                                    "type": "string",
                                    "maxLength": 2000
                                  }
                                },
                                "default": {
                                  "width": 600,
                                  "background": "#f4f4f5",
                                  "font": "system"
                                }
                              },
                              "blocks": {
                                "type": "array",
                                "items": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "heading"
                                          ]
                                        },
                                        "level": {
                                          "type": "string",
                                          "enum": [
                                            "1",
                                            "2",
                                            "3"
                                          ],
                                          "default": "1"
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 20000
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "text"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "paragraph"
                                          ]
                                        },
                                        "text": {
                                          "type": "string",
                                          "maxLength": 20000
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "text"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "image"
                                          ]
                                        },
                                        "src": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "alt": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "href": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "width": {
                                          "type": "integer",
                                          "minimum": 16,
                                          "maximum": 1200
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "src",
                                        "alt"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "button"
                                          ]
                                        },
                                        "label": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        },
                                        "href": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "maxLength": 2048,
                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                            },
                                            {
                                              "type": "string",
                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                            }
                                          ]
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "label",
                                        "href"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "divider"
                                          ]
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "spacer"
                                          ]
                                        },
                                        "height": {
                                          "type": "integer",
                                          "minimum": 4,
                                          "maximum": 200
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "height"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "html"
                                          ]
                                        },
                                        "html": {
                                          "type": "string",
                                          "maxLength": 200000
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "html"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "columns"
                                          ]
                                        },
                                        "columns": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "blocks": {
                                                "type": "array",
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "heading"
                                                          ]
                                                        },
                                                        "level": {
                                                          "type": "string",
                                                          "enum": [
                                                            "1",
                                                            "2",
                                                            "3"
                                                          ],
                                                          "default": "1"
                                                        },
                                                        "text": {
                                                          "type": "string",
                                                          "maxLength": 20000
                                                        },
                                                        "style": {
                                                          "type": "object",
                                                          "properties": {
                                                            "color": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "background": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "align": {
                                                              "type": "string",
                                                              "enum": [
                                                                "left",
                                                                "center",
                                                                "right"
                                                              ]
                                                            },
                                                            "padding": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 80
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "text"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "paragraph"
                                                          ]
                                                        },
                                                        "text": {
                                                          "type": "string",
                                                          "maxLength": 20000
                                                        },
                                                        "style": {
                                                          "type": "object",
                                                          "properties": {
                                                            "color": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "background": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "align": {
                                                              "type": "string",
                                                              "enum": [
                                                                "left",
                                                                "center",
                                                                "right"
                                                              ]
                                                            },
                                                            "padding": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 80
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "text"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "image"
                                                          ]
                                                        },
                                                        "src": {
                                                          "anyOf": [
                                                            {
                                                              "type": "string",
                                                              "maxLength": 2048,
                                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                            },
                                                            {
                                                              "type": "string",
                                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                            }
                                                          ]
                                                        },
                                                        "alt": {
                                                          "type": "string",
                                                          "maxLength": 500
                                                        },
                                                        "href": {
                                                          "anyOf": [
                                                            {
                                                              "type": "string",
                                                              "maxLength": 2048,
                                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                            },
                                                            {
                                                              "type": "string",
                                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                            }
                                                          ]
                                                        },
                                                        "width": {
                                                          "type": "integer",
                                                          "minimum": 16,
                                                          "maximum": 1200
                                                        },
                                                        "style": {
                                                          "type": "object",
                                                          "properties": {
                                                            "color": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "background": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "align": {
                                                              "type": "string",
                                                              "enum": [
                                                                "left",
                                                                "center",
                                                                "right"
                                                              ]
                                                            },
                                                            "padding": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 80
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "src",
                                                        "alt"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "button"
                                                          ]
                                                        },
                                                        "label": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 200
                                                        },
                                                        "href": {
                                                          "anyOf": [
                                                            {
                                                              "type": "string",
                                                              "maxLength": 2048,
                                                              "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                            },
                                                            {
                                                              "type": "string",
                                                              "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                            }
                                                          ]
                                                        },
                                                        "style": {
                                                          "type": "object",
                                                          "properties": {
                                                            "color": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "background": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "align": {
                                                              "type": "string",
                                                              "enum": [
                                                                "left",
                                                                "center",
                                                                "right"
                                                              ]
                                                            },
                                                            "padding": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 80
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "label",
                                                        "href"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "divider"
                                                          ]
                                                        },
                                                        "style": {
                                                          "type": "object",
                                                          "properties": {
                                                            "color": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "background": {
                                                              "type": "string",
                                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                                            },
                                                            "align": {
                                                              "type": "string",
                                                              "enum": [
                                                                "left",
                                                                "center",
                                                                "right"
                                                              ]
                                                            },
                                                            "padding": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 80
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "spacer"
                                                          ]
                                                        },
                                                        "height": {
                                                          "type": "integer",
                                                          "minimum": 4,
                                                          "maximum": 200
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "height"
                                                      ]
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "enum": [
                                                            "html"
                                                          ]
                                                        },
                                                        "html": {
                                                          "type": "string",
                                                          "maxLength": 200000
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "html"
                                                      ]
                                                    }
                                                  ]
                                                },
                                                "maxItems": 20
                                              }
                                            },
                                            "required": [
                                              "blocks"
                                            ]
                                          },
                                          "minItems": 2,
                                          "maxItems": 3
                                        },
                                        "style": {
                                          "type": "object",
                                          "properties": {
                                            "color": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "background": {
                                              "type": "string",
                                              "pattern": "^#[0-9a-fA-F]{6}$"
                                            },
                                            "align": {
                                              "type": "string",
                                              "enum": [
                                                "left",
                                                "center",
                                                "right"
                                              ]
                                            },
                                            "padding": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 80
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "columns"
                                      ]
                                    }
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 200
                              }
                            },
                            "required": [
                              "version",
                              "blocks"
                            ]
                          },
                          "html": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "text": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "variables": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64,
                                  "pattern": "^[a-z][a-z0-9_.]*$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "boolean"
                                  ]
                                },
                                "fallback_value": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "required": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "key",
                                "type",
                                "fallback_value",
                                "required"
                              ]
                            }
                          },
                          "published_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "version",
                          "subject",
                          "document",
                          "html",
                          "text",
                          "variables",
                          "published_at",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/versions/{version}": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "Get one version",
        "operationId": "getTemplateVersion",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "required": true,
            "name": "version",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "integer"
                    },
                    "subject": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "document": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "version": {
                          "type": "number",
                          "enum": [
                            1
                          ]
                        },
                        "settings": {
                          "type": "object",
                          "properties": {
                            "width": {
                              "type": "integer",
                              "minimum": 320,
                              "maximum": 800,
                              "default": 600
                            },
                            "background": {
                              "type": "string",
                              "pattern": "^#[0-9a-fA-F]{6}$",
                              "default": "#f4f4f5"
                            },
                            "font": {
                              "type": "string",
                              "enum": [
                                "system",
                                "serif",
                                "mono"
                              ],
                              "default": "system"
                            },
                            "footer": {
                              "type": "string",
                              "maxLength": 2000
                            }
                          },
                          "default": {
                            "width": 600,
                            "background": "#f4f4f5",
                            "font": "system"
                          }
                        },
                        "blocks": {
                          "type": "array",
                          "items": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "heading"
                                    ]
                                  },
                                  "level": {
                                    "type": "string",
                                    "enum": [
                                      "1",
                                      "2",
                                      "3"
                                    ],
                                    "default": "1"
                                  },
                                  "text": {
                                    "type": "string",
                                    "maxLength": 20000
                                  },
                                  "style": {
                                    "type": "object",
                                    "properties": {
                                      "color": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "background": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "align": {
                                        "type": "string",
                                        "enum": [
                                          "left",
                                          "center",
                                          "right"
                                        ]
                                      },
                                      "padding": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 80
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "text"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "paragraph"
                                    ]
                                  },
                                  "text": {
                                    "type": "string",
                                    "maxLength": 20000
                                  },
                                  "style": {
                                    "type": "object",
                                    "properties": {
                                      "color": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "background": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "align": {
                                        "type": "string",
                                        "enum": [
                                          "left",
                                          "center",
                                          "right"
                                        ]
                                      },
                                      "padding": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 80
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "text"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "image"
                                    ]
                                  },
                                  "src": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 2048,
                                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                      },
                                      {
                                        "type": "string",
                                        "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                      }
                                    ]
                                  },
                                  "alt": {
                                    "type": "string",
                                    "maxLength": 500
                                  },
                                  "href": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 2048,
                                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                      },
                                      {
                                        "type": "string",
                                        "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                      }
                                    ]
                                  },
                                  "width": {
                                    "type": "integer",
                                    "minimum": 16,
                                    "maximum": 1200
                                  },
                                  "style": {
                                    "type": "object",
                                    "properties": {
                                      "color": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "background": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "align": {
                                        "type": "string",
                                        "enum": [
                                          "left",
                                          "center",
                                          "right"
                                        ]
                                      },
                                      "padding": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 80
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "src",
                                  "alt"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "button"
                                    ]
                                  },
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  },
                                  "href": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 2048,
                                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                      },
                                      {
                                        "type": "string",
                                        "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                      }
                                    ]
                                  },
                                  "style": {
                                    "type": "object",
                                    "properties": {
                                      "color": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "background": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "align": {
                                        "type": "string",
                                        "enum": [
                                          "left",
                                          "center",
                                          "right"
                                        ]
                                      },
                                      "padding": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 80
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "label",
                                  "href"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "divider"
                                    ]
                                  },
                                  "style": {
                                    "type": "object",
                                    "properties": {
                                      "color": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "background": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "align": {
                                        "type": "string",
                                        "enum": [
                                          "left",
                                          "center",
                                          "right"
                                        ]
                                      },
                                      "padding": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 80
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "spacer"
                                    ]
                                  },
                                  "height": {
                                    "type": "integer",
                                    "minimum": 4,
                                    "maximum": 200
                                  }
                                },
                                "required": [
                                  "type",
                                  "height"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "html"
                                    ]
                                  },
                                  "html": {
                                    "type": "string",
                                    "maxLength": 200000
                                  }
                                },
                                "required": [
                                  "type",
                                  "html"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "columns"
                                    ]
                                  },
                                  "columns": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "blocks": {
                                          "type": "array",
                                          "items": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "heading"
                                                    ]
                                                  },
                                                  "level": {
                                                    "type": "string",
                                                    "enum": [
                                                      "1",
                                                      "2",
                                                      "3"
                                                    ],
                                                    "default": "1"
                                                  },
                                                  "text": {
                                                    "type": "string",
                                                    "maxLength": 20000
                                                  },
                                                  "style": {
                                                    "type": "object",
                                                    "properties": {
                                                      "color": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "background": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "align": {
                                                        "type": "string",
                                                        "enum": [
                                                          "left",
                                                          "center",
                                                          "right"
                                                        ]
                                                      },
                                                      "padding": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 80
                                                      }
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "text"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "paragraph"
                                                    ]
                                                  },
                                                  "text": {
                                                    "type": "string",
                                                    "maxLength": 20000
                                                  },
                                                  "style": {
                                                    "type": "object",
                                                    "properties": {
                                                      "color": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "background": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "align": {
                                                        "type": "string",
                                                        "enum": [
                                                          "left",
                                                          "center",
                                                          "right"
                                                        ]
                                                      },
                                                      "padding": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 80
                                                      }
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "text"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "image"
                                                    ]
                                                  },
                                                  "src": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 2048,
                                                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                      },
                                                      {
                                                        "type": "string",
                                                        "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                      }
                                                    ]
                                                  },
                                                  "alt": {
                                                    "type": "string",
                                                    "maxLength": 500
                                                  },
                                                  "href": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 2048,
                                                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                      },
                                                      {
                                                        "type": "string",
                                                        "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                      }
                                                    ]
                                                  },
                                                  "width": {
                                                    "type": "integer",
                                                    "minimum": 16,
                                                    "maximum": 1200
                                                  },
                                                  "style": {
                                                    "type": "object",
                                                    "properties": {
                                                      "color": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "background": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "align": {
                                                        "type": "string",
                                                        "enum": [
                                                          "left",
                                                          "center",
                                                          "right"
                                                        ]
                                                      },
                                                      "padding": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 80
                                                      }
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "src",
                                                  "alt"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "button"
                                                    ]
                                                  },
                                                  "label": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 200
                                                  },
                                                  "href": {
                                                    "anyOf": [
                                                      {
                                                        "type": "string",
                                                        "maxLength": 2048,
                                                        "description": "An https URL to a public host. Private, loopback, link-local and metadata addresses are refused, also after DNS resolution and redirects."
                                                      },
                                                      {
                                                        "type": "string",
                                                        "pattern": "^\\{\\{[a-z][a-z0-9_.]*\\}\\}$"
                                                      }
                                                    ]
                                                  },
                                                  "style": {
                                                    "type": "object",
                                                    "properties": {
                                                      "color": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "background": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "align": {
                                                        "type": "string",
                                                        "enum": [
                                                          "left",
                                                          "center",
                                                          "right"
                                                        ]
                                                      },
                                                      "padding": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 80
                                                      }
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "label",
                                                  "href"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "divider"
                                                    ]
                                                  },
                                                  "style": {
                                                    "type": "object",
                                                    "properties": {
                                                      "color": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "background": {
                                                        "type": "string",
                                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                                      },
                                                      "align": {
                                                        "type": "string",
                                                        "enum": [
                                                          "left",
                                                          "center",
                                                          "right"
                                                        ]
                                                      },
                                                      "padding": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 80
                                                      }
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "spacer"
                                                    ]
                                                  },
                                                  "height": {
                                                    "type": "integer",
                                                    "minimum": 4,
                                                    "maximum": 200
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "height"
                                                ]
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "html"
                                                    ]
                                                  },
                                                  "html": {
                                                    "type": "string",
                                                    "maxLength": 200000
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "html"
                                                ]
                                              }
                                            ]
                                          },
                                          "maxItems": 20
                                        }
                                      },
                                      "required": [
                                        "blocks"
                                      ]
                                    },
                                    "minItems": 2,
                                    "maxItems": 3
                                  },
                                  "style": {
                                    "type": "object",
                                    "properties": {
                                      "color": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "background": {
                                        "type": "string",
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                      },
                                      "align": {
                                        "type": "string",
                                        "enum": [
                                          "left",
                                          "center",
                                          "right"
                                        ]
                                      },
                                      "padding": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 80
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "columns"
                                ]
                              }
                            ]
                          },
                          "minItems": 1,
                          "maxItems": 200
                        }
                      },
                      "required": [
                        "version",
                        "blocks"
                      ]
                    },
                    "html": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "text": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "variables": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "pattern": "^[a-z][a-z0-9_.]*$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "boolean"
                            ]
                          },
                          "fallback_value": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "required": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "key",
                          "type",
                          "fallback_value",
                          "required"
                        ]
                      }
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "version",
                    "subject",
                    "document",
                    "html",
                    "text",
                    "variables",
                    "published_at",
                    "created_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/templates/{id}/preview": {
      "post": {
        "tags": [
          "Templates"
        ],
        "summary": "Render a template with variables",
        "operationId": "previewTemplate",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "variables": {
                    "type": "object",
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "version": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "subject": {
                      "type": "string"
                    },
                    "html": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "subject",
                    "html",
                    "text",
                    "missing"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/suppressions": {
      "get": {
        "tags": [
          "Suppressions"
        ],
        "summary": "List suppressed addresses",
        "operationId": "listSuppressions",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 320
            },
            "required": false,
            "name": "email",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "hard_bounce",
                "complaint",
                "unsubscribe",
                "one_click",
                "manual",
                "sunset",
                "imported"
              ]
            },
            "required": false,
            "name": "reason",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "transactional",
                "marketing"
              ],
              "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
            },
            "required": false,
            "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe.",
            "name": "stream",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Suppression"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Suppressions"
        ],
        "summary": "Suppress an address",
        "operationId": "createSuppression",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "An email address without display name."
                  },
                  "stream": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "transactional",
                      "marketing",
                      null
                    ],
                    "default": null,
                    "description": "Transactional mail is one-to-one and expected; marketing mail goes to lists and must carry List-Unsubscribe."
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "imported"
                    ],
                    "default": "manual"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Suppression"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/suppressions/{id}": {
      "delete": {
        "tags": [
          "Suppressions"
        ],
        "summary": "Remove a suppression",
        "description": "Hard bounces and complaints should stay suppressed; removing them is audited.",
        "operationId": "deleteSuppression",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "suppression"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "deleted"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Create an automation (draft)",
        "operationId": "createAutomation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "trigger": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "custom_event"
                                ]
                              },
                              "event": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              }
                            },
                            "required": [
                              "kind",
                              "event"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "contact_created"
                                ]
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "contact_updated"
                                ]
                              },
                              "properties": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[a-z][a-z0-9_]*$"
                                }
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "topic_subscribed"
                                ]
                              },
                              "topic_id": {
                                "type": "string",
                                "description": "A UUID."
                              }
                            },
                            "required": [
                              "kind",
                              "topic_id"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "segment_entered"
                                ]
                              },
                              "segment_id": {
                                "type": "string",
                                "description": "A UUID."
                              }
                            },
                            "required": [
                              "kind",
                              "segment_id"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "email_event"
                                ]
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "email.sent",
                                  "email.scheduled",
                                  "email.delivered",
                                  "email.delivery_delayed",
                                  "email.complained",
                                  "email.bounced",
                                  "email.opened",
                                  "email.clicked",
                                  "email.received",
                                  "email.failed",
                                  "email.suppressed",
                                  "email.canceled",
                                  "contact.created",
                                  "contact.updated",
                                  "contact.deleted",
                                  "domain.created",
                                  "domain.updated",
                                  "domain.deleted",
                                  "broadcast.started",
                                  "broadcast.completed",
                                  "automation.completed",
                                  "automation.failed"
                                ]
                              },
                              "tag": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "value"
                                ]
                              }
                            },
                            "required": [
                              "kind",
                              "type"
                            ]
                          }
                        ]
                      },
                      "filter": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "all": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "field": {
                                      "type": "string",
                                      "maxLength": 120,
                                      "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                    },
                                    "op": {
                                      "type": "string",
                                      "enum": [
                                        "eq",
                                        "neq",
                                        "contains",
                                        "not_contains",
                                        "starts_with",
                                        "ends_with",
                                        "gt",
                                        "gte",
                                        "lt",
                                        "lte",
                                        "is_set",
                                        "is_not_set",
                                        "in",
                                        "not_in",
                                        "before",
                                        "after",
                                        "within_days",
                                        "not_within_days"
                                      ]
                                    },
                                    "value": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array",
                                          "items": {
                                            "type": "string"
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "field",
                                    "op"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 50
                              }
                            },
                            "required": [
                              "all"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "any": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "field": {
                                      "type": "string",
                                      "maxLength": 120,
                                      "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                    },
                                    "op": {
                                      "type": "string",
                                      "enum": [
                                        "eq",
                                        "neq",
                                        "contains",
                                        "not_contains",
                                        "starts_with",
                                        "ends_with",
                                        "gt",
                                        "gte",
                                        "lt",
                                        "lte",
                                        "is_set",
                                        "is_not_set",
                                        "in",
                                        "not_in",
                                        "before",
                                        "after",
                                        "within_days",
                                        "not_within_days"
                                      ]
                                    },
                                    "value": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array",
                                          "items": {
                                            "type": "string"
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "field",
                                    "op"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 50
                              }
                            },
                            "required": [
                              "any"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "default": null
                      },
                      "allow_reentry": {
                        "type": "boolean",
                        "default": false
                      },
                      "start": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 50,
                        "pattern": "^[A-Za-z0-9_-]+$"
                      },
                      "steps": {
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "send_email"
                                  ]
                                },
                                "template_id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "variables": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 1000
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      }
                                    ]
                                  }
                                },
                                "from": {
                                  "type": "string",
                                  "maxLength": 320
                                },
                                "subject": {
                                  "type": "string",
                                  "maxLength": 998
                                },
                                "reply_to": {
                                  "type": "string",
                                  "maxLength": 320
                                },
                                "stream": {
                                  "type": "string",
                                  "enum": [
                                    "transactional",
                                    "marketing"
                                  ]
                                },
                                "topic_id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "A UUID."
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "template_id",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "wait"
                                  ]
                                },
                                "duration": {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "unit": {
                                      "type": "string",
                                      "enum": [
                                        "minutes",
                                        "hours",
                                        "days"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "amount",
                                    "unit"
                                  ]
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "duration",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "wait_for_event"
                                  ]
                                },
                                "event": {
                                  "type": "string",
                                  "enum": [
                                    "email.opened",
                                    "email.clicked",
                                    "custom_event"
                                  ]
                                },
                                "custom_event": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "timeout": {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "unit": {
                                      "type": "string",
                                      "enum": [
                                        "minutes",
                                        "hours",
                                        "days"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "amount",
                                    "unit"
                                  ]
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "timeout_next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "event",
                                "timeout",
                                "next",
                                "timeout_next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "branch"
                                  ]
                                },
                                "condition": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "all": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "field": {
                                                "type": "string",
                                                "maxLength": 120,
                                                "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                              },
                                              "op": {
                                                "type": "string",
                                                "enum": [
                                                  "eq",
                                                  "neq",
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "is_set",
                                                  "is_not_set",
                                                  "in",
                                                  "not_in",
                                                  "before",
                                                  "after",
                                                  "within_days",
                                                  "not_within_days"
                                                ]
                                              },
                                              "value": {
                                                "anyOf": [
                                                  {
                                                    "type": "string"
                                                  },
                                                  {
                                                    "type": "number"
                                                  },
                                                  {
                                                    "type": "boolean"
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "field",
                                              "op"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 50
                                        }
                                      },
                                      "required": [
                                        "all"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "field": {
                                                "type": "string",
                                                "maxLength": 120,
                                                "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                              },
                                              "op": {
                                                "type": "string",
                                                "enum": [
                                                  "eq",
                                                  "neq",
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "is_set",
                                                  "is_not_set",
                                                  "in",
                                                  "not_in",
                                                  "before",
                                                  "after",
                                                  "within_days",
                                                  "not_within_days"
                                                ]
                                              },
                                              "value": {
                                                "anyOf": [
                                                  {
                                                    "type": "string"
                                                  },
                                                  {
                                                    "type": "number"
                                                  },
                                                  {
                                                    "type": "boolean"
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "field",
                                              "op"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 50
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ]
                                },
                                "engagement": {
                                  "type": "object",
                                  "properties": {
                                    "event": {
                                      "type": "string",
                                      "enum": [
                                        "email.opened",
                                        "email.clicked"
                                      ]
                                    },
                                    "step_id": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "minLength": 1,
                                      "maxLength": 50,
                                      "pattern": "^[A-Za-z0-9_-]+$",
                                      "default": null
                                    }
                                  },
                                  "required": [
                                    "event"
                                  ]
                                },
                                "yes": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "no": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "yes",
                                "no"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "update_contact"
                                  ]
                                },
                                "first_name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 200
                                },
                                "last_name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 200
                                },
                                "unsubscribed": {
                                  "type": "boolean"
                                },
                                "properties": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 1000
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "segment"
                                  ]
                                },
                                "action": {
                                  "type": "string",
                                  "enum": [
                                    "add",
                                    "remove"
                                  ]
                                },
                                "segment_id": {
                                  "type": "string",
                                  "description": "A UUID."
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "action",
                                "segment_id",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "topic"
                                  ]
                                },
                                "action": {
                                  "type": "string",
                                  "enum": [
                                    "subscribe",
                                    "unsubscribe"
                                  ]
                                },
                                "topic_id": {
                                  "type": "string",
                                  "description": "A UUID."
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "action",
                                "topic_id",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "delete_contact"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "type"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "exit"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "type"
                              ]
                            }
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 100
                      }
                    },
                    "required": [
                      "trigger",
                      "start",
                      "steps"
                    ]
                  }
                },
                "required": [
                  "name",
                  "definition"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Automation"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "List automations",
        "operationId": "listAutomations",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "automation"
                            ]
                          },
                          "project_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "active",
                              "paused",
                              "archived"
                            ]
                          },
                          "current_version": {
                            "type": "integer"
                          },
                          "published_version": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "trigger": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "custom_event"
                                    ]
                                  },
                                  "event": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  }
                                },
                                "required": [
                                  "kind",
                                  "event"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "contact_created"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "contact_updated"
                                    ]
                                  },
                                  "properties": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 50,
                                      "pattern": "^[a-z][a-z0-9_]*$"
                                    }
                                  }
                                },
                                "required": [
                                  "kind"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "topic_subscribed"
                                    ]
                                  },
                                  "topic_id": {
                                    "type": "string",
                                    "description": "A UUID."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "topic_id"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "segment_entered"
                                    ]
                                  },
                                  "segment_id": {
                                    "type": "string",
                                    "description": "A UUID."
                                  }
                                },
                                "required": [
                                  "kind",
                                  "segment_id"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "email_event"
                                    ]
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "email.sent",
                                      "email.scheduled",
                                      "email.delivered",
                                      "email.delivery_delayed",
                                      "email.complained",
                                      "email.bounced",
                                      "email.opened",
                                      "email.clicked",
                                      "email.received",
                                      "email.failed",
                                      "email.suppressed",
                                      "email.canceled",
                                      "contact.created",
                                      "contact.updated",
                                      "contact.deleted",
                                      "domain.created",
                                      "domain.updated",
                                      "domain.deleted",
                                      "broadcast.started",
                                      "broadcast.completed",
                                      "automation.completed",
                                      "automation.failed"
                                    ]
                                  },
                                  "tag": {
                                    "type": "object",
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "name",
                                      "value"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "type"
                                ]
                              }
                            ]
                          },
                          "stats": {
                            "type": "object",
                            "properties": {
                              "runs_total": {
                                "type": "integer"
                              },
                              "runs_active": {
                                "type": "integer"
                              },
                              "runs_completed": {
                                "type": "integer"
                              },
                              "runs_failed": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "runs_total",
                              "runs_active",
                              "runs_completed",
                              "runs_failed"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "project_id",
                          "name",
                          "status",
                          "current_version",
                          "published_version",
                          "trigger",
                          "stats",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{id}": {
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "Get an automation with its current definition",
        "operationId": "getAutomation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Automation"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Automations"
        ],
        "summary": "Update an automation",
        "operationId": "updateAutomation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "trigger": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "custom_event"
                                ]
                              },
                              "event": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 100
                              }
                            },
                            "required": [
                              "kind",
                              "event"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "contact_created"
                                ]
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "contact_updated"
                                ]
                              },
                              "properties": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[a-z][a-z0-9_]*$"
                                }
                              }
                            },
                            "required": [
                              "kind"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "topic_subscribed"
                                ]
                              },
                              "topic_id": {
                                "type": "string",
                                "description": "A UUID."
                              }
                            },
                            "required": [
                              "kind",
                              "topic_id"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "segment_entered"
                                ]
                              },
                              "segment_id": {
                                "type": "string",
                                "description": "A UUID."
                              }
                            },
                            "required": [
                              "kind",
                              "segment_id"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "email_event"
                                ]
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "email.sent",
                                  "email.scheduled",
                                  "email.delivered",
                                  "email.delivery_delayed",
                                  "email.complained",
                                  "email.bounced",
                                  "email.opened",
                                  "email.clicked",
                                  "email.received",
                                  "email.failed",
                                  "email.suppressed",
                                  "email.canceled",
                                  "contact.created",
                                  "contact.updated",
                                  "contact.deleted",
                                  "domain.created",
                                  "domain.updated",
                                  "domain.deleted",
                                  "broadcast.started",
                                  "broadcast.completed",
                                  "automation.completed",
                                  "automation.failed"
                                ]
                              },
                              "tag": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "value"
                                ]
                              }
                            },
                            "required": [
                              "kind",
                              "type"
                            ]
                          }
                        ]
                      },
                      "filter": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "all": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "field": {
                                      "type": "string",
                                      "maxLength": 120,
                                      "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                    },
                                    "op": {
                                      "type": "string",
                                      "enum": [
                                        "eq",
                                        "neq",
                                        "contains",
                                        "not_contains",
                                        "starts_with",
                                        "ends_with",
                                        "gt",
                                        "gte",
                                        "lt",
                                        "lte",
                                        "is_set",
                                        "is_not_set",
                                        "in",
                                        "not_in",
                                        "before",
                                        "after",
                                        "within_days",
                                        "not_within_days"
                                      ]
                                    },
                                    "value": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array",
                                          "items": {
                                            "type": "string"
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "field",
                                    "op"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 50
                              }
                            },
                            "required": [
                              "all"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "any": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "field": {
                                      "type": "string",
                                      "maxLength": 120,
                                      "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                    },
                                    "op": {
                                      "type": "string",
                                      "enum": [
                                        "eq",
                                        "neq",
                                        "contains",
                                        "not_contains",
                                        "starts_with",
                                        "ends_with",
                                        "gt",
                                        "gte",
                                        "lt",
                                        "lte",
                                        "is_set",
                                        "is_not_set",
                                        "in",
                                        "not_in",
                                        "before",
                                        "after",
                                        "within_days",
                                        "not_within_days"
                                      ]
                                    },
                                    "value": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array",
                                          "items": {
                                            "type": "string"
                                          }
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "field",
                                    "op"
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 50
                              }
                            },
                            "required": [
                              "any"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "default": null
                      },
                      "allow_reentry": {
                        "type": "boolean",
                        "default": false
                      },
                      "start": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 50,
                        "pattern": "^[A-Za-z0-9_-]+$"
                      },
                      "steps": {
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "send_email"
                                  ]
                                },
                                "template_id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "variables": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 1000
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      }
                                    ]
                                  }
                                },
                                "from": {
                                  "type": "string",
                                  "maxLength": 320
                                },
                                "subject": {
                                  "type": "string",
                                  "maxLength": 998
                                },
                                "reply_to": {
                                  "type": "string",
                                  "maxLength": 320
                                },
                                "stream": {
                                  "type": "string",
                                  "enum": [
                                    "transactional",
                                    "marketing"
                                  ]
                                },
                                "topic_id": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "description": "A UUID."
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "template_id",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "wait"
                                  ]
                                },
                                "duration": {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "unit": {
                                      "type": "string",
                                      "enum": [
                                        "minutes",
                                        "hours",
                                        "days"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "amount",
                                    "unit"
                                  ]
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "duration",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "wait_for_event"
                                  ]
                                },
                                "event": {
                                  "type": "string",
                                  "enum": [
                                    "email.opened",
                                    "email.clicked",
                                    "custom_event"
                                  ]
                                },
                                "custom_event": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 100
                                },
                                "timeout": {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "integer",
                                      "minimum": 1
                                    },
                                    "unit": {
                                      "type": "string",
                                      "enum": [
                                        "minutes",
                                        "hours",
                                        "days"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "amount",
                                    "unit"
                                  ]
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "timeout_next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "event",
                                "timeout",
                                "next",
                                "timeout_next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "branch"
                                  ]
                                },
                                "condition": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "all": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "field": {
                                                "type": "string",
                                                "maxLength": 120,
                                                "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                              },
                                              "op": {
                                                "type": "string",
                                                "enum": [
                                                  "eq",
                                                  "neq",
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "is_set",
                                                  "is_not_set",
                                                  "in",
                                                  "not_in",
                                                  "before",
                                                  "after",
                                                  "within_days",
                                                  "not_within_days"
                                                ]
                                              },
                                              "value": {
                                                "anyOf": [
                                                  {
                                                    "type": "string"
                                                  },
                                                  {
                                                    "type": "number"
                                                  },
                                                  {
                                                    "type": "boolean"
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "field",
                                              "op"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 50
                                        }
                                      },
                                      "required": [
                                        "all"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "field": {
                                                "type": "string",
                                                "maxLength": 120,
                                                "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                              },
                                              "op": {
                                                "type": "string",
                                                "enum": [
                                                  "eq",
                                                  "neq",
                                                  "contains",
                                                  "not_contains",
                                                  "starts_with",
                                                  "ends_with",
                                                  "gt",
                                                  "gte",
                                                  "lt",
                                                  "lte",
                                                  "is_set",
                                                  "is_not_set",
                                                  "in",
                                                  "not_in",
                                                  "before",
                                                  "after",
                                                  "within_days",
                                                  "not_within_days"
                                                ]
                                              },
                                              "value": {
                                                "anyOf": [
                                                  {
                                                    "type": "string"
                                                  },
                                                  {
                                                    "type": "number"
                                                  },
                                                  {
                                                    "type": "boolean"
                                                  },
                                                  {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "field",
                                              "op"
                                            ]
                                          },
                                          "minItems": 1,
                                          "maxItems": 50
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ]
                                },
                                "engagement": {
                                  "type": "object",
                                  "properties": {
                                    "event": {
                                      "type": "string",
                                      "enum": [
                                        "email.opened",
                                        "email.clicked"
                                      ]
                                    },
                                    "step_id": {
                                      "type": [
                                        "string",
                                        "null"
                                      ],
                                      "minLength": 1,
                                      "maxLength": 50,
                                      "pattern": "^[A-Za-z0-9_-]+$",
                                      "default": null
                                    }
                                  },
                                  "required": [
                                    "event"
                                  ]
                                },
                                "yes": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "no": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "yes",
                                "no"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "update_contact"
                                  ]
                                },
                                "first_name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 200
                                },
                                "last_name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "maxLength": 200
                                },
                                "unsubscribed": {
                                  "type": "boolean"
                                },
                                "properties": {
                                  "type": "object",
                                  "additionalProperties": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "maxLength": 1000
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "segment"
                                  ]
                                },
                                "action": {
                                  "type": "string",
                                  "enum": [
                                    "add",
                                    "remove"
                                  ]
                                },
                                "segment_id": {
                                  "type": "string",
                                  "description": "A UUID."
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "action",
                                "segment_id",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "topic"
                                  ]
                                },
                                "action": {
                                  "type": "string",
                                  "enum": [
                                    "subscribe",
                                    "unsubscribe"
                                  ]
                                },
                                "topic_id": {
                                  "type": "string",
                                  "description": "A UUID."
                                },
                                "next": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                }
                              },
                              "required": [
                                "id",
                                "type",
                                "action",
                                "topic_id",
                                "next"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "delete_contact"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "type"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 50,
                                  "pattern": "^[A-Za-z0-9_-]+$"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "exit"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "type"
                              ]
                            }
                          ]
                        },
                        "minItems": 1,
                        "maxItems": 100
                      }
                    },
                    "required": [
                      "trigger",
                      "start",
                      "steps"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "archived"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "automation"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "archived"
                      ]
                    },
                    "current_version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status",
                    "current_version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Automations"
        ],
        "summary": "Archive an automation",
        "operationId": "deleteAutomation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "automation"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "archived"
                      ]
                    },
                    "current_version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status",
                    "current_version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{id}/publish": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Publish the current version",
        "description": "New runs start on this version; in-flight runs finish on theirs.",
        "operationId": "publishAutomation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "automation"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "archived"
                      ]
                    },
                    "current_version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status",
                    "current_version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{id}/stop": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Pause an automation and stop its waiting runs",
        "operationId": "stopAutomation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "automation"
                      ]
                    },
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "archived"
                      ]
                    },
                    "current_version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "object",
                    "id",
                    "status",
                    "current_version"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{id}/duplicate": {
      "post": {
        "tags": [
          "Automations"
        ],
        "summary": "Duplicate an automation",
        "description": "A new draft named `<name> (copy)` with the current version's definition (the newest draft, if it is newer than the published version). It starts no runs until it is published.",
        "operationId": "duplicateAutomation",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Automation"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{id}/versions": {
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "List versions",
        "operationId": "listAutomationVersions",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "version": {
                            "type": "integer"
                          },
                          "definition": {
                            "type": "object",
                            "properties": {
                              "trigger": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "custom_event"
                                        ]
                                      },
                                      "event": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 100
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "event"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "contact_created"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "contact_updated"
                                        ]
                                      },
                                      "properties": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[a-z][a-z0-9_]*$"
                                        }
                                      }
                                    },
                                    "required": [
                                      "kind"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "topic_subscribed"
                                        ]
                                      },
                                      "topic_id": {
                                        "type": "string",
                                        "description": "A UUID."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "topic_id"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "segment_entered"
                                        ]
                                      },
                                      "segment_id": {
                                        "type": "string",
                                        "description": "A UUID."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "segment_id"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "email_event"
                                        ]
                                      },
                                      "type": {
                                        "type": "string",
                                        "enum": [
                                          "email.sent",
                                          "email.scheduled",
                                          "email.delivered",
                                          "email.delivery_delayed",
                                          "email.complained",
                                          "email.bounced",
                                          "email.opened",
                                          "email.clicked",
                                          "email.received",
                                          "email.failed",
                                          "email.suppressed",
                                          "email.canceled",
                                          "contact.created",
                                          "contact.updated",
                                          "contact.deleted",
                                          "domain.created",
                                          "domain.updated",
                                          "domain.deleted",
                                          "broadcast.started",
                                          "broadcast.completed",
                                          "automation.completed",
                                          "automation.failed"
                                        ]
                                      },
                                      "tag": {
                                        "type": "object",
                                        "properties": {
                                          "name": {
                                            "type": "string"
                                          },
                                          "value": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "name",
                                          "value"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "type"
                                    ]
                                  }
                                ]
                              },
                              "filter": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "all": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "field": {
                                              "type": "string",
                                              "maxLength": 120,
                                              "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                            },
                                            "op": {
                                              "type": "string",
                                              "enum": [
                                                "eq",
                                                "neq",
                                                "contains",
                                                "not_contains",
                                                "starts_with",
                                                "ends_with",
                                                "gt",
                                                "gte",
                                                "lt",
                                                "lte",
                                                "is_set",
                                                "is_not_set",
                                                "in",
                                                "not_in",
                                                "before",
                                                "after",
                                                "within_days",
                                                "not_within_days"
                                              ]
                                            },
                                            "value": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                },
                                                {
                                                  "type": "boolean"
                                                },
                                                {
                                                  "type": "array",
                                                  "items": {
                                                    "type": "string"
                                                  }
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            }
                                          },
                                          "required": [
                                            "field",
                                            "op"
                                          ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 50
                                      }
                                    },
                                    "required": [
                                      "all"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "any": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "field": {
                                              "type": "string",
                                              "maxLength": 120,
                                              "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                            },
                                            "op": {
                                              "type": "string",
                                              "enum": [
                                                "eq",
                                                "neq",
                                                "contains",
                                                "not_contains",
                                                "starts_with",
                                                "ends_with",
                                                "gt",
                                                "gte",
                                                "lt",
                                                "lte",
                                                "is_set",
                                                "is_not_set",
                                                "in",
                                                "not_in",
                                                "before",
                                                "after",
                                                "within_days",
                                                "not_within_days"
                                              ]
                                            },
                                            "value": {
                                              "anyOf": [
                                                {
                                                  "type": "string"
                                                },
                                                {
                                                  "type": "number"
                                                },
                                                {
                                                  "type": "boolean"
                                                },
                                                {
                                                  "type": "array",
                                                  "items": {
                                                    "type": "string"
                                                  }
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ]
                                            }
                                          },
                                          "required": [
                                            "field",
                                            "op"
                                          ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 50
                                      }
                                    },
                                    "required": [
                                      "any"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "default": null
                              },
                              "allow_reentry": {
                                "type": "boolean",
                                "default": false
                              },
                              "start": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 50,
                                "pattern": "^[A-Za-z0-9_-]+$"
                              },
                              "steps": {
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "send_email"
                                          ]
                                        },
                                        "template_id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 100
                                        },
                                        "variables": {
                                          "type": "object",
                                          "additionalProperties": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "maxLength": 1000
                                              },
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "boolean"
                                              }
                                            ]
                                          }
                                        },
                                        "from": {
                                          "type": "string",
                                          "maxLength": 320
                                        },
                                        "subject": {
                                          "type": "string",
                                          "maxLength": 998
                                        },
                                        "reply_to": {
                                          "type": "string",
                                          "maxLength": 320
                                        },
                                        "stream": {
                                          "type": "string",
                                          "enum": [
                                            "transactional",
                                            "marketing"
                                          ]
                                        },
                                        "topic_id": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "description": "A UUID."
                                        },
                                        "next": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "template_id",
                                        "next"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "wait"
                                          ]
                                        },
                                        "duration": {
                                          "type": "object",
                                          "properties": {
                                            "amount": {
                                              "type": "integer",
                                              "minimum": 1
                                            },
                                            "unit": {
                                              "type": "string",
                                              "enum": [
                                                "minutes",
                                                "hours",
                                                "days"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "amount",
                                            "unit"
                                          ]
                                        },
                                        "next": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "duration",
                                        "next"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "wait_for_event"
                                          ]
                                        },
                                        "event": {
                                          "type": "string",
                                          "enum": [
                                            "email.opened",
                                            "email.clicked",
                                            "custom_event"
                                          ]
                                        },
                                        "custom_event": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 100
                                        },
                                        "timeout": {
                                          "type": "object",
                                          "properties": {
                                            "amount": {
                                              "type": "integer",
                                              "minimum": 1
                                            },
                                            "unit": {
                                              "type": "string",
                                              "enum": [
                                                "minutes",
                                                "hours",
                                                "days"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "amount",
                                            "unit"
                                          ]
                                        },
                                        "next": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "timeout_next": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "event",
                                        "timeout",
                                        "next",
                                        "timeout_next"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "branch"
                                          ]
                                        },
                                        "condition": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "all": {
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "field": {
                                                        "type": "string",
                                                        "maxLength": 120,
                                                        "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                                      },
                                                      "op": {
                                                        "type": "string",
                                                        "enum": [
                                                          "eq",
                                                          "neq",
                                                          "contains",
                                                          "not_contains",
                                                          "starts_with",
                                                          "ends_with",
                                                          "gt",
                                                          "gte",
                                                          "lt",
                                                          "lte",
                                                          "is_set",
                                                          "is_not_set",
                                                          "in",
                                                          "not_in",
                                                          "before",
                                                          "after",
                                                          "within_days",
                                                          "not_within_days"
                                                        ]
                                                      },
                                                      "value": {
                                                        "anyOf": [
                                                          {
                                                            "type": "string"
                                                          },
                                                          {
                                                            "type": "number"
                                                          },
                                                          {
                                                            "type": "boolean"
                                                          },
                                                          {
                                                            "type": "array",
                                                            "items": {
                                                              "type": "string"
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "field",
                                                      "op"
                                                    ]
                                                  },
                                                  "minItems": 1,
                                                  "maxItems": 50
                                                }
                                              },
                                              "required": [
                                                "all"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "field": {
                                                        "type": "string",
                                                        "maxLength": 120,
                                                        "pattern": "^(email|first_name|last_name|unsubscribed|status|created_at|last_sent_at|last_opened_at|last_clicked_at|property:[a-z][a-z0-9_]*|topic:[0-9a-f-]{36})$"
                                                      },
                                                      "op": {
                                                        "type": "string",
                                                        "enum": [
                                                          "eq",
                                                          "neq",
                                                          "contains",
                                                          "not_contains",
                                                          "starts_with",
                                                          "ends_with",
                                                          "gt",
                                                          "gte",
                                                          "lt",
                                                          "lte",
                                                          "is_set",
                                                          "is_not_set",
                                                          "in",
                                                          "not_in",
                                                          "before",
                                                          "after",
                                                          "within_days",
                                                          "not_within_days"
                                                        ]
                                                      },
                                                      "value": {
                                                        "anyOf": [
                                                          {
                                                            "type": "string"
                                                          },
                                                          {
                                                            "type": "number"
                                                          },
                                                          {
                                                            "type": "boolean"
                                                          },
                                                          {
                                                            "type": "array",
                                                            "items": {
                                                              "type": "string"
                                                            }
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "field",
                                                      "op"
                                                    ]
                                                  },
                                                  "minItems": 1,
                                                  "maxItems": 50
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ]
                                            }
                                          ]
                                        },
                                        "engagement": {
                                          "type": "object",
                                          "properties": {
                                            "event": {
                                              "type": "string",
                                              "enum": [
                                                "email.opened",
                                                "email.clicked"
                                              ]
                                            },
                                            "step_id": {
                                              "type": [
                                                "string",
                                                "null"
                                              ],
                                              "minLength": 1,
                                              "maxLength": 50,
                                              "pattern": "^[A-Za-z0-9_-]+$",
                                              "default": null
                                            }
                                          },
                                          "required": [
                                            "event"
                                          ]
                                        },
                                        "yes": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "no": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "yes",
                                        "no"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "update_contact"
                                          ]
                                        },
                                        "first_name": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "maxLength": 200
                                        },
                                        "last_name": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "maxLength": 200
                                        },
                                        "unsubscribed": {
                                          "type": "boolean"
                                        },
                                        "properties": {
                                          "type": "object",
                                          "additionalProperties": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "maxLength": 1000
                                              },
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "boolean"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          }
                                        },
                                        "next": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "next"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "segment"
                                          ]
                                        },
                                        "action": {
                                          "type": "string",
                                          "enum": [
                                            "add",
                                            "remove"
                                          ]
                                        },
                                        "segment_id": {
                                          "type": "string",
                                          "description": "A UUID."
                                        },
                                        "next": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "action",
                                        "segment_id",
                                        "next"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "topic"
                                          ]
                                        },
                                        "action": {
                                          "type": "string",
                                          "enum": [
                                            "subscribe",
                                            "unsubscribe"
                                          ]
                                        },
                                        "topic_id": {
                                          "type": "string",
                                          "description": "A UUID."
                                        },
                                        "next": {
                                          "type": [
                                            "string",
                                            "null"
                                          ],
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type",
                                        "action",
                                        "topic_id",
                                        "next"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "delete_contact"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 50,
                                          "pattern": "^[A-Za-z0-9_-]+$"
                                        },
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "exit"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "type"
                                      ]
                                    }
                                  ]
                                },
                                "minItems": 1,
                                "maxItems": 100
                              }
                            },
                            "required": [
                              "trigger",
                              "start",
                              "steps"
                            ]
                          },
                          "published_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "version",
                          "definition",
                          "published_at",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{id}/runs": {
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "List runs",
        "operationId": "listAutomationRuns",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "waiting",
                "completed",
                "exited",
                "failed",
                "stopped"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "contact_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "run"
                            ]
                          },
                          "automation_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "version": {
                            "type": "integer"
                          },
                          "contact_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "trigger_event_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "live",
                              "test"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "running",
                              "waiting",
                              "completed",
                              "exited",
                              "failed",
                              "stopped"
                            ]
                          },
                          "current_step_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "wait_until": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "error": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "started_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "finished_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "automation_id",
                          "version",
                          "contact_id",
                          "trigger_event_id",
                          "mode",
                          "status",
                          "current_step_id",
                          "wait_until",
                          "error",
                          "started_at",
                          "finished_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/automations/{id}/runs/{runId}": {
      "get": {
        "tags": [
          "Automations"
        ],
        "summary": "Get a run with its step history",
        "operationId": "getAutomationRun",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "runId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutomationRun"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "get": {
        "tags": [
          "Keys"
        ],
        "summary": "List API keys of the project",
        "description": "Active keys of the calling key's environment, newest first. Never the keys themselves.",
        "operationId": "listKeys",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Key"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Keys"
        ],
        "summary": "Create an API key",
        "description": "The token is returned once. Needs a live full-access key; the new key stays in its environment, with the same domain restriction and a rate limit no higher.",
        "operationId": "createKey",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "environment_id": {
                    "type": "string",
                    "description": "A UUID."
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "live",
                      "test"
                    ]
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "full_access",
                      "sending_access",
                      "inbound_read"
                    ],
                    "default": "full_access"
                  },
                  "domain_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "A UUID."
                  },
                  "rate_limit_per_second": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                },
                "required": [
                  "name",
                  "environment_id",
                  "mode"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created; `token` is returned once",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Key"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/current": {
      "get": {
        "tags": [
          "Keys"
        ],
        "summary": "Describe the key making the request",
        "description": "The project, environment, mode and scope of the calling key. Every scope may call this.",
        "operationId": "getCurrentKey",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Key"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{id}": {
      "delete": {
        "tags": [
          "Keys"
        ],
        "summary": "Revoke an API key",
        "description": "Revokes a key of the calling key's environment; its next request is refused.",
        "operationId": "revokeKey",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "key"
                      ]
                    },
                    "revoked_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "revoked_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/members": {
      "get": {
        "tags": [
          "Members"
        ],
        "summary": "List members of the organization",
        "description": "Members by id and role. Addresses and names are shown in the console only, where members are managed.",
        "operationId": "listMembers",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "member"
                            ]
                          },
                          "organization_id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "user": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "A UUID."
                              }
                            },
                            "required": [
                              "id"
                            ]
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "developer",
                              "viewer"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "organization_id",
                          "user",
                          "role",
                          "created_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logs": {
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "List API request logs",
        "operationId": "listLogs",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": [
                "integer",
                "null"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "required": false,
            "name": "path",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": false,
            "description": "A UUID.",
            "name": "api_key_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 60
            },
            "required": false,
            "name": "error_code",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
            },
            "required": false,
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z.",
            "name": "from_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
            },
            "required": false,
            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z.",
            "name": "to_date",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "A UUID."
                          },
                          "object": {
                            "type": "string",
                            "enum": [
                              "log"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                          },
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "status": {
                            "type": "integer"
                          },
                          "latency_ms": {
                            "type": "integer"
                          },
                          "api_key_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "environment_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "A UUID."
                          },
                          "mode": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "live",
                              "test",
                              null
                            ]
                          },
                          "idempotency_key": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "error_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "request_id": {
                            "type": "string"
                          },
                          "ip": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "user_agent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "created_at",
                          "method",
                          "path",
                          "status",
                          "latency_ms",
                          "api_key_id",
                          "environment_id",
                          "mode",
                          "idempotency_key",
                          "error_code",
                          "request_id",
                          "ip",
                          "user_agent"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "object",
                    "data",
                    "has_more"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logs/{id}": {
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "Get one request log entry",
        "operationId": "getLog",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "A UUID."
            },
            "required": true,
            "description": "A UUID.",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "A UUID."
                    },
                    "object": {
                      "type": "string",
                      "enum": [
                        "log"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "An ISO 8601 timestamp with timezone, for example 2026-10-24T18:00:00.000Z."
                    },
                    "method": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer"
                    },
                    "latency_ms": {
                      "type": "integer"
                    },
                    "api_key_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "A UUID."
                    },
                    "environment_id": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "A UUID."
                    },
                    "mode": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "live",
                        "test",
                        null
                      ]
                    },
                    "idempotency_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "error_code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "ip": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "user_agent": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "created_at",
                    "method",
                    "path",
                    "status",
                    "latency_ms",
                    "api_key_id",
                    "environment_id",
                    "mode",
                    "idempotency_key",
                    "error_code",
                    "request_id",
                    "ip",
                    "user_agent"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Malformed request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Missing or restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid API key, or not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Conflict (idempotency in progress, invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited or over quota",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
