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.

You can also add an HMAC encrypted secret which is used for hashing the payload and sending the hashed String via the X-Sinch-Signature header - that you can use to validate that an incoming request is secure.

To use callbacks, add the following IP addresses to your allowlist:

- 54.76.19.159
- 54.78.194.39
- 54.155.83.128

Get callbacks configuration

Returns the callbacks configuration for the specified project

SecurityBasic or OAuth2.0
Request
path Parameters
projectId
required
string

Found on your Sinch Customer Dashboard. Settings > Projects.

Example: d1923022-5199-4bb3-a513-c47b3a656bc5
Responses
200

Callbacks configuration

Response Schema: application/json
projectId
string

ID of the project the configuration belongs to.

hmacSecret
string

The HMAC secret used for hashing the callback body using the HMAC-SHA1 algorithm - and for creating the X-Sinch-Signature header.

400

400 Invalid Argument error

404

404 Not Found error

500

500 Internal Server error

get/v1beta1/projects/{projectId}/callbackConfiguration
Request samples
Response samples
application/json
{
  • "projectId": "a99aa9aa-b888-777c-dd6d-ee55e5555555",
  • "hmacSecret": "YOUR_hmac_secret"
}

Update callback configuration

Updates the callbacks configuration for the specified project

SecurityBasic or OAuth2.0
Request
path Parameters
projectId
required
string

Found on your Sinch Customer Dashboard. Settings > Projects.

Example: d1923022-5199-4bb3-a513-c47b3a656bc5
Request Body schema: application/json

The callback configuration details to be updated.

hmacSecret
string

The HMAC secret to be updated for the specified project

Responses
200

Callback configuration

Response Schema: application/json
projectId
string

ID of the project the configuration belongs to.

hmacSecret
string

The HMAC secret used for hashing the callback body using the HMAC-SHA1 algorithm - and for creating the X-Sinch-Signature header.

400

400 Invalid Argument error

404

404 Not Found error

500

500 Internal Server error

patch/v1beta1/projects/{projectId}/callbackConfiguration
Request samples
application/json
{ }
Response samples
application/json
{
  • "projectId": "a99aa9aa-b888-777c-dd6d-ee55e5555555",
  • "hmacSecret": "YOUR_hmac_secret"
}

Event notificationWebhook

A notification of an event sent to your configured callback URL.

SecurityBasic or OAuth2.0
Request
Request Body schema: application/json
eventId
string

The ID of the event.

timestamp
string

The date and time when the callback was created and added to the callbacks queue.

projectId
string

The ID of the project to which the event belongs.

resourceId
string

The unique identifier of the resource, depending on the resource type. For example, a phone number, a hosting order ID, or a brand ID.

resourceType
string

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.

eventType
string

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.

status
string

The status of the event. For example, SUCCEEDED or FAILED.

failureCode
string

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: "CAMPAIGN_NOT_AVAILABLE" "EXCEEDED_10DLC_LIMIT" "NUMBER_PROVISIONING_FAILED" "PARTNER_SERVICE_UNAVAILABLE" "CAMPAIGN_PENDING_ACCEPTANCE" "MNO_SHARING_ERROR" "CAMPAIGN_PROVISIONING_FAILED" "CAMPAIGN_EXPIRED" "CAMPAIGN_MNO_REJECTED" "CAMPAIGN_MNO_SUSPENDED" "CAMPAIGN_MNO_REVIEW" "INSUFFICIENT_BALANCE" "MOCK_CAMPAIGN_NOT_ALLOWED" "TFN_NOT_ALLOWED" "INVALID_NNID"
Responses
default

200 OK

Request samples
application/json
{
  • "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"
}