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/webhooks

List 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
FieldTypeDescription
webhooksarray<object>
webhooks[].idstringIdentifier of the registered address, for example `whk_3f9c1a7e5b2d4c8a6e01b9d3`.
webhooks[].urlstringThe address deliveries are POSTed to.
webhooks[].created_atnumberWhen the address was registered, in milliseconds since the Unix epoch.
Errors
StatusCodeDescription
401invalid_keyMissing, malformed, unknown or revoked API key.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary 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/webhooks

Register 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

NameTypeRequiredDescription
urlbodystringRequiredAn https URL that resolves to a public address, at most 4096 bytes. Allowed: 1 to 4096 characters.
Response fields
FieldTypeDescription
idstringIdentifier of the registered address, for example `whk_3f9c1a7e5b2d4c8a6e01b9d3`.
urlstringThe address deliveries are POSTed to.
created_atnumberWhen the address was registered, in milliseconds since the Unix epoch.
notice_sentbooleanTrue 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
StatusCodeDescription
400invalid_webhook_url`url` is missing, not a string, or not an https URL that resolves to a public address.
401invalid_keyMissing, malformed, unknown or revoked API key.
409webhook_endpoint_limit_reachedThe account already has 5 registered addresses.
413webhook_url_too_large`url` is too long.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary 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

NameTypeRequiredDescription
idpathstringRequiredThe `id` returned when the address was registered.
Response fields
FieldTypeDescription
idstring
deletedtrue
notice_sentbooleanTrue when an email notice was sent to the account owner. A false value never means the deletion failed.
Errors
StatusCodeDescription
401invalid_keyMissing, malformed, unknown or revoked API key.
404webhook_not_foundNo active registered address with this id exists for your account.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary 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-secret

Get 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
FieldTypeDescription
secretstringYour signing secret: 64 lowercase hex characters. Keep it private.
created_atnumberWhen this secret was created, in milliseconds since the Unix epoch.
Errors
StatusCodeDescription
401invalid_keyMissing, malformed, unknown or revoked API key.
409signing_secret_revokedThe secret was revoked; no secret is returned.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary 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/revoke

Revoke 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
FieldTypeDescription
revoked_atnumberWhen the secret was revoked, in milliseconds since the Unix epoch.
notice_sentbooleanTrue 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
StatusCodeDescription
401invalid_keyMissing, malformed, unknown or revoked API key.
404no_signing_secretThe account never created a signing secret.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary 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/rotate

Rotate 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
FieldTypeDescription
secretstringYour signing secret: 64 lowercase hex characters. Keep it private.
created_atnumberWhen this secret was created, in milliseconds since the Unix epoch.
notice_sentbooleanTrue when an email notice was sent to the account owner. A false value never means the rotation failed.
Errors
StatusCodeDescription
401invalid_keyMissing, malformed, unknown or revoked API key.
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary 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.