StartAuthorization#
The method works with limitations
There are limitations on the use of the method on the Telegram side. Even if the method is called successfully, the verification code may not arrive.
For authorization, it is recommended to use the QR and SendAuthorizationPassword methods.
The method is intended for authorizing an instance.
During authorization, a verification code will be sent to the Telegram system chat.
The received code must be sent using the SendAuthorizationCode method to complete the authorization process.
The authorization code remains valid for 5 minutes after it is received.
If less than 5 minutes have passed since the previous
startAuthorizationrequest, a new code will not be sent.
The method uses limits on the request rate per second.
Request#
To start instance authorization, you need to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/startAuthorization/{{apiTokenInstance}}
To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
phoneNumber | integer | Yes | Phone number for authorization in the Telegram messenger |
Request body example#
Request body example:
{
"phoneNumber": 79876543210
}
Response#
Response fields#
| Field | Type | Description |
|---|---|---|
status | boolean | Status of the authorization code request |
true - The method executed successfully | ||
false - The method executed with an error | ||
data | object | Details of the authorization code request |
Fields of the data object#
| Field | Type | Description |
|---|---|---|
status | string | Result of the authorization code request. Possible values: success and fail |
reason | string | Reason for an unsuccessful authorization code request |
already_registered | ||
system_busy | ||
invalid_phone_number | ||
blocked_or_deleted | ||
rate_limit_exceededretryAfter field | ||
timeout_waiting_client | ||
connection_closed | ||
retryAfter | integer | Time until the next request attempt in milliseconds The field is present when "reason": "rate_limit_exceeded" |
Response body example#
Successful execution of the method#
{
"status": true,
"data": {
"status": "success",
"reason": ""
}
}
Execution of the method with an error#
An example when the instance is busy (already waiting for a code):
{
"status": false,
"data": {
"status": "fail",
"reason": "system_busy"
}
}
An example of exceeding the limits:
{
"status": false,
"data": {
"status": "fail",
"reason": "rate_limit_exceeded",
"retryAfter": 6000
}
}
Errors#
For the list of errors common to all methods, see the Common errors section
| HTTP code | Error identifier | Description |
|---|---|---|
| 200 | already_registered | The instance is already authorized |
| 200 | system_busy | The instance is busy with another login process |
| 200 | invalid_phone_number | Incorrect number format |