NAV
cURL

Introduction

Dive into our full API Reference Documentation and seamlessly integrate Voice and SMS functionalities into your website or application. This API uses HTTP verbs and a RESTful endpoint structure. Your Account SID and Auth Token is used as the API Authorization framework. Request and response payloads are formatted as JSON using UTF-8 encoding and URL encoded values.

Make an HTTP Request

There are a lot of ways you can make an HTTP request to Somleng. You can use a Helper Library or SDK for your preferred programming language or you can make a raw HTTP request in your code by using a tool like Postman.

Credentials

All requests to Somleng need to be authenticated. Somleng using HTTP basic auth, which use the following username/password schemes:

Account SID and Auth Token

The account SID and auth token are the master keys to your account.

Username Password
AccountSid AuthToken

Helper Libraries

The following is a list of officially supported helper libraries for Somleng. Please refer to the documentation in each library for more details.

Demo Applications

The following is a list of demo applications which you can use to get started with Somleng.

Messages

To send a new outgoing message, make an HTTP POST to this Messages list resource URI.

When creating a new message via the API, you must include the To parameter. This value should be either a destination phone number. You also need to pass a Body containing the message's content.

You must also include either the From parameter or MessagingServiceSid parameter. You may use MessagingServiceSid if sending your message with a messaging service. Alternatively, you can choose a specific number in a messaging service to set as the From.

There is a slight difference in how the API responds based on the parameter you include:

If the body of your message is more than 160 GSM-7 characters (or 70 UCS-2 characters), we will send the message as a segmented SMS.

Cancel a scheduled message

Request

curl "https://api.somleng.org/2010-04-01/Accounts/53f87791-5149-4392-aea3-54bba98865bc/Messages/da106749-3a56-450c-bdd8-b3681c7e8c33" -d 'Status=canceled' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 53f87791-5149-4392-aea3-54bba98865bc:HJQ83ekYUOXCgbjp5UgnSAU93qPaCfIGmSKJLSTy5uM

Endpoint

POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid

POST https://api.somleng.org/2010-04-01/Accounts/53f87791-5149-4392-aea3-54bba98865bc/Messages/da106749-3a56-450c-bdd8-b3681c7e8c33

Parameters

Status=canceled
Name Description
AccountSid required The SID of the Account that created the Message resources to update.
Sid required The ID that uniquely identifies the Message resource to update.
Body Must be an empty string (""). Required for redacting a message
Status When set as canceled, allows a message cancelation request if a message has not yet been sent.

Response


200 OK
{
  "api_version": "2010-04-01",
  "sid": "da106749-3a56-450c-bdd8-b3681c7e8c33",
  "account_sid": "53f87791-5149-4392-aea3-54bba98865bc",
  "date_created": "Wed, 20 Sep 2023 01:55:46 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:55:46 -0000",
  "body": "Hello World",
  "date_sent": null,
  "direction": "outbound-api",
  "error_code": null,
  "error_message": null,
  "from": null,
  "messaging_service_sid": "4e7ffde0-0015-4db8-b7e8-d2094f029731",
  "num_media": "0",
  "num_segments": "1",
  "price": null,
  "price_unit": null,
  "status": "canceled",
  "subresource_uris": {
  },
  "tags": {
  },
  "to": "+85512334667",
  "uri": "/2010-04-01/Accounts/53f87791-5149-4392-aea3-54bba98865bc/Messages/da106749-3a56-450c-bdd8-b3681c7e8c33"
}

Create a Message

Request

curl "https://api.somleng.org/2010-04-01/Accounts/13ad37be-702a-4875-8e3f-1aa6f4207757/Messages" -d 'To=%2B855+716+788+123&From=%2B855+716+788+999&Body=Hello+World' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 13ad37be-702a-4875-8e3f-1aa6f4207757:2PVtkRQyfl8rJs_RM2LlY2JIzZzGhLHbXbMuO5rqvp0

Endpoint

POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages

POST https://api.somleng.org/2010-04-01/Accounts/13ad37be-702a-4875-8e3f-1aa6f4207757/Messages

Parameters

To=%2B855+716+788+123&From=%2B855+716+788+999&Body=Hello+World
Name Description
From A phone number in E.164 format. Required if MessagingServiceSid is not passed
MessagingServiceSid The SID of the Messaging Service you want to associate with the Message. Set this parameter to use the Messaging Service Settings you have configured and leave the From parameter empty. When only this parameter is set, we will select the From phone number for delivery.
Body required The text of the message you want to send. Can be up to 1,600 characters in length.
To required The destination phone number in E.164 format
StatusCallback The URL we should call to send status information to your application. If specified, we POST these message status changes to the URL: queued, failed, sent, delivered, or undelivered. Somleng will POST its standard request parameters as well as some additional parameters including MessageSid, MessageStatus, and ErrorCode. URLs must contain a valid hostname (underscores are not permitted).
StatusCallbackMethod The HTTP method we should use when calling the status_callback URL. Can be: GET or POST and the default is POST.
ValidityPeriod How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds.
SmartEncoded Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: true or false.
ScheduleType Indicates your intent to schedule a message. Pass the value fixed to schedule a message at a fixed time.
SendAt The time that we will send the message. Must be in ISO 8601 format.

