NAV
cURL

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. Here's 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 "https://api.somleng.org/carrier/v1/accounts" -d '{
  "data": {
    "type": "account",
    "attributes": {
      "name": "Rocket Rides",
      "metadata": {
        "foo": "bar"
      }
    }
  }
}' -X POST \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer iNz5i5ivtiZZLjd90g-Y8sxLixd1y_J0EMzJ6or9-7I"

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",
      "metadata": {
        "foo": "bar"
      }
    }
  }
}
Name Description
data[attributes][name] required A friendly name which identifies the account
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": "43d45b55-f7da-42c0-90e8-90bb58d71221",
    "type": "account",
    "attributes": {
      "created_at": "2022-12-06T10:49:24Z",
      "updated_at": "2022-12-06T10:49:24Z",
      "name": "Rocket Rides",
      "metadata": {
        "foo": "bar"
      },
      "status": "enabled",
      "type": "carrier_managed",
      "auth_token": "YBx1mc3NkV2WwyocHq6R6wCwrLsDHzdlmJQSbbVhAk4"
    }
  }
}

Delete an account

Request

curl "https://api.somleng.org/carrier/v1/accounts/2ae9b7ce-16bd-4ba2-bab7-a7c00cfbf3c8" -d '' -X DELETE \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer PSjdXGaDGsMfkXuOhjj6afN4571xAO3j4uiwGHyOqmU"

Endpoint

DELETE https://api.somleng.org/carrier/v1/accounts/:id

DELETE https://api.somleng.org/carrier/v1/accounts/2ae9b7ce-16bd-4ba2-bab7-a7c00cfbf3c8

Parameters

None known.

Response


204 No Content

List all accounts

Request

curl -g "https://api.somleng.org/carrier/v1/accounts" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer nD99A4wsiJgcKJJl56kTgI87xwERSeBxz8qsr8mf2n4"

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": "bcf92b52-e9de-442e-966d-19485d9edff2",
      "type": "account",
      "attributes": {
        "created_at": "2022-12-06T10:49:24Z",
        "updated_at": "2022-12-06T10:49:24Z",
        "name": "Telco Net",
        "metadata": {
        },
        "status": "enabled",
        "type": "carrier_managed",
        "auth_token": "s803jWvBoXlT66Ghzzs5DWf2TFUOLIySiVBWbWqeTEY"
      }
    },
    {
      "id": "90740430-4607-4cd1-9583-5dcf4f26d800",
      "type": "account",
      "attributes": {
        "created_at": "2022-12-06T10:49:24Z",
        "updated_at": "2022-12-06T10:49:24Z",
        "name": "Rocket Rides",
        "metadata": {
        },
        "status": "enabled",
        "type": "customer_managed"
      }
    }
  ],
  "links": {
    "prev": "https://api.somleng.org/carrier/v1/accounts?page%5Bbefore%5D=bcf92b52-e9de-442e-966d-19485d9edff2",
    "next": null
  }
}

Retrieve an account

Request

curl -g "https://api.somleng.org/carrier/v1/accounts/2bb61ae8-c1a9-4f4a-b096-9ec06ea2aa94" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer GgiKyyNDwilNYwKyZP3i6QaecPsao6A0JvdgxdIZDpE"

Endpoint

GET https://api.somleng.org/carrier/v1/accounts/:id

GET https://api.somleng.org/carrier/v1/accounts/2bb61ae8-c1a9-4f4a-b096-9ec06ea2aa94

Parameters

Name Description
id required The id of the account to be retrieved.

Response


200 OK
{
  "data": {
    "id": "2bb61ae8-c1a9-4f4a-b096-9ec06ea2aa94",
    "type": "account",
    "attributes": {
      "created_at": "2022-12-06T10:49:24Z",
      "updated_at": "2022-12-06T10:49:24Z",
      "name": "Rocket Rides",
      "metadata": {
      },
      "status": "enabled",
      "type": "carrier_managed",
      "auth_token": "X2tJlgnlnUpDHgoFrLFafktIJGgKjd5vFgrPmZx-cpU"
    }
  }
}

