Skip to content

GetStateInstance Test#

The method is aimed for getting the instance state.


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


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


Response parameters#

Parameter Type Description
stateInstance string Instance state. Have variants:
notAuthorized - Instance is not authorized. For instance authorization refer to Before you start section
authorized - Instance is authorized
blocked - Instance banned
sleepMode - Status is out of date. Instance 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 instance state to be changed to authorized
starting - The instance 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 instance state to be set to authorized
yellowCard - Sending messages has been partially or completely suspended on the account due to spamming activity. Messages sent after receiving the status are stored in the queue to be sent for 24 hours. To continue running the instance, you need to do a reboot of the instance

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)

curl --location '{{apiUrl}}/waInstance{{idInstance}}/getStateInstance/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();

var response =, HttpMethod.GET, null, String.class);
var requestUrl = new StringBuilder();

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

Sub GetStateInstance()
    Dim url As String
    Dim http As Object
    Dim response As String

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

    Set http = CreateObject("MSXML2.XMLHTTP")

    http.Open "GET", url, False

    response = http.responseText

    Debug.Print response

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

    Set http = Nothing
End Sub