Response


201 Created
{
  "api_version": "2010-04-01",
  "sid": "fab43a04-987d-40bc-bd45-a6e313e15a66",
  "account_sid": "13ad37be-702a-4875-8e3f-1aa6f4207757",
  "date_created": "Wed, 20 Sep 2023 01:55:46 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:55:46 -0000",
  "body": "Hello World",
  "date_sent": null,
  "direction": "outbound-api",
  "error_code": null,
  "error_message": null,
  "from": "+855716788999",
  "messaging_service_sid": null,
  "num_media": "0",
  "num_segments": "1",
  "price": null,
  "price_unit": null,
  "status": "queued",
  "subresource_uris": {
  },
  "tags": {
  },
  "to": "+855716788123",
  "uri": "/2010-04-01/Accounts/13ad37be-702a-4875-8e3f-1aa6f4207757/Messages/fab43a04-987d-40bc-bd45-a6e313e15a66"
}

Create a Message through a Messaging Service

Request

curl "https://api.somleng.org/2010-04-01/Accounts/f6ab8790-ef6c-48ad-8e50-47f599e4517d/Messages" -d 'To=%2B855716788123&MessagingServiceSid=e86b1b3d-fac3-4bed-9b2f-eaebe645d9df&Body=Hello+World' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u f6ab8790-ef6c-48ad-8e50-47f599e4517d:B_fzMU4BNM_PhR2YnjdhmTTzQphuKzRbwvICx_u7LLI

Endpoint

POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages

POST https://api.somleng.org/2010-04-01/Accounts/f6ab8790-ef6c-48ad-8e50-47f599e4517d/Messages

Parameters

To=%2B855716788123&MessagingServiceSid=e86b1b3d-fac3-4bed-9b2f-eaebe645d9df&Body=Hello+World
Name Description
From A phone number in E.164 format. Required if MessagingServiceSid is not passed
MessagingServiceSid The SID of the Messaging Service you want to associate with the Message. Set this parameter to use the Messaging Service Settings you have configured and leave the From parameter empty. When only this parameter is set, we will select the From phone number for delivery.
Body required The text of the message you want to send. Can be up to 1,600 characters in length.
To required The destination phone number in E.164 format
StatusCallback The URL we should call to send status information to your application. If specified, we POST these message status changes to the URL: queued, failed, sent, delivered, or undelivered. Somleng will POST its standard request parameters as well as some additional parameters including MessageSid, MessageStatus, and ErrorCode. URLs must contain a valid hostname (underscores are not permitted).
StatusCallbackMethod The HTTP method we should use when calling the status_callback URL. Can be: GET or POST and the default is POST.
ValidityPeriod How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds.
SmartEncoded Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: true or false.
ScheduleType Indicates your intent to schedule a message. Pass the value fixed to schedule a message at a fixed time.
SendAt The time that we will send the message. Must be in ISO 8601 format.

Response


201 Created
{
  "api_version": "2010-04-01",
  "sid": "6df2ca6e-e223-4592-ab13-b35caed7473c",
  "account_sid": "f6ab8790-ef6c-48ad-8e50-47f599e4517d",
  "date_created": "Wed, 20 Sep 2023 01:55:45 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:55:45 -0000",
  "body": "Hello World",
  "date_sent": null,
  "direction": "outbound-api",
  "error_code": null,
  "error_message": null,
  "from": null,
  "messaging_service_sid": "e86b1b3d-fac3-4bed-9b2f-eaebe645d9df",
  "num_media": "0",
  "num_segments": "1",
  "price": null,
  "price_unit": null,
  "status": "accepted",
  "subresource_uris": {
  },
  "tags": {
  },
  "to": "+855716788123",
  "uri": "/2010-04-01/Accounts/f6ab8790-ef6c-48ad-8e50-47f599e4517d/Messages/6df2ca6e-e223-4592-ab13-b35caed7473c"
}

Delete a message

Request

curl "https://api.somleng.org/2010-04-01/Accounts/25799f49-44e4-48bc-b8cd-e8ebc53bb8e5/Messages/2b9406c3-d81c-4009-a9e2-08fb23af0d88" -d '' -X DELETE \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 25799f49-44e4-48bc-b8cd-e8ebc53bb8e5:yz0V6PNuWrp0Yk1J5Gm0fw3Fd_I6gphXkq5hAfETJIA

Endpoint

DELETE https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid

DELETE https://api.somleng.org/2010-04-01/Accounts/25799f49-44e4-48bc-b8cd-e8ebc53bb8e5/Messages/2b9406c3-d81c-4009-a9e2-08fb23af0d88

Parameters

Name Description
AccountSid required The SID of the Account that created the Message resources to delete.
Sid required The ID that uniquely identifies the Message resource to delete.

Response


204 No Content