Update an account

Request

curl "https://api.somleng.org/carrier/v1/accounts/8cf38f51-36bb-475d-9269-ff8c9fa8dd67" -d '{
  "data": {
    "attributes": {
      "status": null,
      "name": "Bob Cats",
      "status": "disabled",
      "metadata": {
        "bar": "foo"
      }
    },
    "type": "account",
    "id": "8cf38f51-36bb-475d-9269-ff8c9fa8dd67"
  }
}' -X PATCH \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer 9yymh-T7PbaVRoDVheJPyB4GXjXuA0HUQOwLCBD1d88"

Endpoint

PATCH https://api.somleng.org/carrier/v1/accounts/:id

PATCH https://api.somleng.org/carrier/v1/accounts/8cf38f51-36bb-475d-9269-ff8c9fa8dd67

Parameters

{
  "data": {
    "attributes": {
      "status": null,
      "name": "Bob Cats",
      "status": "disabled",
      "metadata": {
        "bar": "foo"
      }
    },
    "type": "account",
    "id": "8cf38f51-36bb-475d-9269-ff8c9fa8dd67"
  }
}
Name Description
data[attributes][status] Update the status of the account. One of either enabled or disabled.

Response


200 OK
{
  "data": {
    "id": "8cf38f51-36bb-475d-9269-ff8c9fa8dd67",
    "type": "account",
    "attributes": {
      "created_at": "2022-12-06T10:49:24Z",
      "updated_at": "2022-12-06T10:49:24Z",
      "name": "Bob Cats",
      "metadata": {
        "foo": "bar",
        "bar": "foo"
      },
      "status": "disabled",
      "type": "carrier_managed",
      "auth_token": "w8yPWMw9Dcusj1fyVv1NmjTnbFJ7fmFqAbeonviXRRk"
    }
  }
}

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

Request

curl -g "https://api.somleng.org/carrier/v1/events" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer dSWJmO7-3RJsbErkcf_Mkv5oteoi0hMeFZHI5Ttucns"

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": "0da16ec1-a908-4a92-86e0-47534807cd25",
      "type": "event",
      "attributes": {
        "created_at": "2022-12-06T10:49:43Z",
        "updated_at": "2022-12-06T10:49:43Z",
        "type": "phone_call.completed",
        "details": {
          "data": {
            "id": "4b27387f-220b-4759-b67a-86ecb6ebec5e",
            "type": "phone_call",
            "attributes": {
              "to": "+85512334667",
              "sid": "4b27387f-220b-4759-b67a-86ecb6ebec5e",
              "from": "2442",
              "price": null,
              "status": "queued",
              "duration": null,
              "direction": "outbound-api",
              "created_at": "2022-12-06T10:49:43Z",
              "price_unit": null,
              "updated_at": "2022-12-06T10:49:43Z",
              "account_sid": "f725b7f6-de4a-4b70-bd80-368bbd8a7509"
            }
          }
        }
      }
    }
  ],
  "links": {
    "prev": "https://api.somleng.org/carrier/v1/events?page%5Bbefore%5D=0da16ec1-a908-4a92-86e0-47534807cd25",
    "next": null
  }
}

Retrieve an Event

Request

curl -g "https://api.somleng.org/carrier/v1/events/d8b8a5cb-9905-4a46-b376-4f28f207d4fa" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer i1fhVhlNl9X2hhLG2PPdAMZmeMmMY0BSvfoeATAS7Sk"

Endpoint

GET https://api.somleng.org/carrier/v1/events/:id

GET https://api.somleng.org/carrier/v1/events/d8b8a5cb-9905-4a46-b376-4f28f207d4fa

Parameters

None known.

Response


200 OK
{
  "data": {
    "id": "d8b8a5cb-9905-4a46-b376-4f28f207d4fa",
    "type": "event",
    "attributes": {
      "created_at": "2022-12-06T10:49:43Z",
      "updated_at": "2022-12-06T10:49:43Z",
      "type": "phone_call.completed",
      "details": {
        "data": {
          "id": "5266f76a-94f9-414e-9f1a-3910e745e8d8",
          "type": "phone_call",
          "attributes": {
            "to": "+85512334667",
            "sid": "5266f76a-94f9-414e-9f1a-3910e745e8d8",
            "from": "2442",
            "price": null,
            "status": "queued",
            "duration": null,
            "direction": "outbound-api",
            "created_at": "2022-12-06T10:49:43Z",
            "price_unit": null,
            "updated_at": "2022-12-06T10:49:43Z",
            "account_sid": "cbcd5467-45a5-496c-9426-c773f467ed12"
          }
        }
      }
    }
  }
}

Messages

List messages

Request

curl -g "https://api.somleng.org/carrier/v1/messages?filter[status]=sent&filter[from_date]=2021-11-01T00%3A00%3A00Z&filter[to_date]=2021-11-01T11%3A00%3A00Z&filter[account]=e02bcbdd-717c-4fb7-9766-b9c727a9e941&filter[direction]=outbound-api" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer sAJDBCs6jaLnf05N3PcvFjjN51mY1XOJsJgk01yddWg"

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-01T11%3A00%3A00Z&filter[account]=e02bcbdd-717c-4fb7-9766-b9c727a9e941&filter[direction]=outbound-api

Parameters

filter: {"status"=>"sent", "from_date"=>"2021-11-01T00:00:00Z", "to_date"=>"2021-11-01T11:00:00Z", "account"=>"e02bcbdd-717c-4fb7-9766-b9c727a9e941", "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, and outbound-reply
filter[status] One of accepted, scheduled, queued, sending, sent, failed, received, and canceled

Response


200 OK
{
  "data": [
    {
      "id": "062e63c9-11bd-4f7a-8cfe-af16e9e982b2",
      "type": "message",
      "attributes": {
        "created_at": "2021-11-01T01:00:00Z",
        "updated_at": "2022-12-06T10:49:57Z",
        "to": "+85512334667",
        "from": "2442",
        "sid": "062e63c9-11bd-4f7a-8cfe-af16e9e982b2",
        "account_sid": "e02bcbdd-717c-4fb7-9766-b9c727a9e941",
        "price": null,
        "price_unit": null,
        "direction": "outbound-api",
        "status": "sent",
        "body": "Hello World"
      }
    }
  ],
  "links": {
    "prev": "https://api.somleng.org/carrier/v1/messages?filter%5Baccount%5D=e02bcbdd-717c-4fb7-9766-b9c727a9e941&filter%5Bdirection%5D=outbound-api&filter%5Bfrom_date%5D=2021-11-01T00%3A00%3A00Z&filter%5Bstatus%5D=sent&filter%5Bto_date%5D=2021-11-01T11%3A00%3A00Z&page%5Bbefore%5D=062e63c9-11bd-4f7a-8cfe-af16e9e982b2",
    "next": null
  }
}

Retrieve a message

Request

curl -g "https://api.somleng.org/carrier/v1/messages/b9d94bab-9138-49b1-a14e-5da4441fbe88" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer G4LcE0SkZVSI6gilJvqEA-LRq1yw6KoOAWuUZoks_R0"

Endpoint

GET https://api.somleng.org/carrier/v1/messages/:id

GET https://api.somleng.org/carrier/v1/messages/b9d94bab-9138-49b1-a14e-5da4441fbe88

Parameters

None known.

Response


200 OK
{
  "data": {
    "id": "b9d94bab-9138-49b1-a14e-5da4441fbe88",
    "type": "message",
    "attributes": {
      "created_at": "2022-12-06T10:49:57Z",
      "updated_at": "2022-12-06T10:49:57Z",
      "to": "+85512334667",
      "from": "2442",
      "sid": "b9d94bab-9138-49b1-a14e-5da4441fbe88",
      "account_sid": "bf7fdd14-ed1c-4540-992d-6591b243b8cc",
      "price": null,
      "price_unit": null,
      "direction": "outbound-api",
      "status": "accepted",
      "body": "Hello World"
    }
  }
}

Update a message

Request

curl "https://api.somleng.org/carrier/v1/messages/529cd655-3bb7-4f3b-b988-71001efb5463" -d '{
  "data": {
    "id": "529cd655-3bb7-4f3b-b988-71001efb5463",
    "type": "message",
    "attributes": {
      "price": "-0.05",
      "price_unit": "USD"
    }
  }
}' -X PATCH \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer d5K4t8urecpm8URNWUD46CyVta-iBB9EjnbG-CxkhWE"

