> ## Documentation Index
> Fetch the complete documentation index at: https://docs.weav.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload article image

> Requires a token with the external-api:write ability. id string required Format: uuid . image file required JPEG, PNG, GIF, or WebP image up to 5 MB Format: binary . cURL JavaScript Python PHP cURL JavaScript Python PHP 201 Created 201 Created url string Format: uri . key string

```http
POST https://api.weav.com/v1/kb-articles/{id}/images
```

Requires a token with the `external-api:write` ability.

## Path parameters

<ParamField path="id" type="string" required>
Format: `uuid`.
</ParamField>

## Body

<ParamField body="image" type="file" required>
JPEG, PNG, GIF, or WebP image up to 5 MB

Format: `binary`.
</ParamField>

## Request

<CodeGroup>

```bash cURL
curl --request POST \
  --url 'https://api.weav.com/v1/kb-articles/{id}/images' \
  --header "Authorization: Bearer ${WEAV_API_TOKEN}" \
  --form 'image=@/path/to/file'
```

```js JavaScript
import fs from 'node:fs';

const formData = new FormData();
formData.append('image', await fs.openAsBlob('/path/to/file'), 'file');
const response = await fetch("https://api.weav.com/v1/kb-articles/{id}/images", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEAV_API_TOKEN}`
  },
  body: formData
});
console.log(await response.json());
```

```python Python
import os
import requests

headers = {"Authorization": f"Bearer {os.environ['WEAV_API_TOKEN']}"}
files = {"image": open("/path/to/file", 'rb')}
response = requests.post("https://api.weav.com/v1/kb-articles/{id}/images", headers=headers, files=files)
print(response.json())
```

```php PHP
use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('POST', 'https://api.weav.com/v1/kb-articles/{id}/images', [
    'headers' => ['Authorization' => 'Bearer '.getenv('WEAV_API_TOKEN')],
    'multipart' => [
        ['name' => 'image', 'contents' => fopen('/path/to/file', 'r')]
    ],
]);
echo $response->getBody();
```

</CodeGroup>

## Response

<CodeGroup>

```json 201 Created
{
    "url": "https://example.com",
    "key": "string"
}
```

</CodeGroup>

## Response fields

<ParamField body="url" type="string">
Format: `uri`.
</ParamField>

<ParamField body="key" type="string">

</ParamField>

---

This knowledge base is built and hosted on [Weav](https://weav.com).
