Skip to content

GetAvatar#

Test Postman

The method returns the avatar of a correspondent or a group chat.

The method uses limits on the request rate per second.

Request#

To get an avatar, you need to execute a request at:

POST
{{apiUrl}}/waInstance{{idInstance}}/getAvatar/{{apiTokenInstance}}

To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.

Request parameters#

Parameter Type Required Description
chatId string Yes Chat or group chat identifier

Request body example#

To get your own avatar, specify your chatId in the request.
You can get it using the getAccountSettings method.

Get a user's avatar#

{
    "chatId": "10000000"
}

Get a group chat avatar#

{
    "chatId": "-10000000000000"
}

Response#

Response fields#

Field Type Description
urlAvatar string Link to the avatar of the correspondent or the group chat. The parameter takes an empty value if the avatar is not set or privacy settings restricting access to the avatar are enabled

Response body example#

Successful execution of the method#

{
    "urlAvatar": "https://i.oneme.ru/i?r=BTE2sh_eZW7g8kugOdIm2NotBPGJiDHPpKQP3fE_vh2BE1holGE_adbUwUqCIPQgiOI",
}

Execution of the method with an error#

{
    "statusCode": 400,
    "timestamp": "2025-08-21T13:02:16.247Z",
    "path": "/waInstance4100000001/getAvatar/9ece01c05bbe44768fb674840138bbe6af876fe49b69418fbf",
    "message": "Validation failed. Details: 'chatId' must be one of the next formats: 'user_id' or 'group_id'"
}

GetAvatar errors#

For the list of errors common to all methods, see the Common errors section

HTTP code Error identifier Description
400 Bad Request
Validation failed
Validation error

Code examples#

import requests

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

payload = "{\r\n    \"chatId\": \"10000000\"\r\n}"
headers = {'Content-Type': 'application/json'}

response = requests.post(url, json=payload)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getAvatar/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "10000000"
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getAvatar/")
    .append({{apiTokenInstance}});

var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);

var jsonBody = "{\"chatId\": \"10000000\"}";

var requestEntity = new HttpEntity<>(jsonBody, headers);

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.POST, requestEntity, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getAvatar/")
    .append({{apiTokenInstance}});

var response = Unirest.post(requestUrl.toString())
    .header("Content-Type", "application/json")
    .body("{\"chatId\": \"10000000\"}")
    .asString();

System.out.println(response);
Sub GetAvatar()
    Dim url As String
    Dim RequestBody 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}}/GetAvatar/{{apiTokenInstance}}"

    ' chatId - is the number to send the message to (@c.us for private chats, @g.us for group chats)
    RequestBody = "{""chatId"":""10000000""}"

    Set http = CreateObject("MSXML2.XMLHTTP")

    With http
        .Open "POST", url, False
        .setRequestHeader "Content-Type", "application/json"
        .Send RequestBody
    End With

    response = http.responseText

    Debug.Print response

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

    Set http = Nothing
End Sub