Endpoint

PATCH https://api.somleng.org/carrier/v1/messages/:id

PATCH https://api.somleng.org/carrier/v1/messages/529cd655-3bb7-4f3b-b988-71001efb5463

Parameters

{
  "data": {
    "id": "529cd655-3bb7-4f3b-b988-71001efb5463",
    "type": "message",
    "attributes": {
      "price": "-0.05",
      "price_unit": "USD"
    }
  }
}
Name Description
data[attributes][price] The charge for this message.
data[attributes][price_unit] The currency in which price is measured, in ISO 4127 format. (e.g., USD, EUR, JPY). Always capitalized for messages.

Response


200 OK
{
  "data": {
    "id": "529cd655-3bb7-4f3b-b988-71001efb5463",
    "type": "message",
    "attributes": {
      "created_at": "2022-12-06T10:49:57Z",
      "updated_at": "2022-12-06T10:49:57Z",
      "to": "+85512334667",
      "from": "2442",
      "sid": "529cd655-3bb7-4f3b-b988-71001efb5463",
      "account_sid": "7b91c312-29bd-460c-9e7a-d38860d5001e",
      "price": "-0.05",
      "price_unit": "USD",
      "direction": "outbound-api",
      "status": "sent",
      "body": "Hello World"
    }
  }
}

Phone Calls

List phone calls

Request

curl -g "https://api.somleng.org/carrier/v1/phone_calls?filter[status]=queued&filter[from_date]=2021-11-01T00%3A00%3A00Z&filter[to_date]=2021-11-01T11%3A00%3A00Z&filter[account]=edb11bc9-3963-4dab-a6e4-5e1e2590a23f&filter[direction]=outbound-api" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer 2Ke4ch-E5IraWnijN1LxEXfc74O0fD2tjjdjYQXFjag"

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-01T11%3A00%3A00Z&filter[account]=edb11bc9-3963-4dab-a6e4-5e1e2590a23f&filter[direction]=outbound-api

Parameters

