Configure a virtual phone number

Request

POST https://api.46elks.com/a1/numbers/{id}

Request parameters

Which parameters you can set depends on the type of number.

Parameter Example Description
sms_url http://yourapp.example/new_sms
{forward":"+46700000000"}
A webhook URL for incoming SMS or a JSON struct, see Receive an SMS for details.
mms_url http://yourapp.example/new_mms A webhook URL for incoming MMS or a JSON struct, see Receive an MMS for details.
voice_start http://yourapp.example/new_call
{"connect":"+46700000000"}
A webhook URL for incoming voice calls, see Receive a call for details.
websocket_url wss://yourapp.example/elks/calls A websocket URL that the API connects to when the number receives a call. Only for WebSocket numbers. See Realtime Voice for the message protocol.
sms_replies no
yes
no prevents automatic reply of messages if your endpoint gives a response back. yes is the default setting and allow automatic reply.
name Your name for the number Optional field where you can set a name for the number for your reference. Maximum length is 50 characters

If you want to remove a previously set parameter, you can do so in the dashboard.
The special string "none" and " " (single space) also clears a field.

Number types

Type of number Capabilities Parameters
Virtual phone number One or more of sms, voice, mms sms_url, mms_url, voice_start, sms_replies
SIP number voice, sip Incoming calls are delivered to your SIP client
WebSocket number websocket websocket_url
WebRTC number voice, webrtc voice_start

The name parameter can be set on any number.

Response structure

Example JSON response
{
  "id": "n57c8f48af76bf986a14f251b35389e8b",
  "active": "yes",
  "country": "se",
  "number": "+46766861001",
  "capabilities": [ "sms", "voice", "mms" ],
  "sms_url": "https://yourapp.example/elks/sms",
  "mms_url": "https://yourapp.example/elks/mms",
  "voice_start": "https://yourapp.example/elks/calls",
  "name": "Support phone"
}
Example JSON response for a WebSocket number
{
  "id": "n0ba74fef557dfcec3a96d8d4477ae634",
  "active": "yes",
  "category": "websocket",
  "country": "se",
  "number": "+46700000000",
  "capabilities": [ "websocket" ],
  "websocket_url": "wss://yourapp.example/elks/calls",
  "name": "Voice agent"
}
Parameter Type Description
id string ID of the allocated number
active string If the number is active or not, always "yes" on newly allocated numbers
country string A two-letter (ISO alpha 2) country code.
number string The phone number in E.164 format.
capabilities list The capabilities of the number, for example [ "sms", "voice" ] or [ "websocket" ].
sms_url string If the number has SMS support this url is where the API will send incoming SMS.
voice_start string If the number has Voice support this url is where the API will send incoming calls to be handled.
mms_url string if the number has mms support this url is where the api will send incoming mms.
websocket_url string If the number has WebSocket support this is the url the API will connect to when the number receives a call.
name string if the number has the name field specified this field will be present containing the name.