Create an event type

Create one event type. The response is a 201 with the new type’s URI in Location.

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

Requires the content scope.

To write several types at once, or to upsert and delete together, use POST /sites/{siteId}/event-types/batch. To change a type that already exists, use PATCH /sites/{siteId}/event-types/{slug}.

Usage

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

Location names the type by its slug:

Location: /api/v1/public/sites/default/event-types/breathwork

To create or update in one call, use the batch, which upserts.

Authorizations

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

Body

The body is one event type object.

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.

The site is named in the path, not the body. See addressing. eventTypes and deleteSlugs belong to the batch. Publish your changes with POST /sites/{siteId}/deployments.

Response

201 Created, with the event type in the representation GET /sites/{siteId}/event-types/{slug} serves and its URI in Location.

Errors

Field problems return 422 and name the field. A slug already in use on the site returns 409, and nothing is written. See errors.