---
title: Get a digital twin document
slug: dev/get-a-digital-twin-document
docTags: 
createdAt: 2023-02-23T17:07:09.000Z
---

{
  "id": "ing6_wBpaxRQSxBiiGFc1",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "/digitaltwins",
    "name": "Get a digital twin document",
    "description": "Retrieve a digital twin document for a specific sensor.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "kind": "required",
          "name": "Authorization",
          "type": "string",
          "description": "Auth header",
          "example": "{\"Authorization\":\"Bearer {jwt token}\"}"
        }
      ],
      "queryParameters": [
        {
          "kind": "required",
          "name": "sensor_id",
          "type": "string",
          "description": "ID of the sensor for which the digital twin shall be retrieved."
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "sensor_id",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "ten_sec",
                "kind": "optional",
                "type": "object",
                "example": "{\"p_l1\":0,\"p_l2\":0,\"p_l3\":0,\"q_l1\":0,\"q_l2\":0,\"q_l3\":0,\"last_upd\":\"2023-02-21T15:15:50.000Z\"}",
                "schema": []
              },
              {
                "name": "opm",
                "kind": "optional",
                "type": "object",
                "example": "{\"value\":1,\"last_updt\":\"2023-02-21T15:15:50.000Z\"}",
                "schema": []
              },
              {
                "name": "one_min",
                "kind": "optional",
                "type": "object",
                "example": "",
                "schema": []
              },
              {
                "name": "load_mgmt",
                "kind": "optional",
                "type": "object",
                "example": "",
                "schema": []
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Error name",
                "example": "BadRequest"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Data does not match schema"
              },
              {
                "name": "code",
                "kind": "optional",
                "type": "number",
                "description": "HTTP status code",
                "example": 400
              },
              {
                "name": "className",
                "kind": "optional",
                "type": "string",
                "description": "Error class name",
                "example": "bad-request"
              },
              {
                "name": "data",
                "kind": "optional",
                "type": "string",
                "description": "Error data",
                "example": ""
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "array",
                "description": "Description of errors",
                "example": "[\"detailed description of error\"]",
                "itemType": "object",
                "customType": "object[]",
                "itemExample": ""
              }
            ],
            "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
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Error name",
                "example": "Forbidden"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Access Forbidden"
              },
              {
                "name": "code",
                "kind": "optional",
                "type": "number",
                "description": "HTTP status code",
                "example": 403
              },
              {
                "name": "className",
                "kind": "optional",
                "type": "string",
                "description": "Error class name",
                "example": "forbidden"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "object",
                "description": "Description of errors",
                "example": "",
                "schema": []
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "R8N99XmDEo9_enjjiJbsZ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url '/digitaltwins?sensor_id=string' \\\n     --header 'accept: application/json' \\\n     --header 'authorization: {\"Authorization\":\"Bearer {jwt token}\"}'"
        },
        {
          "id": "06Bc4bZBF64f1byMfWbDv",
          "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(\"/digitaltwins?sensor_id=string\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "3wf1Qs3CLjbMF_M5rgbEt",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/digitaltwins?sensor_id=string\")\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": "Ug109jsYt-PN3JFU8WabI",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/digitaltwins?sensor_id=string\"\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": "R8N99XmDEo9_enjjiJbsZ"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n{\n  \"sensor_id\": \"\",\n  \"ten_sec\": {},\n  \"opm\": {},\n  \"one_min\": {},\n  \"load_mgmt\": {}\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n{\n  \"name\": \"BadRequest\",\n  \"message\": \"Data does not match schema\",\n  \"code\": 400,\n  \"className\": \"bad-request\",\n  \"data\": \"\",\n  \"errors\": [\n    {}\n  ]\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized\n{\n  \"name\": \"NotAuthenticated\",\n  \"message\": \"Not authenticated\",\n  \"code\": 401,\n  \"className\": \"not-authenticated\",\n  \"errors\": {}\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Forbidden\n{\n  \"name\": \"Forbidden\",\n  \"message\": \"Access Forbidden\",\n  \"code\": 403,\n  \"className\": \"forbidden\",\n  \"errors\": {}\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "id": "6xXI4jHs08yoX4fc_ySPo",
      "type": "paragraph",
      "children": [
        {
          "text": "Retrieve a digital twin document for a specific sensor."
        }
      ]
    }
  ]
}