---
title: Uploads an image.
slug: montsetesting/uploads-an-image
createdAt: 2026-10-06T04:09:55.211Z
---

{
  "id": "Z9n8CvfL4d0c4Vu-FtYLC",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/api/v3/pet/{petId}/uploadImage",
    "servers": [
      {
        "url": "/api/v3/pet/{petId}/uploadImage"
      }
    ],
    "name": "Uploads an image.",
    "description": "Upload image of the pet.",
    "contentType": "application/octet-stream",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "petId",
          "type": "integer<int64>",
          "description": "ID of pet to update",
          "format": "int64"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "additionalMetadata",
          "type": "string",
          "description": "Additional Metadata"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "petstore_auth",
          "name": "petstore_auth",
          "kind": "optional",
          "type": "oauth2",
          "oauth2Flows": {
            "implicit": {
              "authorizationUrl": "https://petstore3.swagger.io/oauth/authorize",
              "scopes": {
                "write:pets": "modify pets in your account",
                "read:pets": "read your pets"
              }
            }
          },
          "requiredScopes": [
            "write:pets",
            "read:pets"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ApiResponse",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "integer<int32>",
                "description": "",
                "format": "int32"
              },
              {
                "name": "type",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "modelRef": "#/components/schemas/ApiResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "No file uploaded",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Pet not found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "default",
        "description": "Unexpected error",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /api/v3/pet/{petId}/uploadImage \\\n     --header 'accept: application/json'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/octet-stream\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/api/v3/pet/{petId}/uploadImage\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"/api/v3/pet/{petId}/uploadImage\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/octet-stream\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"/api/v3/pet/{petId}/uploadImage\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/octet-stream'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// successful operation\n{\n  \"code\": \"\",\n  \"type\": \"\",\n  \"message\": \"\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// No file uploaded\n"
        },
        {
          "id": "response-2-404",
          "language": "404",
          "code": "// Pet not found\n"
        },
        {
          "id": "response-3-default",
          "language": "default",
          "code": "// Unexpected error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}