Events
Send your own events (an order was paid, a booking was made) to start the business's automations.
Send your own events (an order was paid, a booking was made) to start the business's automations.
Send an event to the automations
POST /events
| Scope | Package | Idempotency-Key |
|---|---|---|
events:write | Scale (API) with automations | not used |
Needs the automations feature as well (Growth and up, so every Scale business has it). The body may be up to 64 KB. type must be one of the event types of the automations (see the guide Trigger a workflow by API); type plus id runs once: sending the same pair again answers 200 with duplicate: true and starts nothing. The answer lists the automation runs that started.
Request body
JSON object EventInput.
| Field | Type | Description |
|---|---|---|
type (required) | string | |
id (required) | string | Your id of the event; the same type + id runs once. |
contact | object | |
data | object |
Request
curl -X POST "https://hevia.app/api/v1/events" \
-H "Authorization: Bearer $HEVIA_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"order.paid","id":"order-1042","contact":{"email":"anna@example.com"},"data":{"order_number":"1042","amount":"129.00"}}'Response
200 Duplicate (already received, nothing runs twice), 201 Accepted.
JSON
{
"data": {
"id": "3f1c2a9e-5b7d-4e21-9c0a-6d8e2f4b1a70",
"duplicate": false,
"runs": [
{
"ruleId": "order-paid-thanks",
"status": "scheduled"
}
]
}
}Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | Invalid request |
| 401 | unauthorized | Missing or invalid key |
| 403 | insufficient_scope | The key or token does not have the scope of the endpoint. |
| 403 | plan_required | The business's package does not include the API (Scale) or the feature of the endpoint. |
| 413 | payload_too_large | Body too large |
| 422 | invalid_request | Invalid body |
| 429 | rate_limited | Rate limit (120 requests per minute and key); see the RateLimit-* headers |