Event Subscriptions
Have the Level365 API post real-time events to your own webhook URL.
Event subscriptions let your application react to activity as it happens instead of polling. When you create a subscription, the API sends data for the type of event you choose, called the model, to a URL you control.
Event models
Each subscription covers exactly one model. To receive more than one type of event, create one subscription per model.
| Model | Events about |
|---|---|
call | Active calls |
call_origid | Active calls, keyed by originating call ID |
cdr | Call detail records for completed calls |
agent | Call center agents |
presence | User presence |
message | Messages |
messagesession | Message sessions |
voicemail | Voicemail |
subscriber | Users (subscribers) |
auditlog | Audit log entries |
auditlog_lite | Audit log entries, in a lighter format |
Create a subscription
Send the model, your webhook URL, and the scope of data you want. This example subscribes to call events for every user in one domain:
curl -X POST https://api.365sip.com/ns-api/v2/domains/yourdomain/subscriptions \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "call",
"post-url": "https://webhook.example.com/level365/events",
"domain": "yourdomain",
"user": "*"
}'{
"id": "f38d00a5eed9d15603922fe98db23600",
"model": "call",
"post-url": "https://webhook.example.com/level365/events",
"reseller": "*",
"domain": "yourdomain",
"user": "*",
"status": "pending",
"error-count": 0,
"posts-count": 0,
"subscription-creation-datetime": "2026-11-19 10:15:00",
"subscription-expires-datetime": "2046-11-19 10:15:00"
}Save the id; you need it to update or delete the subscription.
You can create subscriptions at two levels:
POST /domains/{domain}/subscriptions: scoped to a single domainPOST /subscriptions: not tied to a path; setreseller,domain, anduserin the body
Filtering
| Field | Meaning | Default |
|---|---|---|
reseller | Only send events for this reseller. * means all resellers and requires Super User. | — |
domain | Only send events for this domain. * means all domains and requires Super User. | * |
user | Only send events for this user. * means all users. | * |
If a matching subscription already exists, the API returns 409 Conflict.
Subscription expiration
Use an API key for long-running subscriptionsIf you don't set
subscription-expires-datetime, the subscription expires at the same time as the token used to create it. For subscriptions created with a short-lived JWT or access token, that can be soon. Subscriptions created with an API key default to 20 years.
To set an expiration explicitly, send subscription-expires-datetime in the format YYYY-MM-DD HH:MM:SS. Expired subscriptions are removed some time after they expire.
Receiving events
Your post-url must:
- Include the scheme, for example
https://webhook.example.com/events. A custom port is allowed. - Use HTTPS with a valid SSL certificate. Plain
http://works, but isn't recommended in production. - Respond with a success status. Any response code above
302, or a network, DNS, or timeout failure, counts as an error.
Monitoring a subscription
Read a subscription with GET /subscriptions/{id} to check its health:
| Field | Meaning |
|---|---|
status | pending until the first data is sent, active once posts succeed, error if posts fail over an interval. It returns to active after a clean interval. |
posts-count | Total delivery attempts, successful and failed |
error-count | Failed delivery attempts |
current-active-server | The server currently sending events (read only) |
To reset the counters, update the subscription with posts-count or error-count set to 0. Zero is the only value allowed.
Manage subscriptions
| Request | What it does |
|---|---|
GET /subscriptions | List subscriptions |
GET /domains/{domain}/subscriptions | List subscriptions for a domain |
GET /subscriptions/{id} | Read a subscription |
PUT /subscriptions/{id} | Update a subscription |
DELETE /subscriptions/{id} | Delete a subscription |
Domain-level versions of update and delete are also available at /domains/{domain}/subscriptions/{id}.
Updated 12 days ago
