SIP lines API
Bring-your-own SIP lines.
The same operations are in the interactive API reference, and the whole contract is in the OpenAPI document.
GET/v1/lines
List lines
Returns the SIP lines the organization owns, with live registration status and the numbers on each, ordered by carrier label. Needs lines:read.
Paged, newest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total. Free.
Deleted lines are not listed. The SIP password is never part of the response.
Scope lines:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
POST/v1/lines
Create a line
Registers a SIP line with your carrier and attaches the numbers you list. Needs lines:write and the permission to manage numbers.
reach says how AirFone gets to your carrier. internet uses a cloud SIP box chosen for you. private goes through a box on your premises and needs one already enrolled and approved, otherwise the request is a 400; node_id names which of your boxes to use. proxy is checked against rules that refuse internal and private addresses, so a proxy that resolves inside a private network is rejected unless the line is private.
The sip_password is stored encrypted and is never returned, here or by any other operation. Send it only over TLS and do not log the request.
Every number in numbers must be in E.164 form and not already registered anywhere on the platform, or the request is a 400 naming the number. A SIP credential that is already registered is also a 400. Registration happens in the background after the response: a new line usually reports a transitional status first, so poll the get operation for active, or auth_failed when the carrier refused the credentials.
Nothing is charged for creating a line. Calls over it are billed as live calls at the usual rates. A test key creates the line in the sandbox only.
Send Idempotency-Key. Without it a retry after a timeout may fail with a 400 because the credential is already registered, or leave a duplicate line.
Scope lines:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
GET/v1/lines/{id}
Get a line
Returns one line, including its live registration state. Needs lines:read. Free.
status is the combined health: active when the carrier accepted the registration, auth_failed when it refused the credentials, unreachable when the proxy did not answer, moving while the line changes SIP box, and node_offline when the box itself is down. status_reason and gateway_state give the detail the box last reported, and gateway_state_at says when.
Returns 404 for an id that is not one of this organization's lines, or that was deleted.
Scope lines:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
PATCH/v1/lines/{id}
Update a line
Renames a line, switches its registration on or off, or replaces its password. Needs lines:write and the permission to manage numbers. Send only what changes.
enabled: false stops registration, so calls to the line's numbers fail until it is switched on again. A new sip_password replaces the stored one, resets the failure count and retries registration at once. The password is write only.
carrier_label and sip_password must not be empty strings (400). The changes are applied one after another, not as one transaction, so a request with several fields that fails midway may have applied the earlier ones; re-read the line to see.
Repeating the same PATCH leaves the same result, so no Idempotency-Key is needed.
Scope lines:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
DELETE/v1/lines/{id}
Delete a line
Removes a line and stops its registration. Needs lines:write and the permission to manage numbers.
The line must have no numbers on it. While any remain the answer is 409 "Release this line's numbers before deleting it." Release them in the console first. Deleting is a soft delete: the line disappears from every list and its registration is switched off on the SIP box, but history that refers to it remains.
Deleting a line that is already deleted returns 404, not 204, so a client that retries after a timeout should treat 404 as done.
Scope lines:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |