Skip to content

Create a trigger

POST
/triggers
curl --request POST \
--url https://localhost:3000/api/v1/triggers \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "allow_public_events": false, "color": "#FF5733", "description": "Tracks user signups", "event_mode": "click", "group_id": "550e8400-e29b-41d4-a716-446655440000", "max_batch_size": 50, "name": "user-signups", "owner": "personal", "public_quota": { "daily_limit": 1000, "hourly_limit": 100 }, "slug": "user-signups", "tags": [ "production", "critical" ], "visibility": "private" }'

Creates a new trigger. The optional owner (“personal” or “tenant:”) attaches the trigger to a tenant, which requires the tenant:write: scope. Visibility (private by default, or public) is an explicit field, the public tag has no special meaning; allow_public_events requires a public trigger. Requires trigger:create:* (or trigger:manage:*) for API keys.

Trigger details

Media typeapplication/json
object
allow_public_events
boolean

Example

false
color
string

Example

#FF5733
description
string

Example

Tracks user signups
event_mode
string
Allowed values: click batch both

Example

both
group_id
string format: uuid

Example

550e8400-e29b-41d4-a716-446655440000
max_batch_size
integer

Example

50
name
required
string

Example

user-signups
owner
string
Allowed values: personal tenant:<id>

Example

personal
public_quota
object
daily_limit
integer

Example

1000
hourly_limit
integer

Example

100
slug
string

Example

user-signups
tags
Array<string>

Example

[
"production",
"critical"
]
visibility
string
Allowed values: private public

Example

private

Trigger created

Media typeapplication/json
object
account_id
required
string format: uuid
allow_public_events
required
boolean
color
string
created_at
required
string format: date-time
description
string
event_mode
required
string
group_id
string format: uuid
id
required
string format: uuid
max_batch_size
integer
name
required
string
owner_id
required
string format: uuid
owner_name

Organization name, only set by owner=all

string
owner_type
required
string
Allowed values: account tenant system
public_quota
object
current_daily
required
integer
current_hourly
required
integer
daily_limit
required
integer
hourly_limit
required
integer
slug
string
tags
required
Array<string>
total_events
integer
updated_at
required

Version for optimistic locking on PATCH

string format: date-time
visibility
required
string
Allowed values: private public

Example

{
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"allow_public_events": false,
"color": "#FF5733",
"created_at": "2024-01-15T10:30:00Z",
"description": "Tracks user signups",
"event_mode": "both",
"id": "550e8400-e29b-41d4-a716-446655440000",
"max_batch_size": 50,
"name": "user-signups",
"owner_id": "550e8400-e29b-41d4-a716-446655440000",
"owner_name": "Acme",
"owner_type": "account",
"public_quota": {
"current_daily": 523,
"current_hourly": 42,
"daily_limit": 1000,
"hourly_limit": 100
},
"slug": "user-signups",
"tags": [
"production",
"critical"
],
"total_events": 15234,
"updated_at": "2024-01-15T10:30:00.123456Z",
"visibility": "private"
}

Invalid request

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Unauthorized

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Limit reached, not a tenant member or insufficient permissions

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Trigger name or slug already exists

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Erreur interne

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}