# Every error

Every error the Chatwise API answers on purpose, by status, with its body and what to do.

How errors are shaped, and which to retry, is in [errors](https://chatwise.so/docs/errors.md).

## 400

### Validation failed

A parameter or body field is missing, unknown or malformed. `errors` lists each one.

```json
{
  "message": "Validation failed",
  "errors": [
    {
      "path": "query.limit",
      "message": "Limit must be an integer between 1 and 100"
    }
  ]
}
```

From [list conversations](https://chatwise.so/docs/api/list-conversations.md), [get a conversation](https://chatwise.so/docs/api/get-conversation.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), [get a message](https://chatwise.so/docs/api/get-message.md), [list or search messages](https://chatwise.so/docs/api/list-messages.md), [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), [list WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md), [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md), [get a WhatsApp template](https://chatwise.so/docs/api/get-whatsapp-template.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), [get a webhook endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md), [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md), [delete a webhook endpoint](https://chatwise.so/docs/api/delete-webhook-endpoint.md), [send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md), [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md), [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md), and [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md).

### Invalid cursor or cursor does not match this request

The cursor isn't one this route returned, or the filters or order changed since.

```json
{
  "object": "Pagination",
  "field": "cursor",
  "message": "Invalid cursor or cursor does not match this request"
}
```

From [list conversations](https://chatwise.so/docs/api/list-conversations.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), [list or search messages](https://chatwise.so/docs/api/list-messages.md), [list WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md), and [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md).

### Malformed JSON

The request body isn't valid JSON. The message says where.

```json
{
  "message": "Expected property name or '}' in JSON at position 1 (line 1 column 2)"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md).

### Template must be approved to send messages

Meta hasn't approved the template, or paused or rejected it.

```json
{
  "object": "Template",
  "field": "status",
  "message": "Template must be approved to send messages"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md).

### This template is on a different WhatsApp Business Account from the number in from

Use a `from` number on the template's WhatsApp Business Account.

```json
{
  "object": "Template",
  "field": "templateId",
  "message": "This template is on a different WhatsApp Business Account from the number in from"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md).

### An OTP code is required for authentication templates

Send the code as `templateParams` with `parameter_name` set to `otp`.

```json
{
  "object": "Template",
  "field": "templateParams",
  "message": "An OTP code is required for authentication templates"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### Numbered template variables must start at 1 and include each position once

Number the variables from `1`, each once.

```json
{
  "object": "Template",
  "field": "templateParams",
  "message": "Numbered template variables must start at 1 and include each position once"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### That WhatsApp number is not connected to this workspace

Use one of the workspace's connected numbers, digits only. `data.accounts` lists them.

```json
{
  "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
      }
    ]
  }
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### Provide one sample value for each placeholder

The definition breaks one of WhatsApp's template rules. `field` and `message` say which.

```json
{
  "object": "WhatsApp template",
  "field": "components.body.examples",
  "message": "Provide one sample value for each placeholder"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### Meta rejected the template submission. Check the template details and try again

Meta refused the submission.

```json
{
  "object": "WhatsApp template",
  "field": "body",
  "message": "Meta rejected the template submission. Check the template details and try again"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### Use a public https:// URL on port 443, without a username, password or #fragment

The URL can't receive webhooks.

```json
{
  "object": "Webhook endpoint",
  "field": "url",
  "message": "Use a public https:// URL on port 443, without a username, password or #fragment."
}
```

From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md).

### Every account id must be one of this workspace's connected accounts

An id in `accountIds` isn't one of the workspace's accounts.

```json
{
  "object": "Webhook endpoint",
  "field": "accountIds",
  "message": "Every account id must be one of this workspace's connected accounts."
}
```

From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md).

### A workspace can have at most 10 webhook endpoints

Delete an endpoint you no longer use.

```json
{
  "object": "Webhook endpoint",
  "field": "url",
  "message": "A workspace can have at most 10 webhook endpoints."
}
```

From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md).

### Message events need an API key with the messages:read scope too

The key lacks `messages:read`, which `message.*` events need.

```json
{
  "object": "Webhook endpoint",
  "field": "events",
  "message": "Message events need an API key with the messages:read scope too."
}
```

From [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md) and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md).

### This delivery is already waiting to be sent

It is `PENDING` or `PROCESSING`.

```json
{
  "object": "Webhook delivery",
  "field": "id",
  "message": "This delivery is already waiting to be sent."
}
```

From [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md).

### The endpoint no longer subscribes

