Errors & Pagination

Status codes, error responses, and how to page through large result sets.

Status codes

The API uses standard HTTP status codes.

CodeMeaningWhat to do
200 OKThe request succeeded. The body contains the result.—
202 AcceptedThe change was accepted and is being processed. This is a success.Use "synchronous": "yes" if you need the result in the response. See Getting Started.
400 Bad RequestThe request is invalid, for example a missing or malformed field.Check the message and fix the request.
401 UnauthorizedThe token is missing, invalid, or expired.Get a new token, or refresh it. See Authentication.
403 ForbiddenYou're authenticated, but your user scope doesn't allow this request.Use a token or API key with the right scope.
404 Not FoundThe resource doesn't exist, or isn't visible to you.Check the domain, user, and IDs in the path.
409 ConflictThe resource already exists.Update the existing resource instead, or use a different identifier.

Error responses

Errors return a JSON body with the status code and a message describing the problem:

{
  "code": 409,
  "message": "UID already exists."
}

The message is meant to help you correct the request. Log it, but don't rely on its exact wording in your code; use code and the HTTP status instead.

Pagination

Endpoints that return lists accept two query parameters:

ParameterDefaultRangeMeaning
limit1001–1000Maximum number of results to return
start00 or moreNumber of results to skip

To page through results, keep limit the same and increase start by limit each time:

# Results 1–100
curl "https://api.365sip.com/ns-api/v2/domains/yourdomain/users?limit=100&start=0" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Results 101–200
curl "https://api.365sip.com/ns-api/v2/domains/yourdomain/users?limit=100&start=100" \
  -H "Authorization: Bearer YOUR_TOKEN"

Stop when a page returns fewer results than limit.

Counting results

Most collections have a matching /count endpoint that returns the total without fetching the records. Use it to size a progress bar or work out how many pages to request:

curl https://api.365sip.com/ns-api/v2/domains/yourdomain/users/count \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "total": 25
}

Filtering by date

Endpoints that return historical data, such as CDRs, call center statistics, and audit logs, accept datetime-start and datetime-end to limit results to a time range. Combine them with limit and start to page through large date ranges.

Troubleshooting

I get 401 Unauthorized on every request

Check that the token is sent as Authorization: Bearer YOUR_TOKEN. JWTs and OAuth2 access tokens are short-lived, so refresh the token and retry once. If it still fails, sign in again. See Authentication.

I get 403 Forbidden, but my token works for other requests

Your user scope doesn't allow this request. For example, filters like * for all domains require Super User. Retrying won't help; use a token or API key with the right scope. See User scopes.

I created a resource, but reading it back returns 404

A 202 Accepted response means the change is still being processed, so an immediate read may not find it yet. Send "synchronous": "yes" when you need read-after-write.

Large list requests are slow or time out

Use limit and start to page through results instead of requesting everything at once, and use the /count endpoint to find out how many pages you need.

Don't retry 400, 403, or 409 without changing the request; the same request will fail the same way.


Did this page help you?