API reference ยท Messages

List messages

GET/api/v1/messages

Messages sent through the API, newest first. Filter by recipient, status, template or creation time.

Authentication
Bearer token in the Authorization header.
Required scopes
messages:read
Idempotency
Not supported for this endpoint.

Parameters

Query parameters

limitintegerOptional

How many items to return, 1 to 200. Default 50.

Minimum: 1

Maximum: 200

Default: 50

cursorstringOptional

The next_cursor value from the previous page.

Maximum length: 400

tostringOptional

Only messages to this number.

Maximum length: 32

statusstringOptional

Allowed values: "queued", "sent", "delivered", "read", "failed"

templatestringOptional

Only messages using this template name.

Minimum length: 1

Maximum length: 512

created_afterstringOptional

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

Request example

Run on your server or in a terminal. Replace YOUR_ placeholders and set BUDDY_API_KEY.

Run in bash or zsh with curl 7.76+. Set BUDDY_API_KEY first and replace YOUR_ placeholders before running.

curl --fail-with-body --request GET 'https://usebuddy.app/api/v1/messages' \
  --header "Authorization: Bearer $BUDDY_API_KEY"

Responses

200A page of messages.

application/json

dataarrayRequired
View data structure

Array items: object

idstringRequired

ID starting with msg_.

Pattern: ^msg_[0-9a-f]{32}$

statusstringRequired

queued, sent, delivered, read or failed. Statuses only move forward.

Allowed values: "queued", "sent", "delivered", "read", "failed"

tostringRequired

Phone number in E.164 format.

subscribermultiple typesRequired

The subscriber with this number, if there is one.

View subscriber structure

Must match at least one of these structures.

Option 1: string

ID starting with sub_.

Pattern: ^sub_[0-9a-f]{32}$

Option 2: null
typestringRequired

Allowed values: "template", "text"

templatestring | nullRequired

The template name.

languagestring | nullRequired
categorystring | nullRequired

marketing, utility or authentication.

transactionalbooleanRequired
status_atobjectRequired

When each status was first seen.

View status_at structure
queuedstringOptional

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

sentstringOptional

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

deliveredstringOptional

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

readstringOptional

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

failedstringOptional

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

errorstring | nullRequired

A stable code when the message failed, such as recipient_unavailable.

reasonstring | nullRequired

Why it failed, in plain English.

metadataobjectRequired
View metadata structure

Additional field values: string | number | boolean

Field name requirements

livemodebooleanRequired
created_atstringRequired

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

updated_atmultiple typesRequired
View updated_at structure

Must match at least one of these structures.

Option 1: string

RFC 3339 time.

Format: date-time

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

Option 2: null
has_morebooleanRequired
next_cursorstring | nullRequired
Response headers
Buddy-Request-Id
This request's ID (req_...). Quote it to support.
Buddy-Api-Version
The dated build of v1 that served the request.
RateLimit-Limit
Requests allowed in the current window.
RateLimit-Remaining
Requests left in the current window.
RateLimit-Reset
Seconds until the window resets.

Errors

Use the error code to decide how to recover. See the error reference for guidance.

Error responses for List messages
HTTP statusError codes
400invalid_cursor: Invalid cursor. invalid_phone: Invalid phone number. invalid_request: Invalid request. unknown_field: Unknown field
401unauthorized: Unauthorized. api_key_expired: API key expired. api_key_revoked: API key revoked. token_expired: Access token expired
403api_not_enabled: API access not enabled. merchant_agreement_required: Merchant agreement required. insufficient_scope: Insufficient scope
429rate_limited: Rate limited
500internal_error: Internal error
503service_unavailable: Service unavailable
Error response structure
errorstringRequired

Stable error code.

messagestringRequired

What went wrong and how to fix it.

paramstringOptional

The field the error is about.

request_idstringRequired

Quote this when contacting support.

doc_urlstringRequired

Documentation for this error code.

detailsobjectOptional
View details structure

Additional field values: any value

Field name requirements

Complete OpenAPI schema

