import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: '919876543210', // the phone to act with (x-phone)
});
async function main() {
const response = await client.phones.getPhoneQr();
console.log(response);
}
main();curl -X GET 'https://api.periskope.app/v1/phones/qr' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210'"<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...\" />"{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "NOT_FOUND_ERROR",
"message": "QR code not available — the phone is already connected or the QR has not been generated yet. Restart or reset the phone to generate one.",
"status": 404
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Get QR
Returns the QR code of the phone as an HTML page with an inline PNG. Scan it with WhatsApp (Settings > Linked Devices) to connect.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
phone: '919876543210', // the phone to act with (x-phone)
});
async function main() {
const response = await client.phones.getPhoneQr();
console.log(response);
}
main();curl -X GET 'https://api.periskope.app/v1/phones/qr' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-phone: 919876543210'"<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...\" />"{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "NOT_FOUND_ERROR",
"message": "QR code not available — the phone is already connected or the QR has not been generated yet. Restart or reset the phone to generate one.",
"status": 404
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Authorizations
Your Periskope API token, sent as Authorization: Bearer <token>. Generate one from the Periskope dashboard under Settings → API & Webhooks. API access requires an active Pro or Enterprise plan.
Headers
Phone to act with: country code + number without symbols or spaces (e.g. 911111111111), or a phone_id (phone-xxxxxxxxxxxx). The phone must be connected to the org and accessible by the API token.
1"919876543210"
Response
HTML page with the QR code as an inline base64 PNG image
HTML snippet containing the QR code as an inline base64 PNG image. Open it in a browser and scan it with WhatsApp (Settings > Linked Devices) to connect.
"<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...\" />"
Was this page helpful?