filter: {"status"=>"queued", "from_date"=>"2021-11-01T00:00:00Z", "to_date"=>"2021-11-01T11:00:00Z", "account"=>"edb11bc9-3963-4dab-a6e4-5e1e2590a23f", "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 and outbound-api
filter[status] One of queued, ringing, in-progress, busy, failed, no-answer, completed, and canceled

Response


200 OK
{
  "data": [
    {
      "id": "96082c62-ad69-4a28-9187-1738ecc80f43",
      "type": "phone_call",
      "attributes": {
        "created_at": "2021-11-01T01:00:00Z",
        "updated_at": "2022-12-06T10:50:14Z",
        "to": "+85512334667",
        "from": "2442",
        "sid": "96082c62-ad69-4a28-9187-1738ecc80f43",
        "account_sid": "edb11bc9-3963-4dab-a6e4-5e1e2590a23f",
        "price": null,
        "price_unit": null,
        "duration": null,
        "direction": "outbound-api",
        "status": "queued"
      }
    }
  ],
  "links": {
    "prev": "https://api.somleng.org/carrier/v1/phone_calls?filter%5Baccount%5D=edb11bc9-3963-4dab-a6e4-5e1e2590a23f&filter%5Bdirection%5D=outbound-api&filter%5Bfrom_date%5D=2021-11-01T00%3A00%3A00Z&filter%5Bstatus%5D=queued&filter%5Bto_date%5D=2021-11-01T11%3A00%3A00Z&page%5Bbefore%5D=96082c62-ad69-4a28-9187-1738ecc80f43",
    "next": null
  }
}

Retrieve a phone call

Request

curl -g "https://api.somleng.org/carrier/v1/phone_calls/8bc3900a-0f39-4de0-8a81-eeb0ab1177e7" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer DnWC-HaWDmgtU6gxrMEqLRkQCdJUnDn01PFxWJUn1CI"

Endpoint

GET https://api.somleng.org/carrier/v1/phone_calls/:id

GET https://api.somleng.org/carrier/v1/phone_calls/8bc3900a-0f39-4de0-8a81-eeb0ab1177e7

Parameters

None known.

Response


200 OK
{
  "data": {
    "id": "8bc3900a-0f39-4de0-8a81-eeb0ab1177e7",
    "type": "phone_call",
    "attributes": {
      "created_at": "2022-12-06T10:50:14Z",
      "updated_at": "2022-12-06T10:50:14Z",
      "to": "+85512334667",
      "from": "2442",
      "sid": "8bc3900a-0f39-4de0-8a81-eeb0ab1177e7",
      "account_sid": "b70d9316-ff6e-4aa6-8ef9-3e7e8e5a9a1a",
      "price": null,
      "price_unit": null,
      "duration": null,
      "direction": "outbound-api",
      "status": "queued"
    }
  }
}

Update a phone call

Request

curl "https://api.somleng.org/carrier/v1/phone_calls/a70693b3-241d-4ac2-a296-c56489dcbb7b" -d '{
  "data": {
    "id": "a70693b3-241d-4ac2-a296-c56489dcbb7b",
    "type": "phone_call",
    "attributes": {
      "price": "-0.05",
      "price_unit": "USD"
    }
  }
}' -X PATCH \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer zVWCIJeOxlauiYVk_IWmbWMXbJlD_dLvA_F-Ftrw9zs"

Endpoint

PATCH https://api.somleng.org/carrier/v1/phone_calls/:id

PATCH https://api.somleng.org/carrier/v1/phone_calls/a70693b3-241d-4ac2-a296-c56489dcbb7b

Parameters

{
  "data": {
    "id": "a70693b3-241d-4ac2-a296-c56489dcbb7b",
    "type": "phone_call",
    "attributes": {
      "price": "-0.05",
      "price_unit": "USD"
    }
  }
}
Name Description
data[attributes][price] The charge for this call.
data[attributes][price_unit] The currency in which price is measured, in ISO 4127 format. (e.g., USD, EUR, JPY). Always capitalized for calls.

Response


200 OK
{
  "data": {
    "id": "a70693b3-241d-4ac2-a296-c56489dcbb7b",
    "type": "phone_call",
    "attributes": {
      "created_at": "2022-12-06T10:50:13Z",
      "updated_at": "2022-12-06T10:50:13Z",
      "to": "+85512334667",
      "from": "2442",
      "sid": "a70693b3-241d-4ac2-a296-c56489dcbb7b",
      "account_sid": "ec5b6aea-8f01-4426-8188-8d2f15363578",
      "price": "-0.05",
      "price_unit": "USD",
      "duration": "5",
      "direction": "outbound-api",
      "status": "completed"
    }
  }
}

Phone Numbers

Assign an account to a phone number

Request

curl "https://api.somleng.org/carrier/v1/phone_numbers/2c76a40e-44b0-4190-93f4-b9eff7ccd856" -d '{
  "data": {
    "type": "phone_number",
    "id": "2c76a40e-44b0-4190-93f4-b9eff7ccd856",
    "relationships": {
      "account": {
        "data": {
          "type": "account",
          "id": "4f6f080d-8ee9-4089-9111-cfcd3c75269e"
        }
      }
    }
  }
}' -X PATCH \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer OKjXb6P2uPeyl_-fK8cfnqmtq0-d4LRNDcCPdLKd_k4"

