> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketflows.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Status codes, error bodies, limits, and which errors to retry

When a request fails, the API returns a non-200 status code. Most errors come with a JSON body that
lists what went wrong:

```json theme={null}
{
  "errors": [
    {
      "path": "customers.1.email_address",
      "message": "Email is invalid"
    }
  ]
}
```

**errors** `array`

**properties**

**path** `string`

Where the problem is in your request, as a dot-separated path, for example `customers.1.id` for
the `id` of the second customer in a batch. Empty when the error is about the request as a whole.

**message** `string`

A human-readable description of the error.

> [!NOTE]
>
> One error doesn't follow this shape yet: when a request with a body is missing `Content-Type:
>     application/json`, the API returns `400` with `errors` as a single object instead of an array.

## Status codes

| Status | Meaning | Retry? |
| - | - | - |
| `200` | The request succeeded. The customer batch sync can return `200` with per-customer errors; see [Partial success](#partial-success). | No |
| `400` | The request body doesn't match the endpoint's parameters, or a request with a body is missing `Content-Type: application/json`. | No. Fix the request. |
| `401` | Authentication failed: the credentials are missing or wrong. The body is empty. | No. Check your [credentials](https://docs.pocketflows.com/reference/authentication.md). |
| `404` | The resource doesn't exist, or doesn't belong to your project. | No |
| `409` | A conflict. See [Conflicts](#conflicts) for the two kinds. | Yes, after a short wait |
| `422` | The request is well formed, but Pocketflows can't process it, for example a batch that is over the size limit. | No. Fix the request. |
| `429` | You've reached the limit on direct sends for a business. See [Limits](#limits). | Yes, later |
| `5xx` | An unexpected error on our side. The body may not follow the `errors` shape. | Yes, with backoff |

If a request times out or the connection drops, you can't tell whether it was processed. Retry it
with the same [idempotency key](https://docs.pocketflows.com/reference/idempotency-keys.md) so it can't happen twice.

## Conflicts

A `409` means one of two things:

* **A simultaneous update.** Another request was changing the same records at the same time. The body
  says `There was a simultaneous update happening. Please try again`. Retry the request.
* **An idempotency key conflict.** The body is empty. Either a request with the same
  `Idempotency-Key` is still being processed, or the key was already used for a different request.
  See [Idempotency keys](https://docs.pocketflows.com/reference/idempotency-keys.md).

## Partial success

`POST /sync/businesses/:business_id/customers/batch` processes every valid customer even when some
are invalid, and returns `200`. In the response, the `customers` array is in the order you sent
them, with `null` for each customer that failed, and `errors` gives the reason for each failure with
its position in `path`:

```json theme={null}
{
  "customers": [{ "id": "cust_...", "external_id": "a" }, null],
  "errors": [{ "path": "customers.1.id", "message": "Customer with ID nonsense not found" }]
}
```

Retrying the whole batch is safe, because sync matches customers by `external_id`, but you only need
to resend the failed ones.

`POST /sync/businesses/batch` is all or nothing: if any business is invalid, the request fails and no
businesses are synced.

## Limits

| Limit | Value | Error |
| - | - | - |
| Customers in one `customers/batch` request | 15,000 | `422` |
| Direct sends for each business | 100 emails and 100 SMS messages in any 24 hours | `429` |

Direct sends are messages sent by these endpoints, rather than by a running campaign or trigger:

* `POST /email_templates/:id/send` and `POST /sms_templates/:id/send`
* `POST /campaigns/:id/test_send` and `POST /triggers/:id/test_send`

Every call counts, whoever it's sent to, so don't use these endpoints for receipts, reminders or
other messages your product sends routinely.

The API doesn't currently apply a general request rate limit. For bulk loads, use the batch sync
endpoints rather than one request per record.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.