Resubscribe a Number
POST Method
kaleyra.io enables you to resubscribe to a number using this API.
The following are the conditions to resubscribe to a number:
- The number has been unsubscribed from your account.
- The number must be in the subscription period. For example, if your subscription is from April 1 to April 30 and you have unsubscribed on April 20, then you will be able to resubscribe until April 30 with no additional charges. You have to pay the additional charges for the subscription after the validity of the number has expired.
Note:
You can resubscribe only a number in a request from the kaleyra.io platform. If the request contains more than one number, then only the first number will be resubscribed.
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 Resubscribe to a Number
To resubscribe to a number, use the <api_domain>/v1/<sid>/number/resubscribe
endpoint with the following request method:
Request Format
The following is the request format to resubscribe to a number on the kaleyra.io platform:
curl -X POST 'https://<api_domain>/v1/<sid>/number/resubscribe'\
-H 'api-key: <api-key>' \
-H "Content-Type: <content-type>"\
-d '{
"numbers": ["<numbers>"]
}'
Sample Request Format
The following is the sample request format to resubscribe to a number on the kaleyra.io platform:
curl -X POST 'https://api.in.kaleyra.io/v1/HXAP16xxxxxx97IN/number/resubscribe'\
-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 resubscribe. | 911234xxxxxx | Yes |
Note:
You can resubscribe only a number in a request from the kaleyra.io platform. If the request contains more than one number, then only the first number will be resubscribed.
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 you try to resubscribe an invalid number with status code 403 Forbidden
.
{
"code": "CLE163",
"message": "Numbers cannot be resubscribed.",
"error": {
"scalar": "No unsubscription found for the number: 91384142xxxxxx"
}
}
The following failure responses are received when you try to resubscribe an empty number with status code 400 Bad Request
.
{
"code": "CLE404",
"status": 400,
"message": "Invalid Inputs, Validation Error.",
"error": {
"numbers": "Invalid numbers provided."
}
}
Updated 7 days ago