Skip to main content

Create Event

Define a new custom event for your organization. An event definition is a named schema — once defined, you can send events against it and use them to trigger automations.

Endpoint

POST /events

Returns: 201 Created

Headers

HeaderValueRequired
AuthorizationBearer <your-api-key>Yes
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
namestringYesUnique event name for your organization. 1–80 characters. Immutable after creation.
descriptionstringNoHuman-readable description. Max 2000 characters.
schemaobjectNoField schema that ingested payloads are validated against. Defaults to no fields. See below.

Schema object

schema.fields is an array of field definitions. Payloads sent to this event are validated against them.

FieldTypeDescription
namestringField identifier. Letters, digits, and underscores; must start with a letter or underscore. Max 64 characters.
typestringOne of string, number, boolean, date.
requiredbooleanWhether the field must be present in every payload.
{
"name": "order.completed",
"description": "Fired when a customer completes checkout.",
"schema": {
"fields": [
{ "name": "order_id", "type": "string", "required": true },
{ "name": "total", "type": "number", "required": true },
{ "name": "is_gift", "type": "boolean", "required": false }
]
}
}
Define before you send

You must create an event definition before sending events to it. A send for an undefined name returns 404.


Response

{
"id": "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a",
"name": "order.completed",
"description": "Fired when a customer completes checkout.",
"schema": {
"fields": [
{ "name": "order_id", "type": "string", "required": true },
{ "name": "total", "type": "number", "required": true },
{ "name": "is_gift", "type": "boolean", "required": false }
]
},
"created_at": "2026-06-01T12:00:00.000Z",
"updated_at": "2026-06-01T12:00:00.000Z"
}
FieldTypeDescription
idstringUnique event ID (UUIDv7)
namestringEvent name (unique per organization, immutable)
descriptionstring | nullDescription, or null
schemaobjectThe field schema ({ "fields": [...] })
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp

Examples

curl -X POST "https://api.arsel.sa/v1/events" \
-H "Authorization: Bearer be_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "order.completed",
"description": "Fired when a customer completes checkout.",
"schema": {
"fields": [
{ "name": "order_id", "type": "string", "required": true },
{ "name": "total", "type": "number", "required": true }
]
}
}'

Error Responses

{
"status_code": 409,
"name": "conflict",
"message": "An event named \"order.completed\" already exists"
}