---
title: Update an existing pet
slug: custom-main-prod/update-an-existing-pet
createdAt: 2025-06-24T07:41:50.932Z
---

{
  "id": "bq1cSSnWv3FkXcrp_0SCQ",
  "type": "api-oas-v2",
  "data": {
    "method": "PUT",
    "url": "//petstore.swagger.io/v2/pet",
    "servers": [
      {
        "url": "//petstore.swagger.io/v2/pet",
        "description": "Default server"
      },
      {
        "url": "//petstore.swagger.io/sandbox/pet",
        "description": "Sandbox server"
      }
    ],
    "name": "Update an existing pet",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "Accept-Language",
          "type": "string",
          "example": "en-US",
          "description": "<p>The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US</p>",
          "default": "en-AU"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "Pettie",
          "description": "Pet object that needs to be added to the store",
          "customType": "Pet",
          "schema": [
            {
              "name": "category",
              "kind": "optional",
              "type": "object",
              "description": "Categories this pet belongs to",
              "modelRef": "#/components/schemas/Category",
              "customType": "Category",
              "schema": [
                {
                  "name": "id",
                  "kind": "optional",
                  "type": "integer",
                  "readOnly": true,
                  "description": "Category ID",
                  "modelRef": "#/components/schemas/Id",
                  "customType": "Id",
                  "schema": []
                },
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "description": "Category name",
                  "example": ""
                },
                {
                  "name": "sub",
                  "kind": "optional",
                  "type": "object",
                  "description": "Test Sub Category",
                  "example": "",
                  "schema": [
                    {
                      "name": "prop1",
                      "kind": "optional",
                      "type": "string",
                      "description": "Dumb Property",
                      "example": ""
                    }
                  ]
                }
              ]
            },
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "The name given to a pet",
              "example": "GuruIsExample",
              "default": "FluffyIsDefault"
            },
            {
              "name": "photoUrls",
              "kind": "required",
              "type": "string,integer,null",
              "description": "The list of URL to a cute photos featuring pet",
              "example": ""
            },
            {
              "name": "friend",
              "kind": "optional",
              "type": "object",
              "description": "",
              "modelRef": "#/components/schemas/Pet",
              "customType": "Pet",
              "schema": [
                {
                  "name": "",
                  "description": "",
                  "customType": "Circular-Reference"
                }
              ]
            },
            {
              "name": "tags",
              "kind": "optional",
              "type": "array",
              "description": "Tags attached to the pet",
              "modelRef": "#/components/schemas/Tag",
              "customType": "Tag[]",
              "schema": [
                {
                  "name": "id",
                  "kind": "optional",
                  "type": "integer",
                  "readOnly": true,
                  "description": "Tag ID",
                  "modelRef": "#/components/schemas/Id",
                  "customType": "Id",
                  "schema": []
                },
                {
                  "name": "name",
                  "kind": "optional",
                  "type": "string",
                  "description": "Tag name",
                  "example": ""
                }
              ]
            },
            {
              "name": "status",
              "kind": "optional",
              "type": "string<available | pending | sold>",
              "description": "Pet status in the store",
              "example": "",
              "default": "pending"
            },
            {
              "name": "petType",
              "kind": "optional",
              "type": "string",
              "description": "Type of a pet",
              "example": "k9"
            },
            {
              "name": "huntingSkill",
              "kind": "optional",
              "type": "integer",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/Pet",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "400",
        "description": "Invalid ID supplied",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Pet not found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "405",
        "description": "Validation exception",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PUT \\\n     --url //petstore.swagger.io/v2/pet \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'accept-language: en-AU' \\\n     --data '{\n     \"name\": \"FluffyIsDefault\",\n     \"photoUrls\": \"\",\n     \"status\": \"pending\"\n     }'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"accept-language\", \"en-AU\");\n\nvar raw = JSON.stringify({\n   \"name\": \"FluffyIsDefault\",\n   \"photoUrls\": \"\",\n   \"status\": \"pending\"\n});\n\nvar requestOptions = {\n   method: 'PUT',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"//petstore.swagger.io/v2/pet\", 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 \"json\"\nrequire \"net/http\"\n\nurl = URI(\"//petstore.swagger.io/v2/pet\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Put.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"accept-language\"] = \"en-AU\"\nrequest.body = JSON.dump({\n   \"name\": \"FluffyIsDefault\",\n   \"photoUrls\": \"\",\n   \"status\": \"pending\"\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"//petstore.swagger.io/v2/pet\"\n\npayload = json.dumps({\n   \"name\": \"FluffyIsDefault\",\n   \"photoUrls\": \"\",\n   \"status\": \"pending\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'accept-language': 'en-AU'\n}\n\nresponse = requests.request(\"PUT\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-400",
          "language": "400",
          "code": "// Invalid ID supplied\n"
        },
        {
          "id": "response-1-404",
          "language": "404",
          "code": "// Pet not found\n"
        },
        {
          "id": "response-2-405",
          "language": "405",
          "code": "// Validation exception\n"
        }
      ],
      "selectedLanguageId": "response-0-400"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}