Fetch a message

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/33f3a6ce-d707-4541-9904-f6e308d6931e/Messages/9766c6c0-8ff1-43c4-962a-f571b9fc8e31" -X GET \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 33f3a6ce-d707-4541-9904-f6e308d6931e:s9gYUu4HXVLBxSLqt0MdpxEA8OIyJOvX1HS_ukD7cg4

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid

GET https://api.somleng.org/2010-04-01/Accounts/33f3a6ce-d707-4541-9904-f6e308d6931e/Messages/9766c6c0-8ff1-43c4-962a-f571b9fc8e31

Parameters

None known.

Response


200 OK
{
  "api_version": "2010-04-01",
  "sid": "9766c6c0-8ff1-43c4-962a-f571b9fc8e31",
  "account_sid": "33f3a6ce-d707-4541-9904-f6e308d6931e",
  "date_created": "Wed, 20 Sep 2023 01:55:46 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:55:46 -0000",
  "body": "Hello World",
  "date_sent": null,
  "direction": "outbound-api",
  "error_code": null,
  "error_message": null,
  "from": "2442",
  "messaging_service_sid": null,
  "num_media": "0",
  "num_segments": "1",
  "price": null,
  "price_unit": null,
  "status": "accepted",
  "subresource_uris": {
  },
  "tags": {
  },
  "to": "+85512334667",
  "uri": "/2010-04-01/Accounts/33f3a6ce-d707-4541-9904-f6e308d6931e/Messages/9766c6c0-8ff1-43c4-962a-f571b9fc8e31"
}

List messages

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/371e909b-42e9-4dde-977f-3bc0904ac861/Messages" -X GET \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 371e909b-42e9-4dde-977f-3bc0904ac861:Bc7OMcR2y6dOoq83kxBS4rTgql3PdhJ1D3kqPCPbpo0

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages

GET https://api.somleng.org/2010-04-01/Accounts/371e909b-42e9-4dde-977f-3bc0904ac861/Messages

Parameters

None known.

Response


200 OK
{
  "messages": [
    {
      "api_version": "2010-04-01",
      "sid": "73de66af-9969-43f8-9eec-0892330e1491",
      "account_sid": "371e909b-42e9-4dde-977f-3bc0904ac861",
      "date_created": "Wed, 20 Sep 2023 01:55:46 -0000",
      "date_updated": "Wed, 20 Sep 2023 01:55:46 -0000",
      "body": "Hello World",
      "date_sent": null,
      "direction": "outbound-api",
      "error_code": null,
      "error_message": null,
      "from": "2442",
      "messaging_service_sid": null,
      "num_media": "0",
      "num_segments": "1",
      "price": null,
      "price_unit": null,
      "status": "accepted",
      "subresource_uris": {
      },
      "tags": {
      },
      "to": "+85512334667",
      "uri": "/2010-04-01/Accounts/371e909b-42e9-4dde-977f-3bc0904ac861/Messages/73de66af-9969-43f8-9eec-0892330e1491"
    }
  ],
  "uri": "/2010-04-01/Accounts/371e909b-42e9-4dde-977f-3bc0904ac861/Messages",
  "page": 0,
  "page_size": 50,
  "first_page_uri": "/2010-04-01/Accounts/371e909b-42e9-4dde-977f-3bc0904ac861/Messages?Page=0",
  "next_page_uri": null,
  "previous_page_uri": "/2010-04-01/Accounts/371e909b-42e9-4dde-977f-3bc0904ac861/Messages?Page=0&PageToken=PB73de66af-9969-43f8-9eec-0892330e1491"
}

Redact a message

Request

curl "https://api.somleng.org/2010-04-01/Accounts/1b9945f6-f9b0-4aa0-a882-74ea0b2937cb/Messages/e5ffb6b3-e7e9-4810-bb14-3e52a4c63848" -d 'Body=' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 1b9945f6-f9b0-4aa0-a882-74ea0b2937cb:e0H42hE5XqbPDGeTqZaRQSn8u-cvVQN9us-WADmqNUE

Endpoint

POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid

POST https://api.somleng.org/2010-04-01/Accounts/1b9945f6-f9b0-4aa0-a882-74ea0b2937cb/Messages/e5ffb6b3-e7e9-4810-bb14-3e52a4c63848

Parameters

Body=
Name Description
AccountSid required The SID of the Account that created the Message resources to update.
Sid required The ID that uniquely identifies the Message resource to update.
Body Must be an empty string (""). Required for redacting a message
Status When set as canceled, allows a message cancelation request if a message has not yet been sent.

Response


200 OK
{
  "api_version": "2010-04-01",
  "sid": "e5ffb6b3-e7e9-4810-bb14-3e52a4c63848",
  "account_sid": "1b9945f6-f9b0-4aa0-a882-74ea0b2937cb",
  "date_created": "Wed, 20 Sep 2023 01:55:46 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:55:46 -0000",
  "body": "",
  "date_sent": "Wed, 20 Sep 2023 01:55:46 -0000",
  "direction": "outbound-api",
  "error_code": null,
  "error_message": null,
  "from": "2442",
  "messaging_service_sid": null,
  "num_media": "0",
  "num_segments": "1",
  "price": null,
  "price_unit": null,
  "status": "sent",
  "subresource_uris": {
  },
  "tags": {
  },
  "to": "+85512334667",
  "uri": "/2010-04-01/Accounts/1b9945f6-f9b0-4aa0-a882-74ea0b2937cb/Messages/e5ffb6b3-e7e9-4810-bb14-3e52a4c63848"
}

