API reference ยท Campaigns

List campaigns

GET/api/v1/campaigns
Authentication
Bearer token in the Authorization header.
Required scopes
campaigns: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

statusstringOptional

Allowed values: "draft", "scheduled", "sending", "sent", "failed", "cancelled"

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/campaigns' \
  --header "Authorization: Bearer $BUDDY_API_KEY"

Responses

200Campaign page.

application/json

dataarrayRequired
View data structure

Array items: object

idstringRequired

ID starting with cmp_.

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

titlestringRequired
templatestring | nullRequired
languagestring | nullRequired
variablesarrayRequired
View variables structure

Array items: string

headermultiple typesRequired
View header structure

Must match at least one of these structures.

Option 1: object

The template's header: media, a location, or text header values.

imagestringOptional

An https link to a JPG or PNG, for an image header.

Format: uri

Maximum length: 2048

videostringOptional

An https link to an MP4, for a video header.

Format: uri

Maximum length: 2048

documentstringOptional

An https link to a PDF, for a document header.

Format: uri

Maximum length: 2048

media_idstringOptional

A WhatsApp media ID, instead of a link.

Minimum length: 1

Maximum length: 200

filenamestringOptional

The file name shown for a document header.

Minimum length: 1

Maximum length: 240

locationobjectOptional

For a location header.

View location structure
latitudenumberRequired

Minimum: -90

Maximum: 90

longitudenumberRequired

Minimum: -180

Maximum: 180

namestringOptional

Maximum length: 200

addressstringOptional

Maximum length: 500

variablesmultiple typesOptional

Values for a text header's parameter.

View variables structure

Must match at least one of these structures.

Option 1: array

Maximum items: 100

Array items: multiple types

Must match at least one of these structures.

Option 1: string

Maximum length: 1024

Option 2: number
Option 2: object

Additional field values: multiple types

Must match at least one of these structures.

Option 1: string

Maximum length: 1024

Option 2: number

Field name requirements

Minimum length: 1

Maximum length: 100

Option 2: null
buttonsarrayRequired
View buttons structure

Array items: object

indexintegerRequired

The button's position, from 0, as GET /templates lists it.

Minimum: 0

Maximum: 9

url_suffixstringOptional

Appended to a dynamic URL button's link.

Minimum length: 1

Maximum length: 2000

coupon_codestringOptional

The code a copy code button copies.

Minimum length: 1

Maximum length: 15

otp_codestringOptional

For an authentication template's code button. Defaults to the code in the body.

Minimum length: 1

Maximum length: 15

statusstringRequired
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)))$

send_atmultiple typesRequired
View send_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
sent_atmultiple typesRequired
View sent_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
statsobjectOptional
View stats structure
recipientsnumberRequired
sentnumberRequired
deliverednumberRequired
readnumberRequired
repliednumberRequired
failednumberRequired
clickednumberRequired
failed_reasonstring | nullRequired
ordersnumberRequired
revenue_minornumberRequired
currencystring | nullRequired

Null when purchases span multiple currencies. Use revenue_by_currency for totals.

revenue_by_currencyarrayRequired
View revenue_by_currency structure

Array items: object

