# Upload a profile picture

`POST https://api.chat-data.com/api/v2/upload-chatbot-profile-picture/{chatbotId}`

Canonical: https://www.chat-data.com/api-reference/upload-chatbot-profile-picture

## Authentication

Send an API key as a Bearer token: `Authorization: Bearer $CHAT_DATA_API_KEY`. Workspace keys reach every chatbot in the workspace; chatbot-scoped keys reach only their chatbot. Keep keys on the server.

## Description

This API endpoint allows you to update the profile picture of your chatbot. The image is resized to 100×100 pixels.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| chatbotId | path | string | yes | The unique identifier allocated to the chatbot. |

## Request body (`multipart/form-data`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| image | file | yes | The profile picture to upload. It must be a square PNG, JPEG, GIF or WebP image of up to 1 MB. |

## Example request

```bash
curl 'https://api.chat-data.com/api/v2/upload-chatbot-profile-picture/6650f1c2a9e4b83d2c7a1f05' \
  -H "Authorization: Bearer $CHAT_DATA_API_KEY" \
  -F 'image=@"/path/to/image.png"'
```

## Example response (200)

```json
{
  "status": "success"
}
```

## Responses

| Status | Description |
| --- | --- |
| 200 | Successful response. |
| 400 | The image was rejected: no `image` file was sent, it is not a PNG, JPEG, GIF or WebP image, it is not square, or it could not be processed. |
| 401 | Authentication failed: the `Authorization` header is missing or not in the `Bearer <key>` format, the API key does not exist, its workspace is unavailable or has no owner, or the workspace's plan does not include API access. `message` says which. |
| 403 | The API key cannot access the requested chatbot. A chatbot-scoped key used with another chatbot's ID gets `Access denied to this chatbot`. A workspace key gets `Chatbot <id> was not found in this API key's workspace. It may have been deleted or moved to another workspace.` when the chatbot does not exist or belongs to another workspace. |
| 429 | The workspace sent more than 600 API requests in the last minute. Wait the number of seconds given in the `Retry-After` header (and in `message`) before retrying. |
| 500 | The image is larger than 1 MB, or it was sent under a field other than `image`. The upload is rejected before it reaches the handler, and the response is not JSON. |