Subscribe the endpoint to the event again first.

```json
{
  "object": "Webhook delivery",
  "field": "id",
  "message": "The endpoint no longer subscribes to message.received."
}
```

From [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md).

### The message was unsent, deleted or hidden, so it can't be sent again

The message is no longer visible through the API either.

```json
{
  "object": "Webhook delivery",
  "field": "id",
  "message": "The message was unsent, deleted or hidden, so it can't be sent again."
}
```

From [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md).

## 401

### A valid Bearer API key is required

The `Authorization` header is missing or isn't `Bearer <API key>`.

```json
{
  "message": "A valid Bearer API key is required"
}
```

Any route.

### Invalid or revoked API key

The key doesn't exist, was revoked, or has expired.

```json
{
  "message": "Invalid or revoked API key"
}
```

Any route.

### Invalid API key

Chatwise couldn't check the key. Try again.

```json
{
  "message": "Invalid API key"
}
```

Any route.

## 402

### ADMIN_SERVICES_BLOCKED

Sending is paused for the workspace. Contact support.

```json
{
  "code": "ADMIN_SERVICES_BLOCKED",
  "message": "Chatwise services have been paused for this workspace by an administrator. Contact support to restore service."
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

## 403

### API key does not have the required scope

The key lacks the route's scope. Create a key that has it.

```json
{
  "message": "API key does not have the required scope: conversations:read"
}
```

Any route.

### WHATSAPP_REAUTH_REQUIRED

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.

```json
{
  "code": "WHATSAPP_REAUTH_REQUIRED",
  "message": "WhatsApp authorization has expired. Ask an administrator to reconnect WhatsApp in Settings.",
  "reason": "expired"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), and [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### The connected WhatsApp account is not authorized to create templates

The connected WhatsApp account can't create templates.

```json
{
  "message": "The connected WhatsApp account is not authorized to create templates"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### Changing an endpoint that receives message events needs an API key with the messages:read scope too

The endpoint has `message.*` events and the key lacks `messages:read`.

```json
{
  "message": "Changing an endpoint that receives message events needs an API key with the messages:read scope too."
}
```

From [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md) and [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md).

### Reading a message event's delivery needs an API key with the messages:read scope too

The delivery is for a `message.*` event and the key lacks `messages:read`.

```json
{
  "message": "Reading a message event's delivery needs an API key with the messages:read scope too."
}
```

From [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md) and [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md).

## 404

### Conversation not found

No conversation with this id in the key's workspace.

```json
{
  "message": "Conversation not found"
}
```

From [get a conversation](https://chatwise.so/docs/api/get-conversation.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), and [list or search messages](https://chatwise.so/docs/api/list-messages.md).

### Message not found

No visible message with this id in this conversation.

```json
{
  "message": "Message not found"
}
```

From [get a message](https://chatwise.so/docs/api/get-message.md).

### Template not found

No such template in the key's workspace. Sending by name finds approved templates only.

```json
{
  "message": "Template not found"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), and [get a WhatsApp template](https://chatwise.so/docs/api/get-whatsapp-template.md).

### Whatsapp account not found

The workspace has no connected WhatsApp number.

```json
{
  "message": "Whatsapp account not found"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### No connected WhatsApp number on this template's business account

Connect a number on the template's WhatsApp Business Account.

```json
{
  "message": "No connected WhatsApp number on this template's business account"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### WhatsApp ID not found

The workspace has no WhatsApp number.

```json
{
  "message": "WhatsApp ID not found"
}
```

From [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### Active WhatsApp connection not found

Connect a WhatsApp number in the dashboard first.

```json
{
  "message": "Active WhatsApp connection not found"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### Template not found

The template this submission created was deleted since. Use a new `Idempotency-Key`.

```json
{
  "message": "Template not found"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### Webhook endpoint not found

No endpoint with this id in the key's workspace.

```json
{
  "message": "Webhook endpoint not found"
}
```

From [get a webhook endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md), [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md), [delete a webhook endpoint](https://chatwise.so/docs/api/delete-webhook-endpoint.md), [send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md), [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), and [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md).

### Webhook delivery not found

No delivery with this id, or its endpoint was deleted, or it is older than 30 days.

```json
{
  "message": "Webhook delivery not found"
}
```

From [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md) and [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md).

## 409

### TEMPLATE_EXISTS

Use another name, or read the existing template.

```json
{
  "code": "TEMPLATE_EXISTS",
  "message": "A WhatsApp template with this name and language already exists"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### IDEMPOTENCY_KEY_REUSED

Use a new key for a new template.

```json
{
  "code": "IDEMPOTENCY_KEY_REUSED",
  "message": "This Idempotency-Key was already used with different template details"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### TEMPLATE_SUBMISSION_IN_PROGRESS

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.

```json
{
  "code": "TEMPLATE_SUBMISSION_IN_PROGRESS",
  "message": "A submission for this template name and language is already in progress"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### TEMPLATE_SUBMISSION_UNCONFIRMED

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.

```json
{
  "code": "TEMPLATE_SUBMISSION_UNCONFIRMED",
  "message": "Meta has not confirmed this submission. Retry using the same Idempotency-Key"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### WHATSAPP_CONNECTION_CHANGED

The workspace connected another WhatsApp Business Account since. Submit again with a new key.

```json
{
  "code": "WHATSAPP_CONNECTION_CHANGED",
  "message": "The WhatsApp connection changed after this template was submitted"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

## 413

### request entity too large

The request body is larger than 100 KB.

```json
{
  "message": "request entity too large"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md), [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md), [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), and [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md).

## 429

### API key rate limit exceeded

Wait the number of seconds in the `Retry-After` header.

```json
{
  "message": "API key rate limit exceeded"
}
```

Any route.

## 500

### Internal server error

Something failed in Chatwise. Retry reads with backoff.

```json
{
  "message": "Internal server error"
}
```

From [list conversations](https://chatwise.so/docs/api/list-conversations.md), [get a conversation](https://chatwise.so/docs/api/get-conversation.md), [list a conversation's messages](https://chatwise.so/docs/api/list-conversation-messages.md), [get a message](https://chatwise.so/docs/api/get-message.md), [list or search messages](https://chatwise.so/docs/api/list-messages.md), [list WhatsApp templates](https://chatwise.so/docs/api/list-whatsapp-templates.md), [get a WhatsApp template](https://chatwise.so/docs/api/get-whatsapp-template.md), [list webhook endpoints](https://chatwise.so/docs/api/list-webhook-endpoints.md), [create a webhook endpoint](https://chatwise.so/docs/api/create-webhook-endpoint.md), [get a webhook endpoint](https://chatwise.so/docs/api/get-webhook-endpoint.md), [update a webhook endpoint](https://chatwise.so/docs/api/update-webhook-endpoint.md), [delete a webhook endpoint](https://chatwise.so/docs/api/delete-webhook-endpoint.md), [send a test event](https://chatwise.so/docs/api/test-webhook-endpoint.md), [rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), [list deliveries](https://chatwise.so/docs/api/list-webhook-deliveries.md), [get a delivery](https://chatwise.so/docs/api/get-webhook-delivery.md), [redeliver](https://chatwise.so/docs/api/redeliver-webhook-delivery.md), and [list event types](https://chatwise.so/docs/api/list-webhook-event-types.md).

### WhatsApp send failed

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.

```json
{
  "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"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### Internal server error

Something failed in Chatwise. The message may have been sent, even if it isn't in the conversation. Quote `errorId` to support.

```json
{
  "message": "Internal server error",
  "errorId": "7b0c7f5e-2f0a-4c55-9a3e-0d8f4c1b2a6d"
}
```

From [send a template by id](https://chatwise.so/docs/api/send-message.md) and [send a template by name](https://chatwise.so/docs/api/send-whatsapp-template.md).

### Internal server error

Something failed in Chatwise. Repeat the request with the same key and body.

```json
{
  "message": "Internal server error"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

## 502

### WHATSAPP_LOOKUP_FAILED

Repeat the request with the same key and body.

```json
{
  "code": "WHATSAPP_LOOKUP_FAILED",
  "message": "Could not check the WhatsApp template submission"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

### TEMPLATE_SUBMISSION_UNCONFIRMED

Repeat the request with the same key and body.

```json
{
  "code": "TEMPLATE_SUBMISSION_UNCONFIRMED",
  "message": "The WhatsApp template submission could not be confirmed. Retry using the same Idempotency-Key"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).

## 503

### WHATSAPP_RATE_LIMITED

Wait, then repeat the request with the same key and body.

```json
{
  "code": "WHATSAPP_RATE_LIMITED",
  "message": "WhatsApp is rate limiting template submissions. Retry with the same Idempotency-Key"
}
```

From [create a WhatsApp template](https://chatwise.so/docs/api/create-whatsapp-template.md).
