Carrier API
This documentation is intended for carriers as defined in the carrier documentation. The API documentation for Somleng's Open Source implementation of Twilio's REST API is available here.
The Carrier API is intended for carriers who need to automate provisioning of carrier resources (e.g. Accounts) rather that using the dashboard. This API is written according to the JSON API Specification. We recommend using a JSON API Client for consuming this API.
Authentication
This API uses Bearer authentication. You must include your API key in the Authorization header for all requests. Your API key is available on the Carrier Dashboard.
Webhooks
Somleng uses webhooks to notify your application when an event happens in your account.
Somleng signs the webhook events it sends to your endpoint by including a signature in each event's Authorization
header.
This allows you to verify that the events were sent by Somleng, not by a third party.
All requests are signed using JSON Web Token (JWT) Bearer authentication, according to the HS256 (HMAC-SHA256) algorithm.
You should verify the events that Somleng sends to your Webhook endpoints. On the right is an example in Ruby ---->
JWT.decode(
request.headers["Authorization"].sub("Bearer ", ""),
"[your-webhook-signing-secret]",
true,
algorithm: "HS256",
verify_iss: true,
iss: "Somleng"
)
Accounts
Create an account
Request
curl -X POST "https://api.somleng.org/carrier/v1/accounts" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer aLOHF7sXvQuLX4-kEFfUu8uKqRsOXPtwfX2agGxfuZ4" \
--data-urlencode "{
"data": {
"type": "account",
"attributes": {
"name": "Rocket Rides",
"default_tts_voice": "Basic.Kal",
"metadata": {
"foo": "bar"
}
}
}
}="
Endpoint
POST https://api.somleng.org/carrier/v1/accounts
POST https://api.somleng.org/carrier/v1/accounts
Parameters
{
"data": {
"type": "account",
"attributes": {
"name": "Rocket Rides",
"default_tts_voice": "Basic.Kal",
"metadata": {
"foo": "bar"
}
}
}
}
Name | Description |
---|---|
data[attributes][name] required | A friendly name which identifies the account |
data[attributes][tts_voice] | The default TTS voice identifier. Defaults to: Basic.Kal |
data[attributes][metadata] | Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
Response
201 Created
{
"data": {
"id": "3bec8ea0-c9c0-42bb-ab8e-17c6c2ef147d",
"type": "account",
"attributes": {
"created_at": "2024-07-11T05:35:14Z",
"updated_at": "2024-07-11T05:35:14Z",
"name": "Rocket Rides",
"metadata": {
"foo": "bar"
},
"status": "enabled",
"type": "carrier_managed",
"auth_token": "kphQmaf8ZApf1ECzi5gn5UsDgg1ekW1nRmFOAd_TEOM",
"default_tts_voice": "Basic.Kal"
}
}
}
Delete an account
Request
curl "https://api.somleng.org/carrier/v1/accounts/a4379556-ab1d-4f8e-bcae-3554cde377dc" -d '' -X DELETE \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer k-WWdGr5MOmq3R3tB-e05bX1GYbxl7QwQ0gF-6tZVj8"
Endpoint
DELETE https://api.somleng.org/carrier/v1/accounts/:id
DELETE https://api.somleng.org/carrier/v1/accounts/a4379556-ab1d-4f8e-bcae-3554cde377dc
Parameters
None known.
Response
204 No Content
List all accounts
Request
curl "https://api.somleng.org/carrier/v1/accounts" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer wtpsZQWgWofDUEE1KTItSBBzWjPsvo0K_sSlgO1DF7c"
Endpoint
GET https://api.somleng.org/carrier/v1/accounts
GET https://api.somleng.org/carrier/v1/accounts
Parameters
None known.
Response
200 OK
{
"data": [
{
"id": "36aeea7f-68f5-4a06-ae50-a9a720576501",
"type": "account",
"attributes": {
"created_at": "2024-07-11T05:35:14Z",
"updated_at": "2024-07-11T05:35:14Z",
"name": "Telco Net",
"metadata": {
},
"status": "enabled",
"type": "carrier_managed",
"auth_token": "xpHGFIyCKlyYT8b8fTxRLYb74XO-jsdn5vH0e_hVq6E",
"default_tts_voice": "Basic.Kal"
}
},
{
"id": "c164b944-8ad1-439f-832b-7aa1523a88c3",
"type": "account",
"attributes": {
"created_at": "2024-07-11T05:35:14Z",
"updated_at": "2024-07-11T05:35:14Z",
"name": "Rocket Rides",
"metadata": {
},
"status": "enabled",
"type": "customer_managed",
"default_tts_voice": "Basic.Kal"
}
}
],
"links": {
"prev": "https://api.somleng.org/carrier/v1/accounts?page%5Bbefore%5D=36aeea7f-68f5-4a06-ae50-a9a720576501",
"next": null
}
}
Retrieve an account
Request
curl "https://api.somleng.org/carrier/v1/accounts/44da5872-be46-4682-a1ac-a136799b2bad" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer _crdJGJnxSq4SpQVqU_3cbZ6LNOW_zWKWaHUREoDYoo"
Endpoint
GET https://api.somleng.org/carrier/v1/accounts/:id
GET https://api.somleng.org/carrier/v1/accounts/44da5872-be46-4682-a1ac-a136799b2bad
Parameters
Name | Description |
---|---|
id required | The id of the account to be retrieved. |
Response
200 OK
{
"data": {
"id": "44da5872-be46-4682-a1ac-a136799b2bad",
"type": "account",
"attributes": {
"created_at": "2024-07-11T05:35:14Z",
"updated_at": "2024-07-11T05:35:14Z",
"name": "Rocket Rides",
"metadata": {
},
"status": "enabled",
"type": "carrier_managed",
"auth_token": "QtbweW5-dvbCuQ1aI3Tce6MzntIG5thb5zTZiCf5-Qc",
"default_tts_voice": "Basic.Kal"
}
}
}
Update an account
Request
curl "https://api.somleng.org/carrier/v1/accounts/87b9b008-60f8-4faa-94ef-76a519847172" -d '{
"data": {
"attributes": {
"status": null,
"name": "Bob Cats",
"status": "disabled",
"default_tts_voice": "Basic.Kal",
"metadata": {
"bar": "foo"
}
},
"type": "account",
"id": "87b9b008-60f8-4faa-94ef-76a519847172"
}
}' -X PATCH \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer 58qy6DIG5imdOBEjYuiqBaW8cdSPoAf9Kz1TrsznqzQ"
Endpoint
PATCH https://api.somleng.org/carrier/v1/accounts/:id
PATCH https://api.somleng.org/carrier/v1/accounts/87b9b008-60f8-4faa-94ef-76a519847172
Parameters
{
"data": {
"attributes": {
"status": null,
"name": "Bob Cats",
"status": "disabled",
"default_tts_voice": "Basic.Kal",
"metadata": {
"bar": "foo"
}
},
"type": "account",
"id": "87b9b008-60f8-4faa-94ef-76a519847172"
}
}
Name | Description |
---|---|
data[attributes][status] | Update the status of the account. One of either enabled or disabled . |
Response
200 OK
{
"data": {
"id": "87b9b008-60f8-4faa-94ef-76a519847172",
"type": "account",
"attributes": {
"created_at": "2024-07-11T05:35:14Z",
"updated_at": "2024-07-11T05:35:14Z",
"name": "Bob Cats",
"metadata": {
"foo": "bar",
"bar": "foo"
},
"status": "disabled",
"type": "carrier_managed",
"auth_token": "YGz4d_u0ayZaJDuNM3yNSENJ9mfzr0jlEaKFIdespy4",
"default_tts_voice": "Basic.Kal"
}
}
}
Events
List all events
Types of events
This is a list of all the types of events we currently send. We may add more at any time, so in developing and maintaining your code, you should not assume that only these types exist.
You'll notice that these events follow a pattern: resource.event
.
Our goal is to design a consistent system that makes things easier to anticipate and code against.
Event |
---|
phone_call.completed |
message.sent |
message.delivered |
Request
curl "https://api.somleng.org/carrier/v1/events" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer mQ643F80IxCT_DyTShJ1oKvAeiEeffpJArOWmXvNkXU"
Endpoint
GET https://api.somleng.org/carrier/v1/events
GET https://api.somleng.org/carrier/v1/events
Parameters
None known.
Response
200 OK
{
"data": [
{
"id": "5f105b86-819b-4345-808d-fa5723a45e19",
"type": "event",
"attributes": {
"created_at": "2024-07-11T05:34:53Z",
"updated_at": "2024-07-11T05:34:53Z",
"type": "phone_call.completed",
"details": {
"data": {
"id": "fa1f7981-d774-438d-bf34-229ddb913a99",
"type": "phone_call",
"attributes": {
"to": "+85512334667",
"from": "2442",
"price": null,
"status": "queued",
"duration": null,
"direction": "outbound-api",
"created_at": "2024-07-11T05:34:53Z",
"price_unit": null,
"updated_at": "2024-07-11T05:34:53Z"
},
"relationships": {
"account": {
"data": {
"id": "78b3fd63-8ce3-4622-a76c-e266b8e0f481",
"type": "account"
}
}
}
}
}
}
}
],
"links": {
"prev": "https://api.somleng.org/carrier/v1/events?page%5Bbefore%5D=5f105b86-819b-4345-808d-fa5723a45e19",
"next": null
}
}
Retrieve an Event
Request
curl "https://api.somleng.org/carrier/v1/events/f52a79bc-f919-4666-85c9-335d8b9097ca" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer jNbJLThdamvklHrZFaKNh8Ten5Hdq49j3toRKusVWb4"
Endpoint
GET https://api.somleng.org/carrier/v1/events/:id
GET https://api.somleng.org/carrier/v1/events/f52a79bc-f919-4666-85c9-335d8b9097ca
Parameters
None known.
Response
200 OK
{
"data": {
"id": "f52a79bc-f919-4666-85c9-335d8b9097ca",
"type": "event",
"attributes": {
"created_at": "2024-07-11T05:34:53Z",
"updated_at": "2024-07-11T05:34:53Z",
"type": "phone_call.completed",
"details": {
"data": {
"id": "e0e6c819-a72e-4105-94dd-00ba057e638a",
"type": "phone_call",
"attributes": {
"to": "+85512334667",
"from": "2442",
"price": null,
"status": "queued",
"duration": null,
"direction": "outbound-api",
"created_at": "2024-07-11T05:34:53Z",
"price_unit": null,
"updated_at": "2024-07-11T05:34:53Z"
},
"relationships": {
"account": {
"data": {
"id": "3664d509-cca6-4033-a2ce-b228d9d56e41",
"type": "account"
}
}
}
}
}
}
}
}
Messages
List messages
Request
curl "https://api.somleng.org/carrier/v1/messages?filter[status]=sent&filter[from_date]=2021-11-01T00%3A00%3A00Z&filter[to_date]=2021-11-01T00%3A00%3A00Z&filter[account]=fda775af-ca37-485b-a6ae-ffac1f32dc90&filter[direction]=outbound-api" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer dvI04lpvTYFEu7h0Z5R0f8BL0HMFNdpC5BZg_C4_gG4"
Endpoint
GET https://api.somleng.org/carrier/v1/messages
GET https://api.somleng.org/carrier/v1/messages?filter[status]=sent&filter[from_date]=2021-11-01T00%3A00%3A00Z&filter[to_date]=2021-11-01T00%3A00%3A00Z&filter[account]=fda775af-ca37-485b-a6ae-ffac1f32dc90&filter[direction]=outbound-api
Parameters
filter: {"status"=>"sent", "from_date"=>"2021-11-01T00:00:00Z", "to_date"=>"2021-11-01T00:00:00Z", "account"=>"fda775af-ca37-485b-a6ae-ffac1f32dc90", "direction"=>"outbound-api"}
Name | Description |
---|---|
filter[account] | Return messages from the provided account-sid |
filter[from_date] | Return messages on or after the provided date/time in ISO 8601 format. |
filter[to_date] | Return messages on or before the provided date/time in ISO 8601 format. |
filter[direction] | One of inbound , outbound-api , outbound-call , outbound-reply , and outbound |
filter[status] | One of accepted , scheduled , queued , sending , sent , failed , received , canceled , and delivered |
Response
200 OK
{
"data": [
{
"id": "291ff101-66ba-4af2-8e20-e0964e2dc02d",
"type": "message",
"attributes": {
"created_at": "2021-11-01T01:00:00Z",
"updated_at": "2024-07-11T05:34:20Z",
"to": "+85512334667",
"from": "2442",
"price": null,
"price_unit": null,
"direction": "outbound-api",
"status": "sent",
"body": "Hello World"
},
"relationships": {
"account": {
"data": {
"id": "fda775af-ca37-485b-a6ae-ffac1f32dc90",
"type": "account"
}
}
}
}
],
"links": {
"prev": "https://api.somleng.org/carrier/v1/messages?filter%5Baccount%5D=fda775af-ca37-485b-a6ae-ffac1f32dc90&filter%5Bdirection%5D=outbound-api&filter%5Bfrom_date%5D=2021-11-01T00%3A00%3A00Z&filter%5Bstatus%5D=sent&filter%5Bto_date%5D=2021-11-01T00%3A00%3A00Z&page%5Bbefore%5D=291ff101-66ba-4af2-8e20-e0964e2dc02d",
"next": null
}
}
Retrieve a message
Request
curl "https://api.somleng.org/carrier/v1/messages/3eda8cb5-1914-4fdd-a00e-6c8df703a02c" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer SjVuDtDm4x-T8iAboapu3GB1dy1U7W117SSj3Ol9KbQ"
Endpoint
GET https://api.somleng.org/carrier/v1/messages/:id
GET https://api.somleng.org/carrier/v1/messages/3eda8cb5-1914-4fdd-a00e-6c8df703a02c
Parameters
None known.
Response
200 OK
{
"data": {
"id": "3eda8cb5-1914-4fdd-a00e-6c8df703a02c",
"type": "message",
"attributes": {
"created_at": "2024-07-11T05:34:20Z",
"updated_at": "2024-07-11T05:34:20Z",
"to": "+85512334667",
"from": "2442",
"price": null,
"price_unit": null,
"direction": "outbound-api",
"status": "accepted",
"body": "Hello World"
},
"relationships": {
"account": {
"data": {
"id": "747af1a8-ff14-410e-8686-044009e44a36",
"type": "account"
}
}
}
}
}
Update a message
Request
curl "https://api.somleng.org/carrier/v1/messages/a7fe3133-d6e1-4759-b497-3de4d186ed62" -d '{
"data": {
"id": "a7fe3133-d6e1-4759-b497-3de4d186ed62",
"type": "message",
"attributes": {
"price": "-0.05"
}
}
}' -X PATCH \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer n-mzfG2o6PegDY-6D_BTjMKY5SeM2l03yu3IesHgCbA"
Endpoint
PATCH https://api.somleng.org/carrier/v1/messages/:id
PATCH https://api.somleng.org/carrier/v1/messages/a7fe3133-d6e1-4759-b497-3de4d186ed62
Parameters
{
"data": {
"id": "a7fe3133-d6e1-4759-b497-3de4d186ed62",
"type": "message",
"attributes": {
"price": "-0.05"
}
}
}
Name | Description |
---|---|
data[attributes][price] | The charge for this call in the account's billing currency |
Response
200 OK
{
"data": {
"id": "a7fe3133-d6e1-4759-b497-3de4d186ed62",
"type": "message",
"attributes": {
"created_at": "2024-07-11T05:34:20Z",
"updated_at": "2024-07-11T05:34:20Z",
"to": "+85512334667",
"from": "2442",
"price": "-0.05",
"price_unit": "USD",
"direction": "outbound-api",
"status": "sent",
"body": "Hello World"
},
"relationships": {
"account": {
"data": {
"id": "2a4333b4-b73d-43d6-82e7-5e2c050bfbee",
"type": "account"
}
}
}
}
}
Phone Calls
List phone calls
Request
curl "https://api.somleng.org/carrier/v1/phone_calls?filter[status]=queued&filter[from_date]=2021-11-01T00%3A00%3A00Z&filter[to_date]=2021-11-01T00%3A00%3A00Z&filter[account]=767278d1-eb07-4794-89c6-208f9cd83baf&filter[direction]=outbound-api" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer wGK2Nr5OTSYguMWvdX3kmfrHm80VPUIXiimPTSgequ8"
Endpoint
GET https://api.somleng.org/carrier/v1/phone_calls
GET https://api.somleng.org/carrier/v1/phone_calls?filter[status]=queued&filter[from_date]=2021-11-01T00%3A00%3A00Z&filter[to_date]=2021-11-01T00%3A00%3A00Z&filter[account]=767278d1-eb07-4794-89c6-208f9cd83baf&filter[direction]=outbound-api
Parameters
filter: {"status"=>"queued", "from_date"=>"2021-11-01T00:00:00Z", "to_date"=>"2021-11-01T00:00:00Z", "account"=>"767278d1-eb07-4794-89c6-208f9cd83baf", "direction"=>"outbound-api"}
Name | Description |
---|---|
filter[account] | Return phone calls from the provided account-sid |
filter[from_date] | Return phone calls on or after the provided date/time in ISO 8601 format. |
filter[to_date] | Return phone calls on or before the provided date/time in ISO 8601 format. |
filter[direction] | One of inbound , outbound-api , and outbound-dial |
filter[status] | One of queued , ringing , in-progress , busy , failed , no-answer , completed , and canceled |
Response
200 OK
{
"data": [
{
"id": "32fdad8d-34ef-4556-a667-e2c4ac196840",
"type": "phone_call",
"attributes": {
"created_at": "2021-11-01T01:00:00Z",
"updated_at": "2024-07-11T05:34:29Z",
"to": "+85512334667",
"from": "2442",
"price": null,
"price_unit": null,
"duration": null,
"direction": "outbound-api",
"status": "queued"
},
"relationships": {
"account": {
"data": {
"id": "767278d1-eb07-4794-89c6-208f9cd83baf",
"type": "account"
}
}
}
}
],
"links": {
"prev": "https://api.somleng.org/carrier/v1/phone_calls?filter%5Baccount%5D=767278d1-eb07-4794-89c6-208f9cd83baf&filter%5Bdirection%5D=outbound-api&filter%5Bfrom_date%5D=2021-11-01T00%3A00%3A00Z&filter%5Bstatus%5D=queued&filter%5Bto_date%5D=2021-11-01T00%3A00%3A00Z&page%5Bbefore%5D=32fdad8d-34ef-4556-a667-e2c4ac196840",
"next": null
}
}
Retrieve a phone call
Request
curl "https://api.somleng.org/carrier/v1/phone_calls/dd8963fc-9aad-485f-a68a-55507d21b0e2" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer 1v1QnwEkbIoG1131qraEC_mhU_ww2147SjcP7h2jh7w"
Endpoint
GET https://api.somleng.org/carrier/v1/phone_calls/:id
GET https://api.somleng.org/carrier/v1/phone_calls/dd8963fc-9aad-485f-a68a-55507d21b0e2
Parameters
None known.
Response
200 OK
{
"data": {
"id": "dd8963fc-9aad-485f-a68a-55507d21b0e2",
"type": "phone_call",
"attributes": {
"created_at": "2024-07-11T05:34:29Z",
"updated_at": "2024-07-11T05:34:29Z",
"to": "+85512334667",
"from": "2442",
"price": null,
"price_unit": null,
"duration": null,
"direction": "outbound-api",
"status": "queued"
},
"relationships": {
"account": {
"data": {
"id": "a00aecac-45d2-4ca0-82b2-5fc9c91994ad",
"type": "account"
}
}
}
}
}
Update a phone call
Request
curl "https://api.somleng.org/carrier/v1/phone_calls/cb57cf0e-ec1f-4a05-bf61-95ecb653dc93" -d '{
"data": {
"id": "cb57cf0e-ec1f-4a05-bf61-95ecb653dc93",
"type": "phone_call",
"attributes": {
"price": "-0.05"
}
}
}' -X PATCH \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer x-1vS3nNKQSZiTtmji1kYEcfHDS3z8gFV_Lkrl2f_jE"
Endpoint
PATCH https://api.somleng.org/carrier/v1/phone_calls/:id
PATCH https://api.somleng.org/carrier/v1/phone_calls/cb57cf0e-ec1f-4a05-bf61-95ecb653dc93
Parameters
{
"data": {
"id": "cb57cf0e-ec1f-4a05-bf61-95ecb653dc93",
"type": "phone_call",
"attributes": {
"price": "-0.05"
}
}
}
Name | Description |
---|---|
data[attributes][price] | The charge for this call in the account's billing currency |
Response
200 OK
{
"data": {
"id": "cb57cf0e-ec1f-4a05-bf61-95ecb653dc93",
"type": "phone_call",
"attributes": {
"created_at": "2024-07-11T05:34:29Z",
"updated_at": "2024-07-11T05:34:29Z",
"to": "+85512334667",
"from": "2442",
"price": "-0.05",
"price_unit": "USD",
"duration": "5",
"direction": "outbound-api",
"status": "completed"
},
"relationships": {
"account": {
"data": {
"id": "6f9bd0fa-be4e-4f4f-acc3-70fab9bfd82f",
"type": "account"
}
}
}
}
}
Phone Numbers
Create a phone number
Request
curl -X POST "https://api.somleng.org/carrier/v1/phone_numbers" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer yYuQC--0CsdvAB0WgDnAb1I0PRZh5uaIGD_lm2PlCgk" \
--data-urlencode "{
"data": {
"type": "phone_number",
"attributes": {
"number": "1294",
"type": "short_code"
}
}
}="
Endpoint
POST https://api.somleng.org/carrier/v1/phone_numbers
POST https://api.somleng.org/carrier/v1/phone_numbers
Parameters
{
"data": {
"type": "phone_number",
"attributes": {
"number": "1294",
"type": "short_code"
}
}
}
Name | Description |
---|---|
data[attributes][number] required | Phone number in E.164 format or shortcode. |
data[attributes][type] required | The type of the phone number. Must be one of short_code , local , mobile , toll_free . |
data[attributes][visibility] | The visibility of the phone number. Must be one of private , public , disabled . Defaults to public for phone numbers with a price and private for phone numbers without one |
data[attributes][country] | The ISO 3166-1 alpha-2 country code of the phone number. If not specified, it's automatically resolved from the number parameter, or defaults to the carrier's country code if unresolvable. |
data[attributes][price] | The price for the phone number in the billing currency of the carrier. |
data[attributes][region] | The state or province abbreviation of this phone number's location. |
data[attributes][locality] | The locality or city of this phone number's location. |
Response
201 Created
{
"data": {
"id": "0539afd8-1950-4609-85dc-b3e12108a6c4",
"type": "phone_number",
"attributes": {
"created_at": "2024-07-11T05:34:29Z",
"updated_at": "2024-07-11T05:34:29Z",
"number": "1294",
"country": "KH",
"visibility": "private",
"type": "short_code",
"locality": null,
"currency": "KHR",
"price": "0.00",
"region": null
}
}
}
Delete a phone number
Request
curl "https://api.somleng.org/carrier/v1/phone_numbers/fc0b7585-e124-4733-a1a9-72f9502deb21" -d '' -X DELETE \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer U4h88Qp_IbupfoekU4rSU8DHvnKYvm1LW9h_HQilyUw"
Endpoint
DELETE https://api.somleng.org/carrier/v1/phone_numbers/:id
DELETE https://api.somleng.org/carrier/v1/phone_numbers/fc0b7585-e124-4733-a1a9-72f9502deb21
Parameters
None known.
Response
204 No Content
List all phone numbers
Request
curl "https://api.somleng.org/carrier/v1/phone_numbers" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer KOFKgA_WTW4MlkxO55S0wqIkxXpSJIgmdn8mOUezhBU"
Endpoint
GET https://api.somleng.org/carrier/v1/phone_numbers
GET https://api.somleng.org/carrier/v1/phone_numbers
Parameters
None known.
Response
200 OK
{
"data": [
{
"id": "6ccb0d3b-752e-4811-99c4-60e258b572bf",
"type": "phone_number",
"attributes": {
"created_at": "2024-07-11T05:34:29Z",
"updated_at": "2024-07-11T05:34:29Z",
"number": "+855972345699",
"country": "KH",
"visibility": "private",
"type": "mobile",
"locality": null,
"currency": "KHR",
"price": "0.00",
"region": null
}
},
{
"id": "8fa56e44-7b2c-412c-9b84-3dff8eeae7e3",
"type": "phone_number",
"attributes": {
"created_at": "2024-07-11T05:34:29Z",
"updated_at": "2024-07-11T05:34:29Z",
"number": "+855972345698",
"country": "KH",
"visibility": "private",
"type": "mobile",
"locality": null,
"currency": "KHR",
"price": "0.00",
"region": null
}
}
],
"links": {
"prev": "https://api.somleng.org/carrier/v1/phone_numbers?page%5Bbefore%5D=6ccb0d3b-752e-4811-99c4-60e258b572bf",
"next": null
}
}
Retrieve a phone number
Request
curl "https://api.somleng.org/carrier/v1/phone_numbers/0eb5966e-7d16-48d0-b236-7ec5777cb823" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer P-frPDs87VGelCkPVsDa1YhUII61UMrayp6TZuZkHBg"
Endpoint
GET https://api.somleng.org/carrier/v1/phone_numbers/:id
GET https://api.somleng.org/carrier/v1/phone_numbers/0eb5966e-7d16-48d0-b236-7ec5777cb823
Parameters
None known.
Response
200 OK
{
"data": {
"id": "0eb5966e-7d16-48d0-b236-7ec5777cb823",
"type": "phone_number",
"attributes": {
"created_at": "2024-07-11T05:34:29Z",
"updated_at": "2024-07-11T05:34:29Z",
"number": "+855972345697",
"country": "KH",
"visibility": "private",
"type": "mobile",
"locality": null,
"currency": "KHR",
"price": "0.00",
"region": null
}
}
}
Update a phone number
Request
curl "https://api.somleng.org/carrier/v1/phone_numbers/fe6d603b-1975-4a5f-872e-61c5eb4da5d5" -d '{
"data": {
"type": "phone_number",
"id": "fe6d603b-1975-4a5f-872e-61c5eb4da5d5",
"attributes": {
"type": "mobile",
"visibility": "public",
"country": "US",
"price": "1.15",
"region": "AK",
"locality": "Little Rock"
}
}
}' -X PATCH \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer RrSHKRO8UCtU7ya9g35M8c-w8NLDj6j7e-3OXVD1p_c"
Endpoint
PATCH https://api.somleng.org/carrier/v1/phone_numbers/:id
PATCH https://api.somleng.org/carrier/v1/phone_numbers/fe6d603b-1975-4a5f-872e-61c5eb4da5d5
Parameters
{
"data": {
"type": "phone_number",
"id": "fe6d603b-1975-4a5f-872e-61c5eb4da5d5",
"attributes": {
"type": "mobile",
"visibility": "public",
"country": "US",
"price": "1.15",
"region": "AK",
"locality": "Little Rock"
}
}
}
Name | Description |
---|---|
data[attributes][type] | Must be one of short_code , local , mobile , toll_free . |
data[attributes][visibility] | The visibility of the phone number. Must be one of private , public , disabled . Defaults to public for phone numbers with a price and private for phone numbers without one |
data[attributes][country] | The ISO 3166-1 alpha-2 country code of the phone number. |
data[attributes][price] | The price for the phone number in the billing currency of the carrier. |
Response
200 OK
{
"data": {
"id": "fe6d603b-1975-4a5f-872e-61c5eb4da5d5",
"type": "phone_number",
"attributes": {
"created_at": "2024-07-11T05:34:29Z",
"updated_at": "2024-07-11T05:34:29Z",
"number": "+15067020972",
"country": "US",
"visibility": "public",
"type": "mobile",
"locality": "Little Rock",
"currency": "CAD",
"price": "1.15",
"region": "AK"
}
}
}
TTS Events
List all TTS events
Request
curl "https://api.somleng.org/carrier/v1/tts_events?filter[from_date]=2024-07-10&filter[account]=04d4781d-4f20-4232-9127-76dfd69e192d&filter[phone_call]=16757e5a-10af-4edc-84f8-3bfd4458a837" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer WG0GficMJwxgZvsP_FRaPANw3J8uFBBA23x8QdKaKEQ"
Endpoint
GET https://api.somleng.org/carrier/v1/tts_events
GET https://api.somleng.org/carrier/v1/tts_events?filter[from_date]=2024-07-10&filter[account]=04d4781d-4f20-4232-9127-76dfd69e192d&filter[phone_call]=16757e5a-10af-4edc-84f8-3bfd4458a837
Parameters
filter: {"from_date"=>"2024-07-10", "account"=>"04d4781d-4f20-4232-9127-76dfd69e192d", "phone_call"=>"16757e5a-10af-4edc-84f8-3bfd4458a837"}
Name | Description |
---|---|
filter[account] | Return TTS Events from the provided account SID |
filter[phone_call] | Return TTS Events from the provided phone call SID |
filter[from_date] | Return TTS events on or after the provided date/time in ISO 8601 format. |
filter[to_date] | Return TTS events on or before the provided date/time in ISO 8601 format. |
Response
200 OK
{
"data": [
{
"id": "95c709aa-a9cb-4448-a407-fc54c7cc1afa",
"type": "tts_event",
"attributes": {
"created_at": "2024-07-11T05:34:50Z",
"updated_at": "2024-07-11T05:34:50Z",
"voice": "Basic.Kal (Male, en-US)",
"characters": 200
},
"relationships": {
"account": {
"data": {
"id": "04d4781d-4f20-4232-9127-76dfd69e192d",
"type": "account"
}
},
"phone_call": {
"data": {
"id": "16757e5a-10af-4edc-84f8-3bfd4458a837",
"type": "phone_call"
}
}
}
},
{
"id": "7872732e-717c-4a25-bbe2-1d309814017c",
"type": "tts_event",
"attributes": {
"created_at": "2024-07-11T05:34:50Z",
"updated_at": "2024-07-11T05:34:50Z",
"voice": "Basic.Kal (Male, en-US)",
"characters": 100
},
"relationships": {
"account": {
"data": {
"id": "04d4781d-4f20-4232-9127-76dfd69e192d",
"type": "account"
}
},
"phone_call": {
"data": {
"id": "16757e5a-10af-4edc-84f8-3bfd4458a837",
"type": "phone_call"
}
}
}
}
],
"links": {
"prev": "https://api.somleng.org/carrier/v1/tts_events?filter%5Baccount%5D=04d4781d-4f20-4232-9127-76dfd69e192d&filter%5Bfrom_date%5D=2024-07-10&filter%5Bphone_call%5D=16757e5a-10af-4edc-84f8-3bfd4458a837&page%5Bbefore%5D=95c709aa-a9cb-4448-a407-fc54c7cc1afa",
"next": null
}
}
Retrieve a TTS Event
Request
curl "https://api.somleng.org/carrier/v1/tts_events/2e3276f4-6b14-4786-aac5-0b813166ac2e" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer 3UTBPpYHvcbYinWAm6psJbFPp2-BUD6eOLVKo-dWRvk"
Endpoint
GET https://api.somleng.org/carrier/v1/tts_events/:id
GET https://api.somleng.org/carrier/v1/tts_events/2e3276f4-6b14-4786-aac5-0b813166ac2e
Parameters
None known.
Response
200 OK
{
"data": {
"id": "2e3276f4-6b14-4786-aac5-0b813166ac2e",
"type": "tts_event",
"attributes": {
"created_at": "2024-07-11T05:34:49Z",
"updated_at": "2024-07-11T05:34:49Z",
"voice": "Basic.Kal (Male, en-US)",
"characters": 100
},
"relationships": {
"account": {
"data": {
"id": "f627c578-3741-4561-b23d-5bca299fda43",
"type": "account"
}
},
"phone_call": {
"data": {
"id": "27291e38-6753-4f1e-99ec-10abeaef1083",
"type": "phone_call"
}
}
}
}
}