Write many event types at once

Upserts event types keyed by slug, the key that pages and events reference, and deletes the named slugs, all in one request. Everything lands or nothing does. Re-sending the same entry is a no-op update, so retries are safe.

POST https://sitepaste.com/api/v1/public/sites/{siteId}/event-types/batch

Requires the content scope.

To create a single type and be told when its slug is already in use, use POST /sites/{siteId}/event-types.

Usage

curl -X POST https://sitepaste.com/api/v1/public/sites/default/event-types/batch \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "eventTypes": [
      { "name": "Breathwork", "slug": "breathwork", "description": "Guided somatic breathwork" }
    ],
    "deleteSlugs": ["retired-type"]
  }'

Authorizations

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token (Authorization: Bearer sp_...). Created in the dashboard under Account > Tokens. See authentication.

Body

FieldTypeRequiredDescription
eventTypesarrayOne of eventTypes/deleteSlugsUp to 500 entries. Each creates the type or updates it in place, keyed by slug.
deleteSlugsarrayOne of eventTypes/deleteSlugsSlugs to delete. Each type’s events stay published and stop being categorized under it, and the slug is removed from newsletter subscribers’ interests.

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. Publish your changes with POST /sites/{siteId}/deployments once the batch has landed.

Entry fields

An entry takes the same fields the single create takes.

FieldTypeRequiredDescription
namestringYesThe type’s display name.
slugstringYesThe key pages and events reference it by.
descriptionstringNoLonger text for the type.
imageUrlstringNoImage for the type.
pageSlugstringNoA page on the site to link the type to.
sortOrderintegerNoPosition in the type list. A new type appends after the current order when this is omitted.

On an update, every optional field you omit keeps its stored value. Sending {"name": "New name", "slug": "breathwork"} renames the type and leaves its description, image, page link, and position untouched.

Response

{
  "eventTypes": [
    { "id": "t8qj2xv7mz4r", "name": "Breathwork", "slug": "breathwork", "status": "created" }
  ],
  "deleted": ["retired-type"]
}

Validation failures return 422 with problems keyed by entry index. See errors.