Schedule a Message

Request

curl "https://api.somleng.org/2010-04-01/Accounts/89453fe7-4434-4801-8a7a-664cd7d0cb66/Messages" -d 'To=%2B855716788123&Body=Hello+World&SendAt=2023-09-25T01%3A55%3A46Z&ScheduleType=fixed&MessagingServiceSid=5b74f242-fb57-4754-b903-c8b062cbdc86' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 89453fe7-4434-4801-8a7a-664cd7d0cb66:9xMCdmSVpNUplkzzerlKIxuhvVicPgwAUnI7_ruuimM

Endpoint

POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages

POST https://api.somleng.org/2010-04-01/Accounts/89453fe7-4434-4801-8a7a-664cd7d0cb66/Messages

Parameters

To=%2B855716788123&Body=Hello+World&SendAt=2023-09-25T01%3A55%3A46Z&ScheduleType=fixed&MessagingServiceSid=5b74f242-fb57-4754-b903-c8b062cbdc86
Name Description
From A phone number in E.164 format. Required if MessagingServiceSid is not passed
MessagingServiceSid The SID of the Messaging Service you want to associate with the Message. Set this parameter to use the Messaging Service Settings you have configured and leave the From parameter empty. When only this parameter is set, we will select the From phone number for delivery.
Body required The text of the message you want to send. Can be up to 1,600 characters in length.
To required The destination phone number in E.164 format
StatusCallback The URL we should call to send status information to your application. If specified, we POST these message status changes to the URL: queued, failed, sent, delivered, or undelivered. Somleng will POST its standard request parameters as well as some additional parameters including MessageSid, MessageStatus, and ErrorCode. URLs must contain a valid hostname (underscores are not permitted).
StatusCallbackMethod The HTTP method we should use when calling the status_callback URL. Can be: GET or POST and the default is POST.
ValidityPeriod How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds.
SmartEncoded Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: true or false.
ScheduleType Indicates your intent to schedule a message. Pass the value fixed to schedule a message at a fixed time.
SendAt The time that we will send the message. Must be in ISO 8601 format.

Response


201 Created
{
  "api_version": "2010-04-01",
  "sid": "35315a65-67b8-4e52-b136-1c882a53c134",
  "account_sid": "89453fe7-4434-4801-8a7a-664cd7d0cb66",
  "date_created": "Wed, 20 Sep 2023 01:55:46 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:55:46 -0000",
  "body": "Hello World",
  "date_sent": null,
  "direction": "outbound-api",
  "error_code": null,
  "error_message": null,
  "from": null,
  "messaging_service_sid": "5b74f242-fb57-4754-b903-c8b062cbdc86",
  "num_media": "0",
  "num_segments": "1",
  "price": null,
  "price_unit": null,
  "status": "scheduled",
  "subresource_uris": {
  },
  "tags": {
  },
  "to": "+855716788123",
  "uri": "/2010-04-01/Accounts/89453fe7-4434-4801-8a7a-664cd7d0cb66/Messages/35315a65-67b8-4e52-b136-1c882a53c134"
}

Pagination

When fetching multiple pages of API results, use the provided next_page_uri parameter to retrieve the next page of results.

List resources with PageSize

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls?PageSize=2" -X GET \
    -u 41397c2e-5159-45b3-bc43-16dbb613622a:IJhpBcUO3oAI0fq4psZnyR7_OAJQ_TLZMqrJwKygyMk

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls

GET https://api.somleng.org/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls?PageSize=2

Parameters

PageSize: 2
Name Description
PageSize How many resources to return in each list page. The default is 50, and the maximum is 100.

Response


