{
  "openapi": "3.1.0",
  "info": {
    "title": "BillionSend API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.billionsend.com",
      "description": "BillionSend"
    }
  ],
  "components": {
    "schemas": {
      "SendInboxDraftRequest": {
        "type": "object",
        "properties": {
          "headers": {
            "description": "Not supported yet: only an empty value is accepted, anything else answers 422"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "statusCode",
          "name",
          "message"
        ]
      },
      "LinkClicksResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "link": {
                  "type": "string",
                  "description": "Scheme, host and path of the clicked URL"
                },
                "clicked": {
                  "type": "integer",
                  "description": "Clicks by people"
                },
                "bot_clicked": {
                  "type": "integer",
                  "description": "Fetches by machines (security scanners, link previews)"
                }
              },
              "required": [
                "link",
                "clicked",
                "bot_clicked"
              ]
            }
          }
        },
        "required": [
          "object",
          "start_date",
          "end_date",
          "has_more",
          "data"
        ]
      },
      "CountryEngagementResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "country": {
                  "type": "string",
                  "description": "ISO 3166-1 alpha-2 code, or unknown"
                },
                "opened": {
                  "type": "integer",
                  "description": "Opens by people"
                },
                "unique_opened": {
                  "type": "integer",
                  "description": "Emails whose first open came from here"
                },
                "bot_opened": {
                  "type": "integer",
                  "description": "Pixel fetches by machines (scanners, prefetches)"
                },
                "clicked": {
                  "type": "integer",
                  "description": "Clicks by people"
                },
                "unique_clicked": {
                  "type": "integer",
                  "description": "Emails whose first click came from here"
                },
                "bot_clicked": {
                  "type": "integer",
                  "description": "Link fetches by machines"
                }
              },
              "required": [
                "country",
                "opened",
                "unique_opened",
                "bot_opened",
                "clicked",
                "unique_clicked",
                "bot_clicked"
              ]
            }
          }
        },
        "required": [
          "object",
          "start_date",
          "end_date",
          "has_more",
          "data"
        ]
      },
      "ClientEngagementResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "start_date": {
            "type": "string"
          },
          "end_date": {
            "type": "string"
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "client": {
                  "type": "string",
                  "enum": [
                    "gmail",
                    "apple_mail",
                    "outlook",
                    "yahoo",
                    "thunderbird",
                    "other",
                    "unknown"
                  ],
                  "description": "The mail client that fetched the open"
                },
                "opened": {
                  "type": "integer",
                  "description": "Opens by people"
                },
                "unique_opened": {
                  "type": "integer",
                  "description": "Emails whose first open came from here"
                },
                "bot_opened": {
                  "type": "integer",
                  "description": "Pixel fetches by machines (scanners, prefetches)"
                }
              },
              "required": [
                "client",
                "opened",
                "unique_opened",
                "bot_opened"
              ]
            }
          }
        },
        "required": [
          "object",
          "start_date",
          "end_date",
          "has_more",
          "data"
        ]
      },
      "ContactIdResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "contact"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "CreateContactRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "description": "Bare email address (no display name); unique per team"
          },
          "first_name": {
            "type": "string",
            "description": "First name"
          },
          "last_name": {
            "type": "string",
            "description": "Last name"
          },
          "unsubscribed": {
            "type": "boolean",
            "description": "Global opt-out from all marketing sends"
          },
          "properties": {
            "type": "object",
            "additionalProperties": {},
            "description": "Flat map of custom properties (string or number values)"
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "id"
              ]
            },
            "description": "Segments to add the contact to on creation"
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "subscription": {
                  "type": "string",
                  "enum": [
                    "opt_in",
                    "opt_out"
                  ]
                }
              },
              "required": [
                "id",
                "subscription"
              ]
            },
            "description": "Initial per-topic subscription choices"
          }
        },
        "required": [
          "email"
        ]
      },
      "BatchGetContactsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "email": {
                  "type": "string"
                },
                "first_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "unsubscribed": {
                  "type": "boolean",
                  "description": "Opt-out from every marketing send of the team, whichever domain sends. A recipient's own unsubscribe never sets it: that is recorded for the domain whose email carried the link (see unsubscribed_domains)."
                },
                "unsubscribed_domains": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "domain_id": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "uuid",
                        "description": "Null when the domain has since been deleted from the team"
                      },
                      "name": {
                        "type": "string",
                        "description": "The domain's name"
                      },
                      "unsubscribed_at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "domain_id",
                      "name",
                      "unsubscribed_at"
                    ]
                  },
                  "description": "BillionSend extension: the domains this contact unsubscribed from through a link in their email. Marketing sends from those domains skip the contact; other domains still reach them. The team-wide opt-out is `unsubscribed`, not an entry here. Remove an entry with DELETE /unsubscribes/{id}."
                },
                "verification_status": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "valid",
                    "invalid",
                    "risky",
                    "catchall",
                    "role",
                    "disposable",
                    "unknown",
                    null
                  ],
                  "description": "BillionSend extension: the verdict of the contact's last deep verification (POST /verifications); null while it was never verified"
                },
                "verified_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "When the last deep verification finished; null while never verified"
                },
                "properties": {
                  "type": "object",
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "string"
                            ]
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "value"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "number"
                            ]
                          },
                          "value": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "type",
                          "value"
                        ]
                      }
                    ]
                  },
                  "description": "Present with include=properties"
                },
                "topics": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "subscription": {
                        "type": "string",
                        "enum": [
                          "opt_in",
                          "opt_out"
                        ],
                        "description": "Effective choice: the contact's explicit one, else the topic's default"
                      },
                      "explicit": {
                        "type": "boolean",
                        "description": "True when the contact or the API chose this; false when it is the topic's default"
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "public",
                          "private"
                        ],
                        "description": "The hosted preference page lists public topics only"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "description",
                      "subscription",
                      "explicit",
                      "visibility"
                    ]
                  },
                  "description": "Present with include=topics"
                },
                "object": {
                  "type": "string",
                  "enum": [
                    "contact"
                  ]
                }
              },
              "required": [
                "id",
                "email",
                "first_name",
                "last_name",
                "created_at",
                "unsubscribed",
                "unsubscribed_domains",
                "verification_status",
                "verified_at",
                "object"
              ]
            },
            "description": "The contacts found, in request order"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "description": "Position in the request's contacts array"
                },
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "email": {
                  "type": "string"
                }
              },
              "required": [
                "index"
              ]
            },
            "description": "Request entries that matched no contact of the team"
          }
        },
        "required": [
          "object",
          "data",
          "missing"
        ]
      },
      "BatchGetContactsRequest": {
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "email": {
                  "type": "string",
                  "format": "email"
                }
              }
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Up to 1000 contacts, each by id or by email address (matched case-insensitively)"
          },
          "include": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "properties",
                "topics"
              ]
            },
            "description": "Facets to attach to every contact returned: properties and/or topics"
          }
        },
        "required": [
          "contacts"
        ]
      },
      "BatchRemoveContactsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RemoveContactResponse"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "RemoveContactResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "contact"
            ]
          },
          "contact": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "contact",
          "deleted"
        ]
      },
      "BatchRemoveContactsRequest": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Contact ids to delete, up to 1000"
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Contact email addresses to delete, up to 1000; matched case-insensitively"
          },
          "erase": {
            "type": "boolean",
            "description": "Also erase each address from email history, event payloads and API logs (GDPR/LGPD); by default the send log is kept"
          }
        }
      },
      "BatchContactsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "contact"
                  ]
                },
                "index": {
                  "type": "integer",
                  "description": "Position of the item in the request array"
                },
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "The contact's id (the existing one for skipped/updated)"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "updated",
                    "skipped"
                  ]
                }
              },
              "required": [
                "object",
                "index",
                "id",
                "status"
              ]
            },
            "description": "One entry per successful item, in request order"
          },
          "counts": {
            "type": "object",
            "properties": {
              "created": {
                "type": "integer"
              },
              "updated": {
                "type": "integer"
              },
              "skipped": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              }
            },
            "required": [
              "created",
              "updated",
              "skipped",
              "failed"
            ],
            "description": "Per-status totals over the request items; they sum to the request length"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "statusCode": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "index",
                "statusCode",
                "name",
                "message"
              ]
            },
            "description": "Permissive mode only: the failed items by request index, each with the statusCode and name strict mode would answer for it"
          }
        },
        "required": [
          "data",
          "counts"
        ]
      },
      "BatchContactsRequest": {
        "type": "array",
        "items": {
          "allOf": [
            {
              "$ref": "#/components/schemas/CreateContactRequest"
            }
          ]
        },
        "minItems": 1,
        "maxItems": 1000,
        "description": "1-1000 CreateContactRequest items"
      },
      "ListContactsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "email": {
                  "type": "string"
                },
                "first_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "unsubscribed": {
                  "type": "boolean",
                  "description": "Opt-out from every marketing send of the team, whichever domain sends. A recipient's own unsubscribe never sets it: that is recorded for the domain whose email carried the link (see unsubscribed_domains)."
                },
                "unsubscribed_domains": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "domain_id": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "uuid",
                        "description": "Null when the domain has since been deleted from the team"
                      },
                      "name": {
                        "type": "string",
                        "description": "The domain's name"
                      },
                      "unsubscribed_at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "domain_id",
                      "name",
                      "unsubscribed_at"
                    ]
                  },
                  "description": "BillionSend extension: the domains this contact unsubscribed from through a link in their email. Marketing sends from those domains skip the contact; other domains still reach them. The team-wide opt-out is `unsubscribed`, not an entry here. Remove an entry with DELETE /unsubscribes/{id}."
                },
                "verification_status": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "valid",
                    "invalid",
                    "risky",
                    "catchall",
                    "role",
                    "disposable",
                    "unknown",
                    null
                  ],
                  "description": "BillionSend extension: the verdict of the contact's last deep verification (POST /verifications); null while it was never verified"
                },
                "verified_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "When the last deep verification finished; null while never verified"
                },
                "properties": {
                  "type": "object",
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "string"
                            ]
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "value"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "number"
                            ]
                          },
                          "value": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "type",
                          "value"
                        ]
                      }
                    ]
                  },
                  "description": "Present with include=properties"
                },
                "topics": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "subscription": {
                        "type": "string",
                        "enum": [
                          "opt_in",
                          "opt_out"
                        ],
                        "description": "Effective choice: the contact's explicit one, else the topic's default"
                      },
                      "explicit": {
                        "type": "boolean",
                        "description": "True when the contact or the API chose this; false when it is the topic's default"
                      },
                      "visibility": {
                        "type": "string",
                        "enum": [
                          "public",
                          "private"
                        ],
                        "description": "The hosted preference page lists public topics only"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "description",
                      "subscription",
                      "explicit",
                      "visibility"
                    ]
                  },
                  "description": "Present with include=topics"
                }
              },
              "required": [
                "id",
                "email",
                "first_name",
                "last_name",
                "created_at",
                "unsubscribed",
                "unsubscribed_domains",
                "verification_status",
                "verified_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "GetContactResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "unsubscribed": {
            "type": "boolean",
            "description": "Opt-out from every marketing send of the team, whichever domain sends. A recipient's own unsubscribe never sets it: that is recorded for the domain whose email carried the link (see unsubscribed_domains)."
          },
          "unsubscribed_domains": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "domain_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "Null when the domain has since been deleted from the team"
                },
                "name": {
                  "type": "string",
                  "description": "The domain's name"
                },
                "unsubscribed_at": {
                  "type": "string"
                }
              },
              "required": [
                "domain_id",
                "name",
                "unsubscribed_at"
              ]
            },
            "description": "BillionSend extension: the domains this contact unsubscribed from through a link in their email. Marketing sends from those domains skip the contact; other domains still reach them. The team-wide opt-out is `unsubscribed`, not an entry here. Remove an entry with DELETE /unsubscribes/{id}."
          },
          "verification_status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "valid",
              "invalid",
              "risky",
              "catchall",
              "role",
              "disposable",
              "unknown",
              null
            ],
            "description": "BillionSend extension: the verdict of the contact's last deep verification (POST /verifications); null while it was never verified"
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the last deep verification finished; null while never verified"
          },
          "object": {
            "type": "string",
            "enum": [
              "contact"
            ]
          },
          "properties": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "string"
                      ]
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "value"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "number"
                      ]
                    },
                    "value": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "type",
                    "value"
                  ]
                }
              ]
            }
          }
        },
        "required": [
          "id",
          "email",
          "first_name",
          "last_name",
          "created_at",
          "unsubscribed",
          "unsubscribed_domains",
          "verification_status",
          "verified_at",
          "object",
          "properties"
        ]
      },
      "UpdateContactRequest": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "First name; null clears it"
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last name; null clears it"
          },
          "unsubscribed": {
            "type": "boolean",
            "description": "Global opt-out from all marketing sends"
          },
          "properties": {
            "type": "object",
            "additionalProperties": {},
            "description": "Custom properties to set (merged); null removes a key"
          }
        }
      },
      "ContactPreferencesLinkResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "preferences_link"
            ]
          },
          "contact": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The contact's hosted preference page; no expiry, treat as a secret"
          }
        },
        "required": [
          "object",
          "contact",
          "url"
        ]
      },
      "ListContactTopicsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "subscription": {
                  "type": "string",
                  "enum": [
                    "opt_in",
                    "opt_out"
                  ],
                  "description": "Effective choice: the contact's explicit one, else the topic's default"
                },
                "explicit": {
                  "type": "boolean",
                  "description": "True when the contact or the API chose this; false when it is the topic's default"
                },
                "visibility": {
                  "type": "string",
                  "enum": [
                    "public",
                    "private"
                  ],
                  "description": "The hosted preference page lists public topics only"
                }
              },
              "required": [
                "id",
                "name",
                "description",
                "subscription",
                "explicit",
                "visibility"
              ]
            }
          },
          "has_more": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "UpdateContactTopicsResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "id"
        ]
      },
      "UpdateContactTopicsRequest": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid"
            },
            "subscription": {
              "type": "string",
              "enum": [
                "opt_in",
                "opt_out"
              ]
            }
          },
          "required": [
            "id",
            "subscription"
          ]
        }
      },
      "AddContactSegmentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "id"
        ]
      },
      "RemoveContactSegmentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "audienceId": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "id",
          "audienceId",
          "deleted"
        ]
      },
      "GetContactPropertyResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number"
            ]
          },
          "fallback_value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "object": {
            "type": "string",
            "enum": [
              "contact_property"
            ]
          }
        },
        "required": [
          "id",
          "created_at",
          "key",
          "type",
          "fallback_value",
          "object"
        ]
      },
      "CreateContactPropertyRequest": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number"
            ]
          },
          "fallback_value": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "key",
          "type"
        ]
      },
      "ListContactPropertiesResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "created_at": {
                  "type": "string"
                },
                "key": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number"
                  ]
                },
                "fallback_value": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "created_at",
                "key",
                "type",
                "fallback_value"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "ContactPropertyIdResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "contact_property"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "UpdateContactPropertyRequest": {
        "type": "object",
        "properties": {
          "fallback_value": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "RemoveContactPropertyResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "contact_property"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "SegmentResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "segment"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: the domain the segment is bound to; null for a team-wide segment"
          },
          "filter": {
            "$ref": "#/components/schemas/SegmentFilter"
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "domain_id",
          "filter",
          "created_at"
        ]
      },
      "SegmentFilter": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "match": {
            "type": "string",
            "enum": [
              "all",
              "any"
            ]
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "op": {
                  "type": "string"
                },
                "value": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "maxLength": 500
                }
              },
              "required": [
                "field",
                "op",
                "value"
              ]
            },
            "maxItems": 50
          }
        },
        "required": [
          "match",
          "conditions"
        ]
      },
      "CreateSegmentRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: id of one of your domains. A broadcast to this segment must then be sent from that domain (422 otherwise), so an audience is never mailed under another brand or against another brand's opt-outs. null or omitted: a segment of the whole team, sendable from any domain. On update, null makes the segment a team-wide one again."
          },
          "filter": {
            "$ref": "#/components/schemas/SegmentFilter"
          }
        },
        "required": [
          "name"
        ]
      },
      "ListSegmentsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "segment"
                  ]
                },
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "domain_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "BillionSend extension: the domain the segment is bound to; null for a team-wide segment"
                },
                "filter": {
                  "$ref": "#/components/schemas/SegmentFilter"
                },
                "created_at": {
                  "type": "string"
                }
              },
              "required": [
                "object",
                "id",
                "name",
                "domain_id",
                "filter",
                "created_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "GetSegmentResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "segment"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: the domain the segment is bound to; null for a team-wide segment"
          },
          "filter": {
            "$ref": "#/components/schemas/SegmentFilter"
          },
          "created_at": {
            "type": "string"
          },
          "contact_count": {
            "type": "number"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "domain_id",
          "filter",
          "created_at",
          "contact_count"
        ]
      },
      "UpdateSegmentRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: id of one of your domains. A broadcast to this segment must then be sent from that domain (422 otherwise), so an audience is never mailed under another brand or against another brand's opt-outs. null or omitted: a segment of the whole team, sendable from any domain. On update, null makes the segment a team-wide one again."
          },
          "filter": {
            "$ref": "#/components/schemas/SegmentFilter"
          }
        }
      },
      "RemoveSegmentResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "segment"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "SendBroadcastResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "finishes_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the last email is expected to go out (ISO 8601); null when unknown"
          },
          "estimated": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "finishes_at is an estimate that moves as other sends come in"
          },
          "warning": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "paced",
                  "queued_behind"
                ],
                "description": "paced: more than the capacity available now; queued_behind: other sends go first"
              },
              "days": {
                "type": "integer",
                "description": "Days the send spans"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "days",
              "message"
            ]
          }
        },
        "required": [
          "id"
        ]
      },
      "CreateBroadcastRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Internal name shown in the dashboard"
          },
          "segment_id": {
            "type": "string",
            "format": "uuid",
            "description": "Segment to send to; omitted means every contact of the team"
          },
          "from": {
            "type": "string",
            "description": "Sender, \"Name <user@domain>\"; the domain must be one of the team's own verified domains when the broadcast is sent: sending from an address on the shared inbox domain answers 403"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 998,
            "description": "Subject line; supports {{{FIRST_NAME|there}}} merge fields"
          },
          "html": {
            "type": "string",
            "description": "HTML body; include {{{UNSUBSCRIBE_URL}}} for the opt-out link"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body; at least one of html/text is required"
          },
          "reply_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "Reply-To address or list"
          },
          "preview_text": {
            "type": "string",
            "description": "Inbox preview (preheader) text"
          },
          "topic_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Topic id; only contacts subscribed to it receive the broadcast"
          },
          "send": {
            "type": "boolean",
            "description": "true sends (or schedules) immediately instead of saving a draft"
          },
          "scheduled_at": {
            "type": "string",
            "description": "Deliver later (requires send: true): ISO 8601 with offset or relative like \"in 1 hour\""
          }
        },
        "required": [
          "from",
          "subject"
        ]
      },
      "ListBroadcastsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "segment_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "status": {
                  "type": "string",
                  "description": "draft, queued, sent, or the BillionSend extensions canceled and failed. failed: the send could not go ahead, either on a condition no retry would change or because the retries ran out; failure_reason says why. Emails already handed off stay sent."
                },
                "created_at": {
                  "type": "string"
                },
                "scheduled_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sent_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "failure_reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "domain_missing",
                    "sender_domain_mismatch",
                    "topic_other_domain",
                    "segment_other_domain",
                    "domain_unverified",
                    "retries_exhausted",
                    null
                  ],
                  "description": "BillionSend extension: why a failed broadcast failed (domain_missing: its sending domain was deleted; sender_domain_mismatch: from is no longer on that domain; topic_other_domain / segment_other_domain: its topic or segment is bound to another domain; domain_unverified: its sending domain was not verified through every retry; retries_exhausted: sending kept failing until the retries ran out); null unless status is failed"
                },
                "failed_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "BillionSend extension: when the broadcast failed; null unless status is failed"
                },
                "sent_count": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Emails handed off so far; null before the send starts and once its emails have left the retention window"
                },
                "finishes_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Estimated instant the last email goes out, while the broadcast is going out; else null"
                }
              },
              "required": [
                "id",
                "name",
                "segment_id",
                "status",
                "created_at",
                "scheduled_at",
                "sent_at",
                "failure_reason",
                "failed_at",
                "sent_count",
                "finishes_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "GetBroadcastResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "segment_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "description": "draft, queued, sent, or the BillionSend extensions canceled and failed. failed: the send could not go ahead, either on a condition no retry would change or because the retries ran out; failure_reason says why. Emails already handed off stay sent."
          },
          "created_at": {
            "type": "string"
          },
          "scheduled_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "domain_missing",
              "sender_domain_mismatch",
              "topic_other_domain",
              "segment_other_domain",
              "domain_unverified",
              "retries_exhausted",
              null
            ],
            "description": "BillionSend extension: why a failed broadcast failed (domain_missing: its sending domain was deleted; sender_domain_mismatch: from is no longer on that domain; topic_other_domain / segment_other_domain: its topic or segment is bound to another domain; domain_unverified: its sending domain was not verified through every retry; retries_exhausted: sending kept failing until the retries ran out); null unless status is failed"
          },
          "failed_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: when the broadcast failed; null unless status is failed"
          },
          "sent_count": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Emails handed off so far; null before the send starts and once its emails have left the retention window"
          },
          "finishes_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Estimated instant the last email goes out, while the broadcast is going out; else null"
          },
          "object": {
            "type": "string",
            "enum": [
              "broadcast"
            ]
          },
          "from": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "reply_to": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "preview_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "topic_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: the domain of yours that from is on, set whenever from is. Its opt-outs decide who is left out and its unsubscribe page opens from the links. null while from is not on a domain of yours (the broadcast is sent only once it is)."
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "segment_id",
          "status",
          "created_at",
          "scheduled_at",
          "sent_at",
          "failure_reason",
          "failed_at",
          "sent_count",
          "finishes_at",
          "object",
          "from",
          "subject",
          "reply_to",
          "preview_text",
          "topic_id",
          "domain_id",
          "html",
          "text"
        ]
      },
      "BroadcastIdResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "id"
        ]
      },
      "UpdateBroadcastRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "segment_id": {
            "type": "string",
            "format": "uuid"
          },
          "from": {
            "type": "string"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 998
          },
          "html": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "reply_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "maxItems": 50
              }
            ]
          },
          "preview_text": {
            "type": "string"
          },
          "topic_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        }
      },
      "RemoveBroadcastResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "broadcast"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "SendBroadcastRequest": {
        "type": "object",
        "properties": {
          "scheduled_at": {
            "type": "string",
            "description": "Deliver later: ISO 8601 with offset or relative like \"in 1 hour\"; omitted sends now"
          }
        }
      },
      "DuplicateBroadcastResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "broadcast"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "CancelBroadcastResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "broadcast"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "canceled_remaining": {
            "type": "integer",
            "description": "Emails stopped before going out; the ones already sent are not recalled"
          }
        },
        "required": [
          "object",
          "id",
          "canceled_remaining"
        ]
      },
      "TopicResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "default_subscription": {
            "type": "string",
            "enum": [
              "opt_in",
              "opt_out"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "public"
            ]
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: the domain the topic is bound to; null for a team-wide topic"
          },
          "created_at": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "default_subscription",
          "visibility",
          "domain_id",
          "created_at"
        ]
      },
      "CreateTopicRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "default_subscription": {
            "type": "string",
            "enum": [
              "opt_in",
              "opt_out"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "public"
            ]
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: id of one of your domains. The topic then appears only on that domain's unsubscribe page, and a send with this topic_id must come from that domain (422 otherwise). null or omitted: a topic of the whole team, shown for every domain. On update, null makes the topic a team-wide one again."
          }
        },
        "required": [
          "name",
          "default_subscription"
        ]
      },
      "ListTopicsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "default_subscription": {
                  "type": "string",
                  "enum": [
                    "opt_in",
                    "opt_out"
                  ]
                },
                "visibility": {
                  "type": "string",
                  "enum": [
                    "private",
                    "public"
                  ]
                },
                "domain_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "BillionSend extension: the domain the topic is bound to; null for a team-wide topic"
                },
                "created_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "default_subscription",
                "visibility",
                "domain_id",
                "created_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "TopicIdResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "id"
        ]
      },
      "UpdateTopicRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "description": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "public"
            ]
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: id of one of your domains. The topic then appears only on that domain's unsubscribe page, and a send with this topic_id must come from that domain (422 otherwise). null or omitted: a topic of the whole team, shown for every domain. On update, null makes the topic a team-wide one again."
          }
        }
      },
      "RemoveTopicResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "enum": [
              "topic"
            ]
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "id",
          "object",
          "deleted"
        ]
      },
      "CreateDomainResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "open_tracking": {
            "type": "boolean"
          },
          "click_tracking": {
            "type": "boolean"
          },
          "tracking_subdomain": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracking_status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "active",
              "failed",
              null
            ],
            "description": "BillionSend extension: where the tracking subdomain stands: pending (waiting for its CNAME and certificate), active (links go through it) or failed (did not activate within 72 hours; links use the shared host). null while no tracking_subdomain is set."
          },
          "tracking_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: why the tracking subdomain is not active, when known"
          },
          "unsubscribe_subdomain": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: the domain's own unsubscribe host label, null when unset"
          },
          "unsubscribe_status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "active",
              "failed",
              null
            ],
            "description": "BillionSend extension: where the unsubscribe subdomain stands: pending, active (unsubscribe links go through it) or failed (links use the shared host). null while no unsubscribe_subdomain is set. When both subdomains are the same label they share one host and always read the same."
          },
          "unsubscribe_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: why the unsubscribe subdomain is not active, when known"
          },
          "unsubscribe_page": {
            "type": "object",
            "properties": {
              "brand_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "success_message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "redirect_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "background_color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "text_color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accent_color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "logo_radius": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "square",
                  "gentle",
                  "rounded",
                  "circle",
                  null
                ]
              },
              "logo_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Read-only; uploaded in the dashboard"
              }
            },
            "required": [
              "brand_name",
              "message",
              "success_message",
              "redirect_url",
              "background_color",
              "text_color",
              "accent_color",
              "logo_radius",
              "logo_url"
            ],
            "description": "BillionSend extension: this domain's own look for its unsubscribe pages. A null field falls back to the team's default page, then to the built-in default."
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "sending": {
                "type": "string",
                "description": "enabled; on the shared row, disabled while the instance pauses sending from the shared domain"
              },
              "receiving": {
                "type": "string",
                "description": "enabled while the domain receives mail; always disabled on an instance that does not"
              }
            },
            "required": [
              "sending",
              "receiving"
            ]
          },
          "receiving_catch_all": {
            "type": "boolean",
            "description": "BillionSend extension: whether mail to an address without an inbox is stored (true) or refused at RCPT (false)"
          },
          "shared": {
            "type": "boolean",
            "description": "BillionSend extension: true on the team's subdomain of the shared inbox domain, a read-only row listed after the team's own domains (403 on changes) that POST /inboxes domain_id takes; false on the team's own domains"
          },
          "sending_mode": {
            "type": "string",
            "enum": [
              "open",
              "reply_only",
              "receive_only"
            ],
            "description": "BillionSend extension, on the shared row only: what its inboxes' addresses may send. open starts conversations, reply_only replies inside their threads, receive_only sends nothing. Holds on names still apply per send: an address whose username or from_name imitates a brand, or one on an older label that does, replies only, even when the mode is open."
          },
          "sending_mode_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "plan",
              "instance",
              null
            ],
            "description": "BillionSend extension, on the shared row only: what holds sending below open: the team's plan or the instance; null when open"
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "record": {
                  "type": "string",
                  "description": "Which record this is: DKIM, SPF (the MAIL FROM MX and TXT rows), DMARC, Tracking (the tracking subdomain's CNAME, present once a tracking subdomain is set), Unsubscribe (the unsubscribe subdomain's CNAME, present once an unsubscribe subdomain is set to a label other than the tracking one) or Receiving (the MX inbound mail needs, present while receiving is enabled; it reads verified only when it is among the domain's lowest-numbered MX records). Only the DKIM and SPF rows gate sending."
                },
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "ttl": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "description": "not_started | pending | verified | failed. DKIM and SPF rows combine public DNS with the provider's verification: found in DNS but not yet confirmed reads pending, a different published value reads failed, no record reads not_started. DMARC reads verified when a policy covers the domain — its own or a parent domain's (see inherited_from) — and not_started when none does. Tracking and Unsubscribe read verified once their CNAME resolves and its certificate is issued, pending until then, and failed when it did not activate within 72 hours."
                },
                "value": {
                  "type": "string"
                },
                "priority": {
                  "type": "number"
                },
                "live": {
                  "type": "string",
                  "enum": [
                    "found",
                    "missing",
                    "mismatch",
                    "unknown"
                  ],
                  "description": "What public DNS answers for this record right now: found, missing, mismatch (a different value is published) or unknown (the lookup did not conclude). Omitted when no live check ran (the create response)."
                },
                "detail": {
                  "type": "string",
                  "description": "One sentence explaining a row that is not verified: found but awaiting the provider, the value that is published instead, no record at the name, or which parent DMARC policy covers the domain. Omitted when there is nothing to add."
                },
                "inherited_from": {
                  "type": "string",
                  "description": "DMARC only: the _dmarc name whose policy covers this domain when it has no record of its own (RFC 7489 organizational-domain fallback)."
                },
                "policy": {
                  "type": "string",
                  "enum": [
                    "none",
                    "quarantine",
                    "reject"
                  ],
                  "description": "DMARC only, alongside inherited_from: the inherited policy's p= value."
                }
              },
              "required": [
                "record",
                "name",
                "type",
                "ttl",
                "status",
                "value"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "created_at",
          "region",
          "open_tracking",
          "click_tracking",
          "tracking_subdomain",
          "tracking_status",
          "tracking_error",
          "unsubscribe_subdomain",
          "unsubscribe_status",
          "unsubscribe_error",
          "unsubscribe_page",
          "capabilities",
          "receiving_catch_all",
          "shared",
          "records"
        ]
      },
      "CreateDomainRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "region": {
            "type": "string",
            "enum": [
              "us-east-1",
              "eu-west-1",
              "sa-east-1",
              "ap-northeast-1"
            ],
            "description": "SES region of the identity, one of the regions this deployment serves (the values listed here; the first is the default). Any other region is rejected with 422. A domain has one region, fixed when it is added."
          },
          "custom_return_path": {
            "type": "string",
            "default": "send"
          },
          "open_tracking": {
            "type": "boolean",
            "description": "Inject a tracking pixel served from the tracking host and record email.opened events. Off by default."
          },
          "click_tracking": {
            "type": "boolean",
            "description": "Rewrite links to redirect through the tracking host and record email.clicked events. Off by default."
          },
          "tracking_subdomain": {
            "type": "string",
            "description": "DNS label of the domain's own tracking host, e.g. \"links\" for links.<domain>. Optional: without one, tracked links use the shared tracking host. Setting it adds a Tracking CNAME to records[] (point it at the given value, DNS only); its certificate is issued automatically once it resolves, the Tracking record then reads verified, and links go through it from then on. A subdomain that does not activate within 72 hours reads failed; send the same tracking_subdomain again to retry."
          },
          "unsubscribe_subdomain": {
            "type": "string",
            "description": "BillionSend extension: DNS label of the domain's own unsubscribe host, e.g. \"unsubscribe\" for unsubscribe.<domain>. Optional: without one, unsubscribe links (and the List-Unsubscribe header) use the shared unsubscribe host. Setting it adds an Unsubscribe CNAME to records[] (point it at the given value, DNS only); its certificate is issued automatically once it resolves, the Unsubscribe record then reads verified, and unsubscribe links go through it from then on. The same label as tracking_subdomain is allowed: one host then serves both and records[] shows one row. A subdomain that does not activate within 72 hours reads failed; send the same unsubscribe_subdomain again to retry. Kept apart from tracking_subdomain because ad blockers filter tracking hosts by name."
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "sending": {
                "type": "string",
                "enum": [
                  "enabled",
                  "disabled"
                ],
                "description": "Only enabled is accepted: a domain of your own can't be receive-only, so disabled is a 422."
              },
              "receiving": {
                "type": "string",
                "enum": [
                  "enabled",
                  "disabled"
                ],
                "description": "Inbound mail for every address at the domain (a catch-all), readable at /emails/receiving and announced by the email.received webhook. Enabling needs a verified domain on an instance that receives mail, and adds a Receiving MX record to records[]. A domain that already has mailboxes is best received on a subdomain (inbound.example.com): the Receiving MX would take their mail."
              }
            },
            "description": "What the domain is used for (sending, receiving); omitted fields keep their value."
          }
        },
        "required": [
          "name"
        ]
      },
      "ListDomainsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "region": {
                  "type": "string"
                },
                "open_tracking": {
                  "type": "boolean"
                },
                "click_tracking": {
                  "type": "boolean"
                },
                "tracking_subdomain": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tracking_status": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "pending",
                    "active",
                    "failed",
                    null
                  ],
                  "description": "BillionSend extension: where the tracking subdomain stands: pending (waiting for its CNAME and certificate), active (links go through it) or failed (did not activate within 72 hours; links use the shared host). null while no tracking_subdomain is set."
                },
                "tracking_error": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "BillionSend extension: why the tracking subdomain is not active, when known"
                },
                "unsubscribe_subdomain": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "BillionSend extension: the domain's own unsubscribe host label, null when unset"
                },
                "unsubscribe_status": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "pending",
                    "active",
                    "failed",
                    null
                  ],
                  "description": "BillionSend extension: where the unsubscribe subdomain stands: pending, active (unsubscribe links go through it) or failed (links use the shared host). null while no unsubscribe_subdomain is set. When both subdomains are the same label they share one host and always read the same."
                },
                "unsubscribe_error": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "BillionSend extension: why the unsubscribe subdomain is not active, when known"
                },
                "unsubscribe_page": {
                  "type": "object",
                  "properties": {
                    "brand_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "success_message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "redirect_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "background_color": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "text_color": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "accent_color": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "logo_radius": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "square",
                        "gentle",
                        "rounded",
                        "circle",
                        null
                      ]
                    },
                    "logo_url": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Read-only; uploaded in the dashboard"
                    }
                  },
                  "required": [
                    "brand_name",
                    "message",
                    "success_message",
                    "redirect_url",
                    "background_color",
                    "text_color",
                    "accent_color",
                    "logo_radius",
                    "logo_url"
                  ],
                  "description": "BillionSend extension: this domain's own look for its unsubscribe pages. A null field falls back to the team's default page, then to the built-in default."
                },
                "capabilities": {
                  "type": "object",
                  "properties": {
                    "sending": {
                      "type": "string",
                      "description": "enabled; on the shared row, disabled while the instance pauses sending from the shared domain"
                    },
                    "receiving": {
                      "type": "string",
                      "description": "enabled while the domain receives mail; always disabled on an instance that does not"
                    }
                  },
                  "required": [
                    "sending",
                    "receiving"
                  ]
                },
                "receiving_catch_all": {
                  "type": "boolean",
                  "description": "BillionSend extension: whether mail to an address without an inbox is stored (true) or refused at RCPT (false)"
                },
                "shared": {
                  "type": "boolean",
                  "description": "BillionSend extension: true on the team's subdomain of the shared inbox domain, a read-only row listed after the team's own domains (403 on changes) that POST /inboxes domain_id takes; false on the team's own domains"
                },
                "sending_mode": {
                  "type": "string",
                  "enum": [
                    "open",
                    "reply_only",
                    "receive_only"
                  ],
                  "description": "BillionSend extension, on the shared row only: what its inboxes' addresses may send. open starts conversations, reply_only replies inside their threads, receive_only sends nothing. Holds on names still apply per send: an address whose username or from_name imitates a brand, or one on an older label that does, replies only, even when the mode is open."
                },
                "sending_mode_reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "plan",
                    "instance",
                    null
                  ],
                  "description": "BillionSend extension, on the shared row only: what holds sending below open: the team's plan or the instance; null when open"
                }
              },
              "required": [
                "id",
                "name",
                "status",
                "created_at",
                "region",
                "open_tracking",
                "click_tracking",
                "tracking_subdomain",
                "tracking_status",
                "tracking_error",
                "unsubscribe_subdomain",
                "unsubscribe_status",
                "unsubscribe_error",
                "unsubscribe_page",
                "capabilities",
                "receiving_catch_all",
                "shared"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "GetDomainResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "open_tracking": {
            "type": "boolean"
          },
          "click_tracking": {
            "type": "boolean"
          },
          "tracking_subdomain": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracking_status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "active",
              "failed",
              null
            ],
            "description": "BillionSend extension: where the tracking subdomain stands: pending (waiting for its CNAME and certificate), active (links go through it) or failed (did not activate within 72 hours; links use the shared host). null while no tracking_subdomain is set."
          },
          "tracking_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: why the tracking subdomain is not active, when known"
          },
          "unsubscribe_subdomain": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: the domain's own unsubscribe host label, null when unset"
          },
          "unsubscribe_status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "active",
              "failed",
              null
            ],
            "description": "BillionSend extension: where the unsubscribe subdomain stands: pending, active (unsubscribe links go through it) or failed (links use the shared host). null while no unsubscribe_subdomain is set. When both subdomains are the same label they share one host and always read the same."
          },
          "unsubscribe_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: why the unsubscribe subdomain is not active, when known"
          },
          "unsubscribe_page": {
            "type": "object",
            "properties": {
              "brand_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "success_message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "redirect_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "background_color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "text_color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accent_color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "logo_radius": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "square",
                  "gentle",
                  "rounded",
                  "circle",
                  null
                ]
              },
              "logo_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Read-only; uploaded in the dashboard"
              }
            },
            "required": [
              "brand_name",
              "message",
              "success_message",
              "redirect_url",
              "background_color",
              "text_color",
              "accent_color",
              "logo_radius",
              "logo_url"
            ],
            "description": "BillionSend extension: this domain's own look for its unsubscribe pages. A null field falls back to the team's default page, then to the built-in default."
          },
          "capabilities": {
            "type": "object",
            "properties": {
              "sending": {
                "type": "string",
                "description": "enabled; on the shared row, disabled while the instance pauses sending from the shared domain"
              },
              "receiving": {
                "type": "string",
                "description": "enabled while the domain receives mail; always disabled on an instance that does not"
              }
            },
            "required": [
              "sending",
              "receiving"
            ]
          },
          "receiving_catch_all": {
            "type": "boolean",
            "description": "BillionSend extension: whether mail to an address without an inbox is stored (true) or refused at RCPT (false)"
          },
          "shared": {
            "type": "boolean",
            "description": "BillionSend extension: true on the team's subdomain of the shared inbox domain, a read-only row listed after the team's own domains (403 on changes) that POST /inboxes domain_id takes; false on the team's own domains"
          },
          "sending_mode": {
            "type": "string",
            "enum": [
              "open",
              "reply_only",
              "receive_only"
            ],
            "description": "BillionSend extension, on the shared row only: what its inboxes' addresses may send. open starts conversations, reply_only replies inside their threads, receive_only sends nothing. Holds on names still apply per send: an address whose username or from_name imitates a brand, or one on an older label that does, replies only, even when the mode is open."
          },
          "sending_mode_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "plan",
              "instance",
              null
            ],
            "description": "BillionSend extension, on the shared row only: what holds sending below open: the team's plan or the instance; null when open"
          },
          "object": {
            "type": "string",
            "enum": [
              "domain"
            ]
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "record": {
                  "type": "string",
                  "description": "Which record this is: DKIM, SPF (the MAIL FROM MX and TXT rows), DMARC, Tracking (the tracking subdomain's CNAME, present once a tracking subdomain is set), Unsubscribe (the unsubscribe subdomain's CNAME, present once an unsubscribe subdomain is set to a label other than the tracking one) or Receiving (the MX inbound mail needs, present while receiving is enabled; it reads verified only when it is among the domain's lowest-numbered MX records). Only the DKIM and SPF rows gate sending."
                },
                "name": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "ttl": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "description": "not_started | pending | verified | failed. DKIM and SPF rows combine public DNS with the provider's verification: found in DNS but not yet confirmed reads pending, a different published value reads failed, no record reads not_started. DMARC reads verified when a policy covers the domain — its own or a parent domain's (see inherited_from) — and not_started when none does. Tracking and Unsubscribe read verified once their CNAME resolves and its certificate is issued, pending until then, and failed when it did not activate within 72 hours."
                },
                "value": {
                  "type": "string"
                },
                "priority": {
                  "type": "number"
                },
                "live": {
                  "type": "string",
                  "enum": [
                    "found",
                    "missing",
                    "mismatch",
                    "unknown"
                  ],
                  "description": "What public DNS answers for this record right now: found, missing, mismatch (a different value is published) or unknown (the lookup did not conclude). Omitted when no live check ran (the create response)."
                },
                "detail": {
                  "type": "string",
                  "description": "One sentence explaining a row that is not verified: found but awaiting the provider, the value that is published instead, no record at the name, or which parent DMARC policy covers the domain. Omitted when there is nothing to add."
                },
                "inherited_from": {
                  "type": "string",
                  "description": "DMARC only: the _dmarc name whose policy covers this domain when it has no record of its own (RFC 7489 organizational-domain fallback)."
                },
                "policy": {
                  "type": "string",
                  "enum": [
                    "none",
                    "quarantine",
                    "reject"
                  ],
                  "description": "DMARC only, alongside inherited_from: the inherited policy's p= value."
                }
              },
              "required": [
                "record",
                "name",
                "type",
                "ttl",
                "status",
                "value"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "status",
          "created_at",
          "region",
          "open_tracking",
          "click_tracking",
          "tracking_subdomain",
          "tracking_status",
          "tracking_error",
          "unsubscribe_subdomain",
          "unsubscribe_status",
          "unsubscribe_error",
          "unsubscribe_page",
          "capabilities",
          "receiving_catch_all",
          "shared",
          "object",
          "records"
        ]
      },
      "UpdateDomainRequest": {
        "type": "object",
        "properties": {
          "click_tracking": {
            "type": "boolean",
            "description": "Rewrite links to redirect through the tracking host and record email.clicked events. Off by default."
          },
          "open_tracking": {
            "type": "boolean",
            "description": "Inject a tracking pixel served from the tracking host and record email.opened events. Off by default."
          },
          "tracking_subdomain": {
            "type": [
              "string",
              "null"
            ],
            "description": "DNS label of the domain's own tracking host, e.g. \"links\" for links.<domain>. Optional: without one, tracked links use the shared tracking host. Setting it adds a Tracking CNAME to records[] (point it at the given value, DNS only); its certificate is issued automatically once it resolves, the Tracking record then reads verified, and links go through it from then on. A subdomain that does not activate within 72 hours reads failed; send the same tracking_subdomain again to retry. Empty string or null clears it."
          },
          "unsubscribe_subdomain": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: DNS label of the domain's own unsubscribe host, e.g. \"unsubscribe\" for unsubscribe.<domain>. Optional: without one, unsubscribe links (and the List-Unsubscribe header) use the shared unsubscribe host. Setting it adds an Unsubscribe CNAME to records[] (point it at the given value, DNS only); its certificate is issued automatically once it resolves, the Unsubscribe record then reads verified, and unsubscribe links go through it from then on. The same label as tracking_subdomain is allowed: one host then serves both and records[] shows one row. A subdomain that does not activate within 72 hours reads failed; send the same unsubscribe_subdomain again to retry. Kept apart from tracking_subdomain because ad blockers filter tracking hosts by name. Empty string or null clears it."
          },
          "unsubscribe_page": {
            "type": "object",
            "properties": {
              "brand_name": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 80,
                "description": "Name shown on the page; max 80 characters"
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 500,
                "description": "Text above the unsubscribe button; max 500 characters"
              },
              "success_message": {
                "type": [
                  "string",
                  "null"
                ],
                "maxLength": 500,
                "description": "Text shown once the choice is saved; max 500 characters"
              },
              "redirect_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Where the recipient goes after unsubscribing instead of the in-page message; http(s) only"
              },
              "background_color": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Page background, #rrggbb"
              },
              "text_color": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Page text color, #rrggbb"
              },
              "accent_color": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Button and link color, #rrggbb"
              },
              "logo_radius": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "square",
                  "gentle",
                  "rounded",
                  "circle",
                  null
                ],
                "description": "Corner radius of the logo: square, gentle, rounded or circle"
              }
            },
            "description": "BillionSend extension: this domain's own look for its unsubscribe pages. Fields not sent keep their value; null clears one, and a cleared field falls back to the team's default page. logo_url is read-only here: the logo is uploaded in the dashboard."
          },
          "tls": {},
          "capabilities": {
            "type": "object",
            "properties": {
              "sending": {
                "type": "string",
                "enum": [
                  "enabled",
                  "disabled"
                ],
                "description": "Only enabled is accepted: a domain of your own can't be receive-only, so disabled is a 422."
              },
              "receiving": {
                "type": "string",
                "enum": [
                  "enabled",
                  "disabled"
                ],
                "description": "Inbound mail for every address at the domain (a catch-all), readable at /emails/receiving and announced by the email.received webhook. Enabling needs a verified domain on an instance that receives mail, and adds a Receiving MX record to records[]. A domain that already has mailboxes is best received on a subdomain (inbound.example.com): the Receiving MX would take their mail."
              }
            },
            "description": "What the domain is used for (sending, receiving); omitted fields keep their value."
          },
          "receiving_catch_all": {
            "type": "boolean",
            "description": "BillionSend extension: store mail to addresses without an inbox (true) or refuse it at RCPT (false). Turning it on needs receiving enabled and, on BillionSend Cloud, a paid plan."
          }
        }
      },
      "RemoveDomainResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "domain"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "CreateApiKeyResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "token": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "token"
        ]
      },
      "CreateApiKeyRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "permission": {
            "type": "string",
            "enum": [
              "full_access",
              "sending_access"
            ],
            "default": "full_access"
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Restricts the key to this one verified domain of the team: a GET /domains row with shared: false. The key sends only from it and reads and changes only that domain's own resources: its emails, its broadcasts, topics and segments bound to it, its opt-outs, its inboxes and received mail, its own GET, PATCH, DELETE and verify of /domains/{id}, its metrics, and the keys held to the same domain (GET and DELETE /api-keys). Everything that belongs to the team as a whole answers 403 restricted_api_key: webhooks, suppressions, templates, contact properties, /usage, /deliverability, /verifications and POST /domains. Omitted or null, the key inherits the calling key's scope: all domains, or the calling key's domain if it is domain-scoped. A domain-scoped calling key cannot name any other domain (403 restricted_api_key)."
          },
          "inbox_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: restricts the key to one inbox of the team. It reads that inbox's threads, drafts and received mail and sends only from its address; every other route answers 403 restricted_api_key. Needs full_access, can't be combined with domain_id, and an inbox holds at most 5 active keys (outside the team's 25)."
          }
        },
        "required": [
          "name"
        ]
      },
      "ListApiKeysResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "last_used_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "inbox_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "BillionSend extension: the one inbox the key is restricted to, or null"
                }
              },
              "required": [
                "id",
                "name",
                "created_at",
                "last_used_at",
                "inbox_id"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "RemoveApiKeyResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "api_key"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "CreateWebhookResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "webhook"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "signing_secret": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "id",
          "signing_secret"
        ]
      },
      "CreateWebhookRequest": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "email.scheduled",
                "email.sent",
                "email.delivered",
                "email.delivery_delayed",
                "email.bounced",
                "email.complained",
                "email.failed",
                "email.suppressed",
                "email.opened",
                "email.clicked",
                "email.prefetched",
                "email.received",
                "deliverability.warning",
                "deliverability.paused",
                "quota.warning",
                "quota.reached",
                "quota.paused",
                "contact.created",
                "contact.updated",
                "contact.deleted",
                "contact.unsubscribed",
                "contact.resubscribed",
                "contact.topic_opt_in",
                "contact.topic_opt_out",
                "suppression.added",
                "suppression.removed",
                "inbox.created",
                "inbox.updated",
                "inbox.deleted",
                "inbox.expired",
                "inbox.thread.created",
                "inbox.thread.folder.updated",
                "inbox.thread.labels.updated",
                "inbox.email.received",
                "inbox.email.sent",
                "inbox.email.quarantined",
                "inbox.draft.created",
                "inbox.draft.updated",
                "inbox.draft.sent",
                "inbox.draft.deleted",
                "inbox.draft.send_failed"
              ]
            },
            "minItems": 1
          },
          "inbox_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 100,
            "description": "BillionSend extension: inbox events and email.received reach this endpoint only for these inboxes of the team (at most 100). null means every inbox. Omitted: every inbox."
          },
          "signing_secret": {
            "type": "string",
            "description": "Signing secret to use instead of minting one: whsec_ followed by base64 of 24-64 bytes (the Standard Webhooks format). An existing secret carried over keeps the receiver verifying unchanged; when omitted, a new one is generated."
          }
        },
        "required": [
          "endpoint",
          "events"
        ]
      },
      "ListWebhooksResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "endpoint": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "enabled",
                    "disabled"
                  ]
                },
                "events": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  }
                },
                "inbox_ids": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  },
                  "description": "BillionSend extension: inbox events and email.received reach this endpoint only for these inboxes of the team (at most 100). null means every inbox."
                }
              },
              "required": [
                "id",
                "endpoint",
                "created_at",
                "status",
                "events",
                "inbox_ids"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "GetWebhookResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "endpoint": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "events": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "inbox_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "BillionSend extension: inbox events and email.received reach this endpoint only for these inboxes of the team (at most 100). null means every inbox."
          },
          "object": {
            "type": "string",
            "enum": [
              "webhook"
            ]
          },
          "signing_secret": {
            "type": "string",
            "description": "Not returned to a team member's MCP call; the dashboard shows members only its last 4 characters"
          },
          "previous_secret_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "While set, deliveries are also signed with the secret this one replaced (a rotation's overlap window)"
          }
        },
        "required": [
          "id",
          "endpoint",
          "created_at",
          "status",
          "events",
          "inbox_ids",
          "object",
          "previous_secret_expires_at"
        ]
      },
      "RotateWebhookSecretResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "webhook"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "signing_secret": {
            "type": "string"
          },
          "previous_secret_expires_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "signing_secret",
          "previous_secret_expires_at"
        ]
      },
      "RotateWebhookSecretRequest": {
        "type": "object",
        "properties": {
          "signing_secret": {
            "type": "string",
            "description": "New secret to sign with: whsec_ followed by base64 of 24-64 bytes. Omit to mint one."
          },
          "overlap_hours": {
            "type": "integer",
            "minimum": 0,
            "maximum": 72,
            "description": "Hours the previous secret keeps signing alongside the new one (default 24, max 72). Every delivery in the window carries both signatures, so a receiver holding either verifies; 0 drops the old secret at once."
          }
        }
      },
      "WebhookIdResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "webhook"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "UpdateWebhookRequest": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string",
            "maxLength": 2048,
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "email.scheduled",
                "email.sent",
                "email.delivered",
                "email.delivery_delayed",
                "email.bounced",
                "email.complained",
                "email.failed",
                "email.suppressed",
                "email.opened",
                "email.clicked",
                "email.prefetched",
                "email.received",
                "deliverability.warning",
                "deliverability.paused",
                "quota.warning",
                "quota.reached",
                "quota.paused",
                "contact.created",
                "contact.updated",
                "contact.deleted",
                "contact.unsubscribed",
                "contact.resubscribed",
                "contact.topic_opt_in",
                "contact.topic_opt_out",
                "suppression.added",
                "suppression.removed",
                "inbox.created",
                "inbox.updated",
                "inbox.deleted",
                "inbox.expired",
                "inbox.thread.created",
                "inbox.thread.folder.updated",
                "inbox.thread.labels.updated",
                "inbox.email.received",
                "inbox.email.sent",
                "inbox.email.quarantined",
                "inbox.draft.created",
                "inbox.draft.updated",
                "inbox.draft.sent",
                "inbox.draft.deleted",
                "inbox.draft.send_failed"
              ]
            },
            "minItems": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "inbox_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 100,
            "description": "BillionSend extension: inbox events and email.received reach this endpoint only for these inboxes of the team (at most 100). null means every inbox. Omitted: unchanged."
          }
        }
      },
      "RemoveWebhookResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "webhook"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "BatchAddSuppressionsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SuppressionIdResponse"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "SuppressionIdResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "suppression"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "BatchAddSuppressionsRequest": {
        "type": "object",
        "properties": {
          "emails": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Addresses to block, up to 1000; duplicates collapse"
          },
          "origin": {
            "type": "string",
            "enum": [
              "bounce",
              "complaint",
              "manual"
            ],
            "description": "Origin recorded on rows this request creates (default manual): bounce, complaint or manual; an address already suppressed keeps its origin"
          }
        },
        "required": [
          "emails"
        ]
      },
      "BatchRemoveSuppressionsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RemoveSuppressionResponse"
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "RemoveSuppressionResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "suppression"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "BatchRemoveSuppressionsRequest": {
        "type": "object",
        "properties": {
          "emails": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Addresses to unblock, up to 1000"
          },
          "ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 1000,
            "description": "Suppression ids to remove, up to 1000"
          }
        }
      },
      "CreateSuppressionRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "description": "Bare email address to block; stored normalized (lowercase)"
          },
          "origin": {
            "type": "string",
            "enum": [
              "bounce",
              "complaint",
              "manual"
            ],
            "description": "Origin recorded on rows this request creates (default manual): bounce, complaint or manual; an address already suppressed keeps its origin"
          }
        },
        "required": [
          "email"
        ]
      },
      "ListSuppressionsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "email": {
                  "type": "string"
                },
                "origin": {
                  "type": "string",
                  "enum": [
                    "bounce",
                    "complaint",
                    "manual"
                  ]
                },
                "source_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "Email id whose bounce/complaint created the entry"
                },
                "created_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "email",
                "origin",
                "source_id",
                "created_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "GetSuppressionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string"
          },
          "origin": {
            "type": "string",
            "enum": [
              "bounce",
              "complaint",
              "manual"
            ]
          },
          "source_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Email id whose bounce/complaint created the entry"
          },
          "created_at": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "suppression"
            ]
          }
        },
        "required": [
          "id",
          "email",
          "origin",
          "source_id",
          "created_at",
          "object"
        ]
      },
      "ListUnsubscribesResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "email": {
                  "type": "string",
                  "description": "The address; a tombstone for a recipient erased under GDPR/LGPD"
                },
                "domain_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "The domain the opt-out is for; null for the whole team, or once that domain was deleted"
                },
                "domain": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The domain's name; null for the whole team. A deleted domain's name stays, and its opt-outs apply again if the domain is added back"
                },
                "created_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "email",
                "domain_id",
                "domain",
                "created_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "UnsubscribeResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "description": "The address; a tombstone for a recipient erased under GDPR/LGPD"
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The domain the opt-out is for; null for the whole team, or once that domain was deleted"
          },
          "domain": {
            "type": [
              "string",
              "null"
            ],
            "description": "The domain's name; null for the whole team. A deleted domain's name stays, and its opt-outs apply again if the domain is added back"
          },
          "created_at": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "unsubscribe"
            ]
          }
        },
        "required": [
          "id",
          "email",
          "domain_id",
          "domain",
          "created_at",
          "object"
        ]
      },
      "CreateUnsubscribeRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "description": "Bare email address that opted out; stored normalized (lowercase)"
          },
          "domain_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "One of your domains: the address stops receiving marketing mail from it. Omitted or null: from every domain of the team"
          }
        },
        "required": [
          "email"
        ]
      },
      "RemoveUnsubscribeResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "unsubscribe"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "TemplateIdResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "template"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "CreateTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "subject": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 998,
            "description": "\"\" or null clears the subject"
          },
          "html": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500000,
            "description": "Stored as sent; the dashboard sanitizes at render"
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500000,
            "description": "\"\" or null clears the text part"
          },
          "alias": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
            "description": "Case-sensitive handle, unique per team; GET /templates/{alias} resolves it"
          },
          "from": {
            "type": [
              "string",
              "null"
            ],
            "description": "Not supported yet: any value is a 422"
          },
          "reply_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Not supported yet: any value is a 422"
          },
          "variables": {
            "type": "array",
            "items": {},
            "description": "Not supported yet: a non-empty list is a 422"
          }
        },
        "required": [
          "name",
          "html"
        ]
      },
      "ListTemplatesResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "alias": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "published"
                  ]
                },
                "published_at": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "alias",
                "status",
                "published_at",
                "created_at",
                "updated_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "GetTemplateResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "alias": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "published"
            ]
          },
          "published_at": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "template"
            ]
          },
          "current_version_id": {
            "type": "string",
            "format": "uuid"
          },
          "from": {
            "type": "null"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "reply_to": {
            "type": "null"
          },
          "html": {
            "type": "string"
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "variables": {
            "type": "array",
            "items": {},
            "description": "Always empty"
          },
          "has_unpublished_versions": {
            "type": "boolean",
            "enum": [
              false
            ]
          }
        },
        "required": [
          "id",
          "name",
          "alias",
          "status",
          "published_at",
          "created_at",
          "updated_at",
          "object",
          "current_version_id",
          "from",
          "subject",
          "reply_to",
          "html",
          "text",
          "variables",
          "has_unpublished_versions"
        ]
      },
      "UpdateTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "subject": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 998,
            "description": "\"\" or null clears the subject"
          },
          "html": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500000
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500000
          },
          "alias": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
            "description": "null clears the alias"
          },
          "from": {
            "type": [
              "string",
              "null"
            ],
            "description": "Not supported yet: any value is a 422"
          },
          "reply_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Not supported yet: any value is a 422"
          },
          "variables": {
            "type": "array",
            "items": {},
            "description": "Not supported yet: a non-empty list is a 422"
          }
        }
      },
      "RemoveTemplateResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "template"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "VerificationAvailabilityResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "verification_availability"
            ]
          },
          "paid_plan": {
            "type": "boolean",
            "description": "Deep verification is open to paid plans; Free has the basic checks only"
          },
          "available": {
            "type": "boolean",
            "description": "Whether deep verification can be started right now"
          },
          "price_per_1k_cents": {
            "type": "integer",
            "description": "What 1,000 verified addresses cost past the free credit, in cents"
          }
        },
        "required": [
          "object",
          "paid_plan",
          "available",
          "price_per_1k_cents"
        ]
      },
      "EstimateVerificationResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "verification_estimate"
            ]
          },
          "total": {
            "type": "integer",
            "description": "Contacts the target names"
          },
          "unverified": {
            "type": "integer",
            "description": "Of them, never verified: what a start would verify (verified ones are skipped)"
          },
          "in_run": {
            "type": "integer",
            "description": "Of the unverified, already being verified"
          },
          "grant_remaining": {
            "type": "integer",
            "description": "Free verification credit left this quota month, which a run uses first"
          },
          "estimated_cents": {
            "type": "integer",
            "description": "What verifying the unverified would cost past the credit, in cents"
          }
        },
        "required": [
          "object",
          "total",
          "unverified",
          "in_run",
          "grant_remaining",
          "estimated_cents"
        ]
      },
      "EstimateVerificationRequest": {
        "type": "object",
        "properties": {
          "target": {
            "$ref": "#/components/schemas/VerificationTarget"
          }
        },
        "required": [
          "target"
        ]
      },
      "VerificationTarget": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "contacts"
                ]
              },
              "contact_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                },
                "minItems": 1,
                "maxItems": 50000,
                "description": "Contacts of the team, by id"
              }
            },
            "required": [
              "kind",
              "contact_ids"
            ]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "segment"
                ]
              },
              "segment_id": {
                "type": "string",
                "format": "uuid",
                "description": "Every contact in this segment"
              }
            },
            "required": [
              "kind",
              "segment_id"
            ]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "broadcast"
                ]
              },
              "broadcast_id": {
                "type": "string",
                "format": "uuid",
                "description": "The broadcast's audience: the contacts it would mail, leaving out everyone who unsubscribed"
              }
            },
            "required": [
              "kind",
              "broadcast_id"
            ]
          }
        ]
      },
      "StartVerificationResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "verification_start"
            ]
          },
          "runs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "total": {
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "total"
              ]
            },
            "description": "The runs started, one per 50,000 contacts"
          },
          "contacts": {
            "type": "integer",
            "description": "Contacts that joined a run"
          },
          "already_verified": {
            "type": "integer",
            "description": "Contacts skipped because they were verified before (pass recheck to include them)"
          },
          "in_run": {
            "type": "integer",
            "description": "Contacts skipped because a run already holds them"
          }
        },
        "required": [
          "object",
          "runs",
          "contacts",
          "already_verified",
          "in_run"
        ]
      },
      "StartVerificationRequest": {
        "type": "object",
        "properties": {
          "target": {
            "$ref": "#/components/schemas/VerificationTarget"
          },
          "recheck": {
            "type": "boolean",
            "description": "Verify contacts verified before too; by default they are skipped"
          }
        },
        "required": [
          "target"
        ]
      },
      "ListVerificationsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "verification"
                  ]
                },
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "queued",
                    "submitted",
                    "completed",
                    "failed"
                  ],
                  "description": "queued, submitted (being verified), completed or failed"
                },
                "failure_reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "timeout",
                    "provider_failed",
                    "provider_rejected",
                    "results_unreadable",
                    "submit_failed",
                    null
                  ],
                  "description": "Why a failed run failed; nothing is billed for it"
                },
                "total": {
                  "type": "integer",
                  "description": "Contacts in the run"
                },
                "counts": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "additionalProperties": {
                    "type": "integer"
                  },
                  "description": "Results by verdict once the run completed"
                },
                "billable": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Addresses with a definite verdict, which is what is billed (unknown is free)"
                },
                "grant_used": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Of billable, covered by the free credit"
                },
                "metered": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Of billable, billed on the monthly invoice"
                },
                "created_at": {
                  "type": "string"
                },
                "finished_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "object",
                "id",
                "status",
                "failure_reason",
                "total",
                "counts",
                "billable",
                "grant_used",
                "metered",
                "created_at",
                "finished_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "VerificationRun": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "verification"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "submitted",
              "completed",
              "failed"
            ],
            "description": "queued, submitted (being verified), completed or failed"
          },
          "failure_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "timeout",
              "provider_failed",
              "provider_rejected",
              "results_unreadable",
              "submit_failed",
              null
            ],
            "description": "Why a failed run failed; nothing is billed for it"
          },
          "total": {
            "type": "integer",
            "description": "Contacts in the run"
          },
          "counts": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Results by verdict once the run completed"
          },
          "billable": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Addresses with a definite verdict, which is what is billed (unknown is free)"
          },
          "grant_used": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Of billable, covered by the free credit"
          },
          "metered": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Of billable, billed on the monthly invoice"
          },
          "created_at": {
            "type": "string"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "status",
          "failure_reason",
          "total",
          "counts",
          "billable",
          "grant_used",
          "metered",
          "created_at",
          "finished_at"
        ]
      },
      "UsageResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "usage"
            ]
          },
          "plan": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "free",
              "starter",
              "pro",
              "scale",
              null
            ],
            "description": "Effective plan; null on the instance's own (system) team"
          },
          "limits": {
            "type": "object",
            "properties": {
              "emails_per_day": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Daily cap (UTC day) on Free; null on monthly plans"
              },
              "emails_per_month": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Emails included per billing period on Starter, Pro and Scale; null on Free"
              },
              "domains": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "null = unlimited"
              },
              "contacts": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Contacts the team may hold; null = unlimited"
              },
              "inboxes": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Inboxes the team may hold at once; null = unlimited"
              },
              "webhook_endpoints": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Webhook endpoints the team may hold; null = unlimited"
              }
            },
            "required": [
              "emails_per_day",
              "emails_per_month",
              "domains",
              "contacts",
              "inboxes",
              "webhook_endpoints"
            ]
          },
          "today": {
            "type": "object",
            "properties": {
              "emails_sent": {
                "type": "integer",
                "description": "Emails accepted so far this UTC day"
              },
              "resets_at": {
                "type": "string",
                "description": "Next UTC midnight, when the daily counter resets"
              }
            },
            "required": [
              "emails_sent",
              "resets_at"
            ]
          },
          "period": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "emails_sent": {
                "type": "integer",
                "description": "Emails accepted so far this billing period"
              },
              "included": {
                "type": "integer",
                "description": "Emails the plan includes per period"
              },
              "overage_enabled": {
                "type": "boolean",
                "description": "Whether sends past `included` bill overage instead of being refused"
              },
              "overage_usd_per_1k": {
                "type": "number",
                "description": "Overage price per 1,000 emails, in USD"
              },
              "starts_at": {
                "type": "string",
                "description": "Billing period start"
              },
              "ends_at": {
                "type": "string",
                "description": "Billing period end, when the counter resets"
              }
            },
            "required": [
              "emails_sent",
              "included",
              "overage_enabled",
              "overage_usd_per_1k",
              "starts_at",
              "ends_at"
            ],
            "description": "Billing-period usage on monthly plans; null on daily plans"
          },
          "verification": {
            "type": "object",
            "properties": {
              "verified": {
                "type": "integer",
                "description": "Addresses deep verification gave a definite verdict this quota month"
              },
              "from_grant": {
                "type": "integer",
                "description": "Of them, covered by the free credit"
              },
              "metered": {
                "type": "integer",
                "description": "Of them, billed on the monthly invoice"
              },
              "cost_cents": {
                "type": "integer",
                "description": "What the billed addresses cost, in cents"
              },
              "price_per_1k_cents": {
                "type": "integer",
                "description": "Price per 1,000 verified addresses past the credit, in cents"
              }
            },
            "required": [
              "verified",
              "from_grant",
              "metered",
              "cost_cents",
              "price_per_1k_cents"
            ],
            "description": "Deep verification of contacts this quota month (POST /verifications)"
          },
          "team": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "app_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Dashboard origin, for building links; null when unset"
          }
        },
        "required": [
          "object",
          "plan",
          "limits",
          "today",
          "period",
          "verification",
          "team",
          "app_url"
        ]
      },
      "Inbox": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "email_address": {
            "type": "string"
          },
          "domain_id": {
            "type": "string",
            "format": "uuid",
            "description": "A shared address's is its team's shared subdomain: the GET /domains row with shared: true"
          },
          "receiving_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "unread": {
            "type": "integer",
            "description": "Threads with an unread message"
          },
          "drafts": {
            "type": "integer",
            "description": "Unsent drafts"
          },
          "last_received": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "agent",
              "human"
            ]
          },
          "shared": {
            "type": "boolean",
            "description": "On the shared inbox domain"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "quarantined": {
            "type": "integer",
            "description": "Held messages not yet released"
          },
          "pending_approval": {
            "type": "integer",
            "description": "Drafts waiting for a person"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "email_address",
          "domain_id",
          "receiving_address",
          "from_name",
          "unread",
          "drafts",
          "last_received",
          "created_at",
          "updated_at",
          "kind",
          "shared",
          "expires_at",
          "quarantined",
          "pending_approval"
        ]
      },
      "CreateInboxRequest": {
        "type": "object",
        "properties": {
          "email_address": {
            "type": "string",
            "description": "An address on one of your verified domains; it needs receiving on unless forwarding is true. BillionSend extension: omitted, the inbox gets an address on the shared inbox domain (no DNS), named by username or random, unless domain_id names one of your domains."
          },
          "domain_id": {
            "type": "string",
            "format": "uuid",
            "description": "BillionSend extension: the id of a GET /domains row, instead of email_address. The team's subdomain of the shared domain (the row with shared: true) is the same as leaving email_address out; one of your verified domains needs username, the part before the @."
          },
          "username": {
            "type": "string",
            "description": "BillionSend extension: with email_address omitted, the part before the @ of the shared-domain address, trimmed and lowercased: 1-64 letters, digits, dots, hyphens and underscores, starting and ending with a letter or digit, never cut short. Reserved names (postmaster, abuse, admin, security, support, noreply, no-reply, billing, hostmaster, webmaster, mailer-daemon, root, compared without dots, hyphens and underscores), the fwd- prefix and brand look-alikes answer 422, and one already in use 409. Where the instance reviews names, a chosen one is reviewed first: 503 with retry-after while that review is unavailable. Omitted: a random one. With a domain_id of one of your domains, it is the part before the @ there, required, under email_address's rule."
          },
          "name": {
            "type": "string",
            "description": "Internal name, 1-320 characters, so any address fits. Defaults to email_address."
          },
          "from_name": {
            "type": "string",
            "description": "The name recipients see, a plain name (not \"Name <email>\"); \"\" leaves it unset. On the shared domain it may not imitate a brand, and it is reviewed like username."
          },
          "forwarding": {
            "type": "boolean",
            "description": "Receive without an MX record: mail forwarded to the inbox's receiving_address lands in it"
          },
          "kind": {
            "type": "string",
            "enum": [
              "agent",
              "human"
            ],
            "description": "BillionSend extension: agent (default; threads, screening, drafts that wait for approval) or human (a team mailbox)"
          },
          "expires_in": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: a lifetime counted from now, \"1h\" to \"365d\"; omitted or null, the inbox never expires. A shared-domain inbox left unused for 90 days (no mail in or out, no API calls on it) is deleted either way."
          },
          "safety": {
            "$ref": "#/components/schemas/InboxSafetyPatch"
          }
        }
      },
      "InboxSafetyPatch": {
        "type": "object",
        "properties": {
          "accept_from": {
            "type": "string",
            "enum": [
              "anyone",
              "verified",
              "allowlist"
            ],
            "description": "Who may write in: anyone; verified (DMARC-aligned senders, known threads, the allowlist); allowlist only. Mail that fails is quarantined."
          },
          "allowlist": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 500,
            "description": "\"local@domain\" (exact) or \"*@domain\" (the domain and its subdomains). On the shared domain it only lets mail in"
          },
          "owner_addresses": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "description": "Owners besides the team members' login addresses; ignored on the shared domain"
          },
          "screening": {
            "type": "boolean",
            "description": "Score external mail for prompt injection (agent inboxes only)"
          },
          "extract_codes": {
            "type": "boolean",
            "description": "Expose extracted codes and sign-in links"
          },
          "send_policy": {
            "type": "string",
            "enum": [
              "reply_only",
              "allowlist",
              "open"
            ],
            "description": "What the inbox may send without a person's approval. On the shared domain \"allowlist\" answers 422, and so does \"open\" unless the instance lets the team start conversations there (paid plans only)"
          },
          "require_approval": {
            "type": "boolean",
            "description": "Every send waits for a person"
          },
          "private_codes": {
            "type": "boolean",
            "description": "Received codes and sign-in links can't be sent on to anyone but owners"
          },
          "send_cap": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unattended recipients per UTC day; null: no cap. 1-50 on the shared domain"
          },
          "forward_to": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 5,
            "description": "Forward every delivered message to these team member or owner addresses; team members only on the shared domain"
          }
        },
        "additionalProperties": false,
        "description": "BillionSend extension: safety rules over the kind's defaults"
      },
      "ListInboxesResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "email_address": {
                  "type": "string"
                },
                "from_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "unread": {
                  "type": "integer"
                },
                "last_received": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string"
                },
                "updated_at": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "agent",
                    "human"
                  ]
                },
                "shared": {
                  "type": "boolean"
                },
                "expires_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "email_address",
                "from_name",
                "unread",
                "last_received",
                "created_at",
                "updated_at",
                "kind",
                "shared",
                "expires_at"
              ]
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "UpdateInboxRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "from_name": {
            "type": "string",
            "description": "\"\" removes it. On the shared domain a new one may not imitate a brand, and it is reviewed first where the instance reviews names (503 with retry-after while that review is unavailable)."
          },
          "expires_in": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: a new lifetime counted from now, \"1h\" to \"365d\"; null never expires"
          }
        }
      },
      "RemoveInboxResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "InboxAgent": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_agent"
            ]
          },
          "instructions": {
            "type": "null"
          },
          "tone": {
            "type": "null"
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "draft_reply",
                "forward_thread",
                "add_labels",
                "assign_thread",
                "mark_as_spam",
                "archive",
                "move_to_trash"
              ]
            },
            "maxItems": 0
          }
        },
        "required": [
          "object",
          "instructions",
          "tone",
          "actions"
        ]
      },
      "InboxSafety": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_safety"
            ]
          },
          "inbox_id": {
            "type": "string",
            "format": "uuid"
          },
          "accept_from": {
            "type": "string",
            "enum": [
              "anyone",
              "verified",
              "allowlist"
            ],
            "description": "Who may write in: anyone; verified (DMARC-aligned senders, known threads, the allowlist); allowlist only. Mail that fails is quarantined."
          },
          "allowlist": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 500,
            "description": "\"local@domain\" (exact) or \"*@domain\" (the domain and its subdomains). On the shared domain it only lets mail in"
          },
          "owner_addresses": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "description": "Owners besides the team members' login addresses; ignored on the shared domain"
          },
          "screening": {
            "type": "boolean",
            "description": "Score external mail for prompt injection (agent inboxes only)"
          },
          "extract_codes": {
            "type": "boolean",
            "description": "Expose extracted codes and sign-in links"
          },
          "send_policy": {
            "type": "string",
            "enum": [
              "reply_only",
              "allowlist",
              "open"
            ],
            "description": "What the inbox may send without a person's approval. On the shared domain \"allowlist\" answers 422, and so does \"open\" unless the instance lets the team start conversations there (paid plans only)"
          },
          "require_approval": {
            "type": "boolean",
            "description": "Every send waits for a person"
          },
          "private_codes": {
            "type": "boolean",
            "description": "Received codes and sign-in links can't be sent on to anyone but owners"
          },
          "send_cap": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unattended recipients per UTC day; null: no cap. 1-50 on the shared domain"
          },
          "forward_to": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 5,
            "description": "Forward every delivered message to these team member or owner addresses; team members only on the shared domain"
          }
        },
        "required": [
          "object",
          "inbox_id",
          "accept_from",
          "allowlist",
          "owner_addresses",
          "screening",
          "extract_codes",
          "send_policy",
          "require_approval",
          "private_codes",
          "send_cap",
          "forward_to"
        ]
      },
      "ListInboxLabelsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "color": {
                  "type": "string",
                  "description": "Uppercase #RRGGBB"
                },
                "created_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "color",
                "created_at"
              ]
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "InboxLabel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "description": "Uppercase #RRGGBB"
          },
          "created_at": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "inbox_label"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "color",
          "created_at",
          "object"
        ]
      },
      "CreateInboxLabelRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "1-64 characters, unique in the inbox regardless of case"
          },
          "color": {
            "type": "string",
            "description": "#RRGGBB; a color is picked when omitted"
          }
        },
        "required": [
          "name"
        ]
      },
      "UpdateInboxLabelRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        }
      },
      "RemoveInboxLabelResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_label"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "SearchInboxThreadsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "subject": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "from": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "to": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "cc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "bcc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "labels": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      },
                      "color": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "color"
                    ]
                  }
                },
                "email_count": {
                  "type": "integer"
                },
                "has_attachment": {
                  "type": "boolean"
                },
                "has_draft": {
                  "type": "boolean"
                },
                "read": {
                  "type": "boolean"
                },
                "quarantined": {
                  "type": "integer",
                  "description": "BillionSend extension, with include_quarantined=true: messages in quarantine, not yet released; mail still being screened isn't counted. Held mail never counts as unread"
                },
                "received_at": {
                  "type": "string"
                },
                "folder": {
                  "type": "string",
                  "enum": [
                    "inbox",
                    "archive",
                    "spam",
                    "sent",
                    "trash"
                  ]
                },
                "matched_email_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "The thread's best-matching email"
                },
                "highlights": {
                  "type": "object",
                  "properties": {
                    "subject": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "from": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "to": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "cc": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "bcc": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "description": "Fragments with **match** markers; only keys that matched; {} without query, or when only the text or an attachment name matched"
                }
              },
              "required": [
                "id",
                "subject",
                "from",
                "to",
                "cc",
                "bcc",
                "labels",
                "email_count",
                "has_attachment",
                "has_draft",
                "read",
                "received_at",
                "folder",
                "matched_email_id",
                "highlights"
              ]
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "ListInboxThreadsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "subject": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "from": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "to": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "cc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "bcc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "labels": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      },
                      "color": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "color"
                    ]
                  }
                },
                "email_count": {
                  "type": "integer"
                },
                "has_attachment": {
                  "type": "boolean"
                },
                "has_draft": {
                  "type": "boolean"
                },
                "read": {
                  "type": "boolean"
                },
                "quarantined": {
                  "type": "integer",
                  "description": "BillionSend extension, with include_quarantined=true: messages in quarantine, not yet released; mail still being screened isn't counted. Held mail never counts as unread"
                },
                "received_at": {
                  "type": "string"
                },
                "folder": {
                  "type": "string",
                  "enum": [
                    "inbox",
                    "archive",
                    "spam",
                    "sent",
                    "trash"
                  ]
                }
              },
              "required": [
                "id",
                "subject",
                "from",
                "to",
                "cc",
                "bcc",
                "labels",
                "email_count",
                "has_attachment",
                "has_draft",
                "read",
                "received_at",
                "folder"
              ]
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "InboxThread": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_thread"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "folder": {
            "type": "string",
            "enum": [
              "inbox",
              "archive",
              "spam",
              "sent",
              "trash"
            ]
          },
          "labels": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "color": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "color"
              ]
            }
          },
          "read": {
            "type": "boolean"
          },
          "quarantined": {
            "type": "integer",
            "description": "BillionSend extension: held messages; 0 for inbox-scoped keys"
          }
        },
        "required": [
          "object",
          "id",
          "subject",
          "folder",
          "labels",
          "read",
          "quarantined"
        ]
      },
      "UpdateInboxThreadRequest": {
        "type": "object",
        "properties": {
          "read": {
            "type": "boolean",
            "description": "Marks every message read or unread"
          },
          "folder": {
            "type": "string",
            "enum": [
              "inbox",
              "archive",
              "spam",
              "trash"
            ],
            "description": "sent is assigned, never chosen"
          }
        }
      },
      "InboxThreadLabels": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "color": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name",
                "color"
              ]
            },
            "description": "Every label on the thread after the change"
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "AddInboxThreadLabelsRequest": {
        "type": "object",
        "properties": {
          "labels": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 10,
            "description": "1-10 label IDs of the inbox"
          }
        },
        "required": [
          "labels"
        ]
      },
      "SetInboxThreadLabelsRequest": {
        "type": "object",
        "properties": {
          "labels": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 100,
            "description": "Up to 100 label IDs of the inbox: exactly the labels the thread ends up with"
          }
        },
        "required": [
          "labels"
        ]
      },
      "RemoveInboxThreadResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_thread"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "ListInboxThreadEmailsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InboxThreadEmail"
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "InboxThreadEmail": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "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"
                }
              },
              "subject": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "html": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "attachments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "filename": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "size": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "filename",
                    "size"
                  ]
                }
              },
              "read": {
                "type": "boolean"
              },
              "received_at": {
                "type": "string"
              },
              "direction": {
                "type": "string",
                "enum": [
                  "inbound"
                ]
              },
              "extracted_text": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "BillionSend extension: hidden text, quotes and signature removed"
              },
              "screening": {
                "type": "object",
                "properties": {
                  "verdict": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "clean",
                      "suspicious",
                      "quarantined",
                      "released"
                    ]
                  },
                  "sender_trust": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "allowlisted",
                      "known_thread",
                      "external",
                      "unauthenticated",
                      "failed"
                    ]
                  },
                  "quarantine_reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "failed_auth",
                      "unauthenticated_sender",
                      "not_allowlisted",
                      "injection",
                      "phishing",
                      "virus",
                      "unscreened",
                      "screening_cap",
                      null
                    ]
                  },
                  "reasons": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "injection_score": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "phishing_score": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "hidden_text_removed": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "verdict",
                  "sender_trust",
                  "quarantine_reason",
                  "reasons",
                  "injection_score",
                  "phishing_score",
                  "hidden_text_removed"
                ]
              },
              "spam_verdict": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "pass",
                  "gray",
                  "fail",
                  null
                ]
              },
              "virus_verdict": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "pass",
                  "fail",
                  "processing_failed",
                  null
                ]
              }
            },
            "required": [
              "id",
              "from",
              "to",
              "cc",
              "bcc",
              "reply_to",
              "subject",
              "message_id",
              "html",
              "text",
              "attachments",
              "read",
              "received_at",
              "direction",
              "extracted_text",
              "screening",
              "spam_verdict",
              "virus_verdict"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "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"
                }
              },
              "subject": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "html": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "attachments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "filename": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "size": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "filename",
                    "size"
                  ]
                }
              },
              "read": {
                "type": "boolean"
              },
              "received_at": {
                "type": "string"
              },
              "direction": {
                "type": "string",
                "enum": [
                  "outbound"
                ]
              },
              "status": {
                "type": "string",
                "description": "BillionSend extension: the email's last event"
              }
            },
            "required": [
              "id",
              "from",
              "to",
              "cc",
              "bcc",
              "reply_to",
              "subject",
              "message_id",
              "html",
              "text",
              "attachments",
              "read",
              "received_at",
              "direction",
              "status"
            ]
          }
        ]
      },
      "ListQuarantinedEmailsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "thread_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "from": {
                  "type": "string"
                },
                "subject": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "received_at": {
                  "type": "string"
                },
                "quarantine_reason": {
                  "type": "string",
                  "enum": [
                    "failed_auth",
                    "unauthenticated_sender",
                    "not_allowlisted",
                    "injection",
                    "phishing",
                    "virus",
                    "unscreened",
                    "screening_cap"
                  ]
                },
                "sender_trust": {
                  "type": "string",
                  "enum": [
                    "owner",
                    "allowlisted",
                    "known_thread",
                    "external",
                    "unauthenticated",
                    "failed"
                  ]
                },
                "injection_score": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "phishing_score": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "virus_signature": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "thread_id",
                "from",
                "subject",
                "received_at",
                "quarantine_reason",
                "sender_trust",
                "injection_score",
                "phishing_score",
                "virus_signature"
              ]
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "InboxRelease": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_release"
            ]
          },
          "inbox_id": {
            "type": "string",
            "format": "uuid"
          },
          "email_id": {
            "type": "string",
            "format": "uuid"
          },
          "released_at": {
            "type": "string"
          },
          "trusted_sender": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "object",
          "inbox_id",
          "email_id",
          "released_at",
          "trusted_sender"
        ]
      },
      "ReleaseQuarantinedRequest": {
        "type": "object",
        "properties": {
          "trust_sender": {
            "type": "boolean",
            "description": "Also add the sender's address to the inbox allowlist"
          }
        }
      },
      "VerificationCode": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "verification_code"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "found",
              "none",
              "ambiguous",
              "timeout"
            ]
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "otp",
              "link",
              null
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "link_domain_matches_sender": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "email_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "received_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "sender_trust": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "owner",
              "allowlisted",
              "known_thread",
              "external",
              "unauthenticated",
              "failed",
              null
            ]
          }
        },
        "required": [
          "object",
          "status",
          "kind",
          "code",
          "url",
          "link_domain_matches_sender",
          "email_id",
          "from",
          "received_at",
          "sender_trust"
        ]
      },
      "InboxSentEmail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the sent email: GET /emails/{id} reads it"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: the thread the email was sent in"
          }
        },
        "required": [
          "id",
          "thread_id"
        ]
      },
      "InboxDraft": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_draft"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "standalone",
              "reply"
            ]
          },
          "to": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "reply_to_email_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "email_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "filename": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "filename",
                "content_type",
                "size"
              ]
            },
            "description": "The draft's files, by position; empty once it is sent, rejected or expired"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "pending_approval",
              "sent",
              "rejected",
              "expired"
            ]
          },
          "approval_reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "forward": {
            "type": "boolean"
          },
          "decided_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "send_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: when the scheduled send goes out; null when not scheduled"
          },
          "send_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: the error name of the last scheduled send that was refused (e.g. invalid_api_key, inbox_send_cap_reached, not_found); null otherwise"
          }
        },
        "required": [
          "object",
          "id",
          "type",
          "to",
          "cc",
          "bcc",
          "subject",
          "html",
          "text",
          "thread_id",
          "reply_to_email_id",
          "email_id",
          "created_at",
          "updated_at",
          "attachments",
          "status",
          "approval_reasons",
          "forward",
          "decided_by",
          "decided_at",
          "expires_at",
          "send_at",
          "send_error"
        ]
      },
      "InboxReplyRequest": {
        "type": "object",
        "properties": {
          "html": {
            "type": "string",
            "description": "HTML body"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body"
          },
          "subject": {
            "type": "string",
            "description": "1-2000 characters on one line; defaults to the thread subject with Re: or Fwd:"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Files with base64 `content` (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "reply_all": {
            "type": "boolean",
            "description": "Also copy the message's other recipients (cc), never its bcc"
          },
          "requires_approval": {
            "type": "boolean",
            "description": "BillionSend extension: hold the email as a draft that a person approves (202 with the Draft)"
          },
          "headers": {
            "description": "Not supported yet: only an empty value is accepted, anything else answers 422"
          }
        }
      },
      "InboxForwardRequest": {
        "type": "object",
        "properties": {
          "to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "html": {
            "type": "string",
            "description": "HTML body"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body"
          },
          "subject": {
            "type": "string",
            "description": "1-2000 characters on one line; defaults to the thread subject with Re: or Fwd:"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Files with base64 `content` (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft"
          },
          "requires_approval": {
            "type": "boolean",
            "description": "BillionSend extension: hold the email as a draft that a person approves (202 with the Draft)"
          },
          "headers": {
            "description": "Not supported yet: only an empty value is accepted, anything else answers 422"
          }
        },
        "required": [
          "to"
        ]
      },
      "InboxSendRequest": {
        "type": "object",
        "properties": {
          "to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "subject": {
            "type": "string",
            "description": "1-2000 characters on one line"
          },
          "html": {
            "type": "string",
            "description": "HTML body"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Files with base64 `content` (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft"
          },
          "headers": {
            "description": "Not supported yet: only an empty value is accepted, anything else answers 422"
          },
          "requires_approval": {
            "type": "boolean",
            "description": "BillionSend extension: hold the email as a draft that a person approves (202 with the Draft)"
          }
        },
        "required": [
          "to",
          "subject"
        ]
      },
      "CreateInboxDraftRequest": {
        "type": "object",
        "properties": {
          "to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              },
              {
                "type": "null"
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              },
              {
                "type": "null"
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              },
              {
                "type": "null"
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Files with base64 `content` (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft"
          },
          "send_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: send the draft at this time, as the caller, within 30 days: an ISO 8601 datetime with offset (e.g. \"2026-09-01T12:00:00Z\") or a relative time like \"in 2 hours\". A past time sends it within a minute; null cancels. The send runs every rule and limit then; a refused one leaves the draft unsent with send_error set and fires inbox.draft.send_failed. A draft waiting for approval cannot be scheduled (409)"
          },
          "thread_id": {
            "type": "string",
            "format": "uuid",
            "description": "With reply_to_email_id: a reply draft in this thread"
          },
          "reply_to_email_id": {
            "type": "string",
            "format": "uuid",
            "description": "The email of the thread the draft answers"
          }
        }
      },
      "ListInboxDraftsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "standalone",
                    "reply"
                  ]
                },
                "to": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  }
                },
                "cc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "bcc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "subject": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "snippet": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "thread_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "reply_to_email_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "updated_at": {
                  "type": "string"
                },
                "attachments": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "content_type": {
                        "type": "string"
                      },
                      "size": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "id",
                      "filename",
                      "content_type",
                      "size"
                    ]
                  }
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "draft",
                    "pending_approval",
                    "sent",
                    "rejected",
                    "expired"
                  ]
                },
                "approval_reasons": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "send_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "BillionSend extension: when the scheduled send goes out; null when not scheduled"
                },
                "send_error": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "BillionSend extension: the error name of the last scheduled send that was refused (e.g. invalid_api_key, inbox_send_cap_reached, not_found); null otherwise"
                }
              },
              "required": [
                "id",
                "type",
                "to",
                "cc",
                "bcc",
                "subject",
                "snippet",
                "thread_id",
                "reply_to_email_id",
                "updated_at",
                "attachments",
                "status",
                "approval_reasons",
                "send_at",
                "send_error"
              ]
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "UpdateInboxDraftRequest": {
        "type": "object",
        "properties": {
          "to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              },
              {
                "type": "null"
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              },
              {
                "type": "null"
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              },
              {
                "type": "null"
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Files with base64 `content` (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft"
          },
          "send_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: send the draft at this time, as the caller, within 30 days: an ISO 8601 datetime with offset (e.g. \"2026-09-01T12:00:00Z\") or a relative time like \"in 2 hours\". A past time sends it within a minute; null cancels. The send runs every rule and limit then; a refused one leaves the draft unsent with send_error set and fires inbox.draft.send_failed. A draft waiting for approval cannot be scheduled (409)"
          }
        }
      },
      "DeleteInboxDraftResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "inbox_draft"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "ReceivedEmailSendResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "inbox_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id",
          "thread_id",
          "inbox_id"
        ]
      },
      "ReceivedEmailReplyRequest": {
        "type": "object",
        "properties": {
          "html": {
            "type": "string",
            "description": "HTML body"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body"
          },
          "subject": {
            "type": "string",
            "description": "1-2000 characters on one line; defaults to the thread subject with Re: or Fwd:"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Files with base64 `content` (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "reply_all": {
            "type": "boolean",
            "description": "Also copy the message's other recipients (cc), never its bcc"
          },
          "requires_approval": {
            "type": "boolean",
            "description": "BillionSend extension: hold the email as a draft that a person approves (202 with the Draft)"
          },
          "from": {
            "type": "string",
            "description": "Sender on a verified team domain; defaults to the inbox address the email reached, else the first address it was received for"
          },
          "inbox_id": {
            "type": "string",
            "format": "uuid",
            "description": "The inbox to answer from, among those the email reached"
          }
        }
      },
      "ReceivedEmailForwardRequest": {
        "type": "object",
        "properties": {
          "to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 50
              }
            ],
            "description": "An address or a list of them; \"Name <address>\" works too"
          },
          "html": {
            "type": "string",
            "description": "HTML body"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body"
          },
          "subject": {
            "type": "string",
            "description": "1-2000 characters on one line; defaults to the thread subject with Re: or Fwd:"
          },
          "attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Files with base64 `content` (no remote paths), 10 MiB decoded in all; none on the shared domain. A held send keeps them with its draft"
          },
          "requires_approval": {
            "type": "boolean",
            "description": "BillionSend extension: hold the email as a draft that a person approves (202 with the Draft)"
          },
          "from": {
            "type": "string",
            "description": "Sender on a verified team domain; defaults to the inbox address the email reached, else the first address it was received for"
          },
          "inbox_id": {
            "type": "string",
            "format": "uuid",
            "description": "The inbox to answer from, among those the email reached"
          },
          "mode": {
            "type": "string",
            "enum": [
              "inline",
              "attachment"
            ],
            "description": "inline (default) quotes the original under the note; attachment sends it as forwarded_message.eml"
          }
        },
        "required": [
          "to"
        ]
      },
      "AgentSignupResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "agent_signup"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "unclaimed"
            ]
          },
          "api_key": {
            "type": "string",
            "description": "An inbox-scoped key for the inbox below. Shown once; store it now."
          },
          "inbox": {
            "$ref": "#/components/schemas/Inbox"
          },
          "claim": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "description": "Where the claim link was sent"
              },
              "expires_at": {
                "type": "string",
                "description": "When the account deletes itself if nobody claimed it, as ISO 8601"
              }
            },
            "required": [
              "email",
              "expires_at"
            ]
          },
          "limits": {
            "type": "object",
            "properties": {
              "receive_only": {
                "type": "boolean"
              },
              "inboxes": {
                "type": "integer"
              },
              "emails_per_day": {
                "type": "integer"
              },
              "received_per_day": {
                "type": "integer",
                "description": "Emails the account may receive per UTC day; past it the sender is told to retry"
              },
              "received_per_inbox_per_hour": {
                "type": "integer",
                "description": "Emails the inbox may receive per rolling hour; past it the sender is told to retry"
              }
            },
            "required": [
              "receive_only",
              "inboxes",
              "emails_per_day",
              "received_per_day",
              "received_per_inbox_per_hour"
            ],
            "description": "What the account may do while nobody has claimed it"
          }
        },
        "required": [
          "object",
          "status",
          "api_key",
          "inbox",
          "claim",
          "limits"
        ]
      },
      "AgentSignupRequest": {
        "type": "object",
        "properties": {
          "human_email": {
            "type": "string",
            "minLength": 3,
            "maxLength": 254,
            "description": "The person behind the agent. The claim link goes to this address and nowhere else. A disposable-email address, or one on a BillionSend domain, answers 422; at most 3 unclaimed accounts wait on one address."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "The agent's name, at most 60 characters, a plain name (no @, links or phone numbers). It becomes the account's name until a person renames it. A brand look-alike answers 422."
          },
          "username": {
            "type": "string",
            "maxLength": 64,
            "description": "The part before the @ of the inbox address, under the same rules as POST /inboxes (reserved names and brand look-alikes answer 422, a name in use 409). Omitted: a random one."
          }
        },
        "required": [
          "human_email",
          "name"
        ]
      },
      "AgentAccountStatus": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "agent_account"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "unclaimed",
              "claimed"
            ]
          },
          "claim": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "expires_at": {
                "type": "string"
              },
              "mails_left": {
                "type": "integer",
                "description": "How many more times the claim link can be sent again"
              }
            },
            "required": [
              "expires_at",
              "mails_left"
            ],
            "description": "Set while the account is unclaimed"
          },
          "limits": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "receive_only": {
                "type": "boolean"
              },
              "inboxes": {
                "type": "integer"
              },
              "emails_per_day": {
                "type": "integer"
              },
              "received_per_day": {
                "type": "integer",
                "description": "Emails the account may receive per UTC day; past it the sender is told to retry"
              },
              "received_per_inbox_per_hour": {
                "type": "integer",
                "description": "Emails the inbox may receive per rolling hour; past it the sender is told to retry"
              }
            },
            "required": [
              "receive_only",
              "inboxes",
              "emails_per_day",
              "received_per_day",
              "received_per_inbox_per_hour"
            ],
            "description": "Set while the account is unclaimed"
          }
        },
        "required": [
          "object",
          "status",
          "claim",
          "limits"
        ]
      },
      "AgentClaimEmail": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "claim_email"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued"
            ]
          }
        },
        "required": [
          "object",
          "status"
        ]
      },
      "SendEmailResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "id"
        ]
      },
      "SendEmailRequest": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "description": "Sender, \"Name <user@domain>\" or bare address; the domain must be verified for the team",
            "example": "Acme <onboarding@acme.dev>"
          },
          "to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "Recipient address or list of up to 50",
            "example": [
              "success@simulator.amazonses.com"
            ]
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 998,
            "description": "Subject line"
          },
          "html": {
            "type": "string",
            "description": "HTML body; at least one of html/text is required"
          },
          "text": {
            "type": "string",
            "description": "Plain-text body; at least one of html/text is required"
          },
          "cc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "Cc address or list"
          },
          "bcc": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "Bcc address or list"
          },
          "reply_to": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "maxItems": 50
              }
            ],
            "description": "Reply-To address or list"
          },
          "scheduled_at": {
            "type": "string",
            "description": "Deliver later: ISO 8601 with offset, or relative like \"in 2 hours\" (an ISO 8601 datetime with offset (e.g. \"2026-09-01T12:00:00Z\") or a relative time like \"in 5 mins\", \"in 2 hours\", or \"in 1 day\"); max 30 days ahead"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value"
              ]
            },
            "description": "Key/value labels attached to the email for filtering; names starting with billionsend_, in any letter case, are reserved"
          },
          "topic_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Topic id: recipients opted out of the topic are skipped; a send to one address that is a contact also gets that contact's unsubscribe link. A topic bound to a domain (domain_id) can be sent only from that domain (422 otherwise)"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "content": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 255,
                  "description": "Inline part: the HTML shows it with <img src=\"cid:<content_id>\">"
                },
                "path": {
                  "type": "string"
                }
              }
            },
            "description": "Attachments with base64 content (no remote paths)"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Extra message headers (transport headers are rejected)"
          },
          "template": {
            "description": "Not supported: any value is a 422; an email takes html and/or text"
          }
        },
        "required": [
          "from",
          "to",
          "subject"
        ]
      },
      "BatchEmailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "required": [
                "id"
              ]
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "index",
                "message"
              ]
            }
          }
        },
        "required": [
          "data"
        ]
      },
      "BatchEmailRequest": {
        "type": "array",
        "items": {
          "allOf": [
            {
              "$ref": "#/components/schemas/SendEmailRequest"
            }
          ]
        },
        "minItems": 1,
        "maxItems": 100
      },
      "CancelEmailResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "UpdateEmailResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "object",
          "id"
        ]
      },
      "UpdateEmailRequest": {
        "type": "object",
        "properties": {
          "scheduled_at": {
            "type": "string"
          }
        },
        "required": [
          "scheduled_at"
        ]
      },
      "ListReceivedEmailsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "to": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "from": {
                  "type": "string",
                  "description": "Bare address from the From header; the display name is in headers.from"
                },
                "created_at": {
                  "type": "string"
                },
                "subject": {
                  "type": "string"
                },
                "bcc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "cc": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "reply_to": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "received_for": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The team's envelope recipients: the addresses the message was delivered to here"
                },
                "message_id": {
                  "type": "string"
                },
                "attachments": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "filename": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "content_type": {
                        "type": "string"
                      },
                      "content_id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "content_disposition": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "size": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "id",
                      "filename",
                      "content_type",
                      "content_id",
                      "content_disposition",
                      "size"
                    ]
                  }
                },
                "inbox_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "BillionSend extension: the inbox this read is about (an inbox-scoped key's own, the inbox_id filter's, else the oldest inbox the email reached); null for mail no inbox took"
                },
                "thread_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "BillionSend extension: that inbox's thread"
                },
                "inboxes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "inbox_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "thread_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "verdict": {
                        "type": "string",
                        "enum": [
                          "pending",
                          "clean",
                          "suspicious",
                          "quarantined",
                          "released"
                        ]
                      }
                    },
                    "required": [
                      "inbox_id",
                      "thread_id",
                      "verdict"
                    ]
                  },
                  "description": "BillionSend extension, full access keys only: every inbox the email reached and its screening verdict there"
                },
                "spam_verdict": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "pass",
                    "gray",
                    "fail",
                    null
                  ],
                  "description": "BillionSend extension: the local spam score's verdict; null for mail from before it existed"
                },
                "virus_verdict": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "pass",
                    "fail",
                    "processing_failed",
                    null
                  ],
                  "description": "BillionSend extension: clamd's verdict (fail blocks every download for good); null when nothing scanned it"
                },
                "read": {
                  "type": "boolean",
                  "description": "BillionSend extension, with an inbox in context: whether that inbox marked it read"
                },
                "screening": {
                  "type": "object",
                  "properties": {
                    "verdict": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "clean",
                        "suspicious",
                        "quarantined",
                        "released"
                      ]
                    },
                    "sender_trust": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "allowlisted",
                        "known_thread",
                        "external",
                        "unauthenticated",
                        "failed"
                      ]
                    }
                  },
                  "required": [
                    "verdict",
                    "sender_trust"
                  ],
                  "description": "BillionSend extension: the screening verdict and the sender's trust tier"
                },
                "extracted": {
                  "type": "object",
                  "properties": {
                    "kinds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "code",
                          "link"
                        ]
                      }
                    }
                  },
                  "required": [
                    "kinds"
                  ],
                  "description": "BillionSend extension: whether a verification code or sign-in link was found; the values come with GET of one email"
                }
              },
              "required": [
                "id",
                "to",
                "from",
                "created_at",
                "subject",
                "bcc",
                "cc",
                "reply_to",
                "received_for",
                "message_id",
                "attachments",
                "inbox_id",
                "thread_id",
                "spam_verdict",
                "virus_verdict",
                "screening",
                "extracted"
              ]
            }
          },
          "held": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "inbox_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "quarantined"
                  ]
                },
                "quarantine_reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "failed_auth",
                    "unauthenticated_sender",
                    "not_allowlisted",
                    "injection",
                    "phishing",
                    "virus",
                    "unscreened",
                    "screening_cap",
                    null
                  ]
                },
                "created_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "inbox_id",
                "reason",
                "quarantine_reason",
                "created_at"
              ]
            },
            "description": "BillionSend extension, with wait only: matching mail that arrived but is held (being screened or quarantined), ids and why only"
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "GetReceivedEmailResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "from": {
            "type": "string",
            "description": "Bare address from the From header; the display name is in headers.from"
          },
          "created_at": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reply_to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "received_for": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The team's envelope recipients: the addresses the message was delivered to here"
          },
          "message_id": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "filename": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "content_type": {
                  "type": "string"
                },
                "content_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "content_disposition": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "size": {
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "filename",
                "content_type",
                "content_id",
                "content_disposition",
                "size"
              ]
            }
          },
          "inbox_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: the inbox this read is about (an inbox-scoped key's own, the inbox_id filter's, else the oldest inbox the email reached); null for mail no inbox took"
          },
          "thread_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "BillionSend extension: that inbox's thread"
          },
          "inboxes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "inbox_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "thread_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "verdict": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "clean",
                    "suspicious",
                    "quarantined",
                    "released"
                  ]
                }
              },
              "required": [
                "inbox_id",
                "thread_id",
                "verdict"
              ]
            },
            "description": "BillionSend extension, full access keys only: every inbox the email reached and its screening verdict there"
          },
          "spam_verdict": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pass",
              "gray",
              "fail",
              null
            ],
            "description": "BillionSend extension: the local spam score's verdict; null for mail from before it existed"
          },
          "virus_verdict": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pass",
              "fail",
              "processing_failed",
              null
            ],
            "description": "BillionSend extension: clamd's verdict (fail blocks every download for good); null when nothing scanned it"
          },
          "read": {
            "type": "boolean",
            "description": "BillionSend extension, with an inbox in context: whether that inbox marked it read"
          },
          "screening": {
            "type": "object",
            "properties": {
              "verdict": {
                "type": "string",
                "enum": [
                  "pending",
                  "clean",
                  "suspicious",
                  "quarantined",
                  "released"
                ]
              },
              "sender_trust": {
                "type": "string",
                "enum": [
                  "owner",
                  "allowlisted",
                  "known_thread",
                  "external",
                  "unauthenticated",
                  "failed"
                ]
              },
              "quarantine_reason": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "failed_auth",
                  "unauthenticated_sender",
                  "not_allowlisted",
                  "injection",
                  "phishing",
                  "virus",
                  "unscreened",
                  "screening_cap",
                  null
                ]
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "injection_score": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "phishing_score": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "hidden_text_removed": {
                "type": "boolean"
              }
            },
            "required": [
              "verdict",
              "sender_trust",
              "quarantine_reason",
              "reasons",
              "injection_score",
              "phishing_score",
              "hidden_text_removed"
            ],
            "description": "BillionSend extension: the screening verdict, the sender's trust tier, why it was held, the inbound judge's reasons and scores (0-100), and whether hidden text was removed from what agents read"
          },
          "spam_score": {
            "type": [
              "integer",
              "null"
            ],
            "description": "BillionSend extension: the local spam score, 0-100"
          },
          "virus_signature": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: clamd's signature name when it failed"
          },
          "extracted_text": {
            "type": [
              "string",
              "null"
            ],
            "description": "BillionSend extension: what a person sees of the reply, as text with light markdown: hidden text, invisible characters, quoted history and signature taken out. null once the content retention removed it"
          },
          "extracted": {
            "type": "object",
            "properties": {
              "kinds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "code",
                    "link"
                  ]
                }
              },
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "link": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "link_domain_matches_sender": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "ambiguous": {
                "type": "boolean"
              }
            },
            "required": [
              "kinds",
              "code",
              "link",
              "link_domain_matches_sender",
              "ambiguous"
            ],
            "description": "BillionSend extension: the verification code or sign-in link, served only from delivered mail of a sender that did not fail authentication, in an inbox that extracts codes. Links are never fetched."
          },
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "html_format": {
            "type": "string",
            "enum": [
              "data_uri",
              "cid"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "headers": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "string"
            },
            "description": "Top-level headers, lowercase names; a repeated header's values joined by newlines"
          },
          "authentication": {
            "type": "object",
            "properties": {
              "spf": {
                "type": "string"
              },
              "dkim": {
                "type": "string"
              },
              "dmarc": {
                "type": "string"
              }
            },
            "required": [
              "spf",
              "dkim",
              "dmarc"
            ],
            "description": "pass, fail, gray, processing_failed or unknown, checked when the message arrived"
          },
          "raw": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "download_url": {
                "type": "string"
              },
              "expires_at": {
                "type": "string"
              }
            },
            "required": [
              "download_url",
              "expires_at"
            ],
            "description": "The original RFC 822 message: a signed link valid for one hour that needs no API key. null once the content retention period removed the message."
          }
        },
        "required": [
          "id",
          "to",
          "from",
          "created_at",
          "subject",
          "bcc",
          "cc",
          "reply_to",
          "received_for",
          "message_id",
          "attachments",
          "inbox_id",
          "thread_id",
          "spam_verdict",
          "virus_verdict",
          "screening",
          "spam_score",
          "virus_signature",
          "extracted_text",
          "extracted",
          "object",
          "html",
          "html_format",
          "text",
          "headers",
          "authentication",
          "raw"
        ]
      },
      "DeleteReceivedEmailResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      },
      "ListReceivedAttachmentsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "has_more": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "filename": {
                  "type": "string"
                },
                "size": {
                  "type": "integer"
                },
                "content_type": {
                  "type": "string"
                },
                "content_disposition": {
                  "type": "string",
                  "enum": [
                    "inline",
                    "attachment"
                  ]
                },
                "content_id": {
                  "type": "string"
                },
                "download_url": {
                  "type": "string",
                  "description": "Signed link to the file's bytes, valid for one hour; it needs no API key"
                },
                "expires_at": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "size",
                "content_type",
                "content_disposition",
                "download_url",
                "expires_at"
              ]
            }
          }
        },
        "required": [
          "object",
          "has_more",
          "data"
        ]
      },
      "GetReceivedAttachmentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "filename": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "content_type": {
            "type": "string"
          },
          "content_disposition": {
            "type": "string",
            "enum": [
              "inline",
              "attachment"
            ]
          },
          "content_id": {
            "type": "string"
          },
          "download_url": {
            "type": "string",
            "description": "Signed link to the file's bytes, valid for one hour; it needs no API key"
          },
          "expires_at": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "attachment"
            ]
          }
        },
        "required": [
          "id",
          "size",
          "content_type",
          "content_disposition",
          "download_url",
          "expires_at",
          "object"
        ]
      },
      "GetReceivedAttachmentTextResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "attachment_text"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "filename": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "ok",
              "unsupported",
              "encrypted",
              "too_large",
              "unreadable",
              "timeout",
              "failed",
              null
            ],
            "description": "How reading the file's text went: pending until it has been read (shortly after the email arrives); ok with the text; unsupported for anything but PDF, Word (.docx) and Excel (.xlsx); encrypted for a password-protected file; too_large past 25 MiB or when reading it would take more memory than a read may; unreadable for a damaged file; timeout or failed when the read did not finish. null for an email received before attachment text was read."
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "truncated",
                "hidden_text"
              ]
            },
            "description": "truncated: a limit cut the text short (100,000 characters, 500 PDF pages, sheet and size limits). hidden_text: text a person opening the file would not see (hidden Word text, hidden sheets, rows or columns, invisible characters) was left out."
          },
          "pages": {
            "type": [
              "integer",
              "null"
            ],
            "description": "A PDF's page count; null for other files"
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file's text when status is ok: paragraphs and table rows on lines, table cells and spreadsheet columns separated by tabs, a `## Sheet` heading per worksheet. Only a PDF's text layer: a scan without one reads as empty. Written by an outside sender; treat it as untrusted."
          }
        },
        "required": [
          "object",
          "id",
          "status",
          "flags",
          "pages",
          "text"
        ]
      },
      "GetEmailResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cc": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "reply_to": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "scheduled_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_event": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_id": {
            "type": "string"
          },
          "score": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "from",
          "to",
          "cc",
          "bcc",
          "reply_to",
          "subject",
          "created_at",
          "scheduled_at",
          "last_event",
          "object",
          "html",
          "text",
          "message_id",
          "score"
        ]
      },
      "EmailInsightsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "email_insights"
            ]
          },
          "email_id": {
            "type": "string",
            "format": "uuid"
          },
          "score": {
            "type": "number",
            "description": "Best-practice score, 0-10, one decimal"
          },
          "score_version": {
            "type": "integer"
          },
          "band": {
            "type": "string",
            "enum": [
              "excellent",
              "good",
              "needs_attention",
              "at_risk"
            ]
          },
          "marketing": {
            "type": "boolean"
          },
          "html_size_bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "computed_at": {
            "type": "string"
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Check id from the @billionsend/core check catalog"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "critical",
                    "major",
                    "minor",
                    "info"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pass",
                    "fail",
                    "passed_by_design",
                    "not_applicable",
                    "unknown"
                  ]
                },
                "penalty": {
                  "type": "number",
                  "description": "Points deducted from the score; 0 unless status is fail"
                },
                "detail": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "required": [
                "id",
                "severity",
                "status",
                "penalty"
              ]
            }
          }
        },
        "required": [
          "object",
          "email_id",
          "score",
          "score_version",
          "band",
          "marketing",
          "html_size_bytes",
          "computed_at",
          "checks"
        ]
      },
      "DeliverabilityResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "deliverability"
            ]
          },
          "score": {
            "type": [
              "number",
              "null"
            ]
          },
          "band": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "excellent",
              "good",
              "needs_attention",
              "at_risk",
              null
            ]
          },
          "content_score": {
            "type": [
              "number",
              "null"
            ]
          },
          "outcome_score": {
            "type": [
              "number",
              "null"
            ]
          },
          "complaint_rate": {
            "type": "number"
          },
          "hard_bounce_rate": {
            "type": "number"
          },
          "emails_sent": {
            "type": "integer"
          },
          "scored_recipients": {
            "type": "integer"
          },
          "window_days": {
            "type": "integer"
          },
          "insufficient_outcome_data": {
            "type": "boolean"
          },
          "guardrail_status": {
            "type": "string",
            "enum": [
              "ok",
              "warning",
              "paused"
            ]
          },
          "score_version": {
            "type": "integer"
          }
        },
        "required": [
          "object",
          "score",
          "band",
          "content_score",
          "outcome_score",
          "complaint_rate",
          "hard_bounce_rate",
          "emails_sent",
          "scored_recipients",
          "window_days",
          "insufficient_outcome_data",
          "guardrail_status",
          "score_version"
        ]
      },
      "ListEmailsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "cc": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  }
                },
                "bcc": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  }
                },
                "reply_to": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  }
                },
                "subject": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string"
                },
                "scheduled_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_event": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "from",
                "to",
                "cc",
                "bcc",
                "reply_to",
                "subject",
                "created_at",
                "scheduled_at",
                "last_event"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ]
      },
      "RemoveEmailResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "email"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "deleted": {
            "type": "boolean",
            "enum": [
              true
            ]
          }
        },
        "required": [
          "object",
          "id",
          "deleted"
        ]
      }
    },
    "parameters": {},
    "headers": {
      "RequestId": {
        "description": "The request's id (a UUID), the id of its row on the dashboard's Logs page; quote it when asking about a request",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A BillionSend API key (`bs_…`)."
      }
    }
  },
  "paths": {
    "/emails/metrics": {
      "get": {
        "operationId": "emails.metrics",
        "summary": "Get email metrics",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "start_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "end_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "timezone",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "hourly",
                "daily",
                "weekly",
                "monthly"
              ]
            },
            "required": false,
            "name": "granularity",
            "in": "query"
          },
          {
            "schema": {
              "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"
                ]
              }
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "metrics",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "period",
                  "domain",
                  "email",
                  "broadcast"
                ]
              }
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "dimensions",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "domain_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "email_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "broadcast_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Email metrics for the range, as totals and, when dimensions are given, one row per combination. Counts come from statistics written within seconds of the events; `received` is the accepted-for-sending count and is left out of answers scoped or broken down by domain, broadcast or email. Rates are percentages. Counts cover whole UTC hours: `start_date` is floored to its hour, the whole hour of `end_date` counts, and the response shows the start used. Dates before 1970 read as 1970. `timezone` must be an IANA name such as `Europe/Berlin` or `UTC`, not a UTC offset. `sent` counts recipients, like `delivered`, `bounced` and `complained`, so the rates stay at or under 100%. `email` rows list up to 1,000 emails created in the range when no email_id is given. A key held to one domain always reads that domain only.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "metrics"
                      ]
                    },
                    "start_date": {
                      "type": "string"
                    },
                    "end_date": {
                      "type": "string"
                    },
                    "metrics": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "dimensions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "granularity": {
                      "type": "string",
                      "enum": [
                        "hourly",
                        "daily",
                        "weekly",
                        "monthly"
                      ]
                    },
                    "totals": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  },
                  "required": [
                    "object",
                    "start_date",
                    "end_date",
                    "metrics",
                    "dimensions",
                    "granularity",
                    "totals"
                  ]
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key: a sending_access key, or a key held to one domain that named another domain in domain_id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The statistics store is not answering; sending is unaffected. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/metrics/links": {
      "get": {
        "operationId": "emails.metrics.links",
        "summary": "Get clicks by link",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "start_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "end_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "domain_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "broadcast_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Links to list, 1-100 (default 20)"
            },
            "required": false,
            "description": "Links to list, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Clicks in the range by the link that was clicked, most clicked first (BillionSend extension). A link is counted as its scheme, host and path: the query string and fragment are left out, so a link personalised per recipient is one row. `clicked` counts people; `bot_clicked` counts fetches by machines such as security scanners and link previews. Counts cover whole UTC hours like GET /emails/metrics, and clicks are counted by link from 2026-11-16 on. A key held to one domain always reads that domain only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkClicksResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key: a sending_access key, or a key held to one domain that named another domain in domain_id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The statistics store is not answering; sending is unaffected. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/metrics/countries": {
      "get": {
        "operationId": "emails.metrics.countries",
        "summary": "Get opens and clicks by country",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "start_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "end_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "domain_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "broadcast_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Opens and clicks in the range by the country the reader's address is registered in, most engaged first (BillionSend extension). `country` is an ISO 3166-1 alpha-2 code, or `unknown` when the address cannot be placed or the fetch came through a mail provider's image proxy (Gmail, Yahoo, Apple Mail Privacy Protection), whose address is the provider's, not the reader's. Only the country is kept, never the address. People's opens and clicks are counted apart from machines' (`bot_opened`, `bot_clicked`). Counts cover whole UTC hours like GET /emails/metrics, and opens and clicks are counted by country from 2026-11-16 on. IP geolocation by DB-IP (db-ip.com), CC BY 4.0. A key held to one domain always reads that domain only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountryEngagementResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key: a sending_access key, or a key held to one domain that named another domain in domain_id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The statistics store is not answering; sending is unaffected. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/metrics/clients": {
      "get": {
        "operationId": "emails.metrics.clients",
        "summary": "Get opens by mail client",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "start_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "end_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "domain_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 100
            },
            "required": false,
            "style": "form",
            "explode": false,
            "name": "broadcast_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Opens in the range by the mail client that fetched the message's images, most opened first (BillionSend extension). `client` is one of `gmail`, `apple_mail`, `outlook`, `yahoo`, `thunderbird`, `other` (a web browser, which webmail and clients without markers look like) or `unknown` (no user agent). Clicks are not counted by client: a click arrives from the browser the client hands the link to. Only the client is kept, never the user agent. Counts cover whole UTC hours like GET /emails/metrics, and opens are counted by client from 2026-11-16 on. A key held to one domain always reads that domain only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientEngagementResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key: a sending_access key, or a key held to one domain that named another domain in domain_id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The statistics store is not answering; sending is unaffected. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/contacts": {
      "post": {
        "operationId": "contacts.create",
        "summary": "Create a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Plan limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Unknown segment or topic",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Contact already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      },
      "get": {
        "operationId": "contacts.list",
        "summary": "List contacts",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated facets attached to every item — `properties` (the {type, value} map GET /contacts/{id} returns) and `topics` (the rows GET /contacts/{id}/topics returns). Omitted, each item has only the contact fields."
            },
            "required": false,
            "description": "Comma-separated facets attached to every item — `properties` (the {type, value} map GET /contacts/{id} returns) and `topics` (the rows GET /contacts/{id}/topics returns). Omitted, each item has only the contact fields.",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Contacts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContactsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/contacts/batch/get": {
      "post": {
        "operationId": "contacts.batch.get",
        "summary": "Read contacts in bulk",
        "description": "BillionSend extension: returns up to 1000 contacts by id or by email address in one request, in request order, optionally with their properties and topic subscriptions. Entries that match no contact are listed under `missing` instead of failing the call. One call counts as one request against the rate limit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchGetContactsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The contacts found, and the entries that matched none",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchGetContactsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/contacts/batch/remove": {
      "post": {
        "operationId": "contacts.batch.remove",
        "summary": "Delete in bulk",
        "description": "Deletes up to 1000 contacts by id or by email address in one request and lists the rows actually deleted; unknown ids or addresses are skipped. Emails stay in the log; `erase: true` also scrubs each address from email history, event payloads and API logs, like DELETE /contacts/{id}?erase=true.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRemoveContactsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The contacts that were deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchRemoveContactsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/contacts/batch": {
      "post": {
        "operationId": "contacts.batch.create",
        "summary": "Create in bulk",
        "description": "Creates up to 1000 contacts in one request. Each item is a CreateContactRequest. `on_conflict` decides what happens to an email that already belongs to a contact — `error` (default), `skip`, or `upsert`. An upsert updates `first_name`/`last_name` only when provided, merges `properties` (provided keys overwrite), adds `segments` and upserts `topics`. `unsubscribed: true` opts the contact out; `unsubscribed: false` on an already unsubscribed contact is ignored — a batch never re-subscribes anyone, that stays an explicit PATCH /contacts/{id}. The `x-batch-validation` header picks strict (default, all-or-nothing) or permissive (valid subset written, failures listed in `errors`).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "error",
                "skip",
                "upsert"
              ],
              "default": "error",
              "description": "What to do with an item whose email (case-insensitive) already belongs to a contact: `error` fails the item, `skip` leaves the contact untouched and reports its id, `upsert` merges the item into it. Also decides how an email repeated inside the batch is handled: `error` fails the later occurrence, `skip` keeps the first, `upsert` collapses them into one write (later scalar fields win, associations are unioned)."
            },
            "required": false,
            "description": "What to do with an item whose email (case-insensitive) already belongs to a contact: `error` fails the item, `skip` leaves the contact untouched and reports its id, `upsert` merges the item into it. Also decides how an email repeated inside the batch is handled: `error` fails the later occurrence, `skip` keeps the first, `upsert` collapses them into one write (later scalar fields win, associations are unioned).",
            "name": "on_conflict",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "strict",
                "permissive"
              ],
              "description": "`strict` (default): any invalid item rejects the whole batch with that item's status and a `contacts.{index}: ` message prefix, writing nothing. `permissive`: invalid items are listed in `errors` and the valid subset is written."
            },
            "required": false,
            "description": "`strict` (default): any invalid item rejects the whole batch with that item's status and a `contacts.{index}: ` message prefix, writing nothing. `permissive`: invalid items are listed in `errors` and the valid subset is written.",
            "name": "x-batch-validation",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchContactsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch processed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchContactsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Plan limit reached (strict mode)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Unknown segment or topic (strict mode)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Contact already exists (strict mode, on_conflict=error)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/contacts/{id}": {
      "get": {
        "operationId": "contacts.get",
        "summary": "Retrieve a contact",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetContactResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      },
      "patch": {
        "operationId": "contacts.update",
        "summary": "Update a contact",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "An agent acting for a role below owner and admin tried to lift the recipient's own whole-team opt-out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      },
      "delete": {
        "operationId": "contacts.delete",
        "summary": "Delete a contact",
        "description": "Deletes the contact and its segment memberships. Its emails stay in the log; pass `erase=true` to also scrub the address from email history, event payloads and API logs.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "BillionSend extension. `true` also erases the address from email history, event payloads and API logs (a GDPR/LGPD erasure); by default the send log is kept and ages out with the team's retention window"
            },
            "required": false,
            "description": "BillionSend extension. `true` also erases the address from email history, event payloads and API logs (a GDPR/LGPD erasure); by default the send log is kept and ages out with the team's retention window",
            "name": "erase",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveContactResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/contacts/{id}/preferences-link": {
      "post": {
        "operationId": "contacts.preferencesLink",
        "summary": "Get a preferences link",
        "description": "BillionSend extension. Returns the contact's hosted preferences URL, so a product settings screen can deep-link into it. The page lists the team's unbound public topics and carries the team-wide unsubscribe, in the team's default look: the link belongs to no domain. The link is a signed, contact-scoped capability with no expiry: anyone holding it can change that contact's preferences, so hand it only to the contact.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact's preference page URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPreferencesLinkResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "APP_BASE_URL or the encryption key is not configured",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/contacts/{id}/topics": {
      "get": {
        "operationId": "contacts.topics.list",
        "summary": "List contact topics",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Every topic of the team with the contact's effective subscription and whether it was chosen explicitly",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContactTopicsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      },
      "patch": {
        "operationId": "contacts.topics.update",
        "summary": "Update contact topics",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactTopicsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact topic subscriptions updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateContactTopicsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/contacts/{id}/segments/{segmentId}": {
      "post": {
        "operationId": "contacts.segments.add",
        "summary": "Add to a segment",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "segmentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact added to the segment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddContactSegmentResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      },
      "delete": {
        "operationId": "contacts.segments.remove",
        "summary": "Leave a segment",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "segmentId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact removed from the segment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveContactSegmentResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contacts"
        ]
      }
    },
    "/audiences/{audienceId}/contacts": {
      "post": {
        "operationId": "audiences.contacts.create",
        "summary": "Create a contact",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "audienceId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact created in the audience",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Plan limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Contact already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Audiences"
        ]
      }
    },
    "/audiences/{audienceId}/contacts/{id}": {
      "get": {
        "operationId": "audiences.contacts.get",
        "summary": "Retrieve a contact",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "audienceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetContactResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Audiences"
        ]
      },
      "patch": {
        "operationId": "audiences.contacts.update",
        "summary": "Update a contact",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "audienceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "An agent acting for a role below owner and admin tried to lift the recipient's own whole-team opt-out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Audiences"
        ]
      },
      "delete": {
        "operationId": "audiences.contacts.delete",
        "summary": "Delete a contact",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "audienceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "BillionSend extension. `true` also erases the address from email history, event payloads and API logs (a GDPR/LGPD erasure); by default the send log is kept and ages out with the team's retention window"
            },
            "required": false,
            "description": "BillionSend extension. `true` also erases the address from email history, event payloads and API logs (a GDPR/LGPD erasure); by default the send log is kept and ages out with the team's retention window",
            "name": "erase",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveContactResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Audiences"
        ]
      }
    },
    "/contact-properties": {
      "post": {
        "operationId": "contactProperties.create",
        "summary": "Create a property",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactPropertyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact property created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetContactPropertyResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Property already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contact properties"
        ]
      },
      "get": {
        "operationId": "contactProperties.list",
        "summary": "List properties",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact properties",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContactPropertiesResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contact properties"
        ]
      }
    },
    "/contact-properties/{id}": {
      "get": {
        "operationId": "contactProperties.get",
        "summary": "Retrieve a property",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact property",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetContactPropertyResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contact properties"
        ]
      },
      "patch": {
        "operationId": "contactProperties.update",
        "summary": "Update a property",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateContactPropertyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact property updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactPropertyIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contact properties"
        ]
      },
      "delete": {
        "operationId": "contactProperties.delete",
        "summary": "Delete a property",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Contact property deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveContactPropertyResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Contact properties"
        ]
      }
    },
    "/segments": {
      "post": {
        "operationId": "segments.create",
        "summary": "Create a segment",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSegmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Segment created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "A key held to one domain bound this to another domain, or unbound it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, or a domain_id that is not one of your domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Segments"
        ]
      },
      "get": {
        "operationId": "segments.list",
        "summary": "List segments",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Segments",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSegmentsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Segments"
        ]
      }
    },
    "/segments/{id}": {
      "get": {
        "operationId": "segments.get",
        "summary": "Retrieve a segment",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Segment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSegmentResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Segments"
        ]
      },
      "patch": {
        "operationId": "segments.update",
        "summary": "Update a segment",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSegmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Segment updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SegmentResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "A key held to one domain bound this to another domain, or unbound it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, or a domain_id that is not one of your domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Segments"
        ]
      },
      "delete": {
        "operationId": "segments.delete",
        "summary": "Delete a segment",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Segment deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveSegmentResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Segment is in use",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Segments"
        ]
      }
    },
    "/segments/{id}/contacts": {
      "get": {
        "operationId": "segments.contacts.list",
        "summary": "List segment contacts",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated facets attached to every item — `properties` (the {type, value} map GET /contacts/{id} returns) and `topics` (the rows GET /contacts/{id}/topics returns). Omitted, each item has only the contact fields."
            },
            "required": false,
            "description": "Comma-separated facets attached to every item — `properties` (the {type, value} map GET /contacts/{id} returns) and `topics` (the rows GET /contacts/{id}/topics returns). Omitted, each item has only the contact fields.",
            "name": "include",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Contacts the segment resolves to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListContactsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Segments"
        ]
      }
    },
    "/broadcasts": {
      "post": {
        "operationId": "broadcasts.create",
        "summary": "Create a broadcast",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBroadcastRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Broadcast created (and scheduled when send: true)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendBroadcastResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Broadcast state conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, sending paused, or a From on the shared inbox domain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      },
      "get": {
        "operationId": "broadcasts.list",
        "summary": "List broadcasts",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcasts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListBroadcastsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      }
    },
    "/broadcasts/{id}": {
      "get": {
        "operationId": "broadcasts.get",
        "summary": "Retrieve a broadcast",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetBroadcastResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      },
      "patch": {
        "operationId": "broadcasts.update",
        "summary": "Update a broadcast",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateBroadcastRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Broadcast updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BroadcastIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Not a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      },
      "delete": {
        "operationId": "broadcasts.delete",
        "summary": "Delete a broadcast",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveBroadcastResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Not a draft, or a failed broadcast that already wrote emails",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      }
    },
    "/broadcasts/{id}/send": {
      "post": {
        "operationId": "broadcasts.send",
        "summary": "Send a broadcast",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendBroadcastRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Broadcast scheduled; finishes_at and warning say when it goes out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendBroadcastResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Not a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Sending paused, or a From on the shared inbox domain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      }
    },
    "/broadcasts/{id}/duplicate": {
      "post": {
        "operationId": "broadcasts.duplicate",
        "summary": "Duplicate a broadcast",
        "description": "Copy any broadcast, whatever its status, into a new draft named \"<name> (copy)\": audience, sender, subject, reply-to, preview text and content come along; schedule, send times and counts do not.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The new draft's id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DuplicateBroadcastResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      }
    },
    "/broadcasts/{id}/cancel": {
      "post": {
        "operationId": "broadcasts.cancel",
        "summary": "Cancel a broadcast",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast canceled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelBroadcastResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Not queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Broadcasts"
        ]
      }
    },
    "/topics": {
      "post": {
        "operationId": "topics.create",
        "summary": "Create a topic",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTopicRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Topic created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "A key held to one domain bound this to another domain, or unbound it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, or a domain_id that is not one of your domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Topics"
        ]
      },
      "get": {
        "operationId": "topics.list",
        "summary": "List topics",
        "responses": {
          "200": {
            "description": "Topics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTopicsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Topics"
        ]
      }
    },
    "/topics/{id}": {
      "get": {
        "operationId": "topics.get",
        "summary": "Retrieve a topic",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Topic",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Topics"
        ]
      },
      "patch": {
        "operationId": "topics.update",
        "summary": "Update a topic",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTopicRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Topic updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TopicIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "A key held to one domain bound this to another domain, or unbound it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, or a domain_id that is not one of your domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Topics"
        ]
      },
      "delete": {
        "operationId": "topics.delete",
        "summary": "Delete a topic",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Topic deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveTopicResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Topic is in use",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Topics"
        ]
      }
    },
    "/domains": {
      "post": {
        "operationId": "domains.create",
        "summary": "Create a domain",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDomainRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Domain created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateDomainResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Plan domain limit reached, an own tracking or unsubscribe subdomain needs a paid plan, or the key is held to one domain (it cannot create domains)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Domain already added",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many domains created recently, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Domains"
        ]
      },
      "get": {
        "operationId": "domains.list",
        "summary": "List domains",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones. The team's subdomain of the shared domain, when it has one, is the last row (`shared: true`).",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDomainsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Domains"
        ]
      }
    },
    "/domains/{id}": {
      "get": {
        "operationId": "domains.get",
        "summary": "Retrieve a domain",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Domain with its DNS records; the team's shared subdomain has none (records: [])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDomainResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found, or a domain other than the one the calling key is held to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Domains"
        ]
      },
      "patch": {
        "operationId": "domains.update",
        "summary": "Update a domain",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDomainRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Domain updated; full object with records",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDomainResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Catch-all receiving or an own tracking / unsubscribe subdomain needs a paid plan, or the team's subdomain of the shared domain, which is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found, or a domain other than the one the calling key is held to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Another team receives mail for this domain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Domains"
        ]
      },
      "delete": {
        "operationId": "domains.delete",
        "summary": "Delete a domain",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Domain deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveDomainResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Team suspended, not available for this team, or the team's subdomain of the shared domain, which is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found, or a domain other than the one the calling key is held to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Topics or segments are bound to the domain, or a scheduled or sending broadcast uses it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Domains"
        ]
      }
    },
    "/domains/{id}/verify": {
      "post": {
        "operationId": "domains.verify",
        "summary": "Verify a domain",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Verification result: the domain with per-record status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDomainResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "The team's subdomain of the shared domain, which is read-only",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found, or a domain other than the one the calling key is held to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Domains"
        ]
      }
    },
    "/api-keys": {
      "post": {
        "operationId": "apiKeys.create",
        "summary": "Create an API key",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API key created; the token is returned only here",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateApiKeyResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key: a sending_access key, an inbox-scoped key, or a domain_id outside the calling key's domain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "API keys"
        ]
      },
      "get": {
        "operationId": "apiKeys.list",
        "summary": "List API keys",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones. A key held to one domain lists only the keys held to that same domain.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "API keys (never tokens)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListApiKeysResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "API keys"
        ]
      }
    },
    "/api-keys/{id}": {
      "delete": {
        "operationId": "apiKeys.delete",
        "summary": "Delete an API key",
        "description": "A key held to one domain deletes only keys held to that same domain; any other key is not found.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "API key revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveApiKeyResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "API keys"
        ]
      }
    },
    "/webhooks": {
      "post": {
        "operationId": "webhooks.create",
        "summary": "Create a webhook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook created; signing_secret is also retrievable via GET /webhooks/{id}",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateWebhookResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Plan webhook endpoint limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Webhooks"
        ]
      },
      "get": {
        "operationId": "webhooks.list",
        "summary": "List webhooks",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhooks (list rows never carry the signing secret)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWebhooksResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/webhooks/{id}": {
      "get": {
        "operationId": "webhooks.get",
        "summary": "Retrieve a webhook",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook, including its signing secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetWebhookResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Webhooks"
        ]
      },
      "patch": {
        "operationId": "webhooks.update",
        "summary": "Update a webhook",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Webhooks"
        ]
      },
      "delete": {
        "operationId": "webhooks.delete",
        "summary": "Delete a webhook",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveWebhookResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/webhooks/{id}/rotate": {
      "post": {
        "operationId": "webhooks.rotate",
        "summary": "Rotate signing secret",
        "description": "BillionSend extension. Mints a new signing secret (or takes the one in signing_secret) and returns it. For overlap_hours the previous secret keeps signing too: every delivery in that window carries both signatures, space-separated in webhook-signature, so the receiver can switch at any point without a gap. A second rotation inside the window replaces the previous secret.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateWebhookSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new secret and when the previous one stops signing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateWebhookSecretResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/suppressions/batch/add": {
      "post": {
        "operationId": "suppressions.batch.add",
        "summary": "Add in bulk",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchAddSuppressionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One entry per distinct address (case-insensitive) in input order; addresses already suppressed return their existing id and keep their origin. New rows record the request's origin (bounce, complaint or manual; default manual). Accepts up to 1000 addresses.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchAddSuppressionsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Suppressions"
        ]
      }
    },
    "/suppressions/batch/remove": {
      "post": {
        "operationId": "suppressions.batch.remove",
        "summary": "Remove in bulk",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRemoveSuppressionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exactly one of emails or ids (up to 1000 each); lists only the rows actually removed. Rows whose address was erased (GDPR/LGPD) keep blocking sends but are hidden from the list and from lookups by email; they are reachable by id only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchRemoveSuppressionsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Suppressions"
        ]
      }
    },
    "/suppressions": {
      "post": {
        "operationId": "suppressions.create",
        "summary": "Add a suppression",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSuppressionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Address blocked with the given origin (bounce, complaint or manual; default manual). Idempotent: an address already suppressed keeps its entry and origin and its existing id is returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuppressionIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Suppressions"
        ]
      },
      "get": {
        "operationId": "suppressions.list",
        "summary": "List suppressions",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "bounce",
                "complaint",
                "manual"
              ],
              "description": "Only suppressions of this origin: bounce, complaint or manual"
            },
            "required": false,
            "description": "Only suppressions of this origin: bounce, complaint or manual",
            "name": "origin",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Suppressions, optionally filtered by origin (bounce, complaint or manual). Rows whose address was erased (GDPR/LGPD) keep blocking sends but are hidden from the list and from lookups by email; they are reachable by id only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSuppressionsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Suppressions"
        ]
      }
    },
    "/suppressions/{id}": {
      "get": {
        "operationId": "suppressions.get",
        "summary": "Retrieve a suppression",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Suppression by id or by email address. Rows whose address was erased (GDPR/LGPD) keep blocking sends but are hidden from the list and from lookups by email; they are reachable by id only. An erased row reports \"[erased]\" as its email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSuppressionResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Suppressions"
        ]
      },
      "delete": {
        "operationId": "suppressions.delete",
        "summary": "Remove a suppression",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Suppression removed, by id or by email address; the address can receive mail again. Rows whose address was erased (GDPR/LGPD) keep blocking sends but are hidden from the list and from lookups by email; they are reachable by id only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveSuppressionResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Suppressions"
        ]
      }
    },
    "/unsubscribes": {
      "get": {
        "operationId": "unsubscribes.list",
        "summary": "List unsubscribes",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Only opt-outs from this domain (one of your domains); omitted lists every opt-out of the team, whole-team ones included"
            },
            "required": false,
            "description": "Only opt-outs from this domain (one of your domains); omitted lists every opt-out of the team, whole-team ones included",
            "name": "domain_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Opt-outs, newest first, optionally of one domain (domain_id). A row with domain null opts the address out of every domain of the team. Rows whose address was erased (GDPR/LGPD) keep blocking marketing mail but are hidden from the list; they are reachable by id only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListUnsubscribesResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "A key held to one domain asked for another domain's opt-outs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Unsubscribes"
        ]
      },
      "post": {
        "operationId": "unsubscribes.create",
        "summary": "Record an unsubscribe",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUnsubscribeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The address now stops receiving marketing mail from the domain (domain_id) or from every domain of the team (domain_id omitted or null). Idempotent: an opt-out that already exists is returned as it is, with its original created_at.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnsubscribeResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "A key held to one domain recorded an opt-out for another domain or for the whole team",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, or a domain_id that is not one of your domains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Unsubscribes"
        ]
      }
    },
    "/unsubscribes/{id}": {
      "delete": {
        "operationId": "unsubscribes.delete",
        "summary": "Delete an unsubscribe",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Opt-out removed: the address can receive marketing mail from that domain again (a team-wide opt-out lifts for every domain). Rows whose address was erased (GDPR/LGPD) keep blocking marketing mail but are hidden from the list; they are reachable by id only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveUnsubscribeResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Unsubscribes"
        ]
      }
    },
    "/templates": {
      "post": {
        "operationId": "templates.create",
        "summary": "Create a template",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Template created. Templates have no draft/publish cycle: every save is live, so status is always published.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Alias already in use",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, including from/reply_to/variables (not supported yet)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      },
      "get": {
        "operationId": "templates.list",
        "summary": "List templates",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Templates",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTemplatesResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      }
    },
    "/templates/{id}": {
      "get": {
        "operationId": "templates.get",
        "summary": "Retrieve a template",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Template id or alias"
            },
            "required": true,
            "description": "Template id or alias",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Template by id or alias. Templates have no draft/publish cycle: every save is live, so status is always published. from, reply_to and variables are not supported yet and read as null, null and [].",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTemplateResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      },
      "patch": {
        "operationId": "templates.update",
        "summary": "Update a template",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Template id or alias"
            },
            "required": true,
            "description": "Template id or alias",
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTemplateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Template updated (live immediately)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Alias already in use",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, including from/reply_to/variables (not supported yet)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      },
      "delete": {
        "operationId": "templates.delete",
        "summary": "Delete a template",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Template id or alias"
            },
            "required": true,
            "description": "Template id or alias",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Template deleted. Broadcasts keep their own copy of the content.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveTemplateResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      }
    },
    "/templates/{id}/publish": {
      "post": {
        "operationId": "templates.publish",
        "summary": "Publish a template",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Template id or alias"
            },
            "required": true,
            "description": "Template id or alias",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "No-op kept for SDK compatibility. Templates have no draft/publish cycle: every save is live, so status is always published.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      }
    },
    "/templates/{id}/duplicate": {
      "post": {
        "operationId": "templates.duplicate",
        "summary": "Duplicate a template",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Template id or alias"
            },
            "required": true,
            "description": "Template id or alias",
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Copy named \"<name> (copy)\" with no alias; returns the new template id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateIdResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Templates"
        ]
      }
    },
    "/verifications/availability": {
      "get": {
        "operationId": "verifications.availability",
        "summary": "Check verification availability",
        "responses": {
          "200": {
            "description": "Whether the team may start deep verification, and its price",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationAvailabilityResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Verifications"
        ]
      }
    },
    "/verifications/estimate": {
      "post": {
        "operationId": "verifications.estimate",
        "summary": "Estimate a verification",
        "description": "How many of the target's contacts were never verified and what verifying them would cost. Changes nothing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EstimateVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The counts and the estimated cost",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateVerificationResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "The segment or broadcast is not one of the team's",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Verifications"
        ]
      }
    },
    "/verifications": {
      "post": {
        "operationId": "verifications.create",
        "summary": "Start a verification",
        "description": "Starts deep verification of the target's contacts, one run per 50,000 of them. Contacts verified before are skipped unless recheck is true, and a contact already being verified never joins a second run. Paid plans only; billed per verified address on the monthly invoice.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartVerificationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The runs started",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartVerificationResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "The team is on the Free plan (plan_limit_reached)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "The segment or broadcast is not one of the team's",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Nothing left to verify, too many contacts at once, or a validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Deep verification is not available right now",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Verifications"
        ]
      },
      "get": {
        "operationId": "verifications.list",
        "summary": "List verifications",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The team's verification runs, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListVerificationsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Verifications"
        ]
      }
    },
    "/verifications/{id}": {
      "get": {
        "operationId": "verifications.get",
        "summary": "Retrieve a verification",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "One verification run: its status, and its results once completed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationRun"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Verifications"
        ]
      }
    },
    "/usage": {
      "get": {
        "operationId": "usage.get",
        "summary": "Get usage",
        "responses": {
          "200": {
            "description": "Effective plan, its send, domain, contact, inbox and webhook endpoint limits, today's accepted send count (UTC day), on a monthly plan the billing period's usage, and this quota month's deep verification. BillionSend extension; plan, limits and period are null on the instance's own (system) team.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Usage"
        ]
      }
    },
    "/inboxes/events": {
      "get": {
        "operationId": "inboxes.events.stream",
        "summary": "Stream inbox events",
        "description": "BillionSend extension: a server-sent event stream of every inbox event of the team, named like the webhook events (inbox.email.received, inbox.thread.created, email.received, …; types narrows them), each carrying the webhook payload's data. Send the key as a Bearer header; the stream stays open, and a client that reconnects with Last-Event-ID resumes without losing events. Needs a team-wide key: a key held to one domain streams one inbox at a time. An agent (an inbox-scoped key, or an MCP connection) never receives the events about held mail (inbox.email.quarantined), replay included, and naming them in types is a 403. A stream closes within a few seconds once its key is revoked, its person leaves the team or its inbox is gone; it is also closed every ten minutes or so, and the client reconnects with Last-Event-ID. Streams are capped per key and per team on each API process (429 too_many_streams).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated event names to receive (inbox.email.received, email.received, and the other inbox.* webhook events); every inbox event when omitted"
            },
            "required": false,
            "description": "Comma-separated event names to receive (inbox.email.received, email.received, and the other inbox.* webhook events); every inbox event when omitted",
            "name": "types",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The id of the last event the client saw, for clients that cannot set the Last-Event-ID header; the header wins when both are sent"
            },
            "required": false,
            "description": "The id of the last event the client saw, for clients that cannot set the Last-Event-ID header; the header wins when both are sent",
            "name": "last_event_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "An event stream that stays open. A client that reconnects with Last-Event-ID gets the events it missed (up to 24 hours back, then a stream.gap event) before the live ones",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events: id (the position to resume from), event (the webhook event name) and data (a JSON object with type, created_at, inbox_id and the webhook's data); comment lines keep the connection open"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "A key held to one domain or one inbox, or an agent naming an event about held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many streams open, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/events": {
      "get": {
        "operationId": "inboxes.events.streamInbox",
        "summary": "Stream one inbox's events",
        "description": "BillionSend extension: the event stream of one inbox, as GET /inboxes/events, ending when the inbox is deleted or expires; it carries inbox.deleted and inbox.expired whatever types names. An inbox-scoped key may stream its own inbox, without the events about held mail.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated event names to receive (inbox.email.received, email.received, and the other inbox.* webhook events); every inbox event when omitted"
            },
            "required": false,
            "description": "Comma-separated event names to receive (inbox.email.received, email.received, and the other inbox.* webhook events); every inbox event when omitted",
            "name": "types",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The id of the last event the client saw, for clients that cannot set the Last-Event-ID header; the header wins when both are sent"
            },
            "required": false,
            "description": "The id of the last event the client saw, for clients that cannot set the Last-Event-ID header; the header wins when both are sent",
            "name": "last_event_id",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "An event stream that stays open. A client that reconnects with Last-Event-ID gets the events it missed (up to 24 hours back, then a stream.gap event) before the live ones",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events: id (the position to resume from), event (the webhook event name) and data (a JSON object with type, created_at, inbox_id and the webhook's data); comment lines keep the connection open"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "An agent naming an event about held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many streams open, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes": {
      "post": {
        "operationId": "inboxes.create",
        "summary": "Create an inbox",
        "description": "An address that receives into threads, on one of your verified domains (receiving on, or forwarding: true) or, with email_address omitted, an address on the shared inbox domain that needs no DNS: username names it, or it is random. domain_id takes a row of GET /domains instead of email_address: the team's shared subdomain, or one of your domains with username. It never expires unless expires_in says so. Returns the full inbox. BillionSend extensions: username, domain_id, kind (agent by default), expires_in and safety.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInboxRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Inbox created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Inbox"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "The plan's inbox limit, or a restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "The address is already used by an inbox",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many inboxes created in the last hour, or too many names reviewed or refused on the shared domain today, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "503": {
            "description": "A chosen username or from_name on the shared domain can't be reviewed right now, or the team's subdomain on the shared domain is still waiting for its name review; retry-after says when to try again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "get": {
        "operationId": "inboxes.list",
        "summary": "List inboxes",
        "description": "The team's inboxes, newest first (`after` pages toward older ones). An inbox-scoped key lists only its inbox.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "agent",
                "human"
              ],
              "description": "BillionSend extension: agent or human inboxes only"
            },
            "required": false,
            "description": "BillionSend extension: agent or human inboxes only",
            "name": "kind",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Inboxes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInboxesResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Pagination cursor not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}": {
      "get": {
        "operationId": "inboxes.get",
        "summary": "Retrieve an inbox",
        "description": "By id, or by its email address (case-insensitive). An expired inbox is not found.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Inbox",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Inbox"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "patch": {
        "operationId": "inboxes.update",
        "summary": "Update an inbox",
        "description": "Its name or from_name; BillionSend extension: expires_in, a new lifetime counted from now. On a shared-domain inbox a new from_name is reviewed first (503 while that review is unavailable). Returns the full inbox.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateInboxRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Inbox updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Inbox"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many names reviewed or refused on the shared domain today, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "503": {
            "description": "A new from_name on the shared domain can't be reviewed right now; retry-after says when to try again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "delete": {
        "operationId": "inboxes.delete",
        "summary": "Delete an inbox",
        "description": "Its threads, drafts, labels and the messages only it received go with it, and its address stops receiving. Its inbox-scoped API keys are revoked. Needs the owner, admin or developer role, or a full access team key.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Inbox deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveInboxResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key or role",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/agent": {
      "get": {
        "operationId": "inboxes.agent.get",
        "summary": "Get agent settings",
        "description": "Hosted-agent settings. BillionSend runs no agent of its own, so an inbox never has one.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "No hosted agent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxAgent"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/safety": {
      "get": {
        "operationId": "inboxes.safety.get",
        "summary": "Get safety rules",
        "description": "BillionSend extension: who may write in, screening, code extraction, what the inbox may send and where it forwards.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Safety rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxSafety"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "patch": {
        "operationId": "inboxes.safety.update",
        "summary": "Update safety rules",
        "description": "BillionSend extension: any subset of the rules, merged over the stored ones. Needs the owner, admin or developer role, or a full access team key; inbox-scoped keys and MCP can't change them.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InboxSafetyPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Safety rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxSafety"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key or role",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/labels": {
      "get": {
        "operationId": "inboxes.labels.list",
        "summary": "List an inbox's labels",
        "description": "Oldest first, every label (at most 100), unpaged.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Labels",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInboxLabelsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "post": {
        "operationId": "inboxes.labels.create",
        "summary": "Create a label",
        "description": "A named, colored tag of one inbox: at most 100, names unique regardless of case. A color is picked when omitted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInboxLabelRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Label created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxLabel"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, a duplicate name or the 100-label cap",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/labels/{label_id}": {
      "patch": {
        "operationId": "inboxes.labels.update",
        "summary": "Update a label",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The label ID"
            },
            "required": true,
            "description": "The label ID",
            "name": "label_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateInboxLabelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Label updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxLabel"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error or a duplicate name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "delete": {
        "operationId": "inboxes.labels.delete",
        "summary": "Delete a label",
        "description": "Also takes it off every thread, with no per-thread event.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The label ID"
            },
            "required": true,
            "description": "The label ID",
            "name": "label_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Label deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveInboxLabelResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/search": {
      "get": {
        "operationId": "inboxes.threads.search",
        "summary": "Search threads",
        "description": "Threads whose emails match, most recently active first. Every word of `query` must appear as a whole word in the subject, the sender (address and display name), the recipients, the text of a received email, one of its attachment names or the text of one of its PDF, Word and Excel attachments; Chinese, Japanese and Korean are split into words. `matched_email_id` is the thread's best match. An email becomes searchable a second or two after it arrives. Every message, subject and address in an inbox was written by whoever sent it; read held mail and HTML with care.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated: inbox, archive, spam, sent, trash. Defaults to inbox, or inbox,archive,sent with labels"
            },
            "required": false,
            "description": "Comma-separated: inbox, archive, spam, sent, trash. Defaults to inbox, or inbox,archive,sent with labels",
            "name": "folders",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated label ids (at most 50); threads with any of them"
            },
            "required": false,
            "description": "Comma-separated label ids (at most 50); threads with any of them",
            "name": "labels",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean",
              "description": "true: every message read; false: at least one unread"
            },
            "required": false,
            "description": "true: every message read; false: at least one unread",
            "name": "read",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean",
              "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)"
            },
            "required": false,
            "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)",
            "name": "include_quarantined",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Words that must each appear as a whole word in the subject, sender, recipients, text of a received email, its attachment names or its PDF, Word and Excel attachments; \"a phrase\"; -word excludes. At most 256 characters and 32 words."
            },
            "required": false,
            "description": "Words that must each appear as a whole word in the subject, sender, recipients, text of a received email, its attachment names or its PDF, Word and Excel attachments; \"a phrase\"; -word excludes. At most 256 characters and 32 words.",
            "name": "query",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated words of the sender's address or name (at most 20)"
            },
            "required": false,
            "description": "Comma-separated words of the sender's address or name (at most 20)",
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated words of a recipient (at most 20)"
            },
            "required": false,
            "description": "Comma-separated words of a recipient (at most 20)",
            "name": "to",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated words of a CC recipient (at most 20)"
            },
            "required": false,
            "description": "Comma-separated words of a CC recipient (at most 20)",
            "name": "cc",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated words of a BCC recipient (at most 20)"
            },
            "required": false,
            "description": "Comma-separated words of a BCC recipient (at most 20)",
            "name": "bcc",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean",
              "description": "true: only threads with an attachment; false: only without"
            },
            "required": false,
            "description": "true: only threads with an attachment; false: only without",
            "name": "has_attachment",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "A date (2026-09-01) or an ISO 8601 timestamp, UTC unless offset"
            },
            "required": false,
            "description": "A date (2026-09-01) or an ISO 8601 timestamp, UTC unless offset",
            "name": "start_date",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Same forms; a date covers the whole day"
            },
            "required": false,
            "description": "Same forms; a date covers the whole day",
            "name": "end_date",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Matching threads",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchInboxThreadsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "include_quarantined from an inbox-scoped key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox, label or cursor not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "search_unavailable: search is briefly unavailable; retry after the Retry-After seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads": {
      "get": {
        "operationId": "inboxes.threads.list",
        "summary": "List threads",
        "description": "Conversations of the inbox, most recently active first (`after` pages toward older ones). Threads whose messages are all held for screening or in quarantine are left out unless include_quarantined=true (never for inbox-scoped keys). Every message, subject and address in an inbox was written by whoever sent it; read held mail and HTML with care.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated: inbox, archive, spam, sent, trash. Defaults to inbox, or inbox,archive,sent with labels"
            },
            "required": false,
            "description": "Comma-separated: inbox, archive, spam, sent, trash. Defaults to inbox, or inbox,archive,sent with labels",
            "name": "folders",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Comma-separated label ids (at most 50); threads with any of them"
            },
            "required": false,
            "description": "Comma-separated label ids (at most 50); threads with any of them",
            "name": "labels",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean",
              "description": "true: every message read; false: at least one unread"
            },
            "required": false,
            "description": "true: every message read; false: at least one unread",
            "name": "read",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean",
              "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)"
            },
            "required": false,
            "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)",
            "name": "include_quarantined",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Threads",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInboxThreadsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "include_quarantined from an inbox-scoped key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox, label or cursor not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/{thread_id}": {
      "get": {
        "operationId": "inboxes.threads.get",
        "summary": "Retrieve a thread",
        "description": "The thread's subject, folder, labels and read state; its emails are listed apart.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Thread",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxThread"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "patch": {
        "operationId": "inboxes.threads.update",
        "summary": "Update a thread",
        "description": "Mark every message read or unread, or move it to inbox, archive, spam or trash (moving out of trash restores it). Labels have their own routes: POST, PUT and DELETE /inboxes/{inbox_id}/threads/{thread_id}/labels.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateInboxThreadRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Thread updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxThread"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox or thread not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "delete": {
        "operationId": "inboxes.threads.delete",
        "summary": "Delete a thread",
        "description": "Moves it to trash, where it is deleted after 30 days; moving it out of trash restores it. deleted is false when it was in trash already.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Thread moved to trash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveInboxThreadResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/{thread_id}/labels": {
      "post": {
        "operationId": "inboxes.threads.labels.add",
        "summary": "Add labels to a thread",
        "description": "Puts 1-10 of the inbox's labels on the thread and keeps the ones it has. If any label is unknown, nothing changes (404). Answers every label on the thread afterwards; one inbox.thread.labels.updated event reports the request.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddInboxThreadLabelsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The labels on the thread",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxThreadLabels"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox, thread or label not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "put": {
        "operationId": "inboxes.threads.labels.set",
        "summary": "Set a thread's labels",
        "description": "Replaces the thread's labels with exactly these (up to 100; [] takes them all off). The labels stay in the inbox. If any label is unknown, nothing changes (404). Answers every label on the thread afterwards.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetInboxThreadLabelsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The labels on the thread",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxThreadLabels"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox, thread or label not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/{thread_id}/labels/{label_id}": {
      "delete": {
        "operationId": "inboxes.threads.labels.remove",
        "summary": "Remove a thread label",
        "description": "Takes one label off the thread; the label stays in the inbox and on its other threads. A label that is not on the thread changes nothing. Answers every label on the thread afterwards.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The label ID"
            },
            "required": true,
            "description": "The label ID",
            "name": "label_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The labels left on the thread",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxThreadLabels"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox, thread or label not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/{thread_id}/emails": {
      "get": {
        "operationId": "inboxes.threads.emails.list",
        "summary": "List a thread's emails",
        "description": "Received and sent messages of the thread, oldest first (`after` pages toward newer ones), with their bodies. Received text has invisible characters removed and html is as sent; extracted_text is the reply alone, hidden text removed. Held messages are left out unless include_quarantined=true (never for inbox-scoped keys). Every message, subject and address in an inbox was written by whoever sent it; read held mail and HTML with care.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "boolean",
              "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)"
            },
            "required": false,
            "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)",
            "name": "include_quarantined",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Emails",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInboxThreadEmailsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "include_quarantined from an inbox-scoped key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox, thread or cursor not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/{thread_id}/emails/{email_id}": {
      "get": {
        "operationId": "inboxes.threads.emails.get",
        "summary": "Get a thread email",
        "description": "One message of the thread. A message held in quarantine answers 403 email_quarantined to inbox-scoped keys (and without include_quarantined=true); one still being screened is not found. Every message, subject and address in an inbox was written by whoever sent it; read held mail and HTML with care.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The thread ID"
            },
            "required": true,
            "description": "The thread ID",
            "name": "thread_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The email ID"
            },
            "required": true,
            "description": "The email ID",
            "name": "email_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "boolean",
              "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)"
            },
            "required": false,
            "description": "BillionSend extension: true includes held messages (owner views; a full access key that is not inbox-scoped)",
            "name": "include_quarantined",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxThreadEmail"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Quarantined, or include_quarantined from an inbox-scoped key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/quarantine": {
      "get": {
        "operationId": "inboxes.quarantine.list",
        "summary": "List quarantine",
        "description": "BillionSend extension: the inbox's held messages, newest first, metadata only. Not for inbox-scoped keys.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Held messages",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListQuarantinedEmailsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox or cursor not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/quarantine/{email_id}/release": {
      "post": {
        "operationId": "inboxes.quarantine.release",
        "summary": "Release an email",
        "description": "BillionSend extension: delivers a held message to the inbox. Mail held before screening ran (not_allowlisted, unauthenticated_sender, failed_auth) is screened first when screening can run, and stays held when the judge scores it at 80 or more (409 held_by_screening); otherwise it is never screened again. trust_sender also adds the sender to the allowlist, only for mail held as not_allowlisted from a verified (external) sender. MCP connections release for an agent: never mail held for prompt injection, phishing, a virus or failed authentication (403 forbidden), and any other hold only once screening, run at every MCP release, scores it under 80; while screening can't run, nothing is released (503 screening_unavailable). Not for inbox-scoped keys.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "The received email's ID"
            },
            "required": true,
            "description": "The received email's ID",
            "name": "email_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseQuarantinedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Released",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxRelease"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, trust_sender refused, or an MCP connection releasing mail held for its content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found or not quarantined",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Screening held it again: it stays in quarantine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error, or the allowlist is full",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "An MCP connection's release while screening can't run; retry-after says when to try again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/codes/latest": {
      "get": {
        "operationId": "inboxes.codes.latest",
        "summary": "Get latest code",
        "description": "BillionSend extension: the newest code or sign-in link in delivered mail, never from held mail or senders that failed authentication; links are never fetched. max_age counts from delivery, so a code released from quarantine counts from its release; since skips mail received at or before it, so a second sign-in waits for its own code. wait > 0 long-polls until one arrives (status timeout when none did). Always 200; status none when there is nothing.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "description": "An exact sender address, or a domain covering itself and its subdomains"
            },
            "required": false,
            "description": "An exact sender address, or a domain covering itself and its subdomains",
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 50,
              "description": "Seconds to wait for a code to arrive, 0-50 (default 0)"
            },
            "required": false,
            "description": "Seconds to wait for a code to arrive, 0-50 (default 0)",
            "name": "wait",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 60,
              "maximum": 86400,
              "description": "How long ago the code may have reached the inbox, in seconds, 60-86400 (default 600); a released code counts from its release"
            },
            "required": false,
            "description": "How long ago the code may have reached the inbox, in seconds, 60-86400 (default 600); a released code counts from its release",
            "name": "max_age",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Only mail received after this ISO 8601 instant, such as the received_at of a code already used"
            },
            "required": false,
            "description": "Only mail received after this ISO 8601 instant, such as the received_at of a code already used",
            "name": "since",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The latest code, or a status saying why none",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationCode"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many waits at once, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/{thread_id}/emails/{email_id}/reply": {
      "post": {
        "operationId": "inboxes.threads.emails.reply",
        "summary": "Reply in a thread",
        "description": "Replies from the inbox address in the thread, with In-Reply-To and References set: to the email's Reply-To or sender (or, for an email the inbox sent, its recipients), plus everyone else on it with `reply_all`. Bcc is never copied. Takes `attachments` as POST /emails does. Accepts an `Idempotency-Key`. When the inbox's rules hold the reply (or `requires_approval` is true) it is kept as a draft for a person to approve and the answer is 202 with the Draft.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "thread_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "email_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InboxReplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxSentEmail"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "202": {
            "description": "Held for approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/threads/{thread_id}/emails/{email_id}/forward": {
      "post": {
        "operationId": "inboxes.threads.emails.forward",
        "summary": "Forward a thread email",
        "description": "Forwards the email from the inbox address, quoted under \"---------- Forwarded message ---------\" with its From, Date, Subject and To, after an optional note. Its attachments go along, with any `attachments` you add, within 10 MiB in all. An email that carries malware is never forwarded. Accepts an `Idempotency-Key`; a forward the inbox's rules hold answers 202 with the Draft.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "thread_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "email_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InboxForwardRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxSentEmail"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "202": {
            "description": "Held for approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/emails": {
      "post": {
        "operationId": "inboxes.send",
        "summary": "Send an email from an inbox",
        "description": "Sends a new conversation from the inbox address in one call (`to`, `subject`, `html` and/or `text`, optional `cc`, `bcc` and `attachments` as POST /emails takes them). It runs the same rules as a reply: an inbox that may not start conversations, a first-time recipient past the ramp, or `requires_approval: true` keeps it as a draft for a person to approve and the answer is 202 with the Draft. Accepts an `Idempotency-Key`. An inbox on the shared domain takes no attachments.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InboxSendRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxSentEmail"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "202": {
            "description": "Held for approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/drafts": {
      "post": {
        "operationId": "inboxes.drafts.create",
        "summary": "Create a draft",
        "description": "A standalone draft, or with `thread_id` and `reply_to_email_id` a reply draft in that thread. One unsent reply draft per email: creating another answers 200 with the existing one. A reply draft copies no recipients; set `to` before sending. `attachments` are kept encrypted with the draft until it is sent, rejected, expired or deleted. Nothing is sent until POST /inboxes/{inbox_id}/drafts/{draft_id}/send, or until `send_at` (BillionSend extension) when it is given: the draft is then sent as the caller at that time, through every rule and limit, and must have a recipient. With `send_at`, a reply draft for an email that already has one answers 409 instead of the existing draft.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInboxDraftRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The existing reply draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "get": {
        "operationId": "inboxes.drafts.list",
        "summary": "List drafts",
        "description": "Unsent drafts (draft and pending_approval), most recently updated first; `after` pages toward older ones.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Drafts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListInboxDraftsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/drafts/{draft_id}": {
      "get": {
        "operationId": "inboxes.drafts.get",
        "summary": "Retrieve a draft",
        "description": "One draft with its body, also after it was sent (status sent, email_id set).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "draft_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "patch": {
        "operationId": "inboxes.drafts.update",
        "summary": "Update a draft",
        "description": "Each given field replaces the stored one; null clears it. Setting html or text replaces the whole body: the part left out becomes null. `attachments` replaces the whole list (null or an empty list removes the files). A sent draft, or one that changed during the request, answers 409. An edit by an agent sends a draft waiting for approval back to draft. `send_at` (BillionSend extension) schedules the draft to be sent as the caller, or reschedules it, and clears `send_error`; null cancels the schedule. A draft waiting for approval cannot be scheduled (409). When the scheduled send goes out, the draft becomes sent; when the inbox's rules hold it, pending_approval; when it is refused (the key revoked, the inbox deleted, a limit reached), it stays a draft with `send_at` null, `send_error` set and an `inbox.draft.send_failed` webhook.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "draft_id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateInboxDraftRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      },
      "delete": {
        "operationId": "inboxes.drafts.delete",
        "summary": "Delete a draft",
        "description": "Removes an unsent draft; a sent one answers 409.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "draft_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteInboxDraftResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/drafts/{draft_id}/send": {
      "post": {
        "operationId": "inboxes.drafts.send",
        "summary": "Send a draft",
        "description": "Sends the draft from the inbox address; the body is optional and only ever holds `headers`, which are not supported yet (an empty value is fine), and an `Idempotency-Key` is accepted. Answers the sent email's id. A draft waiting for approval goes out only when a person or a team-wide full access key sends it (403 approval_required otherwise), and their send skips the inbox's rules but never the team's limits or the shared domain's rules. An agent's send of a draft runs the rules and may hold it (202).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "draft_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendInboxDraftRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxSentEmail"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "202": {
            "description": "Held for approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Malformed JSON body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/inboxes/{inbox_id}/drafts/{draft_id}/reject": {
      "post": {
        "operationId": "inboxes.drafts.reject",
        "summary": "Reject a draft",
        "description": "BillionSend extension: a person or a team-wide full access key turns down a draft waiting for approval. It stays readable with status rejected; webhooks report it deleted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The inbox ID or its email address, such as support@example.com"
            },
            "required": true,
            "description": "The inbox ID or its email address, such as support@example.com",
            "name": "inbox_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "draft_id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Rejected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Inboxes"
        ]
      }
    },
    "/emails/receiving/{id}/reply": {
      "post": {
        "operationId": "emails.receiving.reply",
        "summary": "Reply to an email",
        "description": "BillionSend extension: replies server-side, threaded with In-Reply-To and References. It goes out from the inbox the email reached (`inbox_id` picks one), else from the first address it was received for, or from `from`. A reply from an inbox runs its rules and may be held as a draft (202). Accepts an `Idempotency-Key`. Needs a full access key.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceivedEmailReplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceivedEmailSendResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "202": {
            "description": "Held for approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/receiving/{id}/forward": {
      "post": {
        "operationId": "emails.receiving.forward",
        "summary": "Forward an email",
        "description": "BillionSend extension: forwards server-side, inline under a note (default) or with the original attached as forwarded_message.eml (`mode: attachment`), within 10 MiB. An email that carries malware is never forwarded. Sender rules and the 202 draft answer are those of the reply. Accepts an `Idempotency-Key`. Needs a full access key.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceivedEmailForwardRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceivedEmailSendResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "202": {
            "description": "Held for approval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxDraft"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, the inbox's or the shared domain's rules, or held mail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict, or a draft already sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "The inbox's daily send limit, or the team's daily limit for mail from the shared domain, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/agent/signup": {
      "post": {
        "operationId": "agent.signup",
        "summary": "Sign up as an agent",
        "description": "BillionSend extension, no API key needed. Creates an account for an agent without a person present: a team named after the agent, one inbox on the shared domain (no DNS) and an inbox-scoped key for it, so the agent can receive mail at once. The account is **unclaimed**: it only receives, and every send answers 403 `team_unclaimed`. A claim link goes to `human_email`; the person opens it, signs in and claims the account, which becomes theirs on the Free plan (the key keeps working, as an inbox-scoped key under their team). An account nobody claims deletes itself 7 days after signup. Limits: 3 signups per client address per hour, 100 per hour in all, 3 per `human_email` per day.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentSignupRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The unclaimed account, its inbox and its key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentSignupResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "The username is already used by an inbox",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error: human_email, name or username refused (disposable or BillionSend address, not a plain name, a brand look-alike, a reserved name)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many signups from this address, in all, or for this human_email; retry-after says when to try again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "503": {
            "description": "This instance does not offer agent signup, or the username can't be reviewed right now; retry-after says when to try again where it applies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Agent"
        ]
      }
    },
    "/agent/status": {
      "get": {
        "operationId": "agent.status",
        "summary": "Get the account's claim status",
        "description": "BillionSend extension. Whether the account behind the key is still unclaimed, when it deletes itself, and what it may do meanwhile. Any key may ask; an account a person has claimed answers `claimed` with no limits.",
        "responses": {
          "200": {
            "description": "The account's status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentAccountStatus"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Agent"
        ]
      }
    },
    "/agent/claim-email": {
      "post": {
        "operationId": "agent.claimEmail",
        "summary": "Send the claim link again",
        "description": "BillionSend extension. Sends the claim link to the address given at signup again; the earlier link stops working. At most 5 claim emails in all, ten minutes apart.",
        "responses": {
          "202": {
            "description": "The email is on its way",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentClaimEmail"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "The account is already claimed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Asked too soon, or the account used all its claim emails, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Agent"
        ]
      }
    },
    "/emails": {
      "post": {
        "operationId": "emails.send",
        "summary": "Send an email",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmailRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Idempotency-Key is not 1 to 256 characters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Sending quota exceeded, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      },
      "get": {
        "operationId": "emails.list",
        "summary": "List emails",
        "description": "Newest first, with cursor pagination: `after` takes the last id of a page and pages toward older items, `before` takes the first id and pages back toward newer ones.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Emails",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListEmailsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/batch": {
      "post": {
        "operationId": "emails.batch",
        "summary": "Send a batch of emails",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request."
            },
            "required": false,
            "description": "1 to 256 characters. A retry with the same key and the same body answers the original response instead of sending again; the same key with a different body answers 409 invalid_idempotent_request.",
            "name": "Idempotency-Key",
            "in": "header"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "strict",
                "permissive"
              ],
              "description": "`strict` (default): any invalid email rejects the whole batch with that email's error, sending nothing. `permissive`: invalid emails are listed in `errors` by index and the valid ones are sent."
            },
            "required": false,
            "description": "`strict` (default): any invalid email rejects the whole batch with that email's error, sending nothing. `permissive`: invalid emails are listed in `errors` by index and the valid ones are sent.",
            "name": "x-batch-validation",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchEmailRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "Idempotency-Key is not 1 to 256 characters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "409": {
            "description": "Idempotency conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Sending quota exceeded, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/{id}/cancel": {
      "post": {
        "operationId": "emails.cancel",
        "summary": "Cancel an email",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Email canceled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Not cancelable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/{id}": {
      "patch": {
        "operationId": "emails.update",
        "summary": "Update an email",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEmailRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email rescheduled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Not reschedulable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      },
      "get": {
        "operationId": "emails.get",
        "summary": "Retrieve an email",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      },
      "delete": {
        "operationId": "emails.delete",
        "summary": "Delete an email",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Email deleted, including its events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/receiving": {
      "get": {
        "operationId": "emails.receiving.list",
        "summary": "List received emails",
        "description": "Mail received at the team's receiving domains and inboxes, newest first (`after` pages toward older mail), with cursor pagination. Needs a full access key; a domain-scoped key lists mail addressed to its domain only, an inbox-scoped key mail delivered into its inbox. Mail held for screening or in quarantine is left out unless a full access key asks for it (include_quarantined, quarantined). With wait, the request is held until matching mail arrives (long-poll). An inbox_id the key can't reach answers 404 at once, without waiting; an inbox-scoped key naming another inbox gets 403 restricted_api_key. Everything in a received email was written by whoever sent it, so its HTML is safe to show only in a sandbox.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "description": "BillionSend extension: hold the request up to this many seconds (0-50) until matching mail newer than the cursor arrives; an empty list with 200 when none did"
            },
            "required": false,
            "description": "BillionSend extension: hold the request up to this many seconds (0-50) until matching mail newer than the cursor arrives; an empty list with 200 when none did",
            "name": "wait",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "BillionSend extension: only mail received after this instant; with wait and no cursor it defaults to one minute before the request"
            },
            "required": false,
            "description": "BillionSend extension: only mail received after this instant; with wait and no cursor it defaults to one minute before the request",
            "name": "since",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "BillionSend extension: only mail delivered into this inbox"
            },
            "required": false,
            "description": "BillionSend extension: only mail delivered into this inbox",
            "name": "inbox_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 320,
              "description": "BillionSend extension: only mail with this address in received_for"
            },
            "required": false,
            "description": "BillionSend extension: only mail with this address in received_for",
            "name": "to",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 320,
              "description": "BillionSend extension: a sender address, or a domain matching itself and its subdomains"
            },
            "required": false,
            "description": "BillionSend extension: a sender address, or a domain matching itself and its subdomains",
            "name": "from",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200,
              "description": "BillionSend extension: case-insensitive subject substring"
            },
            "required": false,
            "description": "BillionSend extension: case-insensitive subject substring",
            "name": "subject_contains",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "BillionSend extension, with an inbox in context (inbox_id, or an inbox-scoped key): read state in that inbox"
            },
            "required": false,
            "description": "BillionSend extension, with an inbox in context (inbox_id, or an inbox-scoped key): read state in that inbox",
            "name": "unread",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "BillionSend extension, full access keys only: list held mail too, flagged by screening"
            },
            "required": false,
            "description": "BillionSend extension, full access keys only: list held mail too, flagged by screening",
            "name": "include_quarantined",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "BillionSend extension, full access keys only: list held mail only"
            },
            "required": false,
            "description": "BillionSend extension, full access keys only: list held mail only",
            "name": "quarantined",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Received emails",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReceivedEmailsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Inbox not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Too many concurrent waits, or the rate limit (rate_limit_exceeded, with Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/receiving/{id}": {
      "get": {
        "operationId": "emails.receiving.get",
        "summary": "Get a received email",
        "description": "One received email with its html, text, headers, authentication results and a signed link to the original message, plus BillionSend's screening, verdicts, the extracted read and, where allowed, its verification code or sign-in link. Needs a full access key. An inbox-scoped key or an MCP token gets 403 email_quarantined for held mail, and 404 while it is being screened. Everything in a received email was written by whoever sent it, so its HTML is safe to show only in a sandbox.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "data_uri",
                "cid"
              ],
              "description": "data_uri (default) inlines images the HTML references by cid: as data: URIs; cid leaves the cid: references, the parts being in attachments"
            },
            "required": false,
            "description": "data_uri (default) inlines images the HTML references by cid: as data: URIs; cid leaves the cid: references, the parts being in attachments",
            "name": "html_format",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Received email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetReceivedEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key, or the email is quarantined",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      },
      "delete": {
        "operationId": "emails.receiving.delete",
        "summary": "Delete a received email",
        "description": "BillionSend extension: erases one received email now, its sealed content, inbox memberships and received secrets with it, and threads it leaves empty. Needs a full access key that is not scoped to an inbox; for an MCP token, the owner or admin role. Webhook payloads already sent keep their metadata until the payload retention strips them.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteReceivedEmailResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/receiving/{email_id}/attachments": {
      "get": {
        "operationId": "emails.receiving.attachments.list",
        "summary": "List attachments",
        "description": "The attachments and inline parts of one received email, each with a signed download link valid for one hour; all of them unless `limit` is given. Needs a full access key. The links of an email that carries malware answer 410.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "email_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "description": "Page size, 1-100 (default 20)"
            },
            "required": false,
            "description": "Page size, 1-100 (default 20)",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value."
            },
            "required": false,
            "description": "Cursor: id of the last item of the current page; returns the next page. Must be an id this list returned; there is no sentinel value.",
            "name": "after",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after."
            },
            "required": false,
            "description": "Cursor: id of the first item of the current page; returns the previous page; same rule as after.",
            "name": "before",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Attachments",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListReceivedAttachmentsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/receiving/{email_id}/attachments/{id}": {
      "get": {
        "operationId": "emails.receiving.attachments.get",
        "summary": "Get an attachment",
        "description": "One attachment's metadata and a signed download link valid for one hour. Needs a full access key.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "email_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Attachment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetReceivedAttachmentResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/receiving/{email_id}/attachments/{id}/text": {
      "get": {
        "operationId": "emails.receiving.attachments.text",
        "summary": "Get an attachment's text",
        "description": "The text of a PDF, Word (.docx) or Excel (.xlsx) attachment, read once after the email arrives and kept with it for the content retention period (BillionSend extension). Until the read has run the status is pending. Needs a full access key. An email that carries malware answers 410.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "email_id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Attachment text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetReceivedAttachmentTextResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "410": {
            "description": "The email carries malware",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/emails/{id}/insights": {
      "get": {
        "operationId": "emails.insights",
        "summary": "Get email insights",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Best-practice check results and score computed when the email was sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailInsightsResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Emails"
        ]
      }
    },
    "/deliverability": {
      "get": {
        "operationId": "deliverability.get",
        "summary": "Get deliverability",
        "responses": {
          "200": {
            "description": "Account deliverability score over the trailing 30 days",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliverabilityResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Missing, malformed, unknown or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Restricted API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Over the rate limit (rate_limit_exceeded, with Retry-After)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the request may be retried; sent with rate_limit_exceeded",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Deliverability"
        ]
      }
    }
  },
  "webhooks": {},
  "tags": [
    {
      "name": "Emails"
    },
    {
      "name": "Broadcasts"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Domains"
    },
    {
      "name": "Contacts"
    },
    {
      "name": "Segments"
    },
    {
      "name": "Topics"
    },
    {
      "name": "Contact properties"
    },
    {
      "name": "Audiences"
    },
    {
      "name": "Unsubscribes"
    },
    {
      "name": "Suppressions"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "API keys"
    },
    {
      "name": "Inboxes"
    },
    {
      "name": "Agent"
    },
    {
      "name": "Usage"
    },
    {
      "name": "Deliverability"
    },
    {
      "name": "Verifications"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ]
}
