GetInstances#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method is used to get all the instances of a partner account.
Request#
To get all the instances of the account, you have to execute a GET request at:
{{partnerApiUrl}}/partner/getInstances/{{partnerToken}}
The
partnerApiUrlparameter can be seen in the console.The
partnerTokenrequest parameter is obtained via GREEN-API technical support by requesting a partnership API key.
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
idInstance | integer | The identifier of the account instance. A uint64 value, 10 digits |
name | string | The name of the instance specified by the user in the console or by the createInstance method |
typeInstance | string | The messenger type of the instance: instagram, whatsapp, telegram or v3 (for MAX) |
typeAccount | string | Not used |
partnerUserUiid | string | Not used |
timeCreated | string | The time the instance was created |
timeDeleted | string | The time the instance was deleted |
apiTokenInstance | string | The API token of the account instance |
deleted | boolean | The state of the instance, it shows whether the instance is deleted or active, it takes the values true/false |
tariff | string | The plan connected to the instance |
isFree | boolean | The flag indicates a free instance, for example an instance of the "Developer" plan. It takes the values true/false. |
isPartner | boolean | The flag indicates whether the instance has the "Partner" plan, it takes the values true/false |
expirationDate | string | The expiration date of the instance (partner instances are renewed automatically) |
isExpired | boolean | The state of the instance, it shows whether the instance has expired or not, it takes the values true/false |
Response body example#
In case of success, a JSON string of the following form is returned in response to the request with the HTTP status 200:
[
{
"idInstance": 5100000000,
"name": "Instance 5100000000",
"typeInstance": "instagram",
"typeAccount": "",
"partnerUserUiid": "",
"timeCreated": "2022-06-03T18:39:44",
"timeDeleted": "0001-01-01T00:00:00",
"apiTokenInstance": "1f2485e80f474293b935f77d78c64e76fa4bdceb417a4998a4",
"deleted": false,
"tariff": "PARTNER_23",
"isFree": false,
"isPartner": true,
"expirationDate": "2022-06-09T18:39:44",
"isExpired": false
},
{
"idInstance": 5100000001,
"name": "Instance 5100000001",
"typeInstance": "instagram",
"typeAccount": "",
"partnerUserUiid": "",
"timeCreated": "2022-06-07T10:36:48",
"timeDeleted": "2022-06-07T10:37:00",
"apiTokenInstance": "35d8b4907f8e494289b1d5f999e3582940ceffc413bf4a76b1",
"deleted": true,
"tariff": "PARTNER_23",
"isFree": false,
"isPartner": true,
"expirationDate": "2022-06-08T10:36:48",
"isExpired": false
},
{
"idInstance": 5100000002,
"name": "Instance 5100000002",
"typeInstance": "instagram",
"typeAccount": "",
"partnerUserUiid": "",
"timeCreated": "2022-06-08T09:12:13",
"timeDeleted": "2022-06-08T09:19:04",
"apiTokenInstance": "c8b0474542154e0ead529eb3861ca5f483c346eb00564f64a7",
"deleted": true,
"tariff": "PARTNER_23",
"isFree": false,
"isPartner": true,
"expirationDate": "2022-06-09T09:12:13",
"isExpired": false
}
]
To get the parameters of the account instances, the corresponding API methods are used.
If an incorrect token is entered, a response with the HTTP status 200 is returned, and the response body contains a JSON string with the code and the description of the error:
{
"code": 401,
"description": "Unauthorized"
}
In the other cases of failure, a response with the HTTP status 400 and the error text is returned.
GetInstances errors#
For a list of errors common to all methods, refer to the Common errors section
Request examples#
import requests
url = "https://api.green-api.com/partner/getInstances/{{partnerToken}}"
payload = {}
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location --globoff 'https://api.green-api.com/partner/GetInstances/{{partnerToken}}' \
--data ''
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.green-api.com/partner/GetInstances/{{partnerToken}}")
.body("")
.asString();