200 OK
{
  "calls": [
    {
      "api_version": "2010-04-01",
      "sid": "96cc3532-effe-4986-ae89-b7df3035f3b2",
      "account_sid": "41397c2e-5159-45b3-bc43-16dbb613622a",
      "date_created": "Wed, 20 Sep 2023 01:56:00 -0000",
      "date_updated": "Wed, 20 Sep 2023 01:56:00 -0000",
      "annotation": null,
      "answered_by": null,
      "caller_name": null,
      "direction": "outbound-api",
      "duration": null,
      "end_time": null,
      "forwarded_from": null,
      "from": "2442",
      "from_formatted": "2442",
      "group_sid": null,
      "parent_call_sid": null,
      "phone_number_sid": null,
      "price": null,
      "price_unit": null,
      "start_time": null,
      "status": "queued",
      "subresource_uris": {
      },
      "to": "+85512334667",
      "to_formatted": "+855 12 334 667",
      "uri": "/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls/96cc3532-effe-4986-ae89-b7df3035f3b2"
    },
    {
      "api_version": "2010-04-01",
      "sid": "70494f09-bc77-4c57-b67c-192414ffa1d9",
      "account_sid": "41397c2e-5159-45b3-bc43-16dbb613622a",
      "date_created": "Wed, 20 Sep 2023 01:56:00 -0000",
      "date_updated": "Wed, 20 Sep 2023 01:56:00 -0000",
      "annotation": null,
      "answered_by": null,
      "caller_name": null,
      "direction": "outbound-api",
      "duration": null,
      "end_time": null,
      "forwarded_from": null,
      "from": "2442",
      "from_formatted": "2442",
      "group_sid": null,
      "parent_call_sid": null,
      "phone_number_sid": null,
      "price": null,
      "price_unit": null,
      "start_time": null,
      "status": "queued",
      "subresource_uris": {
      },
      "to": "+85512334667",
      "to_formatted": "+855 12 334 667",
      "uri": "/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls/70494f09-bc77-4c57-b67c-192414ffa1d9"
    }
  ],
  "uri": "/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls?PageSize=2",
  "page": 0,
  "page_size": 2,
  "first_page_uri": "/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls?Page=0&PageSize=2",
  "next_page_uri": "/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls?Page=1&PageSize=2&PageToken=PA70494f09-bc77-4c57-b67c-192414ffa1d9",
  "previous_page_uri": "/2010-04-01/Accounts/41397c2e-5159-45b3-bc43-16dbb613622a/Calls?Page=0&PageSize=2&PageToken=PB96cc3532-effe-4986-ae89-b7df3035f3b2"
}

Phone Calls

Create a call

Request

curl "https://api.somleng.org/2010-04-01/Accounts/eb0ed7ba-0094-46d4-a60d-24531b4686e0/Calls" -d 'To=%2B299221234&From=1234&Url=https%3A%2F%2Fdemo.twilio.com%2Fdocs%2Fvoice.xml' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u eb0ed7ba-0094-46d4-a60d-24531b4686e0:vcRLoLehbRddU9hNY11LnabgL7ImNMzy3auD2uC7swQ

Endpoint

POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls

POST https://api.somleng.org/2010-04-01/Accounts/eb0ed7ba-0094-46d4-a60d-24531b4686e0/Calls

Parameters

To=%2B299221234&From=1234&Url=https%3A%2F%2Fdemo.twilio.com%2Fdocs%2Fvoice.xml
Name Description
To required The phone number to call.
From required The phone number to use as the caller id
Url The absolute URL that returns the TwiML instructions for the call. We will call this URL using the method when the call connects.
Method The HTTP method we should use when calling the url parameter's value. Can be: GET or POST and the default is POST.
Twiml TwiML instructions for the call Somleng will use without fetching Twiml from Url parameter. If both Twiml and Url are provided then Twiml parameter will be ignored.
StatusCallback The URL we should call using the status_callback_method to send status information to your application. URLs must contain a valid hostname (underscores are not permitted).
StatusCallbackMethod The HTTP method we should use when calling the status_callback URL. Can be: GET or POST and the default is POST.

Response


201 Created
{
  "api_version": "2010-04-01",
  "sid": "9b75bdf1-926f-48c4-9c5c-1562374f4300",
  "account_sid": "eb0ed7ba-0094-46d4-a60d-24531b4686e0",
  "date_created": "Wed, 20 Sep 2023 01:56:20 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:56:20 -0000",
  "annotation": null,
  "answered_by": null,
  "caller_name": null,
  "direction": "outbound-api",
  "duration": null,
  "end_time": null,
  "forwarded_from": null,
  "from": "1234",
  "from_formatted": "1234",
  "group_sid": null,
  "parent_call_sid": null,
  "phone_number_sid": null,
  "price": null,
  "price_unit": null,
  "start_time": null,
  "status": "queued",
  "subresource_uris": {
  },
  "to": "+299221234",
  "to_formatted": "+299 22 1234",
  "uri": "/2010-04-01/Accounts/eb0ed7ba-0094-46d4-a60d-24531b4686e0/Calls/9b75bdf1-926f-48c4-9c5c-1562374f4300"
}

Fetch a call

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/55dbec0e-7ecc-491a-b626-87acf344d876/Calls/d4d83c1d-fc63-40cd-801a-31c4f256f9c6" -X GET \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 55dbec0e-7ecc-491a-b626-87acf344d876:upOxizLODb2kqNAGlBr-kAUDNnrwYk_bYYCBXHskYRo

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls/:sid

GET https://api.somleng.org/2010-04-01/Accounts/55dbec0e-7ecc-491a-b626-87acf344d876/Calls/d4d83c1d-fc63-40cd-801a-31c4f256f9c6

Parameters

None known.

Response


