---
title: Create user
slug: mihai-tests/create-user
createdAt: 2024-05-23T13:14:55.472Z
---

{
  "id": "0xdIUMnmQxP1yhfINQ7bC",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://petstore3.swagger.io/api/v3/user",
    "servers": [
      {
        "url": "https://petstore3.swagger.io/api/v3/user"
      }
    ],
    "name": "Create user",
    "description": "This can only be done by the logged in user.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "Created user object",
          "customType": "User",
          "schema": [
            {
              "name": "id",
              "kind": "optional",
              "type": "integer<int64>",
              "example": 10
            },
            {
              "name": "username",
              "kind": "optional",
              "type": "string",
              "example": "theUser"
            },
            {
              "name": "firstName",
              "kind": "optional",
              "type": "string",
              "example": "John"
            },
            {
              "name": "lastName",
              "kind": "optional",
              "type": "string",
              "example": "James"
            },
            {
              "name": "email",
              "kind": "optional",
              "type": "string",
              "example": "john@email.com"
            },
            {
              "name": "password",
              "kind": "optional",
              "type": "string",
              "example": "12345"
            },
            {
              "name": "phone",
              "kind": "optional",
              "type": "string",
              "example": "12345"
            },
            {
              "name": "userStatus",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "User Status",
              "example": 1
            }
          ],
          "modelRef": "#/components/schemas/User",
          "isExpanded": true
        }
      ],
      "formDataParameters": [
        {
          "name": "id",
          "kind": "optional",
          "type": "integer<int64>",
          "example": 10
        },
        {
          "name": "username",
          "kind": "optional",
          "type": "string",
          "example": "theUser"
        },
        {
          "name": "firstName",
          "kind": "optional",
          "type": "string",
          "example": "John"
        },
        {
          "name": "lastName",
          "kind": "optional",
          "type": "string",
          "example": "James"
        },
        {
          "name": "email",
          "kind": "optional",
          "type": "string",
          "example": "john@email.com"
        },
        {
          "name": "password",
          "kind": "optional",
          "type": "string",
          "example": "12345"
        },
        {
          "name": "phone",
          "kind": "optional",
          "type": "string",
          "example": "12345"
        },
        {
          "name": "userStatus",
          "kind": "optional",
          "type": "integer<int32>",
          "description": "User Status",
          "example": 1
        }
      ],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "default",
        "description": "successful operation",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "customType": "User",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "integer<int64>",
                "example": 10
              },
              {
                "name": "username",
                "kind": "optional",
                "type": "string",
                "example": "theUser"
              },
              {
                "name": "firstName",
                "kind": "optional",
                "type": "string",
                "example": "John"
              },
              {
                "name": "lastName",
                "kind": "optional",
                "type": "string",
                "example": "James"
              },
              {
                "name": "email",
                "kind": "optional",
                "type": "string",
                "example": "john@email.com"
              },
              {
                "name": "password",
                "kind": "optional",
                "type": "string",
                "example": "12345"
              },
              {
                "name": "phone",
                "kind": "optional",
                "type": "string",
                "example": "12345"
              },
              {
                "name": "userStatus",
                "kind": "optional",
                "type": "integer<int32>",
                "description": "User Status",
                "example": 1
              }
            ],
            "modelRef": "#/components/schemas/User",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "PdxwfJW1IHTZHUj-1aGps",
          "language": "curl",
          "label": "cURL",
          "code": "curl --location 'https://petstore3.swagger.io/api/v3/user' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"id\": 0,\n  \"username\": \"\",\n  \"firstName\": \"\",\n  \"lastName\": \"\",\n  \"email\": \"\",\n  \"password\": \"\",\n  \"phone\": \"\",\n  \"userStatus\": 0\n}'"
        },
        {
          "id": "6Th7G8AFYGt0r1ihVg8OA",
          "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   \"id\": 0,\n   \"username\": \"\",\n   \"firstName\": \"\",\n   \"lastName\": \"\",\n   \"email\": \"\",\n   \"password\": \"\",\n   \"phone\": \"\",\n   \"userStatus\": 0\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://petstore3.swagger.io/api/v3/user\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "r9YZACa2udKgBrzDm13ds",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://petstore3.swagger.io/api/v3/user\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"Accept\"] = \"application/json\"\nrequest[\"Content-Type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"id\": 0,\n   \"username\": \"\",\n   \"firstName\": \"\",\n   \"lastName\": \"\",\n   \"email\": \"\",\n   \"password\": \"\",\n   \"phone\": \"\",\n   \"userStatus\": 0\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "20a5kMpW9_OEcLLxvj4fK",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://petstore3.swagger.io/api/v3/user\"\n\npayload = json.dumps({\n   \"id\": 0,\n   \"username\": \"\",\n   \"firstName\": \"\",\n   \"lastName\": \"\",\n   \"email\": \"\",\n   \"password\": \"\",\n   \"phone\": \"\",\n   \"userStatus\": 0\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": "PdxwfJW1IHTZHUj-1aGps"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-default",
          "language": "default",
          "code": "// successful operation\n{\n  \"id\": 10,\n  \"username\": \"theUser\",\n  \"firstName\": \"John\",\n  \"lastName\": \"James\",\n  \"email\": \"john@email.com\",\n  \"password\": \"12345\",\n  \"phone\": \"12345\",\n  \"userStatus\": 1\n}"
        }
      ],
      "selectedLanguageId": "response-0-default"
    }
  },
  "children": [
    {
      "id": "bFUhcblkBcPcJoMPG5kbh",
      "type": "paragraph",
      "children": [
        {
          "text": "This can only be done by the logged in user."
        }
      ]
    }
  ]
}