Lines and numbers
A number is a phone number in your workspace. A line is a SIP registration with your carrier that carries one or more numbers.
Scopes: numbers:read, numbers:write, lines:read, lines:write.
Numbers
Section titled “Numbers”curl https://app.airfone.app/v1/numbers \ -H "Authorization: Bearer $AIRFONE_KEY"Each number shows who answers while you are open (when_open) and while you are closed (when_closed), and whether that works today (live).
Choose who answers
Section titled “Choose who answers”curl -X PATCH https://app.airfone.app/v1/numbers/NUMBER_ID \ -H "Authorization: Bearer $AIRFONE_KEY" \ -H "Content-Type: application/json" \ -d '{ "when_open": { "kind": "assistant" }, "when_closed": { "kind": "message" } }'kind is one of:
| kind | extra field |
|---|---|
assistant | assistant_id (optional, defaults to your workspace assistant) |
team | team_id |
member | member_id |
menu | menu_id |
message | none, the caller leaves a message |
curl https://app.airfone.app/v1/lines \ -H "Authorization: Bearer $AIRFONE_KEY"status is the live registration state: active, unreachable, auth_failed, node_offline or moving. status_reason explains a problem.
Create a line
Section titled “Create a line”curl https://app.airfone.app/v1/lines \ -H "Authorization: Bearer $AIRFONE_KEY" \ -H "Content-Type: application/json" \ -d '{ "reach": "internet", "proxy": "sip.carrier.example", "realm": "carrier.example", "username": "9779800000000", "sip_password": "...", "numbers": ["+97798XXXXXXXX"], "carrier_label": "Main line" }'The password is stored encrypted and is never returned. A private line needs a premises box already connected to your workspace.
Update or switch off
Section titled “Update or switch off”curl -X PATCH https://app.airfone.app/v1/lines/LINE_ID \ -H "Authorization: Bearer $AIRFONE_KEY" \ -H "Content-Type: application/json" \ -d '{ "enabled": false }'You can also change carrier_label or send a new sip_password.
Delete a line
Section titled “Delete a line”curl -X DELETE https://app.airfone.app/v1/lines/LINE_ID \ -H "Authorization: Bearer $AIRFONE_KEY"Returns 409 while numbers are still on the line.