Skip to content
Webhook Subscriptions

Create a webhook subscription

POST
/webhook_subscriptions
const url = 'https://api.kirimdev.com/v1/webhook_subscriptions';
const options = {
method: 'POST',
headers: {
'Idempotency-Key': 'order-20260910-0001',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: '{"url":"https://example.com","description":"example","events":["message.received"],"phone_number_ids":["example"]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}

Create a webhook subscription. Store initial_secret server-side immediately. It is returned in the initial response and replayed for 24 hours when the same POST is retried with the same Idempotency-Key; outside that replay, Kirimdev cannot show it again.

Idempotency-Key

Optional retry key. Reusing the same key with the same method, path, and body within 24 hours returns the original response; reusing it for a different request returns 422.

string
Example
order-20260910-0001

Optional retry key. Reusing the same key with the same method, path, and body within 24 hours returns the original response; reusing it for a different request returns 422.

Media type application/json
object
url
required
string format: uri
description
string
<= 200 characters
events
required
Array<string>
>= 1 items
Allowed values: message.received message.status message.sent message.revoked message.edited conversation.assigned conversation.closed contact.created contact.updated contact.identity_updated customer.created customer.updated customer.archived customer.onboarded customer.setup_link.created customer.setup_link.consumed
phone_number_ids
Array<string>
<= 50 items

Created

Media type application/json
object
data
required
object
id
required
string
object
required
string
Allowed values: webhook_subscription
url
required
string format: uri
description
required
string | null
events
required
Array<string>
phone_number_ids
required

Optional whitelist of Meta business_phone_number_id values. When null (default), the subscription fires for events from every WhatsApp account in the organization. When an array, only for events originating from these accounts. Org-level events (e.g. customer.*) IGNORE this filter and always fire.

Array<string> | null
status
required
string
Allowed values: active paused disabled
disabled_reason
required

Why the subscription is CURRENTLY disabled. Cleared when you re-enable it.

string | null
last_disabled_at
required

When the subscription last entered the disabled state. Never cleared, so it still reports a past auto-disable after you have re-enabled.

string | null format: date-time
last_disabled_reason
required
string | null
consecutive_failures
required
integer
secrets
required
Array<object>
object
id
required
string
created_at
required
string format: date-time
expires_at
required
string | null format: date-time
created_at
required
string format: date-time
updated_at
required
string format: date-time
initial_secret
string
request_id
required

Unique request identifier to include when contacting support.

string
Example
{
"data": {
"id": "wbs_01HXYZABCDEFGHJKMNPQRSTVWX",
"object": "webhook_subscription",
"phone_number_ids": [
"1234567890"
],
"status": "active",
"secrets": [
{
"id": "sec_01HXYZABCDEFGHJKMNPQRSTVWX"
}
]
},
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}

Validation failure

Media type application/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error api_error
code
required
string
message
required

Human-readable explanation of the error.

string
param

Request field associated with the error, when applicable.

string
request_id
required

Unique request identifier to include when contacting support.

string
Examples
Example default

A field value is invalid.

{
"error": {
"type": "invalid_request_error",
"code": "invalid_field_value",
"message": "A field value is invalid.",
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}
}

Authentication failure

Media type application/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error api_error
code
required
string
message
required

Human-readable explanation of the error.

string
param

Request field associated with the error, when applicable.

string
request_id
required

Unique request identifier to include when contacting support.

string
Examples
Example default

The provided API key is invalid.

{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The provided API key is invalid.",
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}
}

Conflict (e.g. template already exists, webhook subscription disabled, setup link inactive)

Media type application/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error api_error
code
required
string
message
required

Human-readable explanation of the error.

string
param

Request field associated with the error, when applicable.

string
request_id
required

Unique request identifier to include when contacting support.

string
Examples
Example default

An identical request is still being processed. Retry later.

{
"error": {
"type": "conflict",
"code": "idempotency_in_progress",
"message": "An identical request is still being processed. Retry later.",
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}
}

Semantic failure (e.g. idempotency key reuse, pre-send compliance guard, media not found)

Media type application/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error api_error
code
required
string
message
required

Human-readable explanation of the error.

string
param

Request field associated with the error, when applicable.

string
request_id
required

Unique request identifier to include when contacting support.

string
Examples
Example default

Idempotency-Key was reused with a different request body.

{
"error": {
"type": "invalid_request_error",
"code": "idempotency_key_reuse",
"message": "Idempotency-Key was reused with a different request body.",
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}
}

Rate limit exceeded

Media type application/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error api_error
code
required
string
message
required

Human-readable explanation of the error.

string
param

Request field associated with the error, when applicable.

string
request_id
required

Unique request identifier to include when contacting support.

string
Examples
Example default

Rate limit exceeded.

{
"error": {
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded.",
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}
}

Internal server error

Media type application/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error api_error
code
required
string
message
required

Human-readable explanation of the error.

string
param

Request field associated with the error, when applicable.

string
request_id
required

Unique request identifier to include when contacting support.

string
Examples
Example default

An unexpected error occurred.

{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "An unexpected error occurred.",
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}
}

Service unavailable

Media type application/json
object
error
required
object
type
required
string
Allowed values: invalid_request_error authentication_error permission_error not_found conflict rate_limit_error api_error
code
required
string
message
required

Human-readable explanation of the error.

string
param

Request field associated with the error, when applicable.

string
request_id
required

Unique request identifier to include when contacting support.

string
Examples
Example default

Service temporarily unavailable.

{
"error": {
"type": "api_error",
"code": "service_unavailable",
"message": "Service temporarily unavailable.",
"request_id": "req_01HXYZABCDEFGHJKMNPQRSTVWX"
}
}