200 OK
{
  "api_version": "2010-04-01",
  "sid": "d4d83c1d-fc63-40cd-801a-31c4f256f9c6",
  "account_sid": "55dbec0e-7ecc-491a-b626-87acf344d876",
  "date_created": "Wed, 20 Sep 2023 01:56:20 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:56:20 -0000",
  "annotation": null,
  "answered_by": null,
  "caller_name": null,
  "direction": "outbound-api",
  "duration": null,
  "end_time": null,
  "forwarded_from": null,
  "from": "2442",
  "from_formatted": "2442",
  "group_sid": null,
  "parent_call_sid": null,
  "phone_number_sid": null,
  "price": null,
  "price_unit": null,
  "start_time": null,
  "status": "queued",
  "subresource_uris": {
  },
  "to": "+85512334667",
  "to_formatted": "+855 12 334 667",
  "uri": "/2010-04-01/Accounts/55dbec0e-7ecc-491a-b626-87acf344d876/Calls/d4d83c1d-fc63-40cd-801a-31c4f256f9c6"
}

List phone calls

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/9ae33ebc-faf6-4279-93be-c17d8a33c98a/Calls" -X GET \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 9ae33ebc-faf6-4279-93be-c17d8a33c98a:FalrQZJn4l7OhEhztTWDHpePDX09_-YgsY_c_fafqqE

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls

GET https://api.somleng.org/2010-04-01/Accounts/9ae33ebc-faf6-4279-93be-c17d8a33c98a/Calls

Parameters

None known.

Response


200 OK
{
  "calls": [
    {
      "api_version": "2010-04-01",
      "sid": "4ebf20ff-120a-449f-9b99-c6e25a8b001d",
      "account_sid": "9ae33ebc-faf6-4279-93be-c17d8a33c98a",
      "date_created": "Wed, 20 Sep 2023 01:56:20 -0000",
      "date_updated": "Wed, 20 Sep 2023 01:56:20 -0000",
      "annotation": null,
      "answered_by": null,
      "caller_name": null,
      "direction": "outbound-api",
      "duration": null,
      "end_time": null,
      "forwarded_from": null,
      "from": "2442",
      "from_formatted": "2442",
      "group_sid": null,
      "parent_call_sid": null,
      "phone_number_sid": null,
      "price": null,
      "price_unit": null,
      "start_time": null,
      "status": "queued",
      "subresource_uris": {
      },
      "to": "+85512334667",
      "to_formatted": "+855 12 334 667",
      "uri": "/2010-04-01/Accounts/9ae33ebc-faf6-4279-93be-c17d8a33c98a/Calls/4ebf20ff-120a-449f-9b99-c6e25a8b001d"
    }
  ],
  "uri": "/2010-04-01/Accounts/9ae33ebc-faf6-4279-93be-c17d8a33c98a/Calls",
  "page": 0,
  "page_size": 50,
  "first_page_uri": "/2010-04-01/Accounts/9ae33ebc-faf6-4279-93be-c17d8a33c98a/Calls?Page=0",
  "next_page_uri": null,
  "previous_page_uri": "/2010-04-01/Accounts/9ae33ebc-faf6-4279-93be-c17d8a33c98a/Calls?Page=0&PageToken=PB4ebf20ff-120a-449f-9b99-c6e25a8b001d"
}

Update a call

Request

curl "https://api.somleng.org/2010-04-01/Accounts/93601709-4a0a-420e-b502-6f07ec645888/Calls/9ab359ed-3a82-4348-b717-023701e39d86" -d 'Status=completed' -X POST \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -u 93601709-4a0a-420e-b502-6f07ec645888:_5-tv_RGac8cjZuIEdpz9F-zEqi-s5-Hq45qcbrgzTs

Endpoint

POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls/:sid

POST https://api.somleng.org/2010-04-01/Accounts/93601709-4a0a-420e-b502-6f07ec645888/Calls/9ab359ed-3a82-4348-b717-023701e39d86

Parameters

Status=completed
Name Description
Status The new status of the resource. Can be: canceled or completed. Specifying canceled will attempt to hang up calls that are queued or ringing; however, it will not affect calls already in progress. Specifying completed will attempt to hang up a call even if it's already in progress.

Response


200 OK
{
  "api_version": "2010-04-01",
  "sid": "9ab359ed-3a82-4348-b717-023701e39d86",
  "account_sid": "93601709-4a0a-420e-b502-6f07ec645888",
  "date_created": "Wed, 20 Sep 2023 01:56:20 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:56:20 -0000",
  "annotation": null,
  "answered_by": null,
  "caller_name": null,
  "direction": "outbound-api",
  "duration": null,
  "end_time": null,
  "forwarded_from": null,
  "from": "2442",
  "from_formatted": "2442",
  "group_sid": null,
  "parent_call_sid": null,
  "phone_number_sid": null,
  "price": null,
  "price_unit": null,
  "start_time": null,
  "status": "in-progress",
  "subresource_uris": {
  },
  "to": "+85512334667",
  "to_formatted": "+855 12 334 667",
  "uri": "/2010-04-01/Accounts/93601709-4a0a-420e-b502-6f07ec645888/Calls/9ab359ed-3a82-4348-b717-023701e39d86"
}

Recordings

Fetch a recording

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/982bc34b-8edf-4082-89cb-91e7c15dee4c/Recordings/2054ab06-cab8-48fb-8d83-ac60cb999f34" -X GET 

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Recordings/:sid