This operation and its schema definitions are also available in the OpenAPI document.

{
  "operation": {
    "operationId": "listMessages",
    "summary": "List messages",
    "description": "Messages sent through the API, newest first. Filter by recipient, status, template or creation time.",
    "tags": [
      "Messages"
    ],
    "x-buddy-scopes": [
      "messages:read"
    ],
    "x-buddy-errors": [
      "invalid_cursor",
      "invalid_phone",
      "unauthorized",
      "api_key_expired",
      "api_key_revoked",
      "token_expired",
      "api_not_enabled",
      "merchant_agreement_required",
      "insufficient_scope",
      "invalid_request",
      "unknown_field",
      "rate_limited",
      "service_unavailable",
      "internal_error"
    ],
    "security": [
      {
        "bearerAuth": []
      },
      {
        "oauth2": [
          "messages:read"
        ]
      }
    ],
    "parameters": [
      {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "How many items to return, 1 to 200. Default 50.",
        "schema": {
          "default": 50,
          "type": "integer",
          "minimum": 1,
          "maximum": 200
        }
      },
      {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "The next_cursor value from the previous page.",
        "schema": {
          "type": "string",
          "maxLength": 400
        }
      },
      {
        "name": "to",
        "in": "query",
        "required": false,
        "description": "Only messages to this number.",
        "schema": {
          "type": "string",
          "maxLength": 32
        }
      },
      {
        "name": "status",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "queued",
            "sent",
            "delivered",
            "read",
            "failed"
          ]
        }
      },
      {
        "name": "template",
        "in": "query",
        "required": false,
        "description": "Only messages using this template name.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      {
        "name": "created_after",
        "in": "query",
        "required": false,
        "description": "RFC 3339 time.",
        "schema": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        }
      }
    ],
    "responses": {
      "200": {
        "description": "A page of messages.",
        "headers": {
          "Buddy-Request-Id": {
            "$ref": "#/components/headers/BuddyRequestId"
          },
          "Buddy-Api-Version": {
            "$ref": "#/components/headers/BuddyApiVersion"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "data",
                "has_more",
                "next_cursor"
              ],
              "properties": {
                "data": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Message"
                  }
                },
                "has_more": {
                  "type": "boolean"
                },
                "next_cursor": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "400": {
        "description": "`invalid_cursor`: Invalid cursor. `invalid_phone`: Invalid phone number. `invalid_request`: Invalid request. `unknown_field`: Unknown field",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "401": {
        "description": "`unauthorized`: Unauthorized. `api_key_expired`: API key expired. `api_key_revoked`: API key revoked. `token_expired`: Access token expired",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "403": {
        "description": "`api_not_enabled`: API access not enabled. `merchant_agreement_required`: Merchant agreement required. `insufficient_scope`: Insufficient scope",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "429": {
        "description": "`rate_limited`: Rate limited",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "500": {
        "description": "`internal_error`: Internal error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "503": {
        "description": "`service_unavailable`: Service unavailable",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A live key (bd_live_...) or a test key (bd_test_...). Test keys only see test data. An OAuth access token (bdo_...) works here too."
      },
      "oauth2": {
        "type": "oauth2",
        "description": "For apps that act for other Buddy workspaces: the authorization code flow with PKCE (S256). Access tokens (bdo_...) last an hour; refresh tokens rotate on every use. Requests may also use the group names subscribers, messages, templates, campaigns, events, webhooks and results.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://usebuddy.app/oauth/authorize",
            "tokenUrl": "https://usebuddy.app/oauth/token",
            "refreshUrl": "https://usebuddy.app/oauth/token",
            "scopes": {
              "subscribers:read": "Read subscribers, tags and consent history",
              "subscribers:write": "Create, update, tag, opt out and erase subscribers",
              "messages:read": "Read message status",
              "messages:send": "Send messages",
              "templates:read": "List message templates",
              "campaigns:read": "Read campaigns and their results",
              "campaigns:write": "Create draft campaigns",
              "campaigns:send": "Send, schedule and cancel campaigns",
              "events:write": "Send events",
              "webhooks:read": "Read webhook endpoints and deliveries",
              "webhooks:write": "Manage webhook endpoints"
            }
          }
        }
      }
    },
    "headers": {
      "BuddyRequestId": {
        "description": "This request's ID (req_...). Quote it to support.",
        "schema": {
          "type": "string"
        }
      },
      "BuddyApiVersion": {
        "description": "The dated build of v1 that served the request.",
        "schema": {
          "type": "string"
        }
      },
      "RateLimitLimit": {
        "description": "Requests allowed in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Requests left in the current window.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      },
      "IdempotentReplayed": {
        "description": "true when this is the stored response of an earlier request with the same Idempotency-Key.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "ConsentEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ce_[0-9a-f]{32}$",
            "description": "ID starting with ce_."
          },
          "type": {
            "type": "string",
            "description": "opt_in or opt_out."
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          }
        },
        "required": [
          "id",
          "type",
          "source",
          "ip",
          "evidence",
          "created_at"
        ]
      },
      "DeletedSubscriber": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^sub_[0-9a-f]{32}$",
            "description": "ID starting with sub_."
          },
          "deleted": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id",
          "deleted"
        ]
      },
      "DeletedWebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^we_[0-9a-f]{32}$",
            "description": "ID starting with we_."
          },
          "deleted": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "id",
          "deleted"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Stable error code."
          },
          "message": {
            "type": "string",
            "description": "What went wrong and how to fix it."
          },
          "param": {
            "description": "The field the error is about.",
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "description": "Quote this when contacting support."
          },
          "doc_url": {
            "type": "string",
            "description": "Documentation for this error code."
          },
          "details": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "error",
          "message",
          "request_id",
          "doc_url"
        ]
      },
      "Me": {
        "type": "object",
        "properties": {
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^ws_[0-9a-f]{32}$",
                "description": "ID starting with ws_."
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "credential": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "api_key",
                  "oauth_token"
                ]
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "prefix": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expires_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                    "description": "RFC 3339 time."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "type",
              "id",
              "name",
              "prefix",
              "expires_at"
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "api_included": {
                "type": "boolean",
                "description": "Whether live API keys work on this plan. Test keys work on every plan."
              }
            },
            "required": [
              "id",
              "name",
              "api_included"
            ]
          },
          "rate_limits": {
            "type": "object",
            "properties": {
              "key": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "window_seconds": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "limit",
                  "window_seconds"
                ]
              },
              "workspace": {
                "type": "object",
                "properties": {
                  "limit": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "window_seconds": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "limit",
                  "window_seconds"
                ]
              }
            },
            "required": [
              "key",
              "workspace"
            ]
          },
          "whatsapp": {
            "type": "object",
            "properties": {
              "connected": {
                "type": "boolean"
              },
              "phone_number": {
                "description": "The connected number, as WhatsApp displays it.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "connected",
              "phone_number"
            ]
          },
          "usage": {
            "type": "object",
            "properties": {
              "period": {
                "type": "string",
                "description": "YYYY-MM, in UTC."
              },
              "sends": {
                "type": "object",
                "properties": {
                  "used": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "limit": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "used",
                  "limit"
                ]
              },
              "api_calls": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "period",
              "sends",
              "api_calls"
            ]
          }
        },
        "required": [
          "workspace",
          "credential",
          "livemode",
          "scopes",
          "plan",
          "rate_limits",
          "whatsapp",
          "usage"
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^msg_[0-9a-f]{32}$",
            "description": "ID starting with msg_."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "sent",
              "delivered",
              "read",
              "failed"
            ],
            "description": "queued, sent, delivered, read or failed. Statuses only move forward."
          },
          "to": {
            "type": "string",
            "description": "Phone number in E.164 format."
          },
          "subscriber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^sub_[0-9a-f]{32}$",
                "description": "ID starting with sub_."
              },
              {
                "type": "null"
              }
            ],
            "description": "The subscriber with this number, if there is one."
          },
          "type": {
            "type": "string",
            "enum": [
              "template",
              "text"
            ]
          },
          "template": {
            "description": "The template name.",
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "description": "marketing, utility or authentication.",
            "type": [
              "string",
              "null"
            ]
          },
          "transactional": {
            "type": "boolean"
          },
          "status_at": {
            "type": "object",
            "properties": {
              "queued": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "sent": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "delivered": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "read": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "failed": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              }
            },
            "description": "When each status was first seen."
          },
          "error": {
            "description": "A stable code when the message failed, such as recipient_unavailable.",
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "description": "Why it failed, in plain English.",
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            }
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status",
          "to",
          "subscriber",
          "type",
          "template",
          "language",
          "category",
          "transactional",
          "status_at",
          "error",
          "reason",
          "metadata",
          "livemode",
          "created_at",
          "updated_at"
        ]
      },
      "Subscriber": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^sub_[0-9a-f]{32}$",
            "description": "ID starting with sub_."
          },
          "phone": {
            "type": "string",
            "description": "Phone number in E.164 format."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "subscribed",
              "opted_out"
            ],
            "description": "opted_out once the person replied STOP or opted out any other way."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "attributes": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            }
          },
          "source": {
            "description": "Where the subscriber came from.",
            "type": [
              "string",
              "null"
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "phone",
          "name",
          "status",
          "tags",
          "external_id",
          "attributes",
          "source",
          "livemode",
          "created_at",
          "updated_at"
        ]
      },
      "TagCount": {
        "type": "object",
        "properties": {
          "tag": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "tag",
          "count"
        ]
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^tpl_[0-9a-f]{32}$",
            "description": "ID starting with tpl_."
          },
          "name": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "category": {
            "description": "marketing, utility or authentication.",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "description": "approved, pending, rejected, paused, disabled, ..."
          },
          "quality_rating": {
            "type": [
              "string",
              "null"
            ]
          },
          "body": {
            "type": "string"
          },
          "header_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "footer": {
            "type": [
              "string",
              "null"
            ]
          },
          "parameters": {
            "$ref": "#/components/schemas/TemplateParameters"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "language",
          "category",
          "status",
          "quality_rating",
          "body",
          "header_text",
          "footer",
          "parameters",
          "created_at",
          "updated_at"
        ]
      },
      "TemplateButton": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Position of the button, from 0."
          },
          "type": {
            "type": "string",
            "description": "url, quick_reply, phone_number, copy_code, otp, flow, ..."
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "description": "The URL pattern for url buttons.",
            "type": [
              "string",
              "null"
            ]
          },
          "takes_parameter": {
            "type": "boolean",
            "description": "True when a send must provide a value for this button."
          },
          "parameter": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "url_suffix",
                  "coupon_code",
                  "otp_code"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "What to send for this button: url_suffix (dynamic URL), coupon_code (copy code) or otp_code."
          }
        },
        "required": [
          "index",
          "type",
          "text",
          "url",
          "takes_parameter",
          "parameter"
        ]
      },
      "TemplateParameter": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "\"1\", \"2\", ... for positional templates, or the parameter name for named ones."
          },
          "example": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "example"
        ]
      },
      "TemplateParameters": {
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "positional",
              "named",
              "none"
            ]
          },
          "body": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TemplateParameter"
            }
          },
          "header": {
            "type": "object",
            "properties": {
              "type": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "text",
                      "image",
                      "video",
                      "document",
                      "location"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "parameters": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TemplateParameter"
                },
                "description": "Text header parameters."
              },
              "media_required": {
                "type": "boolean",
                "description": "True when a send must provide header media or a location."
              }
            },
            "required": [
              "type",
              "parameters",
              "media_required"
            ]
          },
          "buttons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TemplateButton"
            }
          }
        },
        "required": [
          "format",
          "body",
          "header",
          "buttons"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^dlv_[0-9a-f]{32}$",
            "description": "ID starting with dlv_."
          },
          "event_id": {
            "type": "string",
            "pattern": "^evt_[0-9a-f]{32}$",
            "description": "ID starting with evt_."
          },
          "event_type": {
            "type": "string"
          },
          "webhook_endpoint": {
            "type": "string",
            "pattern": "^we_[0-9a-f]{32}$",
            "description": "ID starting with we_."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ],
            "description": "pending while attempts remain, then succeeded or failed."
          },
          "attempt": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Attempts made so far."
          },
          "response_status": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "The HTTP status of the last attempt."
          },
          "response_ms": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "response_snippet": {
            "description": "The start of your endpoint's reply to the last attempt.",
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "description": "Why the last attempt failed, when it did.",
            "type": [
              "string",
              "null"
            ]
          },
          "next_attempt_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              {
                "type": "null"
              }
            ]
          },
          "resent_from": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^dlv_[0-9a-f]{32}$",
                "description": "ID starting with dlv_."
              },
              {
                "type": "null"
              }
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          }
        },
        "required": [
          "id",
          "event_id",
          "event_type",
          "webhook_endpoint",
          "status",
          "attempt",
          "response_status",
          "response_ms",
          "response_snippet",
          "error",
          "next_attempt_at",
          "resent_from",
          "livemode",
          "created_at",
          "updated_at"
        ]
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^we_[0-9a-f]{32}$",
            "description": "ID starting with we_."
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "disabled_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "manual",
                  "gone",
                  "failing"
                ],
                "description": "Why the endpoint is off: you turned it off, it answered 410 Gone, or every delivery failed for 3 days."
              },
              {
                "type": "null"
              }
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "events",
          "status",
          "disabled_reason",
          "livemode",
          "created_at",
          "updated_at"
        ]
      },
      "WebhookEndpointSecret": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "description": "The current signing secret (whsec_...)."
          },
          "previous_secret_expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              {
                "type": "null"
              }
            ],
            "description": "While set, deliveries are also signed with the previous secret until this time."
          }
        },
        "required": [
          "secret",
          "previous_secret_expires_at"
        ]
      },
      "WebhookEndpointWithSecret": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^we_[0-9a-f]{32}$",
            "description": "ID starting with we_."
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "disabled_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "manual",
                  "gone",
                  "failing"
                ],
                "description": "Why the endpoint is off: you turned it off, it answered 410 Gone, or every delivery failed for 3 days."
              },
              {
                "type": "null"
              }
            ]
          },
          "livemode": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "RFC 3339 time."
          },
          "secret": {
            "type": "string",
            "description": "The signing secret (whsec_...). Verify the Buddy-Signature header of every delivery with it."
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "events",
          "status",
          "disabled_reason",
          "livemode",
          "created_at",
          "updated_at",
          "secret"
        ]
      },
      "WebhookEvent": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^evt_[0-9a-f]{32}$",
                "description": "ID starting with evt_."
              },
              "version": {
                "type": "string",
                "const": "1"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "livemode": {
                "type": "boolean"
              },
              "type": {
                "type": "string",
                "enum": [
                  "message.sent",
                  "message.delivered",
                  "message.read",
                  "message.failed"
                ]
              },
              "data": {
                "type": "object",
                "properties": {
                  "message_id": {
                    "type": "string",
                    "pattern": "^msg_[0-9a-f]{32}$",
                    "description": "ID starting with msg_."
                  },
                  "to": {
                    "type": "string"
                  },
                  "subscriber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[0-9a-f]{32}$",
                        "description": "ID starting with sub_."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "sent",
                      "delivered",
                      "read",
                      "failed"
                    ]
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                    "description": "RFC 3339 time."
                  },
                  "template": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "metadata": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "error": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "message_id",
                  "to",
                  "subscriber",
                  "status",
                  "at",
                  "template",
                  "metadata"
                ]
              }
            },
            "required": [
              "id",
              "version",
              "at",
              "livemode",
              "type",
              "data"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^evt_[0-9a-f]{32}$",
                "description": "ID starting with evt_."
              },
              "version": {
                "type": "string",
                "const": "1"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "livemode": {
                "type": "boolean"
              },
              "type": {
                "type": "string",
                "const": "message.replied"
              },
              "data": {
                "type": "object",
                "properties": {
                  "message_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^msg_[0-9a-f]{32}$",
                        "description": "ID starting with msg_."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subscriber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sub_[0-9a-f]{32}$",
                        "description": "ID starting with sub_."
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "message_id",
                  "subscriber",
                  "text"
                ]
              }
            },
            "required": [
              "id",
              "version",
              "at",
              "livemode",
              "type",
              "data"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^evt_[0-9a-f]{32}$",
                "description": "ID starting with evt_."
              },
              "version": {
                "type": "string",
                "const": "1"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "livemode": {
                "type": "boolean"
              },
              "type": {
                "type": "string",
                "enum": [
                  "subscriber.created",
                  "subscriber.updated",
                  "subscriber.tagged",
                  "subscriber.opted_in"
                ]
              },
              "data": {
                "type": "object",
                "properties": {
                  "subscriber": {
                    "$ref": "#/components/schemas/Subscriber"
                  },
                  "source": {
                    "type": "string"
                  },
                  "added": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "removed": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "subscriber"
                ]
              }
            },
            "required": [
              "id",
              "version",
              "at",
              "livemode",
              "type",
              "data"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^evt_[0-9a-f]{32}$",
                "description": "ID starting with evt_."
              },
              "version": {
                "type": "string",
                "const": "1"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "livemode": {
                "type": "boolean"
              },
              "type": {
                "type": "string",
                "const": "subscriber.opted_out"
              },
              "data": {
                "type": "object",
                "properties": {
                  "subscriber": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Subscriber"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "phone": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "subscriber",
                  "reason"
                ]
              }
            },
            "required": [
              "id",
              "version",
              "at",
              "livemode",
              "type",
              "data"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^evt_[0-9a-f]{32}$",
                "description": "ID starting with evt_."
              },
              "version": {
                "type": "string",
                "const": "1"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "livemode": {
                "type": "boolean"
              },
              "type": {
                "type": "string",
                "enum": [
                  "campaign.sent",
                  "campaign.completed"
                ]
              },
              "data": {
                "type": "object",
                "properties": {
                  "campaign_id": {
                    "type": "string",
                    "pattern": "^cmp_[0-9a-f]{32}$",
                    "description": "ID starting with cmp_."
                  },
                  "status": {
                    "type": "string"
                  }
                },
                "required": [
                  "campaign_id",
                  "status"
                ]
              }
            },
            "required": [
              "id",
              "version",
              "at",
              "livemode",
              "type",
              "data"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^evt_[0-9a-f]{32}$",
                "description": "ID starting with evt_."
              },
              "version": {
                "type": "string",
                "const": "1"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "livemode": {
                "type": "boolean"
              },
              "type": {
                "type": "string",
                "const": "template.status_updated"
              },
              "data": {
                "type": "object",
                "properties": {
                  "template": {
                    "$ref": "#/components/schemas/Template"
                  },
                  "event": {
                    "type": "string"
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "template",
                  "event",
                  "reason"
                ]
              }
            },
            "required": [
              "id",
              "version",
              "at",
              "livemode",
              "type",
              "data"
            ]
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^evt_[0-9a-f]{32}$",
                "description": "ID starting with evt_."
              },
              "version": {
                "type": "string",
                "const": "1"
              },
              "at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "RFC 3339 time."
              },
              "livemode": {
                "type": "boolean"
              },
              "type": {
                "type": "string",
                "const": "ping"
              },
              "data": {
                "type": "object",
                "properties": {
                  "webhook_endpoint": {
                    "type": "string",
                    "pattern": "^we_[0-9a-f]{32}$",
                    "description": "ID starting with we_."
                  }
                },
                "required": [
                  "webhook_endpoint"
                ]
              }
            },
            "required": [
              "id",
              "version",
              "at",
              "livemode",
              "type",
              "data"
            ]
          }
        ]
      }
    }
  }
}