Change Blocklist Status for Number
POST Method
The Change Blocklist Status for Number API allows you to change the status of one or multiple phone numbers, determining whether they should be included in the blocklist or not.
Note:
- Status "0" is used to remove a blocklist status from a number and "1" is used to add a blocklist status to a number.
- If a number is passed with Status “1” that was not previously in the blocklist status, then that number is added to the blocklist.
- You can update the blocklist status for up to 100 contacts per request.
Base URL
<https://api.kaleyra.io/v1/><SID>
To change the status of numbers in the blocklist (blocked or unblocked), perform the following steps:
- Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
- Change the status of numbers in the blocklist API request.
API request to change the status of numbers in the blocklist (blocked or unblocked)
To change the status of numbers in the blocklist, use the /contacts/blocklisted
endpoint with the following request method:
Request Format
The following is the request format to change the status of the numbers in the blocklist (blocked or unblocked).
curl -X POST 'https://api.kaleyra.io/v1/<SID>/contacts/blocklisted' \
--header 'api-key: <api_key>' \
--header 'content-type: <content_type> ' \
--data '{"channel":<channel_name>,"contacts":[{"blocklist_status":<blocklist_status>,"numbers":["<mobile_numbers>"]}]}'
Sample Request Format
curl -X POST ' https://api.kaleyra.io/v1/HXXXXXXX071US/contacts/blocklisted' \
-header 'api-key: A522b7e64XXXXXXXXf7d99b03545fa68e' \
-header 'content-type: application/json' \
-data '{"channel":"sms","contacts":[{"blocklist_status":1,"numbers":["+9188XXXX6328","+91620XXXX124"]},{"blocklist_status":0,"numbers":["+9170XXXX9399","+9197XXXX5019"]}]}'
Parameter and Data Types
The following table shows the list of parameters and data types supported:
Parameter | Data Type | Description | Examples | Mandatory |
---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXXXXXXX071US | Yes |
api-key | String | Your API Key generated by Kaleyra.io. | A522b7e64XXXXXXXXf7d99b03545fa68e | Yes |
content_type | JSON | Specifies the type of data being sent in the request. | application/json | Yes |
channel | String | Channel for which the contacts are blocklisted. The acceptable value is "sms", "whatsapp", and "voice". | sms | Yes |
The following table describes the different attributes used for the contacts array.
Parameter | Data Type | Description | Example | Mandatory |
---|---|---|---|---|
blocklist_status | Integer | Indicates the blocklisting status (1 for blocking and 0 for unblocking). | 1 | Yes |
numbers | Array of string | Specifies the phone numbers being blocklisted. | ["+9188XXXX6328","+91620XXXX124"] | Yes |
Sample Success Response to change the status of the numbers in the blocklist
The following success message appears with the status 200 succeeded.
{
"code": "RBC024",
"message": "Request processed",
"data": [],
"error": {}
}
Sample Failure Response
The following is a sample failure response.
{
"status": 400,
"code": "E413",
"message": "Invalid/incorrect inputs",
"error": {
"type": "Invalid/incorrect inputs"
}
}
Updated 2 months ago