GET https://api.somleng.org/2010-04-01/Accounts/982bc34b-8edf-4082-89cb-91e7c15dee4c/Recordings/2054ab06-cab8-48fb-8d83-ac60cb999f34

Parameters

None known.

Response


302 Found
<html><body>You are being <a href="https://api.somleng.org/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhjM0I1YldWc2EyaHNZMjloYTNCeWJ6ZGlkR3A2YUhVMU1IcG1kQVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpU1dGMGRHRmphRzFsYm5RN0lHWnBiR1Z1WVcxbFBTSnlaV052Y21ScGJtY3VkMkYySWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkeVpXTnZjbVJwYm1jdWQyRjJCanNHVkRvUlkyOXVkR1Z1ZEY5MGVYQmxTU0lRWVhWa2FXOHZlQzEzWVhZR093WlVPaEZ6WlhKMmFXTmxYMjVoYldVNkNYUmxjM1E9IiwiZXhwIjoiMjAyMy0wOS0yMFQwMjowMTowMi41MjVaIiwicHVyIjoiYmxvYl9rZXkifX0=--fd812e41c3f81c9722551e767526f39132a2c601/recording.wav">redirected</a>.</body></html>

Fetch a recording as mp3

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/7ccfe36c-1fe0-45df-bf16-9f36b64b06a1/Recordings/2f36e19b-5643-4183-85fd-6fa12867ecd4.mp3" -X GET 

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Recordings/:sid.mp3

GET https://api.somleng.org/2010-04-01/Accounts/7ccfe36c-1fe0-45df-bf16-9f36b64b06a1/Recordings/2f36e19b-5643-4183-85fd-6fa12867ecd4.mp3

Parameters

None known.

Response


302 Found
<html><body>You are being <a href="https://api.somleng.org/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhOalowYzJRNGVYcG5kemcyWm5CNWVYRnhiWE4xTUhJelltOXRkUVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpU1dGMGRHRmphRzFsYm5RN0lHWnBiR1Z1WVcxbFBTSnlaV052Y21ScGJtY3ViWEF6SWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkeVpXTnZjbVJwYm1jdWJYQXpCanNHVkRvUlkyOXVkR1Z1ZEY5MGVYQmxTU0lQWVhWa2FXOHZiWEJsWndZN0JsUTZFWE5sY25acFkyVmZibUZ0WlRvSmRHVnpkQT09IiwiZXhwIjoiMjAyMy0wOS0yMFQwMjowMTowMi43MDBaIiwicHVyIjoiYmxvYl9rZXkifX0=--39de78f8c12aebb960255c115e267627c3dcc2c9/recording.mp3">redirected</a>.</body></html>

Fetch a recording resource

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/c193037d-61d4-43bc-8968-872d13b59150/Recordings/5b8a2183-9613-4adc-8f5a-af57f799c313.json" -X GET 

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Recordings/:sid.json

GET https://api.somleng.org/2010-04-01/Accounts/c193037d-61d4-43bc-8968-872d13b59150/Recordings/5b8a2183-9613-4adc-8f5a-af57f799c313.json

Parameters

None known.

Response


200 OK
{
  "api_version": "2010-04-01",
  "sid": "5b8a2183-9613-4adc-8f5a-af57f799c313",
  "account_sid": "c193037d-61d4-43bc-8968-872d13b59150",
  "date_created": "Wed, 20 Sep 2023 01:56:02 -0000",
  "date_updated": "Wed, 20 Sep 2023 01:56:02 -0000",
  "call_sid": "933ef1e1-579a-4a69-9f9f-0c885d4f3b75",
  "conference_sid": null,
  "channels": 1,
  "start_time": "2023-09-20T01:56:02.386Z",
  "duration": null,
  "price": null,
  "price_unit": null,
  "source": "RecordVerb",
  "status": "processing",
  "error_code": null,
  "encryption_details": null,
  "track": "both",
  "uri": "/2010-04-01/Accounts/c193037d-61d4-43bc-8968-872d13b59150/Calls/933ef1e1-579a-4a69-9f9f-0c885d4f3b75/Recordings/5b8a2183-9613-4adc-8f5a-af57f799c313.json"
}

List recordings by account

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/fab56ace-26b5-40d3-be4a-38aab0c738fd/Recordings" -X GET \
    -u fab56ace-26b5-40d3-be4a-38aab0c738fd:VcBuj_yyU2cAXy3lnhQKwHA0jzIBhCOzErFU0BLA1TE

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Recordings

GET https://api.somleng.org/2010-04-01/Accounts/fab56ace-26b5-40d3-be4a-38aab0c738fd/Recordings

Parameters

None known.

Response


