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.

ModelEvents about
callActive calls
call_origidActive calls, keyed by originating call ID
cdrCall detail records for completed calls
agentCall center agents
presenceUser presence
messageMessages
messagesessionMessage sessions
voicemailVoicemail
subscriberUsers (subscribers)
auditlogAudit log entries
auditlog_liteAudit 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 domain
  • POST /subscriptions: not tied to a path; set reseller, domain, and user in the body

Filtering

FieldMeaningDefault
resellerOnly send events for this reseller. * means all resellers and requires Super User.—
domainOnly send events for this domain. * means all domains and requires Super User.*
userOnly 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 subscriptions

If 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:

FieldMeaning
statuspending 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-countTotal delivery attempts, successful and failed
error-countFailed delivery attempts
current-active-serverThe 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

RequestWhat it does
GET /subscriptionsList subscriptions
GET /domains/{domain}/subscriptionsList 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}.


Did this page help you?