{"openapi":"3.1.0","info":{"title":"Chatwise API","version":"1.0.0","description":"Read a Chatwise workspace's inbox, send and create WhatsApp templates, and receive signed webhooks.","contact":{"name":"Chatwise","url":"https://chatwise.so/docs"}},"externalDocs":{"description":"Documentation","url":"https://chatwise.so/docs"},"servers":[{"url":"https://api.chatwise.so"}],"tags":[{"name":"Conversations","description":"Read the conversations in the workspace's inbox."},{"name":"Messages","description":"Read and search messages, and send approved WhatsApp templates."},{"name":"WhatsApp templates","description":"Find WhatsApp templates, and create new ones."},{"name":"Webhook endpoints","description":"Choose where Chatwise sends events."},{"name":"Webhook deliveries","description":"See what was sent to an endpoint, and send it again."}],"paths":{"/v1/conversations":{"get":{"tags":["Conversations"],"operationId":"listConversations","summary":"List conversations","description":"Lists the workspace's conversations, or finds them by customer. The latest activity comes first; conversations without a message come last. A conversation that gets a message while you read the pages moves to the top, so you can miss it.\n\n`from` and `to` filter by `lastMessageAt`.","security":[{"apiKey":["conversations:read"]}],"x-required-scopes":["conversations:read"],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many to return, from 1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"example":25},{"name":"cursor","in":"query","required":false,"description":"The previous page's `pagination.nextCursor`. Repeat the same filters and order with it.","schema":{"type":"string","maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"}},{"name":"from","in":"query","required":false,"description":"Only conversations with a latest message at or after this time. ISO 8601 with a time zone, at most milliseconds.","schema":{"type":"string","format":"date-time","pattern":"^[^.]*(?:\\.\\d{1,3}[Z+-][^.]*)?$"}},{"name":"to","in":"query","required":false,"description":"Only conversations with a latest message before this time, which must be after `from`. ISO 8601 with a time zone, at most milliseconds.","schema":{"type":"string","format":"date-time","pattern":"^[^.]*(?:\\.\\d{1,3}[Z+-][^.]*)?$"}},{"name":"channel","in":"query","required":false,"description":"Only conversations on this channel. Without it, every channel, Website Chat included.","schema":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER"]},"example":"WHATSAPP"},{"name":"status","in":"query","required":false,"description":"Only open or only resolved conversations. Leave out for both.","schema":{"type":"string","enum":["open","resolved"]},"example":"open"},{"name":"q","in":"query","required":false,"description":"Text in the customer's name, WhatsApp number or Instagram username (with or without `@`), in any case. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates.","schema":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$"}}],"responses":{"200":{"description":"A page of conversations.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"pagination":{"type":"object","properties":{"nextCursor":{"type":["string","null"],"description":"Send it as `cursor` for the next page. Null on the last page."}},"required":["nextCursor"]}},"required":["data","pagination"]},"example":{"data":[{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"}],"pagination":{"nextCursor":"eyJ2IjoxLCJiaW5kaW5nIjoiZXhhbXBsZSJ9"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"INVALID_CURSOR":{"$ref":"#/components/examples/INVALID_CURSOR"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: conversations:read"}}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/conversations/{conversationId}":{"get":{"tags":["Conversations"],"operationId":"getConversation","summary":"Get a conversation","description":"Reads one conversation: its channel, status and customer.","security":[{"apiKey":["conversations:read"]}],"x-required-scopes":["conversations:read"],"parameters":[{"name":"conversationId","in":"path","required":true,"description":"The conversation's id.","schema":{"type":"string","pattern":"^(?:[1-9]\\d{0,17}|[1-8]\\d{18}|9[0-1]\\d{17}|92[0-1]\\d{16}|922[0-2]\\d{15}|9223[0-2]\\d{14}|92233[0-6]\\d{13}|922337[0-1]\\d{12}|92233720[0-2]\\d{10}|922337203[0-5]\\d{9}|9223372036[0-7]\\d{8}|92233720368[0-4]\\d{7}|922337203685[0-3]\\d{6}|9223372036854[0-6]\\d{5}|92233720368547[0-6]\\d{4}|922337203685477[0-4]\\d{3}|9223372036854775[0-7]\\d{2}|922337203685477580[0-6]|9223372036854775807)$"},"example":"1234"}],"responses":{"200":{"description":"The conversation.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Conversation"}},"required":["data"]},"example":{"data":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: conversations:read"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"CONVERSATION_NOT_FOUND":{"$ref":"#/components/examples/CONVERSATION_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/conversations/{conversationId}/messages":{"get":{"tags":["Messages"],"operationId":"listConversationMessages","summary":"List a conversation's messages","description":"Lists one conversation's messages. Deleted and hidden messages are left out.","security":[{"apiKey":["messages:read"]}],"x-required-scopes":["messages:read"],"parameters":[{"name":"conversationId","in":"path","required":true,"description":"The conversation's id.","schema":{"type":"string","pattern":"^(?:[1-9]\\d{0,17}|[1-8]\\d{18}|9[0-1]\\d{17}|92[0-1]\\d{16}|922[0-2]\\d{15}|9223[0-2]\\d{14}|92233[0-6]\\d{13}|922337[0-1]\\d{12}|92233720[0-2]\\d{10}|922337203[0-5]\\d{9}|9223372036[0-7]\\d{8}|92233720368[0-4]\\d{7}|922337203685[0-3]\\d{6}|9223372036854[0-6]\\d{5}|92233720368547[0-6]\\d{4}|922337203685477[0-4]\\d{3}|9223372036854775[0-7]\\d{2}|922337203685477580[0-6]|9223372036854775807)$"},"example":"1234"},{"name":"limit","in":"query","required":false,"description":"How many to return, from 1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"example":25},{"name":"cursor","in":"query","required":false,"description":"The previous page's `pagination.nextCursor`. Repeat the same filters and order with it.","schema":{"type":"string","maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"}},{"name":"from","in":"query","required":false,"description":"Only messages at or after this time. ISO 8601 with a time zone, at most milliseconds.","schema":{"type":"string","format":"date-time","pattern":"^[^.]*(?:\\.\\d{1,3}[Z+-][^.]*)?$"},"example":"2026-11-12T00:00:00Z"},{"name":"to","in":"query","required":false,"description":"Only messages before this time, which must be after `from`. ISO 8601 with a time zone, at most milliseconds.","schema":{"type":"string","format":"date-time","pattern":"^[^.]*(?:\\.\\d{1,3}[Z+-][^.]*)?$"}},{"name":"direction","in":"query","required":false,"description":"`inbound` from the customer, `outbound` from the workspace. Leave out for both.","schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"timeField","in":"query","required":false,"description":"The time to filter and sort by: `sentAt`, or `ingestedAt` for when Chatwise stored the message.","schema":{"type":"string","enum":["sentAt","ingestedAt"],"default":"sentAt"}},{"name":"order","in":"query","required":false,"description":"`desc` for newest first, `asc` for oldest first.","schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"example":"asc"}],"responses":{"200":{"description":"A page of messages.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"pagination":{"type":"object","properties":{"nextCursor":{"type":["string","null"],"description":"Send it as `cursor` for the next page. Null on the last page."}},"required":["nextCursor"]}},"required":["data","pagination"]},"example":{"data":[{"id":"5678","conversationId":"1234","channel":"WHATSAPP","direction":"inbound","type":"text","text":"Is this available in blue?","sentAt":"2026-11-12T09:25:36.000Z","ingestedAt":"2026-11-12T09:25:36.412Z","replyToMessageId":null,"attachments":[]},{"id":"5680","conversationId":"1234","channel":"WHATSAPP","direction":"outbound","type":"text","text":"Yes, in two shades of blue.","sentAt":"2026-11-12T09:31:02.000Z","ingestedAt":"2026-11-12T09:31:02.350Z","replyToMessageId":null,"attachments":[]}],"pagination":{"nextCursor":null}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"INVALID_CURSOR":{"$ref":"#/components/examples/INVALID_CURSOR"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: messages:read"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"CONVERSATION_NOT_FOUND":{"$ref":"#/components/examples/CONVERSATION_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/conversations/{conversationId}/messages/{messageId}":{"get":{"tags":["Messages"],"operationId":"getMessage","summary":"Get a message","description":"Reads one message. A deleted or hidden message is not found.","security":[{"apiKey":["messages:read"]}],"x-required-scopes":["messages:read"],"parameters":[{"name":"conversationId","in":"path","required":true,"description":"The conversation's id.","schema":{"type":"string","pattern":"^(?:[1-9]\\d{0,17}|[1-8]\\d{18}|9[0-1]\\d{17}|92[0-1]\\d{16}|922[0-2]\\d{15}|9223[0-2]\\d{14}|92233[0-6]\\d{13}|922337[0-1]\\d{12}|92233720[0-2]\\d{10}|922337203[0-5]\\d{9}|9223372036[0-7]\\d{8}|92233720368[0-4]\\d{7}|922337203685[0-3]\\d{6}|9223372036854[0-6]\\d{5}|92233720368547[0-6]\\d{4}|922337203685477[0-4]\\d{3}|9223372036854775[0-7]\\d{2}|922337203685477580[0-6]|9223372036854775807)$"},"example":"1234"},{"name":"messageId","in":"path","required":true,"description":"The message's id.","schema":{"type":"string","pattern":"^(?:[1-9]\\d{0,17}|[1-8]\\d{18}|9[0-1]\\d{17}|92[0-1]\\d{16}|922[0-2]\\d{15}|9223[0-2]\\d{14}|92233[0-6]\\d{13}|922337[0-1]\\d{12}|92233720[0-2]\\d{10}|922337203[0-5]\\d{9}|9223372036[0-7]\\d{8}|92233720368[0-4]\\d{7}|922337203685[0-3]\\d{6}|9223372036854[0-6]\\d{5}|92233720368547[0-6]\\d{4}|922337203685477[0-4]\\d{3}|9223372036854775[0-7]\\d{2}|922337203685477580[0-6]|9223372036854775807)$"},"example":"5678"}],"responses":{"200":{"description":"The message.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Message"}},"required":["data"]},"example":{"data":{"id":"5678","conversationId":"1234","channel":"WHATSAPP","direction":"inbound","type":"text","text":"Is this available in blue?","sentAt":"2026-11-12T09:25:36.000Z","ingestedAt":"2026-11-12T09:25:36.412Z","replyToMessageId":null,"attachments":[]}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: messages:read"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"MESSAGE_NOT_FOUND":{"$ref":"#/components/examples/MESSAGE_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/messages":{"get":{"tags":["Messages"],"operationId":"listMessages","summary":"List or search messages","description":"Lists messages across the workspace, or searches their text. Deleted and hidden messages are left out, and a search skips WhatsApp authentication templates.\n\nTo pull new messages on a schedule, use `timeField=ingestedAt` and `order=asc`. To get them as they arrive, use [webhooks](/docs/webhooks).","security":[{"apiKey":["messages:read"]}],"x-required-scopes":["messages:read"],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many to return, from 1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"example":25},{"name":"cursor","in":"query","required":false,"description":"The previous page's `pagination.nextCursor`. Repeat the same filters and order with it.","schema":{"type":"string","maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"}},{"name":"from","in":"query","required":false,"description":"Only messages at or after this time. ISO 8601 with a time zone, at most milliseconds.","schema":{"type":"string","format":"date-time","pattern":"^[^.]*(?:\\.\\d{1,3}[Z+-][^.]*)?$"}},{"name":"to","in":"query","required":false,"description":"Only messages before this time, which must be after `from`. ISO 8601 with a time zone, at most milliseconds.","schema":{"type":"string","format":"date-time","pattern":"^[^.]*(?:\\.\\d{1,3}[Z+-][^.]*)?$"}},{"name":"direction","in":"query","required":false,"description":"`inbound` from the customer, `outbound` from the workspace. Leave out for both.","schema":{"type":"string","enum":["inbound","outbound"]}},{"name":"timeField","in":"query","required":false,"description":"The time to filter and sort by: `sentAt`, or `ingestedAt` for when Chatwise stored the message.","schema":{"type":"string","enum":["sentAt","ingestedAt"],"default":"sentAt"}},{"name":"order","in":"query","required":false,"description":"`desc` for newest first, `asc` for oldest first.","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}},{"name":"q","in":"query","required":false,"description":"Text the message contains, in any case. Every character counts as itself: there are no wildcards. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates.","schema":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$"},"example":"blue"},{"name":"conversationId","in":"query","required":false,"description":"Only messages in this conversation.","schema":{"type":"string","pattern":"^(?:[1-9]\\d{0,17}|[1-8]\\d{18}|9[0-1]\\d{17}|92[0-1]\\d{16}|922[0-2]\\d{15}|9223[0-2]\\d{14}|92233[0-6]\\d{13}|922337[0-1]\\d{12}|92233720[0-2]\\d{10}|922337203[0-5]\\d{9}|9223372036[0-7]\\d{8}|92233720368[0-4]\\d{7}|922337203685[0-3]\\d{6}|9223372036854[0-6]\\d{5}|92233720368547[0-6]\\d{4}|922337203685477[0-4]\\d{3}|9223372036854775[0-7]\\d{2}|922337203685477580[0-6]|9223372036854775807)$"}},{"name":"channel","in":"query","required":false,"description":"Only messages on this channel. Without it, every channel, Website Chat included.","schema":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER"]},"example":"WHATSAPP"}],"responses":{"200":{"description":"A page of messages.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"pagination":{"type":"object","properties":{"nextCursor":{"type":["string","null"],"description":"Send it as `cursor` for the next page. Null on the last page."}},"required":["nextCursor"]}},"required":["data","pagination"]},"example":{"data":[{"id":"5678","conversationId":"1234","channel":"WHATSAPP","direction":"inbound","type":"text","text":"Is this available in blue?","sentAt":"2026-11-12T09:25:36.000Z","ingestedAt":"2026-11-12T09:25:36.412Z","replyToMessageId":null,"attachments":[]}],"pagination":{"nextCursor":null}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"INVALID_CURSOR":{"$ref":"#/components/examples/INVALID_CURSOR"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: messages:read"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"CONVERSATION_NOT_FOUND":{"$ref":"#/components/examples/CONVERSATION_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}},"post":{"tags":["Messages"],"operationId":"sendMessage","summary":"Send a template by id","description":"Sends an approved WhatsApp template by its id. The answer means WhatsApp accepted the message, not that it was delivered.\n\nThis route only sends WhatsApp templates. With another `channel`, or without `templateId`, it answers 201 and sends nothing.\n\nSending twice sends two messages. After a timeout or a 500 the message may have been sent, so check before you retry.","security":[{"apiKey":["messages:send"]}],"x-required-scopes":["messages:send"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","description":"The customer's phone number with its country code."},"templateId":{"type":"string","description":"The template's `id`. Needed to send."},"templateParams":{"type":"array","items":{"type":"object","properties":{"parameter_name":{"type":"string","description":"The variable's name, its number (`1`, `2`, …), or `otp` for the code of an authentication template."},"text":{"type":"string","description":"The variable's value."}},"required":["parameter_name","text"],"additionalProperties":true},"description":"Values for the body's variables. A template with a variable or media in its header, a dynamic URL button or a copy code button takes `templateComponents` instead. Keys other than `parameter_name` and `text` are ignored."},"templateLanguage":{"type":"string","pattern":"^[a-z]{2,3}(?:_[A-Z]{2})?$","description":"The language code to send it in, such as `en_US`. Without it, the template's own. Spaces around it are ignored."},"templateComponents":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"header","description":"`header`, `body` or `button`."},"parameters":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"text","description":"The kind of value."},"text":{"type":"string","minLength":1,"description":"The text."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"image","description":"The kind of value."},"image":{"type":"object","properties":{"link":{"type":"string","format":"uri","description":"The image's public URL."},"id":{"type":"string","minLength":1,"pattern":"\\S","description":"The image's Meta media id. Spaces around it are ignored. Can't be blank."}},"additionalProperties":false,"anyOf":[{"required":["link"]},{"required":["id"]}],"description":"An image, by `link` or Meta media `id`."}},"required":["type","image"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"video","description":"The kind of value."},"video":{"type":"object","properties":{"link":{"type":"string","format":"uri","description":"The video's public URL."},"id":{"type":"string","minLength":1,"pattern":"\\S","description":"The video's Meta media id. Spaces around it are ignored. Can't be blank."}},"additionalProperties":false,"anyOf":[{"required":["link"]},{"required":["id"]}],"description":"A video, by `link` or Meta media `id`."}},"required":["type","video"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"document","description":"The kind of value."},"document":{"type":"object","properties":{"link":{"type":"string","format":"uri","description":"The document's public URL."},"id":{"type":"string","minLength":1,"pattern":"\\S","description":"The document's Meta media id. Spaces around it are ignored. Can't be blank."},"filename":{"type":"string","minLength":1,"maxLength":240,"description":"The file name the customer sees."}},"additionalProperties":false,"anyOf":[{"required":["link"]},{"required":["id"]}],"description":"A document, by `link` or Meta media `id`."}},"required":["type","document"],"additionalProperties":false}]},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"body","description":"`header`, `body` or `button`."},"parameters":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"text","description":"The kind of value."},"text":{"type":"string","minLength":1,"description":"The text."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"currency","description":"The kind of value."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."},"currency":{"type":"object","properties":{"fallbackValue":{"type":"string","minLength":1,"description":"The amount as text, such as `$12.50`."},"code":{"type":"string","pattern":"^[A-Z]{3}$","description":"The ISO 4217 currency code. Spaces around it are ignored."},"amount1000":{"type":"integer","description":"The amount times 1000."}},"required":["fallbackValue","code","amount1000"],"additionalProperties":false,"description":"An amount of money."}},"required":["type","currency"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"date_time","description":"The kind of value."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."},"dateTime":{"type":"object","properties":{"fallbackValue":{"type":"string","minLength":1,"description":"The date or time as text."}},"required":["fallbackValue"],"additionalProperties":false,"description":"A date or time."}},"required":["type","dateTime"],"additionalProperties":false}]},"minItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"button","description":"`header`, `body` or `button`."},"subType":{"type":"string","const":"url","description":"The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`."},"index":{"type":"integer","minimum":0,"maximum":9,"description":"The button's position, from 0."},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"text","description":"The kind of value."},"text":{"type":"string","minLength":1,"description":"The text."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."}},"required":["type","text"],"additionalProperties":false},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","subType","index","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"button","description":"`header`, `body` or `button`."},"subType":{"type":"string","const":"quick_reply","description":"The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`."},"index":{"type":"integer","minimum":0,"maximum":9,"description":"The button's position, from 0."},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"payload","description":"The kind of value."},"payload":{"type":"string","minLength":1,"maxLength":256,"description":"What a quick reply button sends back."}},"required":["type","payload"],"additionalProperties":false},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","subType","index","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"button","description":"`header`, `body` or `button`."},"subType":{"type":"string","const":"copy_code","description":"The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`."},"index":{"type":"integer","minimum":0,"maximum":9,"description":"The button's position, from 0."},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"coupon_code","description":"The kind of value."},"couponCode":{"type":"string","minLength":1,"maxLength":15,"description":"The code a copy code button copies."}},"required":["type","couponCode"],"additionalProperties":false},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","subType","index","parameters"],"additionalProperties":false}]},"maxItems":12,"description":"Values for the header, body and buttons, up to 12 components. Used instead of `templateParams`, except for authentication templates. At most one header and one body, and no two buttons with the same `subType` and `index`."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM"],"description":"Use `WHATSAPP`."},"from":{"type":"string","pattern":"^\\d{6,20}$","description":"The connected WhatsApp number to send from, digits only. Without it: the number on the template's WhatsApp Business Account the customer last wrote to, else the oldest number there."}},"required":["to","channel"],"additionalProperties":false},"example":{"to":"12025550147","channel":"WHATSAPP","templateId":"123456789012345","templateParams":[{"parameter_name":"order_number","text":"A-1042"}]}}}},"responses":{"201":{"description":"WhatsApp accepted the message.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"message":{"type":"string","description":"A confirmation."},"from":{"type":"string","description":"The WhatsApp number it was sent from. Absent when nothing was sent."}},"required":["message"]}},"required":["data"]},"example":{"data":{"message":"Message accepted","from":"+1 202-555-0199"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"BODY_NOT_JSON":{"$ref":"#/components/examples/BODY_NOT_JSON"},"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"TEMPLATE_NOT_APPROVED":{"$ref":"#/components/examples/TEMPLATE_NOT_APPROVED"},"TEMPLATE_OTHER_ACCOUNT":{"$ref":"#/components/examples/TEMPLATE_OTHER_ACCOUNT"},"TEMPLATE_OTP_MISSING":{"$ref":"#/components/examples/TEMPLATE_OTP_MISSING"},"TEMPLATE_PARAMS_NUMBERING":{"$ref":"#/components/examples/TEMPLATE_PARAMS_NUMBERING"},"FROM_NOT_CONNECTED":{"$ref":"#/components/examples/FROM_NOT_CONNECTED"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"402":{"description":"Sending is paused for the workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodedError"},"examples":{"SERVICES_BLOCKED":{"$ref":"#/components/examples/SERVICES_BLOCKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/CodedError"}]},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: messages:send"}},"WHATSAPP_REAUTH_REQUIRED":{"$ref":"#/components/examples/WHATSAPP_REAUTH_REQUIRED"}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"TEMPLATE_NOT_FOUND":{"$ref":"#/components/examples/TEMPLATE_NOT_FOUND"},"WHATSAPP_NO_ACTIVE_NUMBER":{"$ref":"#/components/examples/WHATSAPP_NO_ACTIVE_NUMBER"},"WHATSAPP_NO_NUMBER_FOR_TEMPLATE":{"$ref":"#/components/examples/WHATSAPP_NO_NUMBER_FOR_TEMPLATE"}}}}},"413":{"description":"The body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"BODY_TOO_LARGE":{"$ref":"#/components/examples/BODY_TOO_LARGE"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"WHATSAPP_REFUSED":{"$ref":"#/components/examples/WHATSAPP_REFUSED"},"SERVER_ERROR_WITH_ID":{"$ref":"#/components/examples/SERVER_ERROR_WITH_ID"}}}}}}}},"/v1/template/whatsapp":{"post":{"tags":["Messages"],"operationId":"sendWhatsappTemplate","summary":"Send a template by name","description":"Sends an approved WhatsApp template by its name. The answer means WhatsApp accepted the message, not that it was delivered.\n\nSending twice sends two messages. After a timeout or a 500 the message may have been sent, so check before you retry.","security":[{"apiKey":["messages:send"]}],"x-required-scopes":["messages:send"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phoneNumber":{"type":"string","minLength":8,"pattern":"^\\d+$","description":"The customer's phone number with its country code, digits only, at least 8."},"templateName":{"type":"string","description":"The template's exact name."},"templateParams":{"type":"array","items":{"type":"object","properties":{"parameter_name":{"type":"string","description":"The variable's name, its number (`1`, `2`, …), or `otp` for the code of an authentication template."},"text":{"type":"string","description":"The variable's value."}},"required":["parameter_name","text"],"additionalProperties":true},"description":"Values for the body's variables. A template with a variable or media in its header, a dynamic URL button or a copy code button takes `templateComponents` instead. Keys other than `parameter_name` and `text` are ignored."},"templateLanguage":{"type":"string","pattern":"^[a-z]{2,3}(?:_[A-Z]{2})?$","description":"The translation to send, such as `en_US`. Without it, the oldest approved template with this name, in its own language. If Chatwise doesn't have the translation, it asks WhatsApp to send the oldest one in this language. Spaces around it are ignored."},"templateComponents":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"header","description":"`header`, `body` or `button`."},"parameters":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"text","description":"The kind of value."},"text":{"type":"string","minLength":1,"description":"The text."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"image","description":"The kind of value."},"image":{"type":"object","properties":{"link":{"type":"string","format":"uri","description":"The image's public URL."},"id":{"type":"string","minLength":1,"pattern":"\\S","description":"The image's Meta media id. Spaces around it are ignored. Can't be blank."}},"additionalProperties":false,"anyOf":[{"required":["link"]},{"required":["id"]}],"description":"An image, by `link` or Meta media `id`."}},"required":["type","image"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"video","description":"The kind of value."},"video":{"type":"object","properties":{"link":{"type":"string","format":"uri","description":"The video's public URL."},"id":{"type":"string","minLength":1,"pattern":"\\S","description":"The video's Meta media id. Spaces around it are ignored. Can't be blank."}},"additionalProperties":false,"anyOf":[{"required":["link"]},{"required":["id"]}],"description":"A video, by `link` or Meta media `id`."}},"required":["type","video"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"document","description":"The kind of value."},"document":{"type":"object","properties":{"link":{"type":"string","format":"uri","description":"The document's public URL."},"id":{"type":"string","minLength":1,"pattern":"\\S","description":"The document's Meta media id. Spaces around it are ignored. Can't be blank."},"filename":{"type":"string","minLength":1,"maxLength":240,"description":"The file name the customer sees."}},"additionalProperties":false,"anyOf":[{"required":["link"]},{"required":["id"]}],"description":"A document, by `link` or Meta media `id`."}},"required":["type","document"],"additionalProperties":false}]},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"body","description":"`header`, `body` or `button`."},"parameters":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"text","description":"The kind of value."},"text":{"type":"string","minLength":1,"description":"The text."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"currency","description":"The kind of value."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."},"currency":{"type":"object","properties":{"fallbackValue":{"type":"string","minLength":1,"description":"The amount as text, such as `$12.50`."},"code":{"type":"string","pattern":"^[A-Z]{3}$","description":"The ISO 4217 currency code. Spaces around it are ignored."},"amount1000":{"type":"integer","description":"The amount times 1000."}},"required":["fallbackValue","code","amount1000"],"additionalProperties":false,"description":"An amount of money."}},"required":["type","currency"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"date_time","description":"The kind of value."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."},"dateTime":{"type":"object","properties":{"fallbackValue":{"type":"string","minLength":1,"description":"The date or time as text."}},"required":["fallbackValue"],"additionalProperties":false,"description":"A date or time."}},"required":["type","dateTime"],"additionalProperties":false}]},"minItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"button","description":"`header`, `body` or `button`."},"subType":{"type":"string","const":"url","description":"The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`."},"index":{"type":"integer","minimum":0,"maximum":9,"description":"The button's position, from 0."},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"text","description":"The kind of value."},"text":{"type":"string","minLength":1,"description":"The text."},"parameterName":{"type":"string","minLength":1,"maxLength":64,"pattern":"\\S","description":"The variable's name, for templates with named variables. Spaces around it are ignored. Can't be blank."}},"required":["type","text"],"additionalProperties":false},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","subType","index","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"button","description":"`header`, `body` or `button`."},"subType":{"type":"string","const":"quick_reply","description":"The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`."},"index":{"type":"integer","minimum":0,"maximum":9,"description":"The button's position, from 0."},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"payload","description":"The kind of value."},"payload":{"type":"string","minLength":1,"maxLength":256,"description":"What a quick reply button sends back."}},"required":["type","payload"],"additionalProperties":false},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","subType","index","parameters"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"button","description":"`header`, `body` or `button`."},"subType":{"type":"string","const":"copy_code","description":"The button's kind: `url` takes a `text` parameter, `quick_reply` a `payload`, `copy_code` a `coupon_code`."},"index":{"type":"integer","minimum":0,"maximum":9,"description":"The button's position, from 0."},"parameters":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"coupon_code","description":"The kind of value."},"couponCode":{"type":"string","minLength":1,"maxLength":15,"description":"The code a copy code button copies."}},"required":["type","couponCode"],"additionalProperties":false},"minItems":1,"maxItems":1,"description":"The component's values: one for a header or a button, one or more for a body."}},"required":["type","subType","index","parameters"],"additionalProperties":false}]},"maxItems":12,"description":"Values for the header, body and buttons, up to 12 components. Used instead of `templateParams`, except for authentication templates. At most one header and one body, and no two buttons with the same `subType` and `index`."},"from":{"type":"string","pattern":"^\\d{6,20}$","description":"The connected WhatsApp number to send from, digits only. Without it: the number on the template's WhatsApp Business Account the customer last wrote to, else the oldest number there."}},"required":["phoneNumber","templateName"],"additionalProperties":false},"example":{"phoneNumber":"12025550147","templateName":"order_ready","templateLanguage":"en_US","templateParams":[{"parameter_name":"order_number","text":"A-1042"}]}}}},"responses":{"201":{"description":"WhatsApp accepted the message.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"message":{"type":"string","description":"A confirmation."},"from":{"type":"string","description":"The WhatsApp number it was sent from."}},"required":["message","from"]}},"required":["data"]},"example":{"data":{"message":"Send whatsapp template message successfully","from":"+1 202-555-0199"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"BODY_NOT_JSON":{"$ref":"#/components/examples/BODY_NOT_JSON"},"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"TEMPLATE_OTP_MISSING":{"$ref":"#/components/examples/TEMPLATE_OTP_MISSING"},"TEMPLATE_PARAMS_NUMBERING":{"$ref":"#/components/examples/TEMPLATE_PARAMS_NUMBERING"},"FROM_NOT_CONNECTED":{"$ref":"#/components/examples/FROM_NOT_CONNECTED"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"402":{"description":"Sending is paused for the workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodedError"},"examples":{"SERVICES_BLOCKED":{"$ref":"#/components/examples/SERVICES_BLOCKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/CodedError"}]},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: messages:send"}},"WHATSAPP_REAUTH_REQUIRED":{"$ref":"#/components/examples/WHATSAPP_REAUTH_REQUIRED"}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"WHATSAPP_NOT_CONNECTED":{"$ref":"#/components/examples/WHATSAPP_NOT_CONNECTED"},"TEMPLATE_NOT_FOUND":{"$ref":"#/components/examples/TEMPLATE_NOT_FOUND"},"WHATSAPP_NO_ACTIVE_NUMBER":{"$ref":"#/components/examples/WHATSAPP_NO_ACTIVE_NUMBER"},"WHATSAPP_NO_NUMBER_FOR_TEMPLATE":{"$ref":"#/components/examples/WHATSAPP_NO_NUMBER_FOR_TEMPLATE"}}}}},"413":{"description":"The body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"BODY_TOO_LARGE":{"$ref":"#/components/examples/BODY_TOO_LARGE"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"WHATSAPP_REFUSED":{"$ref":"#/components/examples/WHATSAPP_REFUSED"},"SERVER_ERROR_WITH_ID":{"$ref":"#/components/examples/SERVER_ERROR_WITH_ID"}}}}}}}},"/v1/whatsapp/templates":{"get":{"tags":["WhatsApp templates"],"operationId":"listWhatsappTemplates","summary":"List WhatsApp templates","description":"Lists the workspace's WhatsApp templates, newest first, with the variables and buttons each takes.","security":[{"apiKey":["templates:read"]}],"x-required-scopes":["templates:read"],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many to return, from 1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"example":25},{"name":"cursor","in":"query","required":false,"description":"The previous page's `pagination.nextCursor`. Repeat the same filters and order with it.","schema":{"type":"string","maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"}},{"name":"q","in":"query","required":false,"description":"Text in the template's name, in any case. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates.","schema":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$"}},{"name":"name","in":"query","required":false,"description":"The exact name, in any case. Finds every translation of a template. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates.","schema":{"type":"string","maxLength":100,"minLength":1,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$"}},{"name":"language","in":"query","required":false,"description":"The language code, such as `en_US`. Spaces around it are ignored.","schema":{"type":"string","pattern":"^[a-z]{2,3}(?:_[A-Z]{2})?$"},"example":"en_US"},{"name":"category","in":"query","required":false,"description":"Only templates in this category.","schema":{"type":"string","enum":["UTILITY","MARKETING","AUTHENTICATION"]}},{"name":"status","in":"query","required":false,"description":"Meta's review status, such as `APPROVED` or `PENDING`, in any case. Spaces around it are ignored.","schema":{"type":"string","pattern":"^[a-zA-Z_]{1,64}$"}},{"name":"sendable","in":"query","required":false,"description":"`true` for templates the send routes can send, `false` for the others. Leave out for both.","schema":{"type":"string","enum":["true","false"]},"example":"true"}],"responses":{"200":{"description":"A page of templates.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WhatsappTemplate"}},"pagination":{"type":"object","properties":{"nextCursor":{"type":["string","null"],"description":"Send it as `cursor` for the next page. Null on the last page."}},"required":["nextCursor"]}},"required":["data","pagination"]},"example":{"data":[{"id":"123456789012345","name":"order_ready","language":"en_US","category":"UTILITY","status":"APPROVED","rejectionReason":null,"sendable":true,"parameterFormat":"NAMED","requiresOtp":false,"authentication":null,"components":{"header":null,"body":{"text":"Your order {{order_number}} is ready to collect.","variables":["order_number"]},"footer":null,"buttons":[]},"unsupportedReason":null,"createdAt":"2026-11-19T09:00:00.000Z","updatedAt":"2026-11-19T09:05:00.000Z"}],"pagination":{"nextCursor":null}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"INVALID_CURSOR":{"$ref":"#/components/examples/INVALID_CURSOR"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: templates:read"}}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}},"post":{"tags":["WhatsApp templates"],"operationId":"createWhatsappTemplate","summary":"Create a WhatsApp template","description":"Creates a WhatsApp template and submits it to Meta for review, on the WhatsApp Business Account of the workspace's oldest connected number.\n\nSend an `Idempotency-Key` with each new template and reuse it, with the same body, when you retry. A repeat answers 200 with the same template. Without the header, two identical submissions count as a repeat too.","security":[{"apiKey":["templates:write"]}],"x-required-scopes":["templates:write"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"A key you choose for this template: 1 to 128 letters, digits, dots, underscores, hyphens or colons.","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"},"example":"order-ready-en-us-v1"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"name":{"type":"string","maxLength":100,"pattern":"^[a-z0-9][a-z0-9_]*$","description":"Lowercase letters, digits and underscores, up to 100 characters. Spaces around it are ignored."},"language":{"type":"string","pattern":"^[a-z]{2,3}(?:_[A-Z]{2})?$","description":"The language code, such as `en_US`. Each translation is a template of its own. Spaces around it are ignored."},"category":{"type":"string","enum":["UTILITY","MARKETING"],"description":"`UTILITY`, `MARKETING` or `AUTHENTICATION`."},"parameterFormat":{"type":"string","enum":["NAMED","POSITIONAL"],"default":"NAMED","description":"How variables are written: `NAMED` (`{{order_number}}`) or `POSITIONAL` (`{{1}}`)."},"components":{"type":"object","properties":{"header":{"anyOf":[{"type":"object","properties":{"format":{"type":"string","const":"TEXT","description":"The header's kind."},"text":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"The text, with at most one variable, which can't be at its start or end. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."},"examples":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$"},"propertyNames":{"pattern":"^(?:[a-z][a-z0-9_]{0,63}|[1-9]\\d*)$"},"maxProperties":100,"default":{},"description":"A sample value for the variable, by its name or number."}},"required":["format","text"],"additionalProperties":false},{"type":"object","properties":{"format":{"type":"string","enum":["IMAGE","VIDEO","DOCUMENT"],"description":"The header's kind."},"exampleMediaHandle":{"type":"string","minLength":1,"maxLength":2048,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"Meta's handle for a sample file. This API can't create one. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."}},"required":["format","exampleMediaHandle"],"additionalProperties":false}],"description":"A text header, or a media header with a sample."},"body":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"The text. Variables must be inside it, not at its start or end. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."},"examples":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$"},"propertyNames":{"pattern":"^(?:[a-z][a-z0-9_]{0,63}|[1-9]\\d*)$"},"maxProperties":100,"default":{},"description":"A sample value for each variable, by its name or number."}},"required":["text"],"additionalProperties":false,"description":"The message."},"footer":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"Fixed text below the body. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."},"buttons":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"QUICK_REPLY","description":"The button's kind."},"text":{"type":"string","minLength":1,"maxLength":25,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"The button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."}},"required":["type","text"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"PHONE_NUMBER","description":"The button's kind."},"text":{"type":"string","minLength":1,"maxLength":25,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"The button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."},"phoneNumber":{"type":"string","pattern":"^\\+?[1-9]\\d{7,14}$","description":"The number to call: 8 to 15 digits, with or without a `+`."}},"required":["type","text","phoneNumber"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"URL","description":"The button's kind."},"text":{"type":"string","minLength":1,"maxLength":25,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"The button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."},"url":{"type":"string","minLength":1,"maxLength":2000,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"The page to open. It may end with one variable. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."},"exampleUrl":{"type":"string","minLength":1,"maxLength":2000,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","description":"A complete sample URL, when the URL has a variable. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."}},"required":["type","text","url"],"additionalProperties":false}]},"minItems":1,"maxItems":10,"description":"Up to 10 buttons."}},"required":["body"],"additionalProperties":false,"description":"What the template contains."}},"required":["name","language","category","components"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","maxLength":100,"pattern":"^[a-z0-9][a-z0-9_]*$","description":"Lowercase letters, digits and underscores, up to 100 characters. Spaces around it are ignored."},"language":{"type":"string","pattern":"^[a-z]{2,3}(?:_[A-Z]{2})?$","description":"The language code, such as `en_US`. Each translation is a template of its own. Spaces around it are ignored."},"category":{"type":"string","const":"AUTHENTICATION","description":"`UTILITY`, `MARKETING` or `AUTHENTICATION`."},"authentication":{"type":"object","properties":{"codeExpirationMinutes":{"type":"integer","minimum":1,"maximum":90,"description":"How long the code is valid, from 1 to 90."},"addSecurityRecommendation":{"type":"boolean","default":false,"description":"Whether to tell the customer not to share the code."},"buttonText":{"type":"string","minLength":1,"maxLength":25,"pattern":"^[^\\x00]*[^\\s\\x00][^\\x00]*$","default":"Copy Code","description":"The copy button's label. Spaces around it are ignored. Can't be blank, or contain NUL characters or unpaired surrogates."}},"required":["codeExpirationMinutes"],"additionalProperties":false,"description":"Settings of an authentication template. Its text and copy code button are WhatsApp's own."}},"required":["name","language","category","authentication"],"additionalProperties":false}]},"example":{"name":"order_ready","language":"en_US","category":"UTILITY","parameterFormat":"NAMED","components":{"body":{"text":"Your order {{order_number}} is ready to collect.","examples":{"order_number":"A-1042"}}}}}}},"responses":{"200":{"description":"A repeat of an earlier submission, with the template as it is now.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WhatsappTemplate"}},"required":["data"]},"example":{"data":{"id":"123456789012345","name":"order_ready","language":"en_US","category":"UTILITY","status":"APPROVED","rejectionReason":null,"sendable":true,"parameterFormat":"NAMED","requiresOtp":false,"authentication":null,"components":{"header":null,"body":{"text":"Your order {{order_number}} is ready to collect.","variables":["order_number"]},"footer":null,"buttons":[]},"unsupportedReason":null,"createdAt":"2026-11-19T09:00:00.000Z","updatedAt":"2026-11-19T09:05:00.000Z"}}}}},"201":{"description":"Submitted to Meta.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WhatsappTemplate"}},"required":["data"]},"example":{"data":{"id":"123456789012345","name":"order_ready","language":"en_US","category":"UTILITY","status":"PENDING","rejectionReason":null,"sendable":false,"parameterFormat":"NAMED","requiresOtp":false,"authentication":null,"components":{"header":null,"body":{"text":"Your order {{order_number}} is ready to collect.","variables":["order_number"]},"footer":null,"buttons":[]},"unsupportedReason":null,"createdAt":"2026-11-19T09:00:00.000Z","updatedAt":"2026-11-19T09:00:00.000Z"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"BODY_NOT_JSON":{"$ref":"#/components/examples/BODY_NOT_JSON"},"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"TEMPLATE_INVALID":{"$ref":"#/components/examples/TEMPLATE_INVALID"},"TEMPLATE_REJECTED":{"$ref":"#/components/examples/TEMPLATE_REJECTED"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/CodedError"}]},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: templates:write"}},"TEMPLATE_NOT_AUTHORIZED":{"$ref":"#/components/examples/TEMPLATE_NOT_AUTHORIZED"},"WHATSAPP_REAUTH_REQUIRED":{"$ref":"#/components/examples/WHATSAPP_REAUTH_REQUIRED"}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"TEMPLATE_NO_CONNECTION":{"$ref":"#/components/examples/TEMPLATE_NO_CONNECTION"},"TEMPLATE_DELETED":{"$ref":"#/components/examples/TEMPLATE_DELETED"}}}}},"409":{"description":"It conflicts with an earlier submission.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodedError"},"examples":{"TEMPLATE_EXISTS":{"$ref":"#/components/examples/TEMPLATE_EXISTS"},"IDEMPOTENCY_KEY_REUSED":{"$ref":"#/components/examples/IDEMPOTENCY_KEY_REUSED"},"TEMPLATE_SUBMISSION_IN_PROGRESS":{"$ref":"#/components/examples/TEMPLATE_SUBMISSION_IN_PROGRESS"},"TEMPLATE_SUBMISSION_UNCONFIRMED_CONFLICT":{"$ref":"#/components/examples/TEMPLATE_SUBMISSION_UNCONFIRMED_CONFLICT"},"WHATSAPP_CONNECTION_CHANGED":{"$ref":"#/components/examples/WHATSAPP_CONNECTION_CHANGED"}}}}},"413":{"description":"The body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"BODY_TOO_LARGE":{"$ref":"#/components/examples/BODY_TOO_LARGE"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"TEMPLATE_SERVER_ERROR":{"$ref":"#/components/examples/TEMPLATE_SERVER_ERROR"}}}}},"502":{"description":"Meta didn't confirm.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodedError"},"examples":{"WHATSAPP_LOOKUP_FAILED":{"$ref":"#/components/examples/WHATSAPP_LOOKUP_FAILED"},"TEMPLATE_SUBMISSION_UNCONFIRMED":{"$ref":"#/components/examples/TEMPLATE_SUBMISSION_UNCONFIRMED"}}}}},"503":{"description":"Meta is busy.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodedError"},"examples":{"WHATSAPP_RATE_LIMITED":{"$ref":"#/components/examples/WHATSAPP_RATE_LIMITED"}}}}}}}},"/v1/whatsapp/templates/{templateId}":{"get":{"tags":["WhatsApp templates"],"operationId":"getWhatsappTemplate","summary":"Get a WhatsApp template","description":"Reads one WhatsApp template. After creating one, poll it until `status` is no longer `PENDING`. `sendable` then says whether the send routes can send it.","security":[{"apiKey":["templates:read"]}],"x-required-scopes":["templates:read"],"parameters":[{"name":"templateId","in":"path","required":true,"description":"The template's id: Meta's, or Chatwise's own numeric id. Not `.` or `..`, which a URL can't carry.","schema":{"type":"string","pattern":"^(?:[A-Za-z0-9._-]*[A-Za-z0-9_-][A-Za-z0-9._-]*|\\.{3,})$","minLength":1,"maxLength":128},"example":"123456789012345"}],"responses":{"200":{"description":"The template.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WhatsappTemplate"}},"required":["data"]},"example":{"data":{"id":"123456789012345","name":"order_ready","language":"en_US","category":"UTILITY","status":"APPROVED","rejectionReason":null,"sendable":true,"parameterFormat":"NAMED","requiresOtp":false,"authentication":null,"components":{"header":null,"body":{"text":"Your order {{order_number}} is ready to collect.","variables":["order_number"]},"footer":null,"buttons":[]},"unsupportedReason":null,"createdAt":"2026-11-19T09:00:00.000Z","updatedAt":"2026-11-19T09:05:00.000Z"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: templates:read"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"TEMPLATE_NOT_FOUND":{"$ref":"#/components/examples/TEMPLATE_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-endpoints":{"get":{"tags":["Webhook endpoints"],"operationId":"listWebhookEndpoints","summary":"List webhook endpoints","description":"Lists the workspace's webhook endpoints, oldest first. There are at most 10, so there are no pages. Signing secrets are never listed.","security":[{"apiKey":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"responses":{"200":{"description":"The endpoints.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}}},"required":["data"]},"example":{"data":[{"id":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","name":"Order support","url":"https://example.com/webhooks/chatwise","events":["message.received"],"accountIds":[],"status":"ACTIVE","apiVersion":"2026-12-01","health":{"lastSuccessAt":"2026-11-12T09:21:08.000Z","lastFailureAt":null,"consecutiveFailures":0,"disabledAt":null,"disabledReason":null},"createdAt":"2026-11-02T10:00:00.000Z","updatedAt":"2026-11-12T09:21:08.000Z"}]}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:read"}}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}},"post":{"tags":["Webhook endpoints"],"operationId":"createWebhookEndpoint","summary":"Create a webhook endpoint","description":"Creates an endpoint that receives events. The response is the only time `signingSecret` is returned, so store it right away.\n\nThe endpoint receives events that happen after it was created. A workspace can have 10 endpoints.","security":[{"apiKey":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-conditional-scopes":[{"scope":"messages:read","when":"You subscribe to `message.*` events."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[^\\x00-\\x1f\\x7f]*[^\\s\\x00-\\x1f\\x7f][^\\x00-\\x1f\\x7f]*$","description":"A name for the endpoint, 1 to 80 characters. Spaces around it are ignored. Can't be blank, or contain control characters or unpaired surrogates."},"url":{"type":"string","format":"uri","maxLength":2048,"description":"Where to send events: a public `https://` URL on port 443, without a username, password or `#fragment`. Spaces around it are ignored."},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"]},"minItems":1,"maxItems":6,"description":"The events to receive. `message.*` events also need the `messages:read` scope."},"accountIds":{"type":"array","items":{"type":"string","pattern":"^(?:[1-9]\\d{0,17}|[1-8]\\d{18}|9[0-1]\\d{17}|92[0-1]\\d{16}|922[0-2]\\d{15}|9223[0-2]\\d{14}|92233[0-6]\\d{13}|922337[0-1]\\d{12}|92233720[0-2]\\d{10}|922337203[0-5]\\d{9}|9223372036[0-7]\\d{8}|92233720368[0-4]\\d{7}|922337203685[0-3]\\d{6}|9223372036854[0-6]\\d{5}|92233720368547[0-6]\\d{4}|922337203685477[0-4]\\d{3}|9223372036854775[0-7]\\d{2}|922337203685477580[0-6]|9223372036854775807)$"},"maxItems":50,"description":"Only send events for these accounts. Leave out, or send an empty list, for every account."}},"required":["name","url","events"],"additionalProperties":false},"example":{"name":"Order support","url":"https://example.com/webhooks/chatwise","events":["message.received"]}}}},"responses":{"201":{"description":"The endpoint, with its signing secret.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"The endpoint's id."},"name":{"type":"string","description":"The endpoint's name."},"url":{"type":"string","description":"Where events are sent."},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"]},"description":"The events it receives."},"accountIds":{"type":"array","items":{"type":"string"},"description":"The accounts it receives events for. Empty means every account."},"status":{"type":"string","enum":["ACTIVE","PAUSED","DISABLED"],"description":"`ACTIVE`, `PAUSED` by the workspace, or `DISABLED` by Chatwise (see `health.disabledReason`)."},"apiVersion":{"type":"string","description":"The payload format it receives, as a date."},"health":{"type":"object","properties":{"lastSuccessAt":{"anyOf":[{"type":"string","format":"date-time","description":"When an attempt last succeeded. ISO 8601, in UTC."},{"type":"null"}],"description":"When an attempt last succeeded. ISO 8601, in UTC."},"lastFailureAt":{"anyOf":[{"type":"string","format":"date-time","description":"When an attempt last failed. ISO 8601, in UTC."},{"type":"null"}],"description":"When an attempt last failed. ISO 8601, in UTC."},"consecutiveFailures":{"type":"integer","description":"Failed attempts since the last success."},"disabledAt":{"anyOf":[{"type":"string","format":"date-time","description":"When Chatwise disabled it. ISO 8601, in UTC."},{"type":"null"}],"description":"When Chatwise disabled it. ISO 8601, in UTC."},"disabledReason":{"type":["string","null"],"description":"Why Chatwise disabled it."}},"required":["lastSuccessAt","lastFailureAt","consecutiveFailures","disabledAt","disabledReason"],"description":"How its deliveries are going."},"createdAt":{"type":"string","format":"date-time","description":"When it was created. ISO 8601, in UTC."},"updatedAt":{"type":"string","format":"date-time","description":"When it, or its health, last changed. ISO 8601, in UTC."},"signingSecret":{"type":"string","description":"The secret that signs its deliveries: `whsec_` and 32 random bytes in base64. Shown only here; store it safely."}},"required":["id","name","url","events","accountIds","status","apiVersion","health","createdAt","updatedAt","signingSecret"]}},"required":["data"]},"example":{"data":{"id":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","name":"Order support","url":"https://example.com/webhooks/chatwise","events":["message.received"],"accountIds":[],"status":"ACTIVE","apiVersion":"2026-12-01","health":{"lastSuccessAt":null,"lastFailureAt":null,"consecutiveFailures":0,"disabledAt":null,"disabledReason":null},"createdAt":"2026-11-02T10:00:00.000Z","updatedAt":"2026-11-02T10:00:00.000Z","signingSecret":"whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA="}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"BODY_NOT_JSON":{"$ref":"#/components/examples/BODY_NOT_JSON"},"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"ENDPOINT_URL":{"$ref":"#/components/examples/ENDPOINT_URL"},"ENDPOINT_ACCOUNTS":{"$ref":"#/components/examples/ENDPOINT_ACCOUNTS"},"ENDPOINT_LIMIT":{"$ref":"#/components/examples/ENDPOINT_LIMIT"},"SUBSCRIBE_NEEDS_MESSAGES":{"$ref":"#/components/examples/SUBSCRIBE_NEEDS_MESSAGES"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:write"}}}}}},"413":{"description":"The body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"BODY_TOO_LARGE":{"$ref":"#/components/examples/BODY_TOO_LARGE"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-endpoints/{endpointId}":{"get":{"tags":["Webhook endpoints"],"operationId":"getWebhookEndpoint","summary":"Get a webhook endpoint","description":"Reads one endpoint and how its deliveries are going.","security":[{"apiKey":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"parameters":[{"name":"endpointId","in":"path","required":true,"description":"The endpoint's id (`we_…`).","schema":{"type":"string","pattern":"^we_[0-9A-HJKMNP-TV-Z]{26}$"},"example":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C"}],"responses":{"200":{"description":"The endpoint.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpoint"}},"required":["data"]},"example":{"data":{"id":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","name":"Order support","url":"https://example.com/webhooks/chatwise","events":["message.received"],"accountIds":[],"status":"ACTIVE","apiVersion":"2026-12-01","health":{"lastSuccessAt":"2026-11-12T09:21:08.000Z","lastFailureAt":null,"consecutiveFailures":0,"disabledAt":null,"disabledReason":null},"createdAt":"2026-11-02T10:00:00.000Z","updatedAt":"2026-11-12T09:21:08.000Z"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:read"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"ENDPOINT_NOT_FOUND":{"$ref":"#/components/examples/ENDPOINT_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}},"patch":{"tags":["Webhook endpoints"],"operationId":"updateWebhookEndpoint","summary":"Update a webhook endpoint","description":"Changes an endpoint. Send only the fields to change, at least one.\n\n- `status: PAUSED` stops new deliveries: what happens while it is paused isn't sent. Deliveries already waiting are sent once it is active again.\n- `status: ACTIVE` resumes it, also after Chatwise disabled it, and clears its failure count.\n- Removing an event cancels its deliveries that weren't sent yet. Changing `accountIds` cancels none.\n- A new `url` also receives the deliveries that were already waiting.","security":[{"apiKey":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-conditional-scopes":[{"scope":"messages:read","when":"The endpoint has `message.*` events, before or after the change."}],"parameters":[{"name":"endpointId","in":"path","required":true,"description":"The endpoint's id (`we_…`).","schema":{"type":"string","pattern":"^we_[0-9A-HJKMNP-TV-Z]{26}$"},"example":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[^\\x00-\\x1f\\x7f]*[^\\s\\x00-\\x1f\\x7f][^\\x00-\\x1f\\x7f]*$","description":"A name for the endpoint, 1 to 80 characters. Spaces around it are ignored. Can't be blank, or contain control characters or unpaired surrogates."},"url":{"type":"string","format":"uri","maxLength":2048,"description":"Where to send events: a public `https://` URL on port 443, without a username, password or `#fragment`. Spaces around it are ignored."},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"]},"minItems":1,"maxItems":6,"description":"The events to receive. `message.*` events also need the `messages:read` scope."},"accountIds":{"type":"array","items":{"type":"string","pattern":"^(?:[1-9]\\d{0,17}|[1-8]\\d{18}|9[0-1]\\d{17}|92[0-1]\\d{16}|922[0-2]\\d{15}|9223[0-2]\\d{14}|92233[0-6]\\d{13}|922337[0-1]\\d{12}|92233720[0-2]\\d{10}|922337203[0-5]\\d{9}|9223372036[0-7]\\d{8}|92233720368[0-4]\\d{7}|922337203685[0-3]\\d{6}|9223372036854[0-6]\\d{5}|92233720368547[0-6]\\d{4}|922337203685477[0-4]\\d{3}|9223372036854775[0-7]\\d{2}|922337203685477580[0-6]|9223372036854775807)$"},"maxItems":50,"description":"The accounts to send events for, instead of the ones it has. An empty list means every account. Leave out to keep them."},"status":{"type":"string","enum":["ACTIVE","PAUSED"],"description":"`PAUSED` to stop deliveries, `ACTIVE` to resume them."}},"additionalProperties":false,"minProperties":1},"example":{"status":"PAUSED"}}}},"responses":{"200":{"description":"The endpoint after the change.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookEndpoint"}},"required":["data"]},"example":{"data":{"id":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","name":"Order support","url":"https://example.com/webhooks/chatwise","events":["message.received"],"accountIds":[],"status":"PAUSED","apiVersion":"2026-12-01","health":{"lastSuccessAt":"2026-11-12T09:21:08.000Z","lastFailureAt":null,"consecutiveFailures":0,"disabledAt":null,"disabledReason":null},"createdAt":"2026-11-02T10:00:00.000Z","updatedAt":"2026-11-13T11:20:00.000Z"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"BODY_NOT_JSON":{"$ref":"#/components/examples/BODY_NOT_JSON"},"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"ENDPOINT_URL":{"$ref":"#/components/examples/ENDPOINT_URL"},"ENDPOINT_ACCOUNTS":{"$ref":"#/components/examples/ENDPOINT_ACCOUNTS"},"SUBSCRIBE_NEEDS_MESSAGES":{"$ref":"#/components/examples/SUBSCRIBE_NEEDS_MESSAGES"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:write"}},"CHANGE_NEEDS_MESSAGES":{"$ref":"#/components/examples/CHANGE_NEEDS_MESSAGES"}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"ENDPOINT_NOT_FOUND":{"$ref":"#/components/examples/ENDPOINT_NOT_FOUND"}}}}},"413":{"description":"The body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"BODY_TOO_LARGE":{"$ref":"#/components/examples/BODY_TOO_LARGE"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}},"delete":{"tags":["Webhook endpoints"],"operationId":"deleteWebhookEndpoint","summary":"Delete a webhook endpoint","description":"Deletes an endpoint and cancels its deliveries that weren't sent yet. Its delivery log can no longer be read.","security":[{"apiKey":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"parameters":[{"name":"endpointId","in":"path","required":true,"description":"The endpoint's id (`we_…`).","schema":{"type":"string","pattern":"^we_[0-9A-HJKMNP-TV-Z]{26}$"},"example":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"The deleted endpoint's id."},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"]}},"required":["data"]},"example":{"data":{"id":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","deleted":true}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:write"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"ENDPOINT_NOT_FOUND":{"$ref":"#/components/examples/ENDPOINT_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-endpoints/{endpointId}/test":{"post":{"tags":["Webhook endpoints"],"operationId":"testWebhookEndpoint","summary":"Send a test event","description":"Sends a signed [`webhook.test`](/docs/webhooks/events/webhook-test) event now and answers with what your endpoint did. It also works while the endpoint is paused. Tests aren't retried and don't appear in the delivery log.","security":[{"apiKey":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"parameters":[{"name":"endpointId","in":"path","required":true,"description":"The endpoint's id (`we_…`).","schema":{"type":"string","pattern":"^we_[0-9A-HJKMNP-TV-Z]{26}$"},"example":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C"}],"responses":{"200":{"description":"What your endpoint answered. Check `delivered`: this is 200 even when your endpoint failed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"delivered":{"type":"boolean","description":"Whether your endpoint answered with a 2xx status."},"statusCode":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The HTTP status it answered, if it did."},"durationMs":{"type":"integer","description":"How long it took, in milliseconds."},"error":{"type":["string","null"],"description":"Why it failed, such as `http_500` or `timeout`."}},"required":["delivered","statusCode","durationMs","error"]}},"required":["data"]},"example":{"data":{"delivered":true,"statusCode":204,"durationMs":182,"error":null}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:write"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"ENDPOINT_NOT_FOUND":{"$ref":"#/components/examples/ENDPOINT_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-endpoints/{endpointId}/rotate-secret":{"post":{"tags":["Webhook endpoints"],"operationId":"rotateWebhookSecret","summary":"Rotate the signing secret","description":"Replaces the endpoint's signing secret and returns the new one, the only time it is returned. For 24 hours every delivery carries two signatures, made with the new secret and the previous one, so you can switch without missing any.","security":[{"apiKey":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-conditional-scopes":[{"scope":"messages:read","when":"The endpoint has `message.*` events."}],"parameters":[{"name":"endpointId","in":"path","required":true,"description":"The endpoint's id (`we_…`).","schema":{"type":"string","pattern":"^we_[0-9A-HJKMNP-TV-Z]{26}$"},"example":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C"}],"responses":{"200":{"description":"The new secret.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"signingSecret":{"type":"string","description":"The secret that signs its deliveries: `whsec_` and 32 random bytes in base64. Shown only here; store it safely."},"previousSecretExpiresAt":{"type":"string","format":"date-time","description":"Until when deliveries are signed with the previous secret too. ISO 8601, in UTC."}},"required":["signingSecret","previousSecretExpiresAt"]}},"required":["data"]},"example":{"data":{"signingSecret":"whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA=","previousSecretExpiresAt":"2026-12-01T10:00:00.000Z"}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:write"}},"CHANGE_NEEDS_MESSAGES":{"$ref":"#/components/examples/CHANGE_NEEDS_MESSAGES"}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"ENDPOINT_NOT_FOUND":{"$ref":"#/components/examples/ENDPOINT_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-endpoints/{endpointId}/deliveries":{"get":{"tags":["Webhook deliveries"],"operationId":"listWebhookDeliveries","summary":"List deliveries","description":"Lists an endpoint's deliveries, newest first. Deliveries are kept for 30 days.","security":[{"apiKey":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"parameters":[{"name":"endpointId","in":"path","required":true,"description":"The endpoint's id (`we_…`).","schema":{"type":"string","pattern":"^we_[0-9A-HJKMNP-TV-Z]{26}$"},"example":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C"},{"name":"limit","in":"query","required":false,"description":"How many to return, from 1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"example":25},{"name":"cursor","in":"query","required":false,"description":"The previous page's `pagination.nextCursor`. Repeat the same filters and order with it.","schema":{"type":"string","maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"}},{"name":"status","in":"query","required":false,"description":"Only deliveries with this status.","schema":{"type":"string","enum":["PENDING","PROCESSING","RETRY","DELIVERED","FAILED","CANCELLED"]},"example":"RETRY"},{"name":"eventType","in":"query","required":false,"description":"Only deliveries of this event.","schema":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"]}}],"responses":{"200":{"description":"A page of deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"pagination":{"type":"object","properties":{"nextCursor":{"type":["string","null"],"description":"Send it as `cursor` for the next page. Null on the last page."}},"required":["nextCursor"]}},"required":["data","pagination"]},"example":{"data":[{"id":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90","eventId":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","eventType":"message.received","occurredAt":"2026-11-12T09:25:36.000Z","status":"RETRY","attempts":1,"lastStatusCode":503,"lastError":"http_503","lastDurationMs":214,"nextAttemptAt":"2026-11-12T09:25:47.000Z","deliveredAt":null,"createdAt":"2026-11-12T09:25:37.000Z"}],"pagination":{"nextCursor":null}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"INVALID_CURSOR":{"$ref":"#/components/examples/INVALID_CURSOR"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:read"}}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"ENDPOINT_NOT_FOUND":{"$ref":"#/components/examples/ENDPOINT_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-deliveries/{deliveryId}":{"get":{"tags":["Webhook deliveries"],"operationId":"getWebhookDelivery","summary":"Get a delivery","description":"Reads one delivery, with the payload it sends and its attempts. Deliveries are kept for 30 days.","security":[{"apiKey":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"x-conditional-scopes":[{"scope":"messages:read","when":"The delivery is for a `message.*` event."}],"parameters":[{"name":"deliveryId","in":"path","required":true,"description":"The delivery's id (`wd_…`).","schema":{"type":"string","pattern":"^wd_[0-9a-f]{32}$"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"}],"responses":{"200":{"description":"The delivery.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookDeliveryDetails"}},"required":["data"]},"example":{"data":{"id":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90","eventId":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","eventType":"message.received","occurredAt":"2026-11-12T09:25:36.000Z","status":"RETRY","attempts":1,"lastStatusCode":503,"lastError":"http_503","lastDurationMs":214,"nextAttemptAt":"2026-11-12T09:25:47.000Z","deliveredAt":null,"createdAt":"2026-11-12T09:25:37.000Z","endpointId":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","payload":{"message":{"id":"5678","conversationId":"1234","channel":"WHATSAPP","direction":"inbound","type":"text","text":"Is this available in blue?","sentAt":"2026-11-12T09:25:36.000Z","ingestedAt":"2026-11-12T09:25:36.412Z","replyToMessageId":null,"attachments":[]},"conversation":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"},"account":{"id":"11","channel":"WHATSAPP"}},"attemptLog":[{"attemptNumber":1,"startedAt":"2026-11-12T09:25:37.120Z","durationMs":214,"statusCode":503,"error":"http_503"}]}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrors"},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:read"}},"DELIVERY_NEEDS_MESSAGES":{"$ref":"#/components/examples/DELIVERY_NEEDS_MESSAGES"}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"DELIVERY_NOT_FOUND":{"$ref":"#/components/examples/DELIVERY_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-deliveries/{deliveryId}/redeliver":{"post":{"tags":["Webhook deliveries"],"operationId":"redeliverWebhookDelivery","summary":"Redeliver","description":"Sends a delivery again, with the same event id, starting from its first attempt. It can be delivered, failed, cancelled or waiting for a retry. A delivery to a paused or disabled endpoint waits until the endpoint is active.","security":[{"apiKey":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-conditional-scopes":[{"scope":"messages:read","when":"The delivery is for a `message.*` event."}],"parameters":[{"name":"deliveryId","in":"path","required":true,"description":"The delivery's id (`wd_…`).","schema":{"type":"string","pattern":"^wd_[0-9a-f]{32}$"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"}],"responses":{"200":{"description":"The delivery, waiting to be sent.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookDeliveryDetails"}},"required":["data"]},"example":{"data":{"id":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90","eventId":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","eventType":"message.received","occurredAt":"2026-11-12T09:25:36.000Z","status":"PENDING","attempts":0,"lastStatusCode":503,"lastError":null,"lastDurationMs":214,"nextAttemptAt":"2026-11-12T10:02:11.000Z","deliveredAt":null,"createdAt":"2026-11-12T09:25:37.000Z","endpointId":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","payload":{"message":{"id":"5678","conversationId":"1234","channel":"WHATSAPP","direction":"inbound","type":"text","text":"Is this available in blue?","sentAt":"2026-11-12T09:25:36.000Z","ingestedAt":"2026-11-12T09:25:36.412Z","replyToMessageId":null,"attachments":[]},"conversation":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"},"account":{"id":"11","channel":"WHATSAPP"}},"attemptLog":[{"attemptNumber":1,"startedAt":"2026-11-12T09:25:37.120Z","durationMs":214,"statusCode":503,"error":"http_503"}]}}}}},"400":{"description":"The request is invalid.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrors"},{"$ref":"#/components/schemas/FieldError"}]},"examples":{"INVALID_INPUT":{"$ref":"#/components/examples/INVALID_INPUT"},"REDELIVER_WAITING":{"$ref":"#/components/examples/REDELIVER_WAITING"},"REDELIVER_UNSUBSCRIBED":{"$ref":"#/components/examples/REDELIVER_UNSUBSCRIBED"},"REDELIVER_REMOVED":{"$ref":"#/components/examples/REDELIVER_REMOVED"}}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:write"}},"DELIVERY_NEEDS_MESSAGES":{"$ref":"#/components/examples/DELIVERY_NEEDS_MESSAGES"}}}}},"404":{"description":"Not found in the key's workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"DELIVERY_NOT_FOUND":{"$ref":"#/components/examples/DELIVERY_NOT_FOUND"}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}},"/v1/webhook-event-types":{"get":{"tags":["Webhook endpoints"],"operationId":"listWebhookEventTypes","summary":"List event types","description":"Lists the events an endpoint can subscribe to and the channels each covers. Some are listed before they are sent: see [events](/docs/webhooks/events).","security":[{"apiKey":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"responses":{"200":{"description":"The events.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"],"description":"The event's name."},"description":{"type":"string","description":"When it happens."},"channels":{"type":"array","items":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"]},"description":"The channels it covers."}},"required":["type","description","channels"]}}},"required":["data"]},"example":{"data":[{"type":"message.received","description":"A customer sent a message.","channels":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"]},{"type":"message.sent","description":"The workspace sent a message: from the dashboard, the mobile app, the API, MCP, a flow, Comment to DM, or the native WhatsApp Business or Instagram app.","channels":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"]},{"type":"message.delivered","description":"The channel reported an outgoing message was delivered.","channels":["WHATSAPP","MESSENGER"]},{"type":"message.read","description":"The channel reported the customer read an outgoing message.","channels":["WHATSAPP","INSTAGRAM","MESSENGER"]},{"type":"message.failed","description":"The channel reported an outgoing message could not be delivered.","channels":["WHATSAPP"]},{"type":"comment.received","description":"Someone commented on a post of a connected Instagram account.","channels":["INSTAGRAM"]}]}}}},"401":{"description":"The API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"KEY_MISSING":{"$ref":"#/components/examples/KEY_MISSING"},"KEY_INVALID":{"$ref":"#/components/examples/KEY_INVALID"},"KEY_UNCHECKED":{"$ref":"#/components/examples/KEY_UNCHECKED"}}}}},"403":{"description":"The key or the workspace may not do this.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: webhooks:read"}}}}}},"429":{"description":"Too many requests with this key.","headers":{"Retry-After":{"description":"Seconds to wait before the next request.","schema":{"type":"string"},"example":"60"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"RATE_LIMITED":{"$ref":"#/components/examples/RATE_LIMITED"}}}}},"500":{"description":"Something failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"SERVER_ERROR":{"$ref":"#/components/examples/SERVER_ERROR"}}}}}}}}},"webhooks":{"message.received":{"post":{"operationId":"onMessageReceived","summary":"A customer sent a message","description":"A customer sent a message.\n\nSent when a live message from a customer is saved, on any connected WhatsApp number, Instagram account, Messenger Page or Website Chat site.\n\nNot sent for reactions, edits, system messages or imported history, or when the message was deleted or hidden before the event was prepared.\n\n`data` is the message and conversation as they were when the event was prepared, after the message was saved. Every retry and redelivery sends the same.","x-status":"available","x-channels":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"x-subscribable":true,"security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The event's id, the same on every retry and redelivery. Dedupe on it.","schema":{"type":"string"},"example":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in Unix seconds.","schema":{"type":"string"},"example":"1794475538"},{"name":"webhook-signature","in":"header","required":true,"description":"One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`.","schema":{"type":"string"},"example":"v1,<base64>"},{"name":"X-Chatwise-Event","in":"header","required":true,"description":"The event's name.","schema":{"type":"string"},"example":"message.received"},{"name":"X-Chatwise-Delivery","in":"header","required":true,"description":"The delivery's id.","schema":{"type":"string"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"},{"name":"User-Agent","in":"header","required":true,"description":"Always `Chatwise-Webhooks/1.0`.","schema":{"type":"string"},"example":"Chatwise-Webhooks/1.0"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id, the same on every retry and redelivery. Also the `webhook-id` header."},"type":{"type":"string","const":"message.received","description":"The event's name. Also the `X-Chatwise-Event` header."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened. The same on every retry. ISO 8601, in UTC."},"apiVersion":{"type":"string","description":"The payload format, as a date."},"workspaceId":{"type":"string","description":"The workspace the event happened in."},"data":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message","description":"The message, as the API returns it."},"conversation":{"$ref":"#/components/schemas/Conversation","description":"Its conversation, as the API returns it."},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","description":"The account's id. The same as in `accountIds`."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"description":"The account's channel."}},"required":["id","channel"]},{"type":"null"}],"description":"The account the conversation is on, such as a WhatsApp number or an Instagram account."}},"required":["message","conversation","account"],"description":"What happened."}},"required":["id","type","timestamp","apiVersion","workspaceId","data"]},"example":{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"message.received","timestamp":"2026-11-12T09:25:36.000Z","apiVersion":"2026-12-01","workspaceId":"42","data":{"message":{"id":"5678","conversationId":"1234","channel":"WHATSAPP","direction":"inbound","type":"text","text":"Is this available in blue?","sentAt":"2026-11-12T09:25:36.000Z","ingestedAt":"2026-11-12T09:25:36.412Z","replyToMessageId":null,"attachments":[]},"conversation":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"},"account":{"id":"11","channel":"WHATSAPP"}}}}}},"responses":{"408":{"description":"Retried, up to 8 attempts in all. The same goes for 425, 429, every 5XX, a timeout and a connection error."},"410":{"description":"Not retried. Chatwise disables the endpoint."},"2XX":{"description":"Received. Answer within 10 seconds and do the work afterwards."},"default":{"description":"Not retried: every other status, redirects included."}},"x-max-attempts":8}},"message.sent":{"post":{"operationId":"onMessageSent","summary":"The workspace sent a message","description":"**Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet, and its payload may change before it is.\n\nThe workspace sent a message: from the dashboard, the mobile app, the API, MCP, a flow, Comment to DM, or the native WhatsApp Business or Instagram app.","x-status":"coming-soon","x-channels":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"x-subscribable":true,"security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The event's id, the same on every retry and redelivery. Dedupe on it.","schema":{"type":"string"},"example":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in Unix seconds.","schema":{"type":"string"},"example":"1794475538"},{"name":"webhook-signature","in":"header","required":true,"description":"One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`.","schema":{"type":"string"},"example":"v1,<base64>"},{"name":"X-Chatwise-Event","in":"header","required":true,"description":"The event's name.","schema":{"type":"string"},"example":"message.sent"},{"name":"X-Chatwise-Delivery","in":"header","required":true,"description":"The delivery's id.","schema":{"type":"string"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"},{"name":"User-Agent","in":"header","required":true,"description":"Always `Chatwise-Webhooks/1.0`.","schema":{"type":"string"},"example":"Chatwise-Webhooks/1.0"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id, the same on every retry and redelivery. Also the `webhook-id` header."},"type":{"type":"string","const":"message.sent","description":"The event's name. Also the `X-Chatwise-Event` header."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened. The same on every retry. ISO 8601, in UTC."},"apiVersion":{"type":"string","description":"The payload format, as a date."},"workspaceId":{"type":"string","description":"The workspace the event happened in."},"data":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message","description":"The message, as the API returns it."},"conversation":{"$ref":"#/components/schemas/Conversation","description":"Its conversation, as the API returns it."},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","description":"The account's id. The same as in `accountIds`."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"description":"The account's channel."}},"required":["id","channel"]},{"type":"null"}],"description":"The account the conversation is on, such as a WhatsApp number or an Instagram account."}},"required":["message","conversation","account"],"description":"What happened."}},"required":["id","type","timestamp","apiVersion","workspaceId","data"]},"example":{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"message.sent","timestamp":"2026-11-12T09:25:36.000Z","apiVersion":"2026-12-01","workspaceId":"42","data":{"message":{"id":"5680","conversationId":"1234","channel":"WHATSAPP","direction":"outbound","type":"text","text":"Yes, in two shades of blue.","sentAt":"2026-11-12T09:31:02.000Z","ingestedAt":"2026-11-12T09:31:02.350Z","replyToMessageId":null,"attachments":[]},"conversation":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"},"account":{"id":"11","channel":"WHATSAPP"}}}}}},"responses":{"408":{"description":"Retried, up to 8 attempts in all. The same goes for 425, 429, every 5XX, a timeout and a connection error."},"410":{"description":"Not retried. Chatwise disables the endpoint."},"2XX":{"description":"Received. Answer within 10 seconds and do the work afterwards."},"default":{"description":"Not retried: every other status, redirects included."}},"x-max-attempts":8}},"message.delivered":{"post":{"operationId":"onMessageDelivered","summary":"A message was delivered","description":"**Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet, and its payload may change before it is.\n\nThe channel reported an outgoing message was delivered.","x-status":"coming-soon","x-channels":["WHATSAPP","MESSENGER"],"x-subscribable":true,"security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The event's id, the same on every retry and redelivery. Dedupe on it.","schema":{"type":"string"},"example":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in Unix seconds.","schema":{"type":"string"},"example":"1794475538"},{"name":"webhook-signature","in":"header","required":true,"description":"One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`.","schema":{"type":"string"},"example":"v1,<base64>"},{"name":"X-Chatwise-Event","in":"header","required":true,"description":"The event's name.","schema":{"type":"string"},"example":"message.delivered"},{"name":"X-Chatwise-Delivery","in":"header","required":true,"description":"The delivery's id.","schema":{"type":"string"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"},{"name":"User-Agent","in":"header","required":true,"description":"Always `Chatwise-Webhooks/1.0`.","schema":{"type":"string"},"example":"Chatwise-Webhooks/1.0"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id, the same on every retry and redelivery. Also the `webhook-id` header."},"type":{"type":"string","const":"message.delivered","description":"The event's name. Also the `X-Chatwise-Event` header."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened. The same on every retry. ISO 8601, in UTC."},"apiVersion":{"type":"string","description":"The payload format, as a date."},"workspaceId":{"type":"string","description":"The workspace the event happened in."},"data":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message","description":"The message, as the API returns it."},"conversation":{"$ref":"#/components/schemas/Conversation","description":"Its conversation, as the API returns it."},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","description":"The account's id. The same as in `accountIds`."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"description":"The account's channel."}},"required":["id","channel"]},{"type":"null"}],"description":"The account the conversation is on, such as a WhatsApp number or an Instagram account."}},"required":["message","conversation","account"],"description":"What happened."}},"required":["id","type","timestamp","apiVersion","workspaceId","data"]},"example":{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"message.delivered","timestamp":"2026-11-12T09:25:36.000Z","apiVersion":"2026-12-01","workspaceId":"42","data":{"message":{"id":"5680","conversationId":"1234","channel":"WHATSAPP","direction":"outbound","type":"text","text":"Yes, in two shades of blue.","sentAt":"2026-11-12T09:31:02.000Z","ingestedAt":"2026-11-12T09:31:02.350Z","replyToMessageId":null,"attachments":[]},"conversation":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"},"account":{"id":"11","channel":"WHATSAPP"}}}}}},"responses":{"408":{"description":"Retried, up to 8 attempts in all. The same goes for 425, 429, every 5XX, a timeout and a connection error."},"410":{"description":"Not retried. Chatwise disables the endpoint."},"2XX":{"description":"Received. Answer within 10 seconds and do the work afterwards."},"default":{"description":"Not retried: every other status, redirects included."}},"x-max-attempts":8}},"message.read":{"post":{"operationId":"onMessageRead","summary":"A message was read","description":"**Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet, and its payload may change before it is.\n\nThe channel reported the customer read an outgoing message.","x-status":"coming-soon","x-channels":["WHATSAPP","INSTAGRAM","MESSENGER"],"x-subscribable":true,"security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The event's id, the same on every retry and redelivery. Dedupe on it.","schema":{"type":"string"},"example":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in Unix seconds.","schema":{"type":"string"},"example":"1794475538"},{"name":"webhook-signature","in":"header","required":true,"description":"One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`.","schema":{"type":"string"},"example":"v1,<base64>"},{"name":"X-Chatwise-Event","in":"header","required":true,"description":"The event's name.","schema":{"type":"string"},"example":"message.read"},{"name":"X-Chatwise-Delivery","in":"header","required":true,"description":"The delivery's id.","schema":{"type":"string"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"},{"name":"User-Agent","in":"header","required":true,"description":"Always `Chatwise-Webhooks/1.0`.","schema":{"type":"string"},"example":"Chatwise-Webhooks/1.0"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id, the same on every retry and redelivery. Also the `webhook-id` header."},"type":{"type":"string","const":"message.read","description":"The event's name. Also the `X-Chatwise-Event` header."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened. The same on every retry. ISO 8601, in UTC."},"apiVersion":{"type":"string","description":"The payload format, as a date."},"workspaceId":{"type":"string","description":"The workspace the event happened in."},"data":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message","description":"The message, as the API returns it."},"conversation":{"$ref":"#/components/schemas/Conversation","description":"Its conversation, as the API returns it."},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","description":"The account's id. The same as in `accountIds`."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"description":"The account's channel."}},"required":["id","channel"]},{"type":"null"}],"description":"The account the conversation is on, such as a WhatsApp number or an Instagram account."}},"required":["message","conversation","account"],"description":"What happened."}},"required":["id","type","timestamp","apiVersion","workspaceId","data"]},"example":{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"message.read","timestamp":"2026-11-12T09:25:36.000Z","apiVersion":"2026-12-01","workspaceId":"42","data":{"message":{"id":"5680","conversationId":"1234","channel":"WHATSAPP","direction":"outbound","type":"text","text":"Yes, in two shades of blue.","sentAt":"2026-11-12T09:31:02.000Z","ingestedAt":"2026-11-12T09:31:02.350Z","replyToMessageId":null,"attachments":[]},"conversation":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"},"account":{"id":"11","channel":"WHATSAPP"}}}}}},"responses":{"408":{"description":"Retried, up to 8 attempts in all. The same goes for 425, 429, every 5XX, a timeout and a connection error."},"410":{"description":"Not retried. Chatwise disables the endpoint."},"2XX":{"description":"Received. Answer within 10 seconds and do the work afterwards."},"default":{"description":"Not retried: every other status, redirects included."}},"x-max-attempts":8}},"message.failed":{"post":{"operationId":"onMessageFailed","summary":"A message couldn't be delivered","description":"**Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet, and its payload may change before it is.\n\nThe channel reported an outgoing message could not be delivered.","x-status":"coming-soon","x-channels":["WHATSAPP"],"x-subscribable":true,"security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The event's id, the same on every retry and redelivery. Dedupe on it.","schema":{"type":"string"},"example":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in Unix seconds.","schema":{"type":"string"},"example":"1794475538"},{"name":"webhook-signature","in":"header","required":true,"description":"One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`.","schema":{"type":"string"},"example":"v1,<base64>"},{"name":"X-Chatwise-Event","in":"header","required":true,"description":"The event's name.","schema":{"type":"string"},"example":"message.failed"},{"name":"X-Chatwise-Delivery","in":"header","required":true,"description":"The delivery's id.","schema":{"type":"string"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"},{"name":"User-Agent","in":"header","required":true,"description":"Always `Chatwise-Webhooks/1.0`.","schema":{"type":"string"},"example":"Chatwise-Webhooks/1.0"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id, the same on every retry and redelivery. Also the `webhook-id` header."},"type":{"type":"string","const":"message.failed","description":"The event's name. Also the `X-Chatwise-Event` header."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened. The same on every retry. ISO 8601, in UTC."},"apiVersion":{"type":"string","description":"The payload format, as a date."},"workspaceId":{"type":"string","description":"The workspace the event happened in."},"data":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/Message","description":"The message, as the API returns it."},"conversation":{"$ref":"#/components/schemas/Conversation","description":"Its conversation, as the API returns it."},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","description":"The account's id. The same as in `accountIds`."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"description":"The account's channel."}},"required":["id","channel"]},{"type":"null"}],"description":"The account the conversation is on, such as a WhatsApp number or an Instagram account."}},"required":["message","conversation","account"],"description":"What happened."}},"required":["id","type","timestamp","apiVersion","workspaceId","data"]},"example":{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"message.failed","timestamp":"2026-11-12T09:25:36.000Z","apiVersion":"2026-12-01","workspaceId":"42","data":{"message":{"id":"5680","conversationId":"1234","channel":"WHATSAPP","direction":"outbound","type":"text","text":"Yes, in two shades of blue.","sentAt":"2026-11-12T09:31:02.000Z","ingestedAt":"2026-11-12T09:31:02.350Z","replyToMessageId":null,"attachments":[]},"conversation":{"id":"1234","channel":"WHATSAPP","status":"open","participant":{"name":"Jordan Example","channelId":"12025550147","phoneNumber":"12025550147","instagramUsername":null},"createdAt":"2026-11-01T09:12:00.000Z","lastMessageAt":"2026-11-12T09:25:36.000Z"},"account":{"id":"11","channel":"WHATSAPP"}}}}}},"responses":{"408":{"description":"Retried, up to 8 attempts in all. The same goes for 425, 429, every 5XX, a timeout and a connection error."},"410":{"description":"Not retried. Chatwise disables the endpoint."},"2XX":{"description":"Received. Answer within 10 seconds and do the work afterwards."},"default":{"description":"Not retried: every other status, redirects included."}},"x-max-attempts":8}},"comment.received":{"post":{"operationId":"onCommentReceived","summary":"Someone commented on a post","description":"**Coming soon.** Endpoints can subscribe to this event, but nothing is sent for it yet, and its payload may change before it is.\n\nSomeone commented on a post of a connected Instagram account.","x-status":"coming-soon","x-channels":["INSTAGRAM"],"x-subscribable":true,"security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The event's id, the same on every retry and redelivery. Dedupe on it.","schema":{"type":"string"},"example":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in Unix seconds.","schema":{"type":"string"},"example":"1794475538"},{"name":"webhook-signature","in":"header","required":true,"description":"One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`.","schema":{"type":"string"},"example":"v1,<base64>"},{"name":"X-Chatwise-Event","in":"header","required":true,"description":"The event's name.","schema":{"type":"string"},"example":"comment.received"},{"name":"X-Chatwise-Delivery","in":"header","required":true,"description":"The delivery's id.","schema":{"type":"string"},"example":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90"},{"name":"User-Agent","in":"header","required":true,"description":"Always `Chatwise-Webhooks/1.0`.","schema":{"type":"string"},"example":"Chatwise-Webhooks/1.0"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id, the same on every retry and redelivery. Also the `webhook-id` header."},"type":{"type":"string","const":"comment.received","description":"The event's name. Also the `X-Chatwise-Event` header."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened. The same on every retry. ISO 8601, in UTC."},"apiVersion":{"type":"string","description":"The payload format, as a date."},"workspaceId":{"type":"string","description":"The workspace the event happened in."},"data":{"type":"object","properties":{},"additionalProperties":true,"description":"What happened."}},"required":["id","type","timestamp","apiVersion","workspaceId","data"]},"example":{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"comment.received","timestamp":"2026-11-12T09:25:36.000Z","apiVersion":"2026-12-01","workspaceId":"42","data":{}}}}},"responses":{"408":{"description":"Retried, up to 8 attempts in all. The same goes for 425, 429, every 5XX, a timeout and a connection error."},"410":{"description":"Not retried. Chatwise disables the endpoint."},"2XX":{"description":"Received. Answer within 10 seconds and do the work afterwards."},"default":{"description":"Not retried: every other status, redirects included."}},"x-max-attempts":8}},"webhook.test":{"post":{"operationId":"onWebhookTest","summary":"A test event","description":"You sent a test event, from the dashboard or with the API.\n\nSent when someone sends a test from the dashboard or calls [Send a test event](/docs/api/test-webhook-endpoint), also to a paused endpoint. Endpoints don't subscribe to it.\n\nIt is signed like every event. It is sent once: it isn't retried, and it isn't in the delivery log. Its `X-Chatwise-Delivery` header is always `wd_test`.","x-status":"available","x-channels":[],"x-subscribable":false,"security":[],"parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The event's id, the same on every retry and redelivery. Dedupe on it.","schema":{"type":"string"},"example":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3"},{"name":"webhook-timestamp","in":"header","required":true,"description":"When this attempt was signed, in Unix seconds.","schema":{"type":"string"},"example":"1794475538"},{"name":"webhook-signature","in":"header","required":true,"description":"One or more signatures, separated by spaces: `v1,` and the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`.","schema":{"type":"string"},"example":"v1,<base64>"},{"name":"X-Chatwise-Event","in":"header","required":true,"description":"The event's name.","schema":{"type":"string"},"example":"webhook.test"},{"name":"X-Chatwise-Delivery","in":"header","required":true,"description":"The delivery's id.","schema":{"type":"string"},"example":"wd_test"},{"name":"User-Agent","in":"header","required":true,"description":"Always `Chatwise-Webhooks/1.0`.","schema":{"type":"string"},"example":"Chatwise-Webhooks/1.0"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id, the same on every retry and redelivery. Also the `webhook-id` header."},"type":{"type":"string","const":"webhook.test","description":"The event's name. Also the `X-Chatwise-Event` header."},"timestamp":{"type":"string","format":"date-time","description":"When the event happened. The same on every retry. ISO 8601, in UTC."},"apiVersion":{"type":"string","description":"The payload format, as a date."},"workspaceId":{"type":"string","description":"The workspace the event happened in."},"data":{"type":"object","properties":{"endpointId":{"type":"string","description":"The endpoint the test was sent to."},"message":{"type":"string","description":"A fixed sentence."}},"required":["endpointId","message"],"description":"What happened."}},"required":["id","type","timestamp","apiVersion","workspaceId","data"]},"example":{"id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","type":"webhook.test","timestamp":"2026-11-12T09:25:36.000Z","apiVersion":"2026-12-01","workspaceId":"42","data":{"endpointId":"we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C","message":"This is a test event from Chatwise."}}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds and do the work afterwards."},"default":{"description":"The test failed. It isn't retried."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"A Chatwise API key, from Settings → Developer → API Keys."}},"schemas":{"Conversation":{"type":"object","properties":{"id":{"type":"string","description":"The conversation's id."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"description":"The channel the conversation is on."},"status":{"type":"string","enum":["open","resolved"],"description":"Whether the conversation is open or resolved in the inbox."},"participant":{"type":"object","properties":{"name":{"type":["string","null"],"description":"The customer's name. A placeholder, or on Website Chat their email, when Chatwise doesn't know it."},"channelId":{"type":["string","null"],"description":"The customer's id on the channel: the WhatsApp number, or an Instagram or Messenger id. Null on Website Chat."},"phoneNumber":{"type":["string","null"],"description":"The customer's phone number, digits only, on WhatsApp. Null on other channels, and when WhatsApp doesn't show it."},"instagramUsername":{"type":["string","null"],"description":"The customer's Instagram username, when known. Null on WhatsApp."}},"required":["name","channelId","phoneNumber","instagramUsername"],"description":"The customer."},"createdAt":{"type":"string","format":"date-time","description":"When the conversation was created in Chatwise. ISO 8601, in UTC."},"lastMessageAt":{"anyOf":[{"type":"string","format":"date-time","description":"When the latest message was sent. Null before the first one. ISO 8601, in UTC."},{"type":"null"}],"description":"When the latest message was sent. Null before the first one. ISO 8601, in UTC."}},"required":["id","channel","status","participant","createdAt","lastMessageAt"]},"Message":{"type":"object","properties":{"id":{"type":"string","description":"The message's id."},"conversationId":{"type":"string","description":"The conversation the message is in."},"channel":{"type":"string","enum":["WHATSAPP","INSTAGRAM","MESSENGER","WEBSITE_CHAT"],"description":"The channel the message is on."},"direction":{"type":"string","enum":["inbound","outbound"],"description":"`inbound` from the customer, `outbound` from the workspace."},"type":{"type":"string","description":"The message's type, such as `text`, `image`, `audio`, `interactive` or `whatsapp_template`."},"text":{"type":["string","null"],"description":"The text or caption. For other types, text that Chatwise makes of the message, such as JSON for a location or contacts. Null for WhatsApp authentication templates, so a one-time code is never returned."},"sentAt":{"type":"string","format":"date-time","description":"When the message was sent. ISO 8601, in UTC."},"ingestedAt":{"type":"string","format":"date-time","description":"When Chatwise stored the message. ISO 8601, in UTC."},"replyToMessageId":{"type":["string","null"],"description":"The message this one replies to, if any and still visible."},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"The attachment's type, such as `image`, `video`, `audio` or `document`."},"mediaId":{"type":["string","null"],"description":"The channel's id for the media, when Chatwise has it: usually on Instagram only."}},"required":["type","mediaId"]},"description":"The message's attachments, at most 10. Always empty on Messenger and Website Chat, and for WhatsApp authentication templates."}},"required":["id","conversationId","channel","direction","type","text","sentAt","ingestedAt","replyToMessageId","attachments"]},"WhatsappTemplate":{"type":"object","properties":{"id":{"type":"string","description":"The template's id: Meta's, or Chatwise's for an older template without one. Send it as `templateId`."},"name":{"type":"string","description":"The template's name."},"language":{"type":"string","description":"The template's language code, such as `en_US`."},"category":{"anyOf":[{"type":"string","enum":["UTILITY","MARKETING","AUTHENTICATION"]},{"type":"null"}],"description":"The template's category."},"status":{"type":["string","null"],"description":"Meta's review status, such as `APPROVED`, `PENDING`, `REJECTED` or `PAUSED`."},"rejectionReason":{"type":["string","null"],"description":"Why Meta rejected it, when it is rejected."},"sendable":{"type":"boolean","description":"Whether the send routes can send it: approved, with a layout they support."},"parameterFormat":{"anyOf":[{"type":"string","enum":["NAMED","POSITIONAL"]},{"type":"null"}],"description":"How its variables are written. Null without variables."},"requiresOtp":{"type":"boolean","description":"Whether sending it needs a one-time code, as the `otp` value in `templateParams`."},"authentication":{"anyOf":[{"type":"object","properties":{"addSecurityRecommendation":{"type":["boolean","null"],"description":"Whether it tells the customer not to share the code."},"codeExpirationMinutes":{"type":["number","null"],"description":"How long it says the code is valid."}},"required":["addSecurityRecommendation","codeExpirationMinutes"]},{"type":"null"}],"description":"Settings of an authentication template. Otherwise null."},"components":{"type":"object","properties":{"header":{"anyOf":[{"type":"object","properties":{"format":{"type":"string","description":"`TEXT`, `IMAGE`, `VIDEO` or `DOCUMENT`."},"text":{"type":["string","null"],"description":"The text of a text header."},"variables":{"type":"array","items":{"type":"string"},"description":"The header's variables."}},"required":["format","text","variables"]},{"type":"null"}],"description":"The header, if any."},"body":{"type":"object","properties":{"text":{"type":["string","null"],"description":"The body's text."},"variables":{"type":"array","items":{"type":"string"},"description":"The body's variables."}},"required":["text","variables"],"description":"The body."},"footer":{"type":["string","null"],"description":"The footer's text, if any."},"buttons":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"The button's position, from 0. Use it as `index` when sending."},"type":{"type":"string","description":"The button's type, such as `URL`, `QUICK_REPLY`, `PHONE_NUMBER`, `COPY_CODE` or `OTP`."},"text":{"type":["string","null"],"description":"The button's label."},"url":{"type":["string","null"],"description":"The URL of a `URL` button."},"phoneNumber":{"type":["string","null"],"description":"The phone number of a `PHONE_NUMBER` button."},"variable":{"type":["string","null"],"description":"The variable at the end of a dynamic URL, if any."},"parameterType":{"anyOf":[{"type":"string","enum":["text","payload","coupon_code"]},{"type":"null"}],"description":"The parameter the button takes when sending, if any."},"otpType":{"type":["string","null"],"description":"The kind of one-time code button, on authentication templates."}},"required":["index","type","text","url","phoneNumber","variable","parameterType","otpType"]},"description":"The buttons."}},"required":["header","body","footer","buttons"],"description":"What the template contains."},"unsupportedReason":{"type":["string","null"],"description":"Why the send routes can't send it, if they can't because of its layout."},"createdAt":{"type":"string","format":"date-time","description":"When Chatwise stored the template. ISO 8601, in UTC."},"updatedAt":{"type":"string","format":"date-time","description":"When the template last changed in Chatwise. ISO 8601, in UTC."}},"required":["id","name","language","category","status","rejectionReason","sendable","parameterFormat","requiresOtp","authentication","components","unsupportedReason","createdAt","updatedAt"]},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string","description":"The endpoint's id."},"name":{"type":"string","description":"The endpoint's name."},"url":{"type":"string","description":"Where events are sent."},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"]},"description":"The events it receives."},"accountIds":{"type":"array","items":{"type":"string"},"description":"The accounts it receives events for. Empty means every account."},"status":{"type":"string","enum":["ACTIVE","PAUSED","DISABLED"],"description":"`ACTIVE`, `PAUSED` by the workspace, or `DISABLED` by Chatwise (see `health.disabledReason`)."},"apiVersion":{"type":"string","description":"The payload format it receives, as a date."},"health":{"type":"object","properties":{"lastSuccessAt":{"anyOf":[{"type":"string","format":"date-time","description":"When an attempt last succeeded. ISO 8601, in UTC."},{"type":"null"}],"description":"When an attempt last succeeded. ISO 8601, in UTC."},"lastFailureAt":{"anyOf":[{"type":"string","format":"date-time","description":"When an attempt last failed. ISO 8601, in UTC."},{"type":"null"}],"description":"When an attempt last failed. ISO 8601, in UTC."},"consecutiveFailures":{"type":"integer","description":"Failed attempts since the last success."},"disabledAt":{"anyOf":[{"type":"string","format":"date-time","description":"When Chatwise disabled it. ISO 8601, in UTC."},{"type":"null"}],"description":"When Chatwise disabled it. ISO 8601, in UTC."},"disabledReason":{"type":["string","null"],"description":"Why Chatwise disabled it."}},"required":["lastSuccessAt","lastFailureAt","consecutiveFailures","disabledAt","disabledReason"],"description":"How its deliveries are going."},"createdAt":{"type":"string","format":"date-time","description":"When it was created. ISO 8601, in UTC."},"updatedAt":{"type":"string","format":"date-time","description":"When it, or its health, last changed. ISO 8601, in UTC."}},"required":["id","name","url","events","accountIds","status","apiVersion","health","createdAt","updatedAt"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","description":"The delivery's id, also sent as the `X-Chatwise-Delivery` header."},"eventId":{"type":"string","description":"The event's id, also sent as the `webhook-id` header."},"eventType":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"],"description":"The event's name."},"occurredAt":{"type":"string","format":"date-time","description":"When the event happened. ISO 8601, in UTC."},"status":{"type":"string","enum":["PENDING","PROCESSING","RETRY","DELIVERED","FAILED","CANCELLED"],"description":"`PENDING` (waiting), `PROCESSING` (being sent), `RETRY` (waiting for its next attempt), `DELIVERED`, `FAILED` or `CANCELLED`."},"attempts":{"type":"integer","description":"Attempts so far. Redelivering starts again from 0."},"lastStatusCode":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The HTTP status the last attempt got. Null when there was no answer."},"lastError":{"type":["string","null"],"description":"Why the last attempt failed, such as `http_500` or `timeout`. `retry_exhausted` once the last of all attempts failed."},"lastDurationMs":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"How long the last attempt took, in milliseconds."},"nextAttemptAt":{"anyOf":[{"type":"string","format":"date-time","description":"When it is next due to be sent, while it is `PENDING` or `RETRY`. Otherwise null. ISO 8601, in UTC."},{"type":"null"}],"description":"When it is next due to be sent, while it is `PENDING` or `RETRY`. Otherwise null. ISO 8601, in UTC."},"deliveredAt":{"anyOf":[{"type":"string","format":"date-time","description":"When it was delivered. ISO 8601, in UTC."},{"type":"null"}],"description":"When it was delivered. ISO 8601, in UTC."},"createdAt":{"type":"string","format":"date-time","description":"When the delivery was created. ISO 8601, in UTC."}},"required":["id","eventId","eventType","occurredAt","status","attempts","lastStatusCode","lastError","lastDurationMs","nextAttemptAt","deliveredAt","createdAt"]},"WebhookDeliveryDetails":{"type":"object","properties":{"id":{"type":"string","description":"The delivery's id, also sent as the `X-Chatwise-Delivery` header."},"eventId":{"type":"string","description":"The event's id, also sent as the `webhook-id` header."},"eventType":{"type":"string","enum":["message.received","message.sent","message.delivered","message.read","message.failed","comment.received"],"description":"The event's name."},"occurredAt":{"type":"string","format":"date-time","description":"When the event happened. ISO 8601, in UTC."},"status":{"type":"string","enum":["PENDING","PROCESSING","RETRY","DELIVERED","FAILED","CANCELLED"],"description":"`PENDING` (waiting), `PROCESSING` (being sent), `RETRY` (waiting for its next attempt), `DELIVERED`, `FAILED` or `CANCELLED`."},"attempts":{"type":"integer","description":"Attempts so far. Redelivering starts again from 0."},"lastStatusCode":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The HTTP status the last attempt got. Null when there was no answer."},"lastError":{"type":["string","null"],"description":"Why the last attempt failed, such as `http_500` or `timeout`. `retry_exhausted` once the last of all attempts failed."},"lastDurationMs":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"How long the last attempt took, in milliseconds."},"nextAttemptAt":{"anyOf":[{"type":"string","format":"date-time","description":"When it is next due to be sent, while it is `PENDING` or `RETRY`. Otherwise null. ISO 8601, in UTC."},{"type":"null"}],"description":"When it is next due to be sent, while it is `PENDING` or `RETRY`. Otherwise null. ISO 8601, in UTC."},"deliveredAt":{"anyOf":[{"type":"string","format":"date-time","description":"When it was delivered. ISO 8601, in UTC."},{"type":"null"}],"description":"When it was delivered. ISO 8601, in UTC."},"createdAt":{"type":"string","format":"date-time","description":"When the delivery was created. ISO 8601, in UTC."},"endpointId":{"type":"string","description":"The endpoint it is for."},"payload":{"anyOf":[{"type":"object","additionalProperties":{}},{"type":"null"}],"description":"The event's `data`. Null until the event is prepared, and once its message was unsent, deleted or hidden."},"attemptLog":{"type":"array","items":{"type":"object","properties":{"attemptNumber":{"type":"integer","description":"The attempt's number, from 1."},"startedAt":{"type":"string","format":"date-time","description":"When it started. ISO 8601, in UTC."},"durationMs":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"How long it took, in milliseconds."},"statusCode":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"The HTTP status your endpoint answered."},"error":{"type":["string","null"],"description":"Why it failed. Null when it succeeded."}},"required":["attemptNumber","startedAt","durationMs","statusCode","error"]},"description":"The attempts that were recorded: all but a success on the first try. After a redelivery the numbers start again and the earlier attempts stay, so sort by `startedAt`."}},"required":["id","eventId","eventType","occurredAt","status","attempts","lastStatusCode","lastError","lastDurationMs","nextAttemptAt","deliveredAt","createdAt","endpointId","payload","attemptLog"]},"Error":{"type":"object","properties":{"message":{"type":"string","description":"What went wrong."},"errorId":{"type":"string","description":"On some 500s: quote it to support."}},"required":["message"]},"CodedError":{"type":"object","properties":{"code":{"type":"string","description":"A code that doesn't change, for your program to check."},"message":{"type":"string","description":"What went wrong."},"reason":{"type":"string","description":"More about the code, on some errors."}},"required":["code","message"]},"FieldError":{"type":"object","properties":{"object":{"type":"string","description":"What was refused."},"field":{"type":"string","description":"The field that was refused."},"message":{"type":"string","description":"What went wrong."},"data":{"type":"object","description":"More about it, on some errors.","additionalProperties":true}},"required":["object","field","message"]},"ValidationErrors":{"type":"object","properties":{"message":{"const":"Validation failed"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"The parameter or field, such as `query.limit` or `body.name`."},"message":{"type":"string","description":"What is wrong with it."}},"required":["path","message"]}}},"required":["message","errors"]}},"examples":{"KEY_MISSING":{"summary":"The `Authorization` header is missing or isn't `Bearer <API key>`.","value":{"message":"A valid Bearer API key is required"}},"KEY_INVALID":{"summary":"The key doesn't exist, was revoked, or has expired.","value":{"message":"Invalid or revoked API key"}},"KEY_UNCHECKED":{"summary":"Chatwise couldn't check the key. Try again.","value":{"message":"Invalid API key"}},"SCOPE_MISSING":{"summary":"The key lacks the route's scope. Create a key that has it.","value":{"message":"API key does not have the required scope: conversations:read"}},"RATE_LIMITED":{"summary":"Wait the number of seconds in the `Retry-After` header.","value":{"message":"API key rate limit exceeded"}},"BODY_TOO_LARGE":{"summary":"The request body is larger than 100 KB.","value":{"message":"request entity too large"}},"BODY_NOT_JSON":{"summary":"The request body isn't valid JSON. The message says where.","value":{"message":"Expected property name or '}' in JSON at position 1 (line 1 column 2)"}},"INVALID_INPUT":{"summary":"A parameter or body field is missing, unknown or malformed. `errors` lists each one.","value":{"message":"Validation failed","errors":[{"path":"query.limit","message":"Limit must be an integer between 1 and 100"}]}},"INVALID_CURSOR":{"summary":"The cursor isn't one this route returned, or the filters or order changed since.","value":{"object":"Pagination","field":"cursor","message":"Invalid cursor or cursor does not match this request"}},"SERVER_ERROR":{"summary":"Something failed in Chatwise. Retry reads with backoff.","value":{"message":"Internal server error"}},"SERVER_ERROR_WITH_ID":{"summary":"Something failed in Chatwise. The message may have been sent, even if it isn't in the conversation. Quote `errorId` to support.","value":{"message":"Internal server error","errorId":"7b0c7f5e-2f0a-4c55-9a3e-0d8f4c1b2a6d"}},"CONVERSATION_NOT_FOUND":{"summary":"No conversation with this id in the key's workspace.","value":{"message":"Conversation not found"}},"MESSAGE_NOT_FOUND":{"summary":"No visible message with this id in this conversation.","value":{"message":"Message not found"}},"TEMPLATE_NOT_FOUND":{"summary":"No such template in the key's workspace. Sending by name finds approved templates only.","value":{"message":"Template not found"}},"TEMPLATE_NOT_APPROVED":{"summary":"Meta hasn't approved the template, or paused or rejected it.","value":{"object":"Template","field":"status","message":"Template must be approved to send messages"}},"TEMPLATE_OTHER_ACCOUNT":{"summary":"Use a `from` number on the template's WhatsApp Business Account.","value":{"object":"Template","field":"templateId","message":"This template is on a different WhatsApp Business Account from the number in from"}},"TEMPLATE_OTP_MISSING":{"summary":"Send the code as `templateParams` with `parameter_name` set to `otp`.","value":{"object":"Template","field":"templateParams","message":"An OTP code is required for authentication templates"}},"TEMPLATE_PARAMS_NUMBERING":{"summary":"Number the variables from `1`, each once.","value":{"object":"Template","field":"templateParams","message":"Numbered template variables must start at 1 and include each position once"}},"FROM_NOT_CONNECTED":{"summary":"Use one of the workspace's connected numbers, digits only. `data.accounts` lists them.","value":{"object":"channelAccount","field":"from","message":"That WhatsApp number is not connected to this workspace","data":{"accounts":[{"id":"11","channel":"WHATSAPP","connected":true,"needsReconnect":false,"phoneNumber":"+1 202-555-0199","name":"Example Store","waBusinessId":"100200300400500","username":null,"pageId":null,"websiteId":null}]}}},"WHATSAPP_NOT_CONNECTED":{"summary":"The workspace has no WhatsApp number.","value":{"message":"WhatsApp ID not found"}},"WHATSAPP_NO_ACTIVE_NUMBER":{"summary":"The workspace has no connected WhatsApp number.","value":{"message":"Whatsapp account not found"}},"WHATSAPP_NO_NUMBER_FOR_TEMPLATE":{"summary":"Connect a number on the template's WhatsApp Business Account.","value":{"message":"No connected WhatsApp number on this template's business account"}},"WHATSAPP_REAUTH_REQUIRED":{"summary":"Meta no longer accepts Chatwise's access to the number. Reconnect it in the dashboard. `reason` is `expired`, `revoked` or `missing`, and the message depends on it.","value":{"code":"WHATSAPP_REAUTH_REQUIRED","message":"WhatsApp authorization has expired. Ask an administrator to reconnect WhatsApp in Settings.","reason":"expired"}},"SERVICES_BLOCKED":{"summary":"Sending is paused for the workspace. Contact support.","value":{"code":"ADMIN_SERVICES_BLOCKED","message":"Chatwise services have been paused for this workspace by an administrator. Contact support to restore service."}},"WHATSAPP_REFUSED":{"summary":"WhatsApp didn't accept the message. The number is Meta's HTTP status, and after it comes Meta's answer when that was JSON. A 429 can be tried later, after a 5xx check first, and for other statuses fix what the answer names.","value":{"message":"Internal server error: WhatsApp send failed: 400 {\"error\":{\"message\":\"(#132000) Number of parameters does not match the expected number of params\"}}","errorId":"7b0c7f5e-2f0a-4c55-9a3e-0d8f4c1b2a6d"}},"TEMPLATE_DELETED":{"summary":"The template this submission created was deleted since. Use a new `Idempotency-Key`.","value":{"message":"Template not found"}},"TEMPLATE_SERVER_ERROR":{"summary":"Something failed in Chatwise. Repeat the request with the same key and body.","value":{"message":"Internal server error"}},"TEMPLATE_INVALID":{"summary":"The definition breaks one of WhatsApp's template rules. `field` and `message` say which.","value":{"object":"WhatsApp template","field":"components.body.examples","message":"Provide one sample value for each placeholder"}},"TEMPLATE_REJECTED":{"summary":"Meta refused the submission.","value":{"object":"WhatsApp template","field":"body","message":"Meta rejected the template submission. Check the template details and try again"}},"TEMPLATE_NOT_AUTHORIZED":{"summary":"The connected WhatsApp account can't create templates.","value":{"message":"The connected WhatsApp account is not authorized to create templates"}},"TEMPLATE_NO_CONNECTION":{"summary":"Connect a WhatsApp number in the dashboard first.","value":{"message":"Active WhatsApp connection not found"}},"TEMPLATE_EXISTS":{"summary":"Use another name, or read the existing template.","value":{"code":"TEMPLATE_EXISTS","message":"A WhatsApp template with this name and language already exists"}},"IDEMPOTENCY_KEY_REUSED":{"summary":"Use a new key for a new template.","value":{"code":"IDEMPOTENCY_KEY_REUSED","message":"This Idempotency-Key was already used with different template details"}},"TEMPLATE_SUBMISSION_IN_PROGRESS":{"summary":"A submission of this name and language, with this key or another, is running or unconfirmed. Wait, then repeat the request with the key it was made with.","value":{"code":"TEMPLATE_SUBMISSION_IN_PROGRESS","message":"A submission for this template name and language is already in progress"}},"TEMPLATE_SUBMISSION_UNCONFIRMED_CONFLICT":{"summary":"Repeat the request later with the same key and body. If it keeps answering this, Meta doesn't have the template: submit it under another name.","value":{"code":"TEMPLATE_SUBMISSION_UNCONFIRMED","message":"Meta has not confirmed this submission. Retry using the same Idempotency-Key"}},"WHATSAPP_CONNECTION_CHANGED":{"summary":"The workspace connected another WhatsApp Business Account since. Submit again with a new key.","value":{"code":"WHATSAPP_CONNECTION_CHANGED","message":"The WhatsApp connection changed after this template was submitted"}},"WHATSAPP_LOOKUP_FAILED":{"summary":"Repeat the request with the same key and body.","value":{"code":"WHATSAPP_LOOKUP_FAILED","message":"Could not check the WhatsApp template submission"}},"TEMPLATE_SUBMISSION_UNCONFIRMED":{"summary":"Repeat the request with the same key and body.","value":{"code":"TEMPLATE_SUBMISSION_UNCONFIRMED","message":"The WhatsApp template submission could not be confirmed. Retry using the same Idempotency-Key"}},"WHATSAPP_RATE_LIMITED":{"summary":"Wait, then repeat the request with the same key and body.","value":{"code":"WHATSAPP_RATE_LIMITED","message":"WhatsApp is rate limiting template submissions. Retry with the same Idempotency-Key"}},"ENDPOINT_NOT_FOUND":{"summary":"No endpoint with this id in the key's workspace.","value":{"message":"Webhook endpoint not found"}},"DELIVERY_NOT_FOUND":{"summary":"No delivery with this id, or its endpoint was deleted, or it is older than 30 days.","value":{"message":"Webhook delivery not found"}},"ENDPOINT_URL":{"summary":"The URL can't receive webhooks.","value":{"object":"Webhook endpoint","field":"url","message":"Use a public https:// URL on port 443, without a username, password or #fragment."}},"ENDPOINT_ACCOUNTS":{"summary":"An id in `accountIds` isn't one of the workspace's accounts.","value":{"object":"Webhook endpoint","field":"accountIds","message":"Every account id must be one of this workspace's connected accounts."}},"ENDPOINT_LIMIT":{"summary":"Delete an endpoint you no longer use.","value":{"object":"Webhook endpoint","field":"url","message":"A workspace can have at most 10 webhook endpoints."}},"SUBSCRIBE_NEEDS_MESSAGES":{"summary":"The key lacks `messages:read`, which `message.*` events need.","value":{"object":"Webhook endpoint","field":"events","message":"Message events need an API key with the messages:read scope too."}},"CHANGE_NEEDS_MESSAGES":{"summary":"The endpoint has `message.*` events and the key lacks `messages:read`.","value":{"message":"Changing an endpoint that receives message events needs an API key with the messages:read scope too."}},"DELIVERY_NEEDS_MESSAGES":{"summary":"The delivery is for a `message.*` event and the key lacks `messages:read`.","value":{"message":"Reading a message event's delivery needs an API key with the messages:read scope too."}},"REDELIVER_WAITING":{"summary":"It is `PENDING` or `PROCESSING`.","value":{"object":"Webhook delivery","field":"id","message":"This delivery is already waiting to be sent."}},"REDELIVER_UNSUBSCRIBED":{"summary":"Subscribe the endpoint to the event again first.","value":{"object":"Webhook delivery","field":"id","message":"The endpoint no longer subscribes to message.received."}},"REDELIVER_REMOVED":{"summary":"The message is no longer visible through the API either.","value":{"object":"Webhook delivery","field":"id","message":"The message was unsent, deleted or hidden, so it can't be sent again."}}}},"x-scopes":[{"scope":"messages:send","label":"Send messages","description":"Send approved WhatsApp templates."},{"scope":"conversations:read","label":"Read conversations","description":"List, find and read conversations."},{"scope":"messages:read","label":"Read messages","description":"List, search and read messages. Also needed for anything that would give the key a message by webhook: subscribing an endpoint to `message.*` events, changing an endpoint that has them or rotating its secret, and reading or redelivering one of their deliveries."},{"scope":"templates:read","label":"Read templates","description":"List and read WhatsApp templates."},{"scope":"templates:write","label":"Create templates","description":"Create WhatsApp templates and submit them to Meta."},{"scope":"webhooks:read","label":"Read webhook endpoints","description":"List webhook endpoints, their deliveries and the event types. Reading the delivery of a `message.*` event also needs `messages:read`."},{"scope":"webhooks:write","label":"Manage webhook endpoints","description":"Create, change, test and delete webhook endpoints, rotate their secrets and redeliver. With `message.*` events, all of these but testing and deleting also need `messages:read`."}],"x-rate-limit":{"note":"The default. Follow Retry-After rather than counting requests.","requestsPerMinute":120,"retryAfterSeconds":60},"x-webhook-limits":{"apiVersion":"2026-12-01","maxAttempts":8,"retryDelaysSeconds":[10,60,300,1800,7200,21600,57600],"retryJitter":0.2,"timeoutSeconds":10,"maxBodyBytes":262144,"maxEndpoints":10,"previousSecretHours":24,"retentionDays":30},"x-webhook-signing-examples":{"note":"Made by the code that signs real deliveries, with secrets that are used nowhere else.","single":{"secret":"whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA=","headers":{"Content-Type":"application/json","webhook-id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","webhook-timestamp":"1794475538","webhook-signature":"v1,L1bPoz66MpwZv1+qbTZ/JIqM6Q++GR68lDnkBgwUnw8=","X-Chatwise-Event":"message.received","X-Chatwise-Delivery":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90","User-Agent":"Chatwise-Webhooks/1.0"},"body":"{\"id\":\"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3\",\"type\":\"message.received\",\"timestamp\":\"2026-11-12T09:25:36.000Z\",\"apiVersion\":\"2026-12-01\",\"workspaceId\":\"42\",\"data\":{\"message\":{\"id\":\"5678\",\"conversationId\":\"1234\",\"channel\":\"WHATSAPP\",\"direction\":\"inbound\",\"type\":\"text\",\"text\":\"Is this available in blue?\",\"sentAt\":\"2026-11-12T09:25:36.000Z\",\"ingestedAt\":\"2026-11-12T09:25:36.412Z\",\"replyToMessageId\":null,\"attachments\":[]},\"conversation\":{\"id\":\"1234\",\"channel\":\"WHATSAPP\",\"status\":\"open\",\"participant\":{\"name\":\"Jordan Example\",\"channelId\":\"12025550147\",\"phoneNumber\":\"12025550147\",\"instagramUsername\":null},\"createdAt\":\"2026-11-01T09:12:00.000Z\",\"lastMessageAt\":\"2026-11-12T09:25:36.000Z\"},\"account\":{\"id\":\"11\",\"channel\":\"WHATSAPP\"}}}"},"rotation":{"secret":"whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA=","previousSecret":"whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDE=","headers":{"Content-Type":"application/json","webhook-id":"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3","webhook-timestamp":"1794475538","webhook-signature":"v1,L1bPoz66MpwZv1+qbTZ/JIqM6Q++GR68lDnkBgwUnw8= v1,DNb+TcqHMMG6Ay8s5t9N3mfeugBMQi6Li09ENz7mWDY=","X-Chatwise-Event":"message.received","X-Chatwise-Delivery":"wd_3f1c0a9b5d7e42688c1f0e2d4b6a8c90","User-Agent":"Chatwise-Webhooks/1.0"},"body":"{\"id\":\"evt_01JE2Z3QK4T8M6N2R5S7V9W1X3\",\"type\":\"message.received\",\"timestamp\":\"2026-11-12T09:25:36.000Z\",\"apiVersion\":\"2026-12-01\",\"workspaceId\":\"42\",\"data\":{\"message\":{\"id\":\"5678\",\"conversationId\":\"1234\",\"channel\":\"WHATSAPP\",\"direction\":\"inbound\",\"type\":\"text\",\"text\":\"Is this available in blue?\",\"sentAt\":\"2026-11-12T09:25:36.000Z\",\"ingestedAt\":\"2026-11-12T09:25:36.412Z\",\"replyToMessageId\":null,\"attachments\":[]},\"conversation\":{\"id\":\"1234\",\"channel\":\"WHATSAPP\",\"status\":\"open\",\"participant\":{\"name\":\"Jordan Example\",\"channelId\":\"12025550147\",\"phoneNumber\":\"12025550147\",\"instagramUsername\":null},\"createdAt\":\"2026-11-01T09:12:00.000Z\",\"lastMessageAt\":\"2026-11-12T09:25:36.000Z\"},\"account\":{\"id\":\"11\",\"channel\":\"WHATSAPP\"}}}"}}}