Endpoint

PATCH https://api.somleng.org/carrier/v1/phone_numbers/:id

PATCH https://api.somleng.org/carrier/v1/phone_numbers/2c76a40e-44b0-4190-93f4-b9eff7ccd856

Parameters

{
  "data": {
    "type": "phone_number",
    "id": "2c76a40e-44b0-4190-93f4-b9eff7ccd856",
    "relationships": {
      "account": {
        "data": {
          "type": "account",
          "id": "4f6f080d-8ee9-4089-9111-cfcd3c75269e"
        }
      }
    }
  }
}
Name Description
data[relationships][account] The id of the account to associate the phone number with.

Response


200 OK
{
  "data": {
    "id": "2c76a40e-44b0-4190-93f4-b9eff7ccd856",
    "type": "phone_number",
    "attributes": {
      "created_at": "2022-12-06T10:49:52Z",
      "updated_at": "2022-12-06T10:49:52Z",
      "number": "855972345693",
      "enabled": true
    },
    "relationships": {
      "account": {
        "data": {
          "id": "4f6f080d-8ee9-4089-9111-cfcd3c75269e",
          "type": "account"
        }
      }
    }
  }
}

Create a phone number

Request

curl "https://api.somleng.org/carrier/v1/phone_numbers" -d '{
  "data": {
    "type": "phone_number",
    "attributes": {
      "number": "1294"
    },
    "relationships": {
      "account": {
        "data": {
          "type": "account",
          "id": "8b5cf319-5948-4964-b13a-b740012b2f95"
        }
      }
    }
  }
}' -X POST \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer DbOTWvIriAPlZgf6R9E-NClih-M8a05UlU9KTZGrIXs"

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"
    },
    "relationships": {
      "account": {
        "data": {
          "type": "account",
          "id": "8b5cf319-5948-4964-b13a-b740012b2f95"
        }
      }
    }
  }
}
Name Description
data[attributes][number] required Phone number or shortcode.
data[attributes][enabled] Set to false to disable this number. Disabled phone numbers cannot be used by accounts. Enabled by default.
data[relationships][account] The id of the account to associate the phone number with.

Response


201 Created
{
  "data": {
    "id": "d6ba3b82-a64f-4562-bacf-214c8de0b5c5",
    "type": "phone_number",
    "attributes": {
      "created_at": "2022-12-06T10:49:52Z",
      "updated_at": "2022-12-06T10:49:52Z",
      "number": "1294",
      "enabled": true
    },
    "relationships": {
      "account": {
        "data": {
          "id": "8b5cf319-5948-4964-b13a-b740012b2f95",
          "type": "account"
        }
      }
    }
  }
}

Delete a phone number

Request

curl "https://api.somleng.org/carrier/v1/phone_numbers/9d7852eb-4598-4f0f-aca0-a7d5b2dd861e" -d '' -X DELETE \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer cmHsfWwzqLS9ag64_GkRnwgEDlaF-CdSV08dIjhsnt8"

Endpoint

DELETE https://api.somleng.org/carrier/v1/phone_numbers/:id

DELETE https://api.somleng.org/carrier/v1/phone_numbers/9d7852eb-4598-4f0f-aca0-a7d5b2dd861e

Parameters

None known.

Response


204 No Content

List all phone numbers

Request

curl -g "https://api.somleng.org/carrier/v1/phone_numbers" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer av45K7fZ0uU9Jr5JLXUo1A0Sb0XUw5RcyfydLIpuPos"

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": "9ba8cbda-26b2-4543-a81f-bf2ea8ec63da",
      "type": "phone_number",
      "attributes": {
        "created_at": "2022-12-06T10:49:52Z",
        "updated_at": "2022-12-06T10:49:52Z",
        "number": "855972345695",
        "enabled": true
      },
      "relationships": {
      }
    },
    {
      "id": "a432fc71-6358-4da5-9b9b-83c2eda2a617",
      "type": "phone_number",
      "attributes": {
        "created_at": "2022-12-06T10:49:52Z",
        "updated_at": "2022-12-06T10:49:52Z",
        "number": "855972345694",
        "enabled": true
      },
      "relationships": {
      }
    }
  ],
  "links": {
    "prev": "https://api.somleng.org/carrier/v1/phone_numbers?page%5Bbefore%5D=9ba8cbda-26b2-4543-a81f-bf2ea8ec63da",
    "next": null
  }
}

Release a phone number

Releases a phone number by unassigning the account and removing any configuration.

Request

curl "https://api.somleng.org/carrier/v1/phone_numbers/6042771e-bc68-47d0-be54-d1e88f4e68a3/release" -d '' -X PATCH \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer IL4G7rJZSZNxpiIjcMKv7SRpyRZWeL4jHKkCru-oHHo"

Endpoint

PATCH https://api.somleng.org/carrier/v1/phone_numbers/:id/release

PATCH https://api.somleng.org/carrier/v1/phone_numbers/6042771e-bc68-47d0-be54-d1e88f4e68a3/release

Parameters

None known.

Response


200 OK
{
  "data": {
    "id": "6042771e-bc68-47d0-be54-d1e88f4e68a3",
    "type": "phone_number",
    "attributes": {
      "created_at": "2022-12-06T10:49:52Z",
      "updated_at": "2022-12-06T10:49:52Z",
      "number": "855972345697",
      "enabled": true
    },
    "relationships": {
    }
  }
}

Retrieve a phone number

Request

curl -g "https://api.somleng.org/carrier/v1/phone_numbers/610dd9ce-d39e-40c3-a9ca-ad1c9fea8a83" -X GET \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer Uo0GuGk2btIhxvXTd2li9CHLd6Y6gkInmt-jhW3Zr9k"

Endpoint

GET https://api.somleng.org/carrier/v1/phone_numbers/:id

GET https://api.somleng.org/carrier/v1/phone_numbers/610dd9ce-d39e-40c3-a9ca-ad1c9fea8a83

Parameters

None known.

Response


200 OK
{
  "data": {
    "id": "610dd9ce-d39e-40c3-a9ca-ad1c9fea8a83",
    "type": "phone_number",
    "attributes": {
      "created_at": "2022-12-06T10:49:52Z",
      "updated_at": "2022-12-06T10:49:52Z",
      "number": "855972345690",
      "enabled": true
    },
    "relationships": {
    }
  }
}

Update a phone number

Request

curl "https://api.somleng.org/carrier/v1/phone_numbers/bc72b629-3d13-4e39-8b8f-b7685eb96a98" -d '{
  "data": {
    "type": "phone_number",
    "id": "bc72b629-3d13-4e39-8b8f-b7685eb96a98",
    "attributes": {
      "enabled": false
    }
  }
}' -X PATCH \
    -H "Version: HTTP/1.0" \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer ePcsFdh1Wqayd0IhKAYzI5CSAqIprVMkqfeKrsKnD5M"

Endpoint

PATCH https://api.somleng.org/carrier/v1/phone_numbers/:id

PATCH https://api.somleng.org/carrier/v1/phone_numbers/bc72b629-3d13-4e39-8b8f-b7685eb96a98

Parameters

{
  "data": {
    "type": "phone_number",
    "id": "bc72b629-3d13-4e39-8b8f-b7685eb96a98",
    "attributes": {
      "enabled": false
    }
  }
}
Name Description
data[attributes][enabled] Set to false to disable the phone number or true to enable it. Disabled phone numbers cannot be used by accounts.

Response


200 OK
{
  "data": {
    "id": "bc72b629-3d13-4e39-8b8f-b7685eb96a98",
    "type": "phone_number",
    "attributes": {
      "created_at": "2022-12-06T10:49:52Z",
      "updated_at": "2022-12-06T10:49:52Z",
      "number": "855972345692",
      "enabled": false
    },
    "relationships": {
    }
  }
}