---
title: Get your own user
slug: dev/get-your-own-user
docTags: 
createdAt: 2023-02-23T17:07:09.000Z
---

{
  "id": "ClsB5138hH8736Rx5x8mP",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "/users",
    "name": "Get your own user",
    "description": "Get your own user",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "kind": "required",
          "name": "Authorization",
          "type": "string",
          "description": "Auth header",
          "example": "{\"Authorization\":\"Bearer {jwt token}\"}"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "array",
            "schema": [
              {
                "name": "_id",
                "kind": "optional",
                "type": "string",
                "example": "myUserId"
              },
              {
                "name": "email",
                "kind": "optional",
                "type": "string",
                "example": "myEmail@clemap.ch"
              },
              {
                "name": "isVerified",
                "kind": "optional",
                "type": "boolean",
                "example": false
              }
            ],
            "itemType": "object",
            "customType": "object[]",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Error name",
                "example": "NotAuthenticated"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Not authenticated"
              },
              {
                "name": "code",
                "kind": "optional",
                "type": "number",
                "description": "HTTP status code",
                "example": 401
              },
              {
                "name": "className",
                "kind": "optional",
                "type": "string",
                "description": "Error class name",
                "example": "not-authenticated"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "object",
                "description": "Description of errors",
                "example": "",
                "schema": []
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "6nVr1453ArUv6h-8k4vZG",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url /users \\\n     --header 'accept: application/json' \\\n     --header 'authorization: {\"Authorization\":\"Bearer {jwt token}\"}'"
        },
        {
          "id": "kTwG3cO_9KwP9j1ttZ1lT",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"authorization\", \"{\\\"Authorization\\\":\\\"Bearer {jwt token}\\\"}\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/users\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "YmgrtZaJM3GgU1Nz3YVNp",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/users\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"authorization\"] = \"{\\\"Authorization\\\":\\\"Bearer {jwt token}\\\"}\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "6Gmlvh2xrH_JONLkJqFmA",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/users\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'authorization': '{\"Authorization\":\"Bearer {jwt token}\"}'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "6nVr1453ArUv6h-8k4vZG"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n[\n  {\n    \"_id\": \"myUserId\",\n    \"email\": \"myEmail@clemap.ch\",\n    \"isVerified\": false\n  }\n]"
        },
        {
          "id": "response-1-401",
          "language": "401",
          "code": "// Unauthorized\n{\n  \"name\": \"NotAuthenticated\",\n  \"message\": \"Not authenticated\",\n  \"code\": 401,\n  \"className\": \"not-authenticated\",\n  \"errors\": {}\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "id": "9jld3gLx7jsVcHi33_5jR",
      "type": "paragraph",
      "children": [
        {
          "text": "Get your own user"
        }
      ]
    }
  ]
}