Skip to content

CallsQr#

Temporary limitations

The Ultra plan, for unlimited calls, can only be connected for new instances. For questions about connecting to the plan and additional conditions, please write to the GREEN-API technical support or to the chat on the website.
At the moment only individual calls are available.

The method is used to get the QR code required to authorize the calls session.

The QR code is updated every 20 seconds, so it is recommended to call the QR code method at an interval of 1 second.

Request#

To get the QR code, you have to execute a request at:

GET
{{apiUrl}}/waInstance{{idInstance}}/callsQr/{{apiTokenInstance}}

The request is executed without parameters.

For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

Response#

Response parameters#

Parameter Type Description
type string Message type, possible values qrCode, alreadyLogged, error
message string Message content. The format depends on the value of the type field

QR code image received#

Parameter Type Description
type string qrCode — QR code image received
message string A 256×256 QR code image in PNG format, encoded in base64. This is a ready-made image, not a string with the QR code content.
To display it in a browser, add the string data:image/png;base64, {message}

Session already authorized#

Parameter Type Description
type string alreadyLogged — the calls session is already authorized. To get a new QR code, first log out the session with the callsLogout method
message string Takes the value instance account already authorized

An error occurred#

Parameter Type Description
type string error — an error occurred
message string Error description
Instance starting — the instance is starting
unexpected agent state: unknown — the calls agent is in an unknown state

Errors#

For a list of errors common to all methods, refer to Common errors section.

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/callsQr/{{apiTokenInstance}}"

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/callsQr/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/callsQr/")
    .append({{apiTokenInstance}});

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.GET, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/callsQr/")
    .append({{apiTokenInstance}});

var response = Unirest.get(requestUrl.toString())
    .header("Content-Type", "application/json")
    .asString();

System.out.println(response);