Introduction
Dive into our full API Reference Documentation and seamlessly integrate Voice 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 make a raw HTTP request in your code (for example, using a module like got in NodeJS) or by using a tool like Postman.
You might find it easier to use the Twilio Helper Library or SDK for your preferred programming language. These libraries can be usually be used with Somleng by overriding the URL parameter from api.twilio.com
to api.somleng.org
or that of your own host.
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 |
Messages
Cancel a scheduled message
Request
curl "https://api.somleng.org/2010-04-01/Accounts/9ba13b9f-b2be-462c-b53f-036fb6f22d11/Messages/f3f3cd00-e78f-4e8d-937c-86949ca6079d" -d 'Status=canceled' -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 9ba13b9f-b2be-462c-b53f-036fb6f22d11:F1lECTUX9jZHde1JIKsxi_d2akOfNqnXv3poWmPL_gI
Endpoint
POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid
POST https://api.somleng.org/2010-04-01/Accounts/9ba13b9f-b2be-462c-b53f-036fb6f22d11/Messages/f3f3cd00-e78f-4e8d-937c-86949ca6079d
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": "f3f3cd00-e78f-4e8d-937c-86949ca6079d",
"account_sid": "9ba13b9f-b2be-462c-b53f-036fb6f22d11",
"date_created": "Tue, 14 Mar 2023 02:22:00 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:00 -0000",
"body": "Hello World",
"date_sent": null,
"direction": "outbound-api",
"error_code": null,
"error_message": null,
"from": null,
"messaging_service_sid": "adb485c3-e892-435f-acdf-bbb9d2eba315",
"num_media": "0",
"num_segments": "1",
"price": null,
"price_unit": null,
"status": "canceled",
"subresource_uris": {
},
"tags": {
},
"to": "+85512334667",
"uri": "/2010-04-01/Accounts/9ba13b9f-b2be-462c-b53f-036fb6f22d11/Messages/f3f3cd00-e78f-4e8d-937c-86949ca6079d"
}
Create a Message
Request
curl "https://api.somleng.org/2010-04-01/Accounts/c804bbef-3872-4035-b27c-8df22b8051c5/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 c804bbef-3872-4035-b27c-8df22b8051c5:4-m9ILxddkIrEiX-0YDN-mO0vi94BQagHQc5yz4f8Wg
Endpoint
POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages
POST https://api.somleng.org/2010-04-01/Accounts/c804bbef-3872-4035-b27c-8df22b8051c5/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": "478899f2-33c5-46fe-9c19-753ec9fcee6a",
"account_sid": "c804bbef-3872-4035-b27c-8df22b8051c5",
"date_created": "Tue, 14 Mar 2023 02:21:59 -0000",
"date_updated": "Tue, 14 Mar 2023 02:21:59 -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/c804bbef-3872-4035-b27c-8df22b8051c5/Messages/478899f2-33c5-46fe-9c19-753ec9fcee6a"
}
Create a Message through a Messaging Service
Request
curl "https://api.somleng.org/2010-04-01/Accounts/234210a3-7593-4445-a95f-0097249ed041/Messages" -d 'To=%2B855716788123&MessagingServiceSid=86170354-e3c2-4a42-b339-8bb15bb9a6fe&Body=Hello+World' -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 234210a3-7593-4445-a95f-0097249ed041:4vqsTAdjWoDObroqgWdDXrzwrLvjdh114K_l7gJAsYI
Endpoint
POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages
POST https://api.somleng.org/2010-04-01/Accounts/234210a3-7593-4445-a95f-0097249ed041/Messages
Parameters
To=%2B855716788123&MessagingServiceSid=86170354-e3c2-4a42-b339-8bb15bb9a6fe&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": "e1082d09-df56-4c61-b22f-a257bc61655c",
"account_sid": "234210a3-7593-4445-a95f-0097249ed041",
"date_created": "Tue, 14 Mar 2023 02:21:59 -0000",
"date_updated": "Tue, 14 Mar 2023 02:21:59 -0000",
"body": "Hello World",
"date_sent": null,
"direction": "outbound-api",
"error_code": null,
"error_message": null,
"from": null,
"messaging_service_sid": "86170354-e3c2-4a42-b339-8bb15bb9a6fe",
"num_media": "0",
"num_segments": "1",
"price": null,
"price_unit": null,
"status": "accepted",
"subresource_uris": {
},
"tags": {
},
"to": "+855716788123",
"uri": "/2010-04-01/Accounts/234210a3-7593-4445-a95f-0097249ed041/Messages/e1082d09-df56-4c61-b22f-a257bc61655c"
}
Delete a message
Request
curl "https://api.somleng.org/2010-04-01/Accounts/3b62ba38-45cd-4679-978a-7c40afb9b99e/Messages/f0b1dc68-2b0f-4019-baed-4780e1e2da1d" -d '' -X DELETE \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 3b62ba38-45cd-4679-978a-7c40afb9b99e:N9gNMUHQUGpHjSkjvZJ8LjNnCly9iOXO8mZxvUHjSbc
Endpoint
DELETE https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid
DELETE https://api.somleng.org/2010-04-01/Accounts/3b62ba38-45cd-4679-978a-7c40afb9b99e/Messages/f0b1dc68-2b0f-4019-baed-4780e1e2da1d
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/c902538b-18fb-4e0f-9aba-421a9b4f9bfe/Messages/550bac0b-62e7-4657-ac7c-1da3d7295361" -X GET \
-H "Content-Type: application/x-www-form-urlencoded" \
-u c902538b-18fb-4e0f-9aba-421a9b4f9bfe:lYGRplnJkaaj6OPwyhk8-zkKSMj7HYl3F7hYn7n9eso
Endpoint
GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid
GET https://api.somleng.org/2010-04-01/Accounts/c902538b-18fb-4e0f-9aba-421a9b4f9bfe/Messages/550bac0b-62e7-4657-ac7c-1da3d7295361
Parameters
None known.
Response
200 OK
{
"api_version": "2010-04-01",
"sid": "550bac0b-62e7-4657-ac7c-1da3d7295361",
"account_sid": "c902538b-18fb-4e0f-9aba-421a9b4f9bfe",
"date_created": "Tue, 14 Mar 2023 02:21:59 -0000",
"date_updated": "Tue, 14 Mar 2023 02:21:59 -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/c902538b-18fb-4e0f-9aba-421a9b4f9bfe/Messages/550bac0b-62e7-4657-ac7c-1da3d7295361"
}
List messages
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a/Messages" -X GET \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a:1tO0U85RY3zrCu-Yja9Gc0ccfcL3m7o7yDsur2VFjCc
Endpoint
GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages
GET https://api.somleng.org/2010-04-01/Accounts/85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a/Messages
Parameters
None known.
Response
200 OK
{
"messages": [
{
"api_version": "2010-04-01",
"sid": "da868a55-1d46-4a9b-8c8c-7d3ea0c066a8",
"account_sid": "85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a",
"date_created": "Tue, 14 Mar 2023 02:22:00 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:00 -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/85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a/Messages/da868a55-1d46-4a9b-8c8c-7d3ea0c066a8"
}
],
"uri": "/2010-04-01/Accounts/85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a/Messages",
"page": 0,
"page_size": 50,
"first_page_uri": "/2010-04-01/Accounts/85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a/Messages?Page=0",
"next_page_uri": null,
"previous_page_uri": "/2010-04-01/Accounts/85717e5c-fcb9-4a9d-bd9a-3d9cccffe20a/Messages?Page=0&PageToken=PBda868a55-1d46-4a9b-8c8c-7d3ea0c066a8"
}
Redact a message
Request
curl "https://api.somleng.org/2010-04-01/Accounts/2bb8a494-c8cd-4634-9379-2a630fc61bd9/Messages/b32c136b-8dcb-40fd-b624-ab0031a271f1" -d 'Body=' -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 2bb8a494-c8cd-4634-9379-2a630fc61bd9:d_fyR-1Ri7PdepEkEsP5wDxBvMbeX5tJjnS9lyhWO14
Endpoint
POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages/:sid
POST https://api.somleng.org/2010-04-01/Accounts/2bb8a494-c8cd-4634-9379-2a630fc61bd9/Messages/b32c136b-8dcb-40fd-b624-ab0031a271f1
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": "b32c136b-8dcb-40fd-b624-ab0031a271f1",
"account_sid": "2bb8a494-c8cd-4634-9379-2a630fc61bd9",
"date_created": "Tue, 14 Mar 2023 02:22:00 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:00 -0000",
"body": "",
"date_sent": "Tue, 14 Mar 2023 02:22:00 -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/2bb8a494-c8cd-4634-9379-2a630fc61bd9/Messages/b32c136b-8dcb-40fd-b624-ab0031a271f1"
}
Schedule a Message
Request
curl "https://api.somleng.org/2010-04-01/Accounts/66bb0ccb-28e8-4b1f-a757-5376f98b6bc3/Messages" -d 'To=%2B855716788123&Body=Hello+World&SendAt=2023-03-19T02%3A21%3A59Z&ScheduleType=fixed&MessagingServiceSid=7197fcf6-251c-49df-9ce7-91ecfce6d98e' -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 66bb0ccb-28e8-4b1f-a757-5376f98b6bc3:uSCYAL5T8xKEekLIaE8mxPp3OjTyq-bkiokNUf8KRmY
Endpoint
POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Messages
POST https://api.somleng.org/2010-04-01/Accounts/66bb0ccb-28e8-4b1f-a757-5376f98b6bc3/Messages
Parameters
To=%2B855716788123&Body=Hello+World&SendAt=2023-03-19T02%3A21%3A59Z&ScheduleType=fixed&MessagingServiceSid=7197fcf6-251c-49df-9ce7-91ecfce6d98e
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": "0b219edd-0269-401d-acaa-a1596cd3b07f",
"account_sid": "66bb0ccb-28e8-4b1f-a757-5376f98b6bc3",
"date_created": "Tue, 14 Mar 2023 02:21:59 -0000",
"date_updated": "Tue, 14 Mar 2023 02:21:59 -0000",
"body": "Hello World",
"date_sent": null,
"direction": "outbound-api",
"error_code": null,
"error_message": null,
"from": null,
"messaging_service_sid": "7197fcf6-251c-49df-9ce7-91ecfce6d98e",
"num_media": "0",
"num_segments": "1",
"price": null,
"price_unit": null,
"status": "scheduled",
"subresource_uris": {
},
"tags": {
},
"to": "+855716788123",
"uri": "/2010-04-01/Accounts/66bb0ccb-28e8-4b1f-a757-5376f98b6bc3/Messages/0b219edd-0269-401d-acaa-a1596cd3b07f"
}
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/34d8e442-d8f1-4f48-a067-17848697fd84/Calls?PageSize=2" -X GET \
-u 34d8e442-d8f1-4f48-a067-17848697fd84:LaoOr2u9tNj_RQ6kITRytcxHWh8HgM6tt78AnqP2Bnk
Endpoint
GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls
GET https://api.somleng.org/2010-04-01/Accounts/34d8e442-d8f1-4f48-a067-17848697fd84/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": "8fe836c1-5ee3-452a-bc37-988447210490",
"account_sid": "34d8e442-d8f1-4f48-a067-17848697fd84",
"date_created": "Tue, 14 Mar 2023 02:22:18 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:18 -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/34d8e442-d8f1-4f48-a067-17848697fd84/Calls/8fe836c1-5ee3-452a-bc37-988447210490"
},
{
"api_version": "2010-04-01",
"sid": "162585a4-0240-4b5d-850d-08733a109710",
"account_sid": "34d8e442-d8f1-4f48-a067-17848697fd84",
"date_created": "Tue, 14 Mar 2023 02:22:18 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:18 -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/34d8e442-d8f1-4f48-a067-17848697fd84/Calls/162585a4-0240-4b5d-850d-08733a109710"
}
],
"uri": "/2010-04-01/Accounts/34d8e442-d8f1-4f48-a067-17848697fd84/Calls?PageSize=2",
"page": 0,
"page_size": 2,
"first_page_uri": "/2010-04-01/Accounts/34d8e442-d8f1-4f48-a067-17848697fd84/Calls?Page=0&PageSize=2",
"next_page_uri": "/2010-04-01/Accounts/34d8e442-d8f1-4f48-a067-17848697fd84/Calls?Page=1&PageSize=2&PageToken=PA162585a4-0240-4b5d-850d-08733a109710",
"previous_page_uri": "/2010-04-01/Accounts/34d8e442-d8f1-4f48-a067-17848697fd84/Calls?Page=0&PageSize=2&PageToken=PB8fe836c1-5ee3-452a-bc37-988447210490"
}
Phone Calls
Create a call
Request
curl "https://api.somleng.org/2010-04-01/Accounts/41bbfcdb-7de9-4c65-bd4f-d4c079bb83a0/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 41bbfcdb-7de9-4c65-bd4f-d4c079bb83a0:2jkepHs8XpJzN3NgRvI5a_krD3CXgJDxtqM7KhuXU8g
Endpoint
POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls
POST https://api.somleng.org/2010-04-01/Accounts/41bbfcdb-7de9-4c65-bd4f-d4c079bb83a0/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": "e0d88823-4543-40c5-a5d4-ec12d4ba530f",
"account_sid": "41bbfcdb-7de9-4c65-bd4f-d4c079bb83a0",
"date_created": "Tue, 14 Mar 2023 02:22:01 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:01 -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/41bbfcdb-7de9-4c65-bd4f-d4c079bb83a0/Calls/e0d88823-4543-40c5-a5d4-ec12d4ba530f"
}
Fetch a call
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/2fbaa66c-4f7b-4766-872b-eba81d93037e/Calls/ef80ca67-5a03-40f2-9f6b-36cb93058a5c" -X GET \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 2fbaa66c-4f7b-4766-872b-eba81d93037e:1B2mfxxhrZs03AslSdYONA8M-UwjI0GvuHc1o8vOPuc
Endpoint
GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls/:sid
GET https://api.somleng.org/2010-04-01/Accounts/2fbaa66c-4f7b-4766-872b-eba81d93037e/Calls/ef80ca67-5a03-40f2-9f6b-36cb93058a5c
Parameters
None known.
Response
200 OK
{
"api_version": "2010-04-01",
"sid": "ef80ca67-5a03-40f2-9f6b-36cb93058a5c",
"account_sid": "2fbaa66c-4f7b-4766-872b-eba81d93037e",
"date_created": "Tue, 14 Mar 2023 02:22:00 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22: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/2fbaa66c-4f7b-4766-872b-eba81d93037e/Calls/ef80ca67-5a03-40f2-9f6b-36cb93058a5c"
}
List phone calls
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/5872f99c-2bae-4d90-a682-a1bb587be986/Calls" -X GET \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 5872f99c-2bae-4d90-a682-a1bb587be986:Ilq9gUu8Rrqr72W90Ubq7M2Gkd0akALdg1NfWykgxIQ
Endpoint
GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls
GET https://api.somleng.org/2010-04-01/Accounts/5872f99c-2bae-4d90-a682-a1bb587be986/Calls
Parameters
None known.
Response
200 OK
{
"calls": [
{
"api_version": "2010-04-01",
"sid": "02c73ef8-55b6-44a3-97b3-bb18da625d25",
"account_sid": "5872f99c-2bae-4d90-a682-a1bb587be986",
"date_created": "Tue, 14 Mar 2023 02:22:01 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:01 -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/5872f99c-2bae-4d90-a682-a1bb587be986/Calls/02c73ef8-55b6-44a3-97b3-bb18da625d25"
}
],
"uri": "/2010-04-01/Accounts/5872f99c-2bae-4d90-a682-a1bb587be986/Calls",
"page": 0,
"page_size": 50,
"first_page_uri": "/2010-04-01/Accounts/5872f99c-2bae-4d90-a682-a1bb587be986/Calls?Page=0",
"next_page_uri": null,
"previous_page_uri": "/2010-04-01/Accounts/5872f99c-2bae-4d90-a682-a1bb587be986/Calls?Page=0&PageToken=PB02c73ef8-55b6-44a3-97b3-bb18da625d25"
}
Update a call
Request
curl "https://api.somleng.org/2010-04-01/Accounts/14ab4eef-77d0-431b-a66f-5f48503ee1e4/Calls/819cb590-b0e7-4652-b801-d597bba466bc" -d 'Status=completed' -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-u 14ab4eef-77d0-431b-a66f-5f48503ee1e4:FLFeV_qPeBtm3wDPZ79T9mo7KVTP4iJbt0ie3jR9vTg
Endpoint
POST https://api.somleng.org/2010-04-01/Accounts/:account_sid/Calls/:sid
POST https://api.somleng.org/2010-04-01/Accounts/14ab4eef-77d0-431b-a66f-5f48503ee1e4/Calls/819cb590-b0e7-4652-b801-d597bba466bc
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": "819cb590-b0e7-4652-b801-d597bba466bc",
"account_sid": "14ab4eef-77d0-431b-a66f-5f48503ee1e4",
"date_created": "Tue, 14 Mar 2023 02:22:00 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22: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": "in-progress",
"subresource_uris": {
},
"to": "+85512334667",
"to_formatted": "+855 12 334 667",
"uri": "/2010-04-01/Accounts/14ab4eef-77d0-431b-a66f-5f48503ee1e4/Calls/819cb590-b0e7-4652-b801-d597bba466bc"
}
Recordings
Fetch a recording
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/5f8b15c1-8f70-4a6f-a431-482283846022/Recordings/31c7aab4-38c9-4198-a217-96dc55986d59" -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/5f8b15c1-8f70-4a6f-a431-482283846022/Recordings/31c7aab4-38c9-4198-a217-96dc55986d59
Parameters
None known.
Response
302 Found
<html><body>You are being <a href="https://api.somleng.org/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhaSGRoZWpCdE5UZ3plWFZ0ZURWbE4yUnhaM1k1TWpjMWNtbHdNQVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpU1dGMGRHRmphRzFsYm5RN0lHWnBiR1Z1WVcxbFBTSnlaV052Y21ScGJtY3VkMkYySWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkeVpXTnZjbVJwYm1jdWQyRjJCanNHVkRvUlkyOXVkR1Z1ZEY5MGVYQmxTU0lRWVhWa2FXOHZlQzEzWVhZR093WlVPaEZ6WlhKMmFXTmxYMjVoYldVNkNYUmxjM1E9IiwiZXhwIjoiMjAyMy0wMy0xNFQwMjoyNzoxOS44MjhaIiwicHVyIjoiYmxvYl9rZXkifX0=--dbd32e653b04918a811a5e644211bb6ef8fc9085/recording.wav">redirected</a>.</body></html>
Fetch a recording as mp3
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/c1be41a4-da6a-44a5-b48e-6e90e5338cf8/Recordings/eb05639b-e0fb-4fd2-828b-afb94610cc3d.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/c1be41a4-da6a-44a5-b48e-6e90e5338cf8/Recordings/eb05639b-e0fb-4fd2-828b-afb94610cc3d.mp3
Parameters
None known.
Response
302 Found
<html><body>You are being <a href="https://api.somleng.org/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhkM1Z2ZERkNVpIZzFhR0ZyYm5veGFIUmhNbTF2Ym5Jd2VXVTBNQVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpU1dGMGRHRmphRzFsYm5RN0lHWnBiR1Z1WVcxbFBTSnlaV052Y21ScGJtY3ViWEF6SWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkeVpXTnZjbVJwYm1jdWJYQXpCanNHVkRvUlkyOXVkR1Z1ZEY5MGVYQmxTU0lQWVhWa2FXOHZiWEJsWndZN0JsUTZFWE5sY25acFkyVmZibUZ0WlRvSmRHVnpkQT09IiwiZXhwIjoiMjAyMy0wMy0xNFQwMjoyNzoxOS45NDFaIiwicHVyIjoiYmxvYl9rZXkifX0=--62e375aadc74cf001693305a829db95c299c2323/recording.mp3">redirected</a>.</body></html>
Fetch a recording resource
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/346e9d86-dfe2-4772-92f4-4d839895bbc6/Recordings/9214d77a-c2a4-4303-b531-1ba809333b2a.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/346e9d86-dfe2-4772-92f4-4d839895bbc6/Recordings/9214d77a-c2a4-4303-b531-1ba809333b2a.json
Parameters
None known.
Response
200 OK
{
"api_version": "2010-04-01",
"sid": "9214d77a-c2a4-4303-b531-1ba809333b2a",
"account_sid": "346e9d86-dfe2-4772-92f4-4d839895bbc6",
"date_created": "Tue, 14 Mar 2023 02:22:19 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:19 -0000",
"call_sid": "22b8b849-89c0-496b-b785-c8f24b57548b",
"conference_sid": null,
"channels": 1,
"start_time": "2023-03-14T02:22:19.439Z",
"duration": null,
"price": null,
"price_unit": null,
"source": "RecordVerb",
"status": "processing",
"error_code": null,
"encryption_details": null,
"track": "both",
"uri": "/2010-04-01/Accounts/346e9d86-dfe2-4772-92f4-4d839895bbc6/Calls/22b8b849-89c0-496b-b785-c8f24b57548b/Recordings/9214d77a-c2a4-4303-b531-1ba809333b2a.json"
}
List recordings by account
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/e76d71a4-e56b-4952-a72b-a73d65d061b4/Recordings" -X GET \
-u e76d71a4-e56b-4952-a72b-a73d65d061b4:TSb5Yij-8hrKeShbSQy0xmkwOUqeoDAHG7hIrbev1v4
Endpoint
GET https://api.somleng.org/2010-04-01/Accounts/:account_sid/Recordings
GET https://api.somleng.org/2010-04-01/Accounts/e76d71a4-e56b-4952-a72b-a73d65d061b4/Recordings
Parameters
None known.
Response
200 OK
{
"recordings": [
{
"api_version": "2010-04-01",
"sid": "e10fc01a-6a30-4849-aee2-a9a6a023d598",
"account_sid": "e76d71a4-e56b-4952-a72b-a73d65d061b4",
"date_created": "Tue, 14 Mar 2023 02:22:19 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:19 -0000",
"call_sid": "8bc00880-9e30-475d-bdc9-8b467b2960cf",
"conference_sid": null,
"channels": 1,
"start_time": "2023-03-14T02:22:19.652Z",
"duration": null,
"price": null,
"price_unit": null,
"source": "RecordVerb",
"status": "processing",
"error_code": null,
"encryption_details": null,
"track": "both",
"uri": "/2010-04-01/Accounts/e76d71a4-e56b-4952-a72b-a73d65d061b4/Calls/8bc00880-9e30-475d-bdc9-8b467b2960cf/Recordings/e10fc01a-6a30-4849-aee2-a9a6a023d598.json"
},
{
"api_version": "2010-04-01",
"sid": "e4493df2-fdbe-486c-a146-90d47c6d1b7e",
"account_sid": "e76d71a4-e56b-4952-a72b-a73d65d061b4",
"date_created": "Tue, 14 Mar 2023 02:22:19 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:19 -0000",
"call_sid": "33917db8-31e7-45b8-aadf-e43d00895060",
"conference_sid": null,
"channels": 1,
"start_time": "2023-03-14T02:22:19.622Z",
"duration": null,
"price": null,
"price_unit": null,
"source": "RecordVerb",
"status": "processing",
"error_code": null,
"encryption_details": null,
"track": "both",
"uri": "/2010-04-01/Accounts/e76d71a4-e56b-4952-a72b-a73d65d061b4/Calls/33917db8-31e7-45b8-aadf-e43d00895060/Recordings/e4493df2-fdbe-486c-a146-90d47c6d1b7e.json"
}
],
"uri": "/2010-04-01/Accounts/e76d71a4-e56b-4952-a72b-a73d65d061b4/Recordings",
"page": 0,
"page_size": 50,
"first_page_uri": "/2010-04-01/Accounts/e76d71a4-e56b-4952-a72b-a73d65d061b4/Recordings?Page=0",
"next_page_uri": null,
"previous_page_uri": "/2010-04-01/Accounts/e76d71a4-e56b-4952-a72b-a73d65d061b4/Recordings?Page=0&PageToken=PBe10fc01a-6a30-4849-aee2-a9a6a023d598"
}
List recordings by call
Request
curl -g "https://api.somleng.org/2010-04-01/Accounts/0a40ad95-d05e-41a5-bae5-73482a8b70da/Calls/0921700d-ecbe-4ef6-8cc3-d3f1ce8afdea/Recordings" -X GET \
-u 0a40ad95-d05e-41a5-bae5-73482a8b70da:MpHAqCUO9WPIcG4F6XAeeW7uEBgYlH4JD0nYSF6wT9w
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/0a40ad95-d05e-41a5-bae5-73482a8b70da/Calls/0921700d-ecbe-4ef6-8cc3-d3f1ce8afdea/Recordings
Parameters
None known.
Response
200 OK
{
"recordings": [
{
"api_version": "2010-04-01",
"sid": "e806ae6e-66d2-4d11-9448-2aa1bb6ccd2a",
"account_sid": "0a40ad95-d05e-41a5-bae5-73482a8b70da",
"date_created": "Tue, 14 Mar 2023 02:22:19 -0000",
"date_updated": "Tue, 14 Mar 2023 02:22:19 -0000",
"call_sid": "0921700d-ecbe-4ef6-8cc3-d3f1ce8afdea",
"conference_sid": null,
"channels": 1,
"start_time": "2023-03-14T02:22:19.493Z",
"duration": "0",
"price": null,
"price_unit": null,
"source": "RecordVerb",
"status": "completed",
"error_code": null,
"encryption_details": null,
"track": "both",
"uri": "/2010-04-01/Accounts/0a40ad95-d05e-41a5-bae5-73482a8b70da/Calls/0921700d-ecbe-4ef6-8cc3-d3f1ce8afdea/Recordings/e806ae6e-66d2-4d11-9448-2aa1bb6ccd2a.json"
}
],
"uri": "/2010-04-01/Accounts/0a40ad95-d05e-41a5-bae5-73482a8b70da/Calls/0921700d-ecbe-4ef6-8cc3-d3f1ce8afdea/Recordings",
"page": 0,
"page_size": 50,
"first_page_uri": "/2010-04-01/Accounts/0a40ad95-d05e-41a5-bae5-73482a8b70da/Calls/0921700d-ecbe-4ef6-8cc3-d3f1ce8afdea/Recordings?Page=0",
"next_page_uri": null,
"previous_page_uri": "/2010-04-01/Accounts/0a40ad95-d05e-41a5-bae5-73482a8b70da/Calls/0921700d-ecbe-4ef6-8cc3-d3f1ce8afdea/Recordings?Page=0&PageToken=PBe806ae6e-66d2-4d11-9448-2aa1bb6ccd2a"
}