API reference
Webhooks
6 operations. Base URL https://api.scarleta.ai. Select an operation to see its parameters, samples and errors.
Jump to an operation
GET/v1/webhooksList registered webhook addresses
Free and paid accounts
- API key required
- Free and paid accounts
- No token cost
Returns the addresses registered for your account, oldest first. Registered addresses receive every batch_completed and recipe_completed event of your account, in addition to the webhook_url of a single request (an address identical to the request's webhook_url is delivered once). Each delivery is signed exactly like a webhook_url delivery, with the same 3 attempts (waiting 2 s and 4 s), 10-second timeout and no redirects. You can register at most 5 addresses.
Cost. Free of charge.
curl "https://api.scarleta.ai/v1/webhooks" \
-H "Authorization: Bearer $SCARLETA_API_KEY"Response fields
| Field | Type | Description |
|---|---|---|
| webhooks | array<object> | |
| webhooks[].id | string | Identifier of the registered address, for example `whk_3f9c1a7e5b2d4c8a6e01b9d3`. |
| webhooks[].url | string | The address deliveries are POSTed to. |
| webhooks[].created_at | number | When the address was registered, in milliseconds since the Unix epoch. |
Errors
| Status | Code | Description |
|---|---|---|
| 401 | invalid_key | Missing, malformed, unknown or revoked API key. |
| 429 | rate_limit_exceeded | Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry. |
| 503 | auth_unavailable | Temporary platform condition; retry shortly. |
Example responses
{
"data": {
"webhooks": [
{
"id": "whk_3f9c1a7e5b2d4c8a6e01b9d3",
"url": "https://example.com/hooks/scarleta",
"created_at": 1761650000000
}
]
},
"meta": {
"request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
}
}- 200 Success
- 401 Missing, malformed, unknown or revoked API key.
- 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
- 503 Temporary platform condition; retry shortly.
Try it
Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.
Other error codes this operation can return: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.
POST/v1/webhooksRegister a webhook address
Free and paid accounts
- API key required
- Free and paid accounts
- No token cost
Registers an address that receives your account's webhook events. Registered addresses receive every batch_completed and recipe_completed event of your account, in addition to the webhook_url of a single request (an address identical to the request's webhook_url is delivered once). Each delivery is signed exactly like a webhook_url delivery, with the same 3 attempts (waiting 2 s and 4 s), 10-second timeout and no redirects. You can register at most 5 addresses. Registering the same address again returns the existing registration and sends no second email. The address must be an https URL that resolves to a public address. The account owner is emailed a notice naming the address's host (never its path or query), because a registered address receives every event; notice_sent is false when no email was sent, and never means the registration failed.
Cost. Free of charge.
curl -X POST "https://api.scarleta.ai/v1/webhooks" \
-H "Authorization: Bearer $SCARLETA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/hooks/scarleta"
}'Request body
| Name | Type | Required | Description |
|---|---|---|---|
| urlbody | string | Required | An https URL that resolves to a public address, at most 4096 bytes. Allowed: 1 to 4096 characters. |
Response fields
| Field | Type | Description |
|---|---|---|
| id | string | Identifier of the registered address, for example `whk_3f9c1a7e5b2d4c8a6e01b9d3`. |
| url | string | The address deliveries are POSTed to. |
| created_at | number | When the address was registered, in milliseconds since the Unix epoch. |
| notice_sent | boolean | True when an email notice was sent to the account owner. False when no email was sent, including when the address was already registered. A false value never means the registration failed. |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | invalid_webhook_url | `url` is missing, not a string, or not an https URL that resolves to a public address. |
| 401 | invalid_key | Missing, malformed, unknown or revoked API key. |
| 409 | webhook_endpoint_limit_reached | The account already has 5 registered addresses. |
| 413 | webhook_url_too_large | `url` is too long. |
| 429 | rate_limit_exceeded | Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry. |
| 503 | auth_unavailable | Temporary platform condition; retry shortly. |
Example responses
{
"data": {
"id": "whk_3f9c1a7e5b2d4c8a6e01b9d3",
"url": "https://example.com/hooks/scarleta",
"created_at": 1761650000000,
"notice_sent": true
},
"meta": {
"request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
}
}- 201 Success
- 400 `url` is missing, not a string, or not an https URL that resolves to a public address.
- 401 Missing, malformed, unknown or revoked API key.
- 409 The account already has 5 registered addresses.
- 413 `url` is too long.
- 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
- 503 Temporary platform condition; retry shortly.
Try it
Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.
Other error codes this operation can return: invalid_auth_format, invalid_json, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized, webhook_validation_unavailable.
DELETE/v1/webhooks/{id}Delete a registered webhook address
Free and paid accounts
- API key required
- Free and paid accounts
- No token cost
Permanently deletes a registered address and erases its stored URL; no further event is delivered to it. Only addresses registered by your own account can be deleted; any other id, or an already deleted one, returns 404. The account owner is emailed a notice naming the address's host (never its path or query); notice_sent is false when no email was sent, and never means the deletion failed.
Cost. Free of charge.
ID="YOUR_ID"
curl -X DELETE "https://api.scarleta.ai/v1/webhooks/$ID" \
-H "Authorization: Bearer $SCARLETA_API_KEY"Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| idpath | string | Required | The `id` returned when the address was registered. |
Response fields
| Field | Type | Description |
|---|---|---|
| id | string | |
| deleted | true | |
| notice_sent | boolean | True when an email notice was sent to the account owner. A false value never means the deletion failed. |
Errors
| Status | Code | Description |
|---|---|---|
| 401 | invalid_key | Missing, malformed, unknown or revoked API key. |
| 404 | webhook_not_found | No active registered address with this id exists for your account. |
| 429 | rate_limit_exceeded | Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry. |
| 503 | auth_unavailable | Temporary platform condition; retry shortly. |
Example responses
{
"data": {
"id": "whk_3f9c1a7e5b2d4c8a6e01b9d3",
"deleted": true,
"notice_sent": true
},
"meta": {
"request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
}
}- 200 Success
- 401 Missing, malformed, unknown or revoked API key.
- 404 No active registered address with this id exists for your account.
- 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
- 503 Temporary platform condition; retry shortly.
Try it
Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.
Other error codes this operation can return: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.
GET/v1/webhooks/signing-secretGet the signing secret
Free and paid accounts
- API key required
- Free and paid accounts
- No token cost
Returns the secret that signs every webhook delivery of your account, creating it on the first call. Every key of one account returns the same secret. Verify a delivery by recomputing v1= plus the lowercase hex HMAC-SHA256 of <X-Scarleta-Timestamp>.<raw body> keyed with this secret, and reject a timestamp more than 300 seconds from your clock. After a revocation this route answers 409 signing_secret_revoked until you rotate.
Cost. Free of charge.
curl "https://api.scarleta.ai/v1/webhooks/signing-secret" \
-H "Authorization: Bearer $SCARLETA_API_KEY"Response fields
| Field | Type | Description |
|---|---|---|
| secret | string | Your signing secret: 64 lowercase hex characters. Keep it private. |
| created_at | number | When this secret was created, in milliseconds since the Unix epoch. |
Errors
| Status | Code | Description |
|---|---|---|
| 401 | invalid_key | Missing, malformed, unknown or revoked API key. |
| 409 | signing_secret_revoked | The secret was revoked; no secret is returned. |
| 429 | rate_limit_exceeded | Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry. |
| 503 | auth_unavailable | Temporary platform condition; retry shortly. |
Example responses
{
"data": {
"secret": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"created_at": 1761650000000
},
"meta": {
"request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
}
}- 200 Success
- 401 Missing, malformed, unknown or revoked API key.
- 409 The secret was revoked; no secret is returned.
- 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
- 503 Temporary platform condition; retry shortly.
Try it
Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.
Other error codes this operation can return: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.
POST/v1/webhooks/signing-secret/revokeRevoke the signing secret
Free and paid accounts
- API key required
- Free and paid accounts
- No token cost
Revokes the signing secret. No webhook is delivered, to any address, until you rotate to a new secret. A revoked secret is never accepted as the previous secret. The account owner is emailed a notice. notice_sent is false when no email was sent, including when the secret was already revoked: revoking an already revoked secret changes nothing, it answers 200 with the original revoked_at and notice_sent: false, and sends no second email. Answers 404 no_signing_secret when the account has no secret yet.
Cost. Free of charge.
curl -X POST "https://api.scarleta.ai/v1/webhooks/signing-secret/revoke" \
-H "Authorization: Bearer $SCARLETA_API_KEY"Response fields
| Field | Type | Description |
|---|---|---|
| revoked_at | number | When the secret was revoked, in milliseconds since the Unix epoch. |
| notice_sent | boolean | True when an email notice was sent to the account owner. False when no email was sent, including when the secret was already revoked. A false value never means the revocation failed. |
Errors
| Status | Code | Description |
|---|---|---|
| 401 | invalid_key | Missing, malformed, unknown or revoked API key. |
| 404 | no_signing_secret | The account never created a signing secret. |
| 429 | rate_limit_exceeded | Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry. |
| 503 | auth_unavailable | Temporary platform condition; retry shortly. |
Example responses
{
"data": {
"revoked_at": 1761650000000,
"notice_sent": true
},
"meta": {
"request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
}
}- 200 Success
- 401 Missing, malformed, unknown or revoked API key.
- 404 The account never created a signing secret.
- 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
- 503 Temporary platform condition; retry shortly.
Try it
Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.
Other error codes this operation can return: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.
POST/v1/webhooks/signing-secret/rotateRotate the signing secret
Free and paid accounts
- API key required
- Free and paid accounts
- No token cost
Creates a new signing secret and returns it. The new secret is in this response and can be read again with GET /v1/webhooks/signing-secret. For one day after a rotation each delivery also carries X-Scarleta-Signature-Previous, signed with the old secret, so a receiver that has not switched yet can verify that header with its old secret and you can switch over without dropping events. A rotation after a revocation restores deliveries. The account owner is emailed a notice that never contains the secret; notice_sent is false when no email was sent.
Cost. Free of charge.
curl -X POST "https://api.scarleta.ai/v1/webhooks/signing-secret/rotate" \
-H "Authorization: Bearer $SCARLETA_API_KEY"Response fields
| Field | Type | Description |
|---|---|---|
| secret | string | Your signing secret: 64 lowercase hex characters. Keep it private. |
| created_at | number | When this secret was created, in milliseconds since the Unix epoch. |
| notice_sent | boolean | True when an email notice was sent to the account owner. A false value never means the rotation failed. |
Errors
| Status | Code | Description |
|---|---|---|
| 401 | invalid_key | Missing, malformed, unknown or revoked API key. |
| 429 | rate_limit_exceeded | Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry. |
| 503 | auth_unavailable | Temporary platform condition; retry shortly. |
Example responses
{
"data": {
"secret": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"created_at": 1761650000000,
"notice_sent": true
},
"meta": {
"request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
}
}- 200 Success
- 401 Missing, malformed, unknown or revoked API key.
- 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
- 503 Temporary platform condition; retry shortly.
Try it
Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.
Other error codes this operation can return: invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.