currencystringRequired
attributed_minornumberRequired
attributed_ordersnumberRequired
unattributed_minornumberRequired
unattributed_ordersnumberRequired
refunded_minornumberRequired
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 campaigns
HTTP statusError codes
400invalid_cursor: Invalid cursor. 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": "listCampaigns",
    "summary": "List campaigns",
    "tags": [
      "Campaigns"
    ],
    "x-buddy-scopes": [
      "campaigns:read"
    ],
    "x-buddy-errors": [
      "invalid_cursor",
      "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": [
          "campaigns: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": "status",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "draft",
            "scheduled",
            "sending",
            "sent",
            "failed",
            "cancelled"
          ]
        }
      }
    ],
    "responses": {
      "200": {
        "description": "Campaign page.",
        "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": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^cmp_[0-9a-f]{32}$",
                        "description": "ID starting with cmp_."
                      },
                      "title": {
                        "type": "string"
                      },
                      "template": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "language": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "variables": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "header": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "image": {
                                "description": "An https link to a JPG or PNG, for an image header.",
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              "video": {
                                "description": "An https link to an MP4, for a video header.",
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              "document": {
                                "description": "An https link to a PDF, for a document header.",
                                "type": "string",
                                "maxLength": 2048,
                                "format": "uri"
                              },
                              "media_id": {
                                "description": "A WhatsApp media ID, instead of a link.",
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "filename": {
                                "description": "The file name shown for a document header.",
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 240
                              },
                              "location": {
                                "description": "For a location header.",
                                "type": "object",
                                "properties": {
                                  "latitude": {
                                    "type": "number",
                                    "minimum": -90,
                                    "maximum": 90
                                  },
                                  "longitude": {
                                    "type": "number",
                                    "minimum": -180,
                                    "maximum": 180
                                  },
                                  "name": {
                                    "type": "string",
                                    "maxLength": 200
                                  },
                                  "address": {
                                    "type": "string",
                                    "maxLength": 500
                                  }
                                },
                                "required": [
                                  "latitude",
                                  "longitude"
                                ]
                              },
                              "variables": {
                                "description": "Values for a text header's parameter.",
                                "anyOf": [
                                  {
                                    "maxItems": 100,
                                    "type": "array",
                                    "items": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "maxLength": 1024
                                        },
                                        {
                                          "type": "number"
                                        }
                                      ]
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 100
                                    },
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "maxLength": 1024
                                        },
                                        {
                                          "type": "number"
                                        }
                                      ]
                                    }
                                  }
                                ]
                              }
                            },
                            "description": "The template's header: media, a location, or text header values."
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "buttons": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "index": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9,
                              "description": "The button's position, from 0, as GET /templates lists it."
                            },
                            "url_suffix": {
                              "description": "Appended to a dynamic URL button's link.",
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "coupon_code": {
                              "description": "The code a copy code button copies.",
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 15
                            },
                            "otp_code": {
                              "description": "For an authentication template's code button. Defaults to the code in the body.",
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 15
                            }
                          },
                          "required": [
                            "index"
                          ]
                        }
                      },
                      "status": {
                        "type": "string"
                      },
                      "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."
                      },
                      "send_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"
                          }
                        ]
                      },
                      "sent_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"
                          }
                        ]
                      },
                      "stats": {
                        "type": "object",
                        "properties": {
                          "recipients": {
                            "type": "number"
                          },
                          "sent": {
                            "type": "number"
                          },
                          "delivered": {
                            "type": "number"
                          },
                          "read": {
                            "type": "number"
                          },
                          "replied": {
                            "type": "number"
                          },
                          "failed": {
                            "type": "number"
                          },
                          "clicked": {
                            "type": "number"
                          },
                          "failed_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "orders": {
                            "type": "number"
                          },
                          "revenue_minor": {
                            "type": "number"
                          },
                          "currency": {
                            "description": "Null when purchases span multiple currencies. Use revenue_by_currency for totals.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "revenue_by_currency": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "currency": {
                                  "type": "string"
                                },
                                "attributed_minor": {
                                  "type": "number"
                                },
                                "attributed_orders": {
                                  "type": "number"
                                },
                                "unattributed_minor": {
                                  "type": "number"
                                },
                                "unattributed_orders": {
                                  "type": "number"
                                },
                                "refunded_minor": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "currency",
                                "attributed_minor",
                                "attributed_orders",
                                "unattributed_minor",
                                "unattributed_orders",
                                "refunded_minor"
                              ]
                            }
                          }
                        },
                        "required": [
                          "recipients",
                          "sent",
                          "delivered",
                          "read",
                          "replied",
                          "failed",
                          "clicked",
                          "failed_reason",
                          "orders",
                          "revenue_minor",
                          "currency",
                          "revenue_by_currency"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "title",
                      "template",
                      "language",
                      "variables",
                      "header",
                      "buttons",
                      "status",
                      "livemode",
                      "created_at",
                      "send_at",
                      "sent_at"
                    ]
                  }
                },
                "has_more": {
                  "type": "boolean"
                },
                "next_cursor": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "400": {
        "description": "`invalid_cursor`: Invalid cursor. `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"
            ]
          }
        ]
      }
    }
  }
}