GetStateInstanceHistory#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method returns the history of the instance state in chronological order - from the most recent to the earlier ones, no more than 100 records.
The method uses the limits on the number of requests per second.
Request#
To get the history of the state, you have to execute a request at:
GET
{{apiUrl}}/waInstance{{idInstance}}/getStateInstanceHistory/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
stateInstance | string | The instance state |
username | string | The username of the instance account at the moment of the state change, in the @username form.An empty string if the username is unknown |
timestamp | integer | The time of the state change in UNIX format (in seconds) |
Response body example#
[
{
"stateInstance": "authorized",
"username": "@green_api_eng",
"timestamp": 1766486400
},
{
"stateInstance": "notAuthorized",
"username": "",
"timestamp": 1766313600
}
]
GetStateInstanceHistory errors#
For a list of errors common to all methods, refer to the Common errors section
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/getStateInstanceHistory/{{apiTokenInstance}}"
response = requests.get(url)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getStateInstanceHistory/{{apiTokenInstance}}'