# Get a profile picture of a chat or user

### Get a contact image or chat/group picture

Very often developers and businesses need to retrieve details about a contact, including a profile image. It is quite easy to do it via API. To get chat or profile images in requests such as [Get Chats](https://whapi.readme.io/reference/getchats), [Get Contacts](https://whapi.readme.io/reference/getcontacts), [Get Messages](https://whapi.readme.io/reference/getmessages), [Get communities](https://whapi.readme.io/reference/getcommunities), you need to enable the `init_avatars` setting in the channel and re-authorize.

```json
curl --request PATCH \
     --url https://gate.whapi.cloud/settings \
     --header 'accept: application/json' \
     --header 'authorization: Bearer {your_token}' \
     --header 'content-type: application/json' \
     --data '
{
  "media": {
    "init_avatars": true
  }
}
'
```

Setting `init_avatars: true` allows you to get chat avatars after channel authorization. Thus, you will need to reconnect to the channel again. Or set this setting before connecting. This setting requires only one-time activation and the channel remembers this setting.

{% embed url="<https://whapi.readme.io/reference/updatechannelsettings>" %}
Endpoint to change channel settings
{% endembed %}

### Why is it done this way?

The fact is that uploading contacts and handling profile pictures for WhatsApp is a massive activity, as you are actively getting to know many contacts in a short period of time. To reduce the risks for new fresh numbers, we decided to introduce this setting.&#x20;

This way, you will be out of risk when you connect. However, if your number is already stable with the API, you can safely automatically get profile images of all contacts and chats using this setting.

### How to get a profile pic if the user is not in your Contacts List

The previous setting is only relevant for chats that are present in your app. However, you can also get this information about any contact outside of your phonebook and without corresponding with them. The cell phone user is not made aware of this!

```json
curl --request GET \
     --url https://gate.whapi.cloud/contacts/919984351847/profile \
     --header 'accept: application/json' \
     --header 'authorization: Bearer {your_token}'
```

{% embed url="<https://whapi.readme.io/reference/getcontactprofile>" %}
This method allows you to get profile information (description, profile image) by phone number, even if it is not in your contact list
{% endembed %}

### WhatsApp Profile Picture Retriever Script

This script allows users to bulk retrieve WhatsApp profile pictures by phone numbers. It leverages the Whapi.Cloud API to automate WhatsApp interactions. After connecting your phone to the API and obtaining a token, you can use the script to download profile pictures by providing a list of phone numbers in a CSV file.

{% embed url="<https://github.com/Whapi-Cloud/whatsapp-get-profile-pictures>" %}
Source code for scraper
{% endembed %}

For more information and instructions, [click here](https://github.com/Whapi-Cloud/whatsapp-get-profile-pictures?tab=readme-ov-file#whatsapp-profile-picture-retriever).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.whapi.cloud/help-desk/receiving/http-api/get-a-profile-picture-of-a-chat-or-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