200 OK
{
  "recordings": [
    {
      "api_version": "2010-04-01",
      "sid": "67a96a8b-ad34-4c64-941a-7de527f85a43",
      "account_sid": "fab56ace-26b5-40d3-be4a-38aab0c738fd",
      "date_created": "Wed, 20 Sep 2023 01:56:02 -0000",
      "date_updated": "Wed, 20 Sep 2023 01:56:02 -0000",
      "call_sid": "58d547c6-ceec-4ec0-90e6-55a14bd8b202",
      "conference_sid": null,
      "channels": 1,
      "start_time": "2023-09-20T01:56:02.593Z",
      "duration": null,
      "price": null,
      "price_unit": null,
      "source": "RecordVerb",
      "status": "processing",
      "error_code": null,
      "encryption_details": null,
      "track": "both",
      "uri": "/2010-04-01/Accounts/fab56ace-26b5-40d3-be4a-38aab0c738fd/Calls/58d547c6-ceec-4ec0-90e6-55a14bd8b202/Recordings/67a96a8b-ad34-4c64-941a-7de527f85a43.json"
    },
    {
      "api_version": "2010-04-01",
      "sid": "c91d4c96-b80a-44fb-bbb8-c42dbc028b45",
      "account_sid": "fab56ace-26b5-40d3-be4a-38aab0c738fd",
      "date_created": "Wed, 20 Sep 2023 01:56:02 -0000",
      "date_updated": "Wed, 20 Sep 2023 01:56:02 -0000",
      "call_sid": "502f3d20-2290-474f-aa96-e52b063e4822",
      "conference_sid": null,
      "channels": 1,
      "start_time": "2023-09-20T01:56:02.568Z",
      "duration": null,
      "price": null,
      "price_unit": null,
      "source": "RecordVerb",
      "status": "processing",
      "error_code": null,
      "encryption_details": null,
      "track": "both",
      "uri": "/2010-04-01/Accounts/fab56ace-26b5-40d3-be4a-38aab0c738fd/Calls/502f3d20-2290-474f-aa96-e52b063e4822/Recordings/c91d4c96-b80a-44fb-bbb8-c42dbc028b45.json"
    }
  ],
  "uri": "/2010-04-01/Accounts/fab56ace-26b5-40d3-be4a-38aab0c738fd/Recordings",
  "page": 0,
  "page_size": 50,
  "first_page_uri": "/2010-04-01/Accounts/fab56ace-26b5-40d3-be4a-38aab0c738fd/Recordings?Page=0",
  "next_page_uri": null,
  "previous_page_uri": "/2010-04-01/Accounts/fab56ace-26b5-40d3-be4a-38aab0c738fd/Recordings?Page=0&PageToken=PB67a96a8b-ad34-4c64-941a-7de527f85a43"
}

List recordings by call

Request

curl -g "https://api.somleng.org/2010-04-01/Accounts/4a141450-6c58-4e86-b765-b994452b1efe/Calls/afd2321c-3bbd-4a25-8da0-6bf34c5578cb/Recordings" -X GET \
    -u 4a141450-6c58-4e86-b765-b994452b1efe:jnjRm5SbXDqJklqNA199eJJ1JuMp7OLEMZ3KiYklm0E

Endpoint

GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls/:call_sid/Recordings

GET https://api.somleng.org/2010-04-01/Accounts/4a141450-6c58-4e86-b765-b994452b1efe/Calls/afd2321c-3bbd-4a25-8da0-6bf34c5578cb/Recordings

Parameters

None known.

Response


200 OK
{
  "recordings": [
    {
      "api_version": "2010-04-01",
      "sid": "1c98ef83-0af7-47b5-9899-5b48d8b321e5",
      "account_sid": "4a141450-6c58-4e86-b765-b994452b1efe",
      "date_created": "Wed, 20 Sep 2023 01:56:02 -0000",
      "date_updated": "Wed, 20 Sep 2023 01:56:02 -0000",
      "call_sid": "afd2321c-3bbd-4a25-8da0-6bf34c5578cb",
      "conference_sid": null,
      "channels": 1,
      "start_time": "2023-09-20T01:56:02.306Z",
      "duration": "0",
      "price": null,
      "price_unit": null,
      "source": "RecordVerb",
      "status": "completed",
      "error_code": null,
      "encryption_details": null,
      "track": "both",
      "uri": "/2010-04-01/Accounts/4a141450-6c58-4e86-b765-b994452b1efe/Calls/afd2321c-3bbd-4a25-8da0-6bf34c5578cb/Recordings/1c98ef83-0af7-47b5-9899-5b48d8b321e5.json"
    }
  ],
  "uri": "/2010-04-01/Accounts/4a141450-6c58-4e86-b765-b994452b1efe/Calls/afd2321c-3bbd-4a25-8da0-6bf34c5578cb/Recordings",
  "page": 0,
  "page_size": 50,
  "first_page_uri": "/2010-04-01/Accounts/4a141450-6c58-4e86-b765-b994452b1efe/Calls/afd2321c-3bbd-4a25-8da0-6bf34c5578cb/Recordings?Page=0",
  "next_page_uri": null,
  "previous_page_uri": "/2010-04-01/Accounts/4a141450-6c58-4e86-b765-b994452b1efe/Calls/afd2321c-3bbd-4a25-8da0-6bf34c5578cb/Recordings?Page=0&PageToken=PB1c98ef83-0af7-47b5-9899-5b48d8b321e5"
}