---
title: Get a list of sensors
slug: dev/get-a-list-of-sensors
docTags: 
createdAt: 2023-02-23T17:07:09.000Z
---

{
  "id": "skAhIO6U3XVuLlM_O6lm9",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "/sensors",
    "name": "Get a list of sensors",
    "description": "Returns a list of all sensors that the authenticated user has access to.",
    "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": ""
              },
              {
                "name": "hw_serial",
                "kind": "optional",
                "type": "string",
                "example": "SE01000000"
              },
              {
                "name": "status",
                "kind": "optional",
                "type": "number",
                "example": 1
              },
              {
                "name": "user_id",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "fw_version",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "sensor_profile",
                "kind": "optional",
                "type": "object",
                "example": "{\"label\":\"My sensor\",\"street_and_number\":\"Flurstrasse 30\",\"zip_code\":8048,\"city\":\"Zürich\",\"country\":\"sui\"}",
                "schema": []
              },
              {
                "name": "sensor_type",
                "kind": "optional",
                "type": "string",
                "example": "clemap_lm"
              }
            ],
            "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": "jDWqrMnoIYBL_2b0-Wrin",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url /sensors \\\n     --header 'accept: application/json' \\\n     --header 'authorization: {\"Authorization\":\"Bearer {jwt token}\"}'"
        },
        {
          "id": "yaEgH3IERnRlPbXorayhz",
          "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(\"/sensors\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "_aKsSYXcLtH2at86j5z6v",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/sensors\")\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": "brzCVPFnEbTSE346PBlKx",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/sensors\"\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": "jDWqrMnoIYBL_2b0-Wrin"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n[\n  {\n    \"_id\": \"\",\n    \"hw_serial\": \"SE01000000\",\n    \"status\": 1,\n    \"user_id\": \"\",\n    \"fw_version\": \"\",\n    \"sensor_profile\": {},\n    \"sensor_type\": \"clemap_lm\"\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": "UijURpXglWGfxc1frRUTP",
      "type": "paragraph",
      "children": [
        {
          "text": "Returns a list of all sensors that the authenticated user has access to."
        }
      ]
    }
  ]
}