Skip to content

GetStateInstance#

The method is aimed for getting the account state.

Request#

To get the account state, you have to execute a request at:

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

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

Response#

Response parameters#

Parameter Type Description
stateInstance string Account state. Have variants:
notAuthorized - Account is not authorized. For account authorization refer to Before you start section
authorized - Account is authorized
blocked - Account banned
sleepMode - Status is out of date. Account is in sleep mode. The state is possible when the phone is switched off. After the phone is switched on, it may take up to 5 minutes for the account state to be changed to authorized
starting - The account is in the process of starting up (service mode). An instance, server, or instance in maintenance mode is rebooting. It may take up to 5 minutes for the account state to be set to authorized
yellowCard - Sending messages has been partially or completely suspended on the account due to spamming activity

Response body example#

{
    "stateInstance": "authorized"
}

Errors GetStateInstance#

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

Error Possible solutions
The instance is in the starting state for a long time (more than 5 minutes) 1. Reboot the instance using the reboot method
2. Contact technical support

Request examples#

import requests

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

payload = {}
headers= {}

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

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}.com/waInstance{{idInstance}}/getStateInstance/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getStateInstance/")
    .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("/getStateInstance/")
    .append({{apiTokenInstance}});

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

System.out.println(response);
Sub GetStateInstance()
    Dim url As String
    Dim http As Object
    Dim response As String

    ' The idInstance and apiTokenInstance values are available in your account, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/getStateInstance/{{apiTokenInstance}}"

    Set http = CreateObject("MSXML2.XMLHTTP")

    http.Open "GET", url, False
    http.Send

    response = http.responseText

    Debug.Print response

    ' Outputting the answer to the desired cell
    ' Range("A1").Value = response

    Set http = Nothing
End Sub