Node.js
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function updatePhone() {
const response = await client.phone.update({
labels: 'Test, Demo'
});
console.log(response);
}
updatePhone();curl -X PATCH \
https://api.periskope.app/v1/phones/update \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"labels": "Test, Demo"
}'{
"created_at": "2024-12-15T11:47:26.668505+00:00",
"first_connected_at": "2024-12-15T11:47:49.649+00:00",
"is_ready": true,
"label_ids": {
"label-bflirzqiodgianfh": true,
"label-rbdshklasmlbfczf": true
},
"labels": [
"test1",
"test2"
],
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"org_phone": "918527184400@c.us",
"phone_id": "phone-bqzvyibhmwkaergr",
"phone_image": "https://storage.googleapis.com/periskope-images/2997dd64-89bf-48d3-9a22-b314fca017e5%2F918527184400%40c.us.jpg?timestamp=1737141384215",
"phone_name": "Support",
"qr_code": null,
"updated_at": "2025-01-20T11:48:40.055+00:00",
"wa_state": "CONNECTED"
}{
"code": "VALIDATION_ERROR",
"fields": {
"labels": {
"message": "labels is missing"
},
"phone_image": {
"message": "phone_image is missing"
},
"phone_name": {
"message": "phone_name is missing"
}
},
"message": "Invalid body. At least one of the following keys are required: phone_name, phone_image, labels",
"name": "Validation Error",
"status": 422
}Phone APIs
Update phone
This endpoint updates properties of the phone
Node.js
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: 'YOUR_PHONE_NUMBER', // e.g., '919876543210'
});
async function updatePhone() {
const response = await client.phone.update({
labels: 'Test, Demo'
});
console.log(response);
}
updatePhone();curl -X PATCH \
https://api.periskope.app/v1/phones/update \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-H 'x-phone: YOUR_PHONE_NUMBER' \
-d '{
"labels": "Test, Demo"
}'{
"created_at": "2024-12-15T11:47:26.668505+00:00",
"first_connected_at": "2024-12-15T11:47:49.649+00:00",
"is_ready": true,
"label_ids": {
"label-bflirzqiodgianfh": true,
"label-rbdshklasmlbfczf": true
},
"labels": [
"test1",
"test2"
],
"org_id": "2997dd64-89bf-48d3-9a22-b314fca017e5",
"org_phone": "918527184400@c.us",
"phone_id": "phone-bqzvyibhmwkaergr",
"phone_image": "https://storage.googleapis.com/periskope-images/2997dd64-89bf-48d3-9a22-b314fca017e5%2F918527184400%40c.us.jpg?timestamp=1737141384215",
"phone_name": "Support",
"qr_code": null,
"updated_at": "2025-01-20T11:48:40.055+00:00",
"wa_state": "CONNECTED"
}{
"code": "VALIDATION_ERROR",
"fields": {
"labels": {
"message": "labels is missing"
},
"phone_image": {
"message": "phone_image is missing"
},
"phone_name": {
"message": "phone_name is missing"
}
},
"message": "Invalid body. At least one of the following keys are required: phone_name, phone_image, labels",
"name": "Validation Error",
"status": 422
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Please provide the number of the phone you want to call with this API in the header. The number must be in country code + number format without any characters or spaces, e.g. 919876543210; Alternatively, provide the phone_id (phone-xxxxxxxxxxxx) in the header
Example:
"918527184400"
Body
application/json
- Updates the name of the phone on WhatsApp.
- Note that phones on the WA Business App cannot be updated
Updates the phone image
- A comma-separated list of labels to be assigned to the phone. All labels are case-insensitive.
- If any label currently does not exist, it will be created
Response
200 OK
The response is a JSON object about the phone . Refer to the phone object here
Was this page helpful?