---
title: Uploads an image.
description: Upload image of the pet.
url: "https://cbotai.shahrear.msf.bd/docs/uploads-an-image/"
updated: "2026-08-16"
category: Full setup / pet
---

# Uploads an image.

POST`/pet/{petId}/uploadImage`

## Code Samples

```curl

                curl --request POST \
  --url '/api/v3/pet/{petId}/uploadImage' \
  --header 'Authorization: Bearer YOUR_TOKEN'

                const response = await fetch('/api/v3/pet/{petId}/uploadImage', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN'
  }
});

const data = await response.json();
console.log(data);

                import requests

headers = {
    "Authorization": "Bearer YOUR_TOKEN"
}

response = requests.post("/api/v3/pet/{petId}/uploadImage", headers=headers)

print(response.json())

                <?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => '/api/v3/pet/{petId}/uploadImage',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
  'Authorization: Bearer YOUR_TOKEN'
  ],
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;

                using System.Net.Http;

var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST"), "/api/v3/pet/{petId}/uploadImage");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);

                import java.net.URI;
import java.net.http.*;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("/api/v3/pet/{petId}/uploadImage"))
    .header("Authorization", "Bearer YOUR_TOKEN")
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

Upload image of the pet.

## Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `petId` | integer (int64) | **Required** | ID of pet to update |

## Query Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `additionalMetadata` | string | Optional | Additional Metadata |

## Request Body

Content type: `application/octet-stream`

## Responses

### 200 — successful operation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | integer (int32) | Optional |  |
| `type` | string | Optional |  |
| `message` | string | Optional |  |

```json

                {
    "code": 1,
    "type": "string",
    "message": "string"
}
```

### 400 — No file uploaded

### 404 — Pet not found

### default — Unexpected error

## Response

```
200
{
    "code": 1,
    "type": "string",
    "message": "string"
}
```
