
# Write many events at once

Applies a batch of event changes in one request, mirroring [the pages batch](/api/pages/post-pages-batch). Everything lands or nothing does.

```sh
POST https://sitepaste.com/api/v1/public/sites/{siteId}/events/batch
```

Requires the `content` scope.

An entry with an `id` updates that event, and one without creates a new event. Ids come from [the list](/api/events/get-events). `deleteIds` names events to delete in the same call. To create a single event, use [POST /sites/{siteId}/events](/api/events/post-events).

## Usage

```bash
curl -X POST https://sitepaste.com/api/v1/public/sites/default/events/batch \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "title": "Morning Breathwork",
        "startsAt": "2026-09-01T09:00",
        "timezone": "America/Los_Angeles",
        "eventTypeSlugs": ["breathwork"],
        "price": "$25",
        "bookingUrl": "https://example.com/book"
      },
      { "id": "4ghjanhpo9sy", "hidden": true }
    ],
    "deleteIds": ["e9q2xv7m4r8t"]
  }'
```

## Authorizations

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |

## Body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| events | array | One of events/deleteIds | Up to 1000 entries; see the fields below. |
| deleteIds | array | One of events/deleteIds | Up to 1000 event ids to delete. An unknown id fails the request. |

The request body may be up to 16 MB, and a larger one is refused with 413.

The site is named in the path, not the body. See [addressing](/api/overview#addressing). Publish your changes with [POST /sites/{siteId}/deployments](/api/deployments/post-deployments) once the batch has landed.

## Entry fields

An entry takes the same fields [the single create](/api/events/post-events#body) takes, plus `id`.

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| id | string | No | Event ID (short ID). Present updates that event; absent creates one. |

Creates require `title`, `startsAt`, and `timezone`. On updates, absent fields keep their stored values.

No two parts of one request may address the same event. An id cannot appear twice in `events`, cannot appear twice in `deleteIds`, and an id in `events` cannot also appear in `deleteIds`. Any of these refuses the whole batch, and nothing is written.

## Response

```json
{
  "events": [
    { "id": "4ghjanhpo9sy", "title": "Morning Breathwork", "status": "created" }
  ],
  "deleted": 1
}
```

Validation failures return 422 with problems keyed by entry index:

```json
{ "error": "validation failed", "code": "validation_failed", "events": { "0": { "timezone": "invalid timezone" } } }
```

See [errors](/api/overview#errors).