Skip to main content

Endpoints & Subscriptions

Create an endpoint

Pass event_types to create the endpoint and its subscription in a single call — the usual way to start:

curl -X POST https://api.travila.ai/api/v1/webhooks/create-endpoint \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "orders-service",
"url": "https://api.example.com/hooks/travila",
"description": "Order pipeline consumer",
"event_types": ["llm.generation_completed"]
}'

The response carries the created endpoint and, when event_types was supplied, the subscription.

Omit event_types if you want to create the subscription separately:

curl -X POST https://api.travila.ai/api/v1/webhooks/create-subscription \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"endpoint_id": "ep_abc123",
"event_types": ["llm.generation_completed", "llm.tool_call_completed"],
"external_id": "orders-prod"
}'

Addressing a subscription with your own id

external_id is optional and yours to choose — unique among live subscriptions in your tenant. Where a subscription reference is needed you may supply either subscription_id or external_id, but exactly one; sending both, or neither, is rejected. Deleting a subscription frees its external_id for reuse.

It saves you storing our generated ids:

curl -X POST https://api.travila.ai/api/v1/webhooks/delete-subscription \
-H "X-API-Key: sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "external_id": "orders-prod" }'

Managing endpoints

OperationEndpoint
List endpointslist-endpoints
Update name, URL, or descriptionupdate-endpoint
Delete an endpoint and its subscriptionsdelete-endpoint
List subscriptionslist-subscriptions

update-endpoint changes only the fields you send; omitted fields are left alone. Deleting an endpoint removes its subscriptions with it.