TypeScript
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
}Phone APIs
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.
TypeScript
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
Headers
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.
Example:
"<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...\" />"
Was this page helpful?