Unsubscribe a Number
DELETE Method
kaleyra.io enables you to unsubscribe from a number you have subscribed to before using this API. After successfully unsubscribing from a number, it gets deleted from your kaleyra.io platform account, you cannot leverage the features available with the number and any rental fee associated with the number will be terminated. If you have scheduled any campaign with the unsubscribed number, it will be terminated.
Note:
You can unsubscribe only a number at a time from the kaleyra.io platform. In case, if the request contains more than one number, then only the first number will be unsubscribed.
Base URL
https://<api_domain>/v1/<SID>
API Domain and Value
api_domain | Value |
---|---|
IN pod | api.in.kaleyra.io |
SG Pod | api.ap.kaleyra.io |
EU Pod | api.eu.kaleyra.io |
API Request to Unsubscribe from a Number
To unsubscribe from a number, use the <api_domain>/v1/<sid>/number/subscriptions
endpoint with the following request method:
Request Format
The following is the request format to unsubscribe from a number on the kaleyra.io platform:
curl -X DELETE 'https://<api_domain>/v1/<sid>/number/subscriptions' \
-H 'api-key: <api-key>' \
-H "Content-Type: <content-type>"\
-d '{
"numbers": ["<numbers>"]
}'
Sample Request Format
The following is the sample request format to unsubscribe from a number on the kaleyra.io platform:
curl -X DELETE 'https://api.in.kaleyra.io/v1/HXAP16XXXXXX97IN/number/subscriptions' \
-H 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
-H "Content-Type: application/json"\
-d '{
"numbers": ["911234xxxxxx"]
}'
URL Parameters and Headers
Following is the list of parameters and headers to send the API request:
Headers | Data Type | Description | Example | Mandatory? |
---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXAP16XXXXXX97IN | Yes |
api-key | String | API key generated from kaleyra.io account. | Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3 | Yes |
content-type | String | Indicates the format of the content the API will be processing. | The only allowed value is application/json. | Yes |
numbers | Array | Number you want to unsubscribe. | 911234xxxxxx | Yes |
Note:
You can unsubscribe only a number at a time from the kaleyra.io platform. In case, if the request contains more than one number, then only the first number will be unsubscribed.
Response Format
This section provides you the success and failure JSON response formats for different scenarios.
Success Response
The following success response is received when the JSON script has the correct syntax with status code 200 OK
:
{
"code": "CLE402",
"message": "Request Submitted Successfully!",
"error": null
}
Failure Responses
The following failure responses are received when the JSON script has an incorrect syntax:
The following failure response is received when you try to unsubscribe an invalid number with status code 403 Forbidden
:
{
"code": "CLE161",
"message": "Numbers cannot be unsubscribed.",
"error": {
"scalar": "No active subscriptions for the number: 2919967609476256"
}
}
The following failure response is received when you try to unsubscribe without any number with status code 400 Bad Request
:
{
"code": "CLE404",
"status": 400,
"message": "Invalid Inputs, Validation Error.",
"error": {
"numbers": "Invalid numbers provided."
}
}
Updated 15 days ago