API for importing, hosting, and qualifying numbers to enable them for use with Sinch SMS text messaging services.
- API reference
- Imported and Hosted Numbers Overview
- Update callback configuration
Imported Numbers and Hosting Orders (1.0)
https://imported.numbers.api.sinch.com/
Hosting Orders
Hosted numbers provide you with an easy method to port your SMS enabled numbers to Sinch or to use SMS messaging and other products to send and receive messages, on voice-enabled numbers (including landline numbers) that you already own.
Note: The SMS enablement process is only supported in United States and Canada.
The Hosting Orders API allows you to manage all the numbers that you are hosting on the Sinch platform. This includes numbers that you have ported to Sinch and/or any non- Sinch numbers that you already own and are hosting on Sinch to enable Sinch SMS messaging and other products.
Imported Numbers
Use the Imported Numbers API endpoints to list imported numbers or import a number that's already been provisioned with an NNID for use with Sinch. Imported numbers can be used with Sinch SMS services.
Note: The SMS enablement process is only supported in United States and Canada.
Qualified Numbers
You can use the Qualified Numbers API to qualify numbers you want Sinch to host and have available for use with Sinch SMS services. Qualifying a number involves verifying ownership of a number either by providing a one time passcode sent to the number by voice call or by providing invoices for multiple numbers. Once numbers are qualified, you can then enable those numbers for SMS text messaging services.
Note: The SMS enablement process is only supported in United States and Canada.
Imported Numbers and Hosting Orders Callbacks
You can set up callback URLs to receive event notifications when your numbers are updated.
When delivering events the order is not guaranteed (for example, a failed event scheduled for retry will not block other events that were queued).
The client's callback handler must implement the state machine that can decide what to do with unexpected events, for example, "old" events or invalid state transitions. In these cases the handler could use the API to GET the latest state for the resource.
The callback handler is expected to "ingest" the event and respond with 200 OK. The domain-specific business logic and processes should be executed outside of the callback request, as internal asynchronous jobs.
To use callbacks, add the following IP addresses to your allowlist:
- 54.76.19.159
- 54.78.194.39
- 54.155.83.128
Implementing HMAC (Hash-based Message Authentication Code) on your webhook endpoints will ensure the integrity of data, preventing tampering during transmission. An HMAC used in webhooks is a common approach in the industry and essentially it is just special code that can be used to check if a message hasn't been tampered with during the transmission.
We recommend to configure an HMAC secret for your project using the callback configuration. Then, when sending the number events, the HTTP POST requests will include the header X-Sinch-Signature with the computed HMAC.
NOTE: The HMAC secret is configured per project; if you are using the Numbers API with multiple projects, make sure you configure the HMAC secret in each project, and fetch it for either imported or purchased numbers from the dedicated endpoints.
We recommend to verify the HMAC code received with every event in your event handler. When receiving a new event on your endpoint URL, compute the HMAC of the payload using the secret (configured here) and compare it with one received in the X-Sinch-Signature header.
NOTE: Compute the HMAC on the plain text value before parsing the JSON payload.
Found on your Sinch Customer Dashboard. Settings > Projects.
- Global API
https://imported.numbers.api.sinch.com/v1/projects/{projectId}/callbackConfiguration
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://imported.numbers.api.sinch.com/v1/projects/d1923022-5199-4bb3-a513-c47b3a656bc5/callbackConfiguration{ "projectId": "a99aa9aa-b888-777c-dd6d-ee55e5555555", "hmacSecret": "YOUR_hmac_secret" }
Found on your Sinch Customer Dashboard. Settings > Projects.
The callback configuration details to be updated.
- Global API
https://imported.numbers.api.sinch.com/v1/projects/{projectId}/callbackConfiguration
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PATCH \
-u <username>:<password> \
https://imported.numbers.api.sinch.com/v1/projects/d1923022-5199-4bb3-a513-c47b3a656bc5/callbackConfiguration \
-H 'Content-Type: application/json' \
-d '{
"hmacSecret": "string"
}'{ "projectId": "a99aa9aa-b888-777c-dd6d-ee55e5555555", "hmacSecret": "YOUR_hmac_secret" }
The date and time when the callback was created and added to the callbacks queue.
The ID of the project to which the event belongs.
The unique identifier of the resource, depending on the resource type. For example, a phone number, a hosting order ID, or a brand ID.
The type of the resource.
| Enum Value | Description |
|---|---|
| HOSTING_ORDER_NUMBER | Numbers that are imported as part of a hosting order. |
| IMPORTED_NUMBER | Numbers imported individually or previously imported successfully via hosting orders but later updated. |
The type of the event.
| Enum Value | Description |
|---|---|
| PROVISIONING_TO_SMS_PLATFORM | An event that occurs when a number is linked to a Service Plan ID. |
| DEPROVISIONING_TO_SMS_PLATFORM | An event that occurs when a number is unlinked from a Service Plan ID. |
| LINK_TO_10DLC_CAMPAIGN | An event that occurs when a number is linked to a Campaign. |
| UNLINK_TO_10DLC_CAMPAIGN | An event that occurs when a number is unlinked from a Campaign. |
The status of the event. For example, SUCCEEDED or FAILED.
| Enum Value | Description |
|---|---|
| SUCCEEDED | The event has succeeded. |
| FAILED | The event has failed. |
If the status is FAILED, a failure code will be provided. For numbers provisioning to SMS platform, there won't be any extra failureCode, as the result is binary. For campaign provisioning-related failures, refer to the list for the possible values.
| Enum Value | Description |
|---|---|
| CAMPAIGN_NOT_AVAILABLE | The specified campaign is not available. |
| EXCEEDED_10DLC_LIMIT | Exceeded the limit for 10DLC. |
| NUMBER_PROVISIONING_FAILED | Provisioning the number failed. |
| PARTNER_SERVICE_UNAVAILABLE | The third party service is unavailable. |
| CAMPAIGN_PENDING_ACCEPTANCE | The campaign is not yet accepted. |
| MNO_SHARING_ERROR | Error with MNO. |
| CAMPAIGN_PROVISIONING_FAILED | The campaign failed to provision. |
| CAMPAIGN_EXPIRED | The campaign expired. |
| CAMPAIGN_MNO_REJECTED | The campaign MNO was rejected. |
| CAMPAIGN_MNO_SUSPENDED | The campaign MNO was suspended. |
- Global API
https://imported.numbers.api.sinch.com/EventsCallback
{ "eventId": "abcd1234efghijklmnop567890", "timestamp": "2023-06-06T07:45:27.785357", "projectId": "abcd12ef-ab12-ab12-bc34-abcdef123456", "resourceId": "+12345612345", "resourceType": "IMPORTED_NUMBER", "eventType": "LINK_TO_10DLC_CAMPAIGN", "status": "FAILED", "failureCode": "CAMPAIGN_NOT_AVAILABLE" }