---
title: Create user XEvi6LSOEr8dueV1Ecvlf
slug: custom-main-prod/create-user-xevi6lsoer8duev1ecvlf
createdAt: 2025-06-24T07:41:50.938Z
---

{
  "id": "eE1UlUOJVRrAlG_TUsmiq",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "//petstore.swagger.io/v2/user",
    "servers": [
      {
        "url": "//petstore.swagger.io/v2/user",
        "description": "Default server"
      },
      {
        "url": "//petstore.swagger.io/sandbox/user",
        "description": "Sandbox server"
      }
    ],
    "name": "Create user XEvi6LSOEr8dueV1Ecvlf",
    "description": "This can only be done by the logged in user.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Created user object",
          "customType": "User",
          "schema": [
            {
              "name": "pet",
              "kind": "optional",
              "type": "object",
              "complexType": "oneOf",
              "complexItems": [
                {
                  "name": "Pet",
                  "description": "",
                  "modelRef": "#/components/schemas/Pet",
                  "schema": [
                    {
                      "name": "id",
                      "kind": "optional",
                      "type": "integer",
                      "readOnly": true,
                      "description": "Pet ID",
                      "modelRef": "#/components/schemas/Id",
                      "customType": "Id",
                      "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": ""
                    }
                  ]
                },
                {
                  "name": "Tag",
                  "description": "",
                  "modelRef": "#/components/schemas/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": ""
                    }
                  ]
                }
              ],
              "schema": []
            },
            {
              "name": "username",
              "kind": "optional",
              "type": "string",
              "description": "User supplied username",
              "example": "John78"
            },
            {
              "name": "firstName",
              "kind": "optional",
              "type": "string",
              "description": "User first name",
              "example": "John"
            },
            {
              "name": "lastName",
              "kind": "optional",
              "type": "string",
              "description": "User last name",
              "example": "Smith"
            },
            {
              "name": "email",
              "kind": "optional",
              "type": "string<email>",
              "description": "User email address",
              "example": "john.smith@example.com"
            },
            {
              "name": "password",
              "kind": "optional",
              "type": "string<password>",
              "description": "User password, MUST contain a mix of upper and lower case letters, as well as digits",
              "example": "drowssaP123"
            },
            {
              "name": "phone",
              "kind": "optional",
              "type": "string",
              "description": "User phone number in international format",
              "example": "+1-202-555-0192"
            },
            {
              "name": "userStatus",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "User status",
              "example": 0
            },
            {
              "name": "image",
              "kind": "optional",
              "type": "string",
              "description": "User image",
              "example": ""
            },
            {
              "name": "addresses",
              "kind": "optional",
              "type": "array",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            }
          ],
          "modelRef": "#/components/schemas/User",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "default",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url //petstore.swagger.io/v2/user \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"pet\": {\n     \"name\": \"FluffyIsDefault\",\n     \"photoUrls\": \"\",\n     \"status\": \"pending\"\n     }\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\");\n\nvar raw = JSON.stringify({\n   \"pet\": {\n      \"name\": \"FluffyIsDefault\",\n      \"photoUrls\": \"\",\n      \"status\": \"pending\"\n   }\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"//petstore.swagger.io/v2/user\", 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/user\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"pet\": {\n      \"name\": \"FluffyIsDefault\",\n      \"photoUrls\": \"\",\n      \"status\": \"pending\"\n   }\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/user\"\n\npayload = json.dumps({\n   \"pet\": {\n      \"name\": \"FluffyIsDefault\",\n      \"photoUrls\": \"\",\n      \"status\": \"pending\"\n   }\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\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-default",
          "language": "default",
          "code": "// successful operation\n"
        }
      ],
      "selectedLanguageId": "response-0-default"
    }
  },
  "children": [
    {
      "id": "0BQd0KBnWK6tAyJRLswDN",
      "type": "paragraph",
      "children": [
        {
          "text": "This can only be done by the logged in user."
        }
      ]
    }
  ]
}