---
title: Register a device
slug: docs/demo/register-a-device
description: Learn how to make a POST request to an API endpoint using the curl command with this code example. The provided headers and JSON payload cover crucial information regarding devices and their corresponding policies.
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "f7rT4S6br08VY82E1QFy3",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/device-policies/{devicePolicyReference}/devices",
    "name": "Register a device",
    "method": "POST",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "accountReference",
          "type": "string",
          "description": ""
        },
        {
          "kind": "required",
          "name": "devicePolicyReference",
          "type": "string",
          "description": ""
        }
      ],
      "queryParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "X-TokenId",
          "type": "string",
          "description": "The eSuite Token Id"
        },
        {
          "kind": "optional",
          "name": "X-SessionId",
          "type": "string",
          "description": "The eSuite Session Id"
        },
        {
          "kind": "required",
          "name": "X-Version",
          "type": "string",
          "description": "The eSuite Version"
        },
        {
          "kind": "optional",
          "name": "Origin",
          "type": "string",
          "description": "The eSuite Origin"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "deviceDTO",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "deviceReference",
              "type": "string",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "deviceName",
              "type": "string",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "deviceType",
              "type": "string<none | mobile | tablet | console | tv | desktop>",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "status",
              "type": "string<Active | AwaitingDeletion>",
              "example": "",
              "description": "The device status"
            },
            {
              "kind": "optional",
              "name": "identifier",
              "type": "string",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "registeredDate",
              "type": "string<date-time>",
              "example": "2021-09-21T05:33:16.8228669",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "lastUpdateDate",
              "type": "string<date-time>",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "registeredSlot",
              "type": "object",
              "schema": [
                {
                  "kind": "optional",
                  "name": "slotReference",
                  "type": "string",
                  "example": "",
                  "description": ""
                },
                {
                  "kind": "optional",
                  "name": "lastUpdatedDate",
                  "type": "string<date-time>",
                  "example": "",
                  "description": ""
                }
              ],
              "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Devices.DeviceSlotDTO",
              "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Devices.DeviceSlotDTO"
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Devices.DeviceDTO",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Devices.DeviceDTO",
          "isExpanded": true
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "string",
            "isExpanded": true,
            "description": "OK"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "OK",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "• The device name parameter is mandatory.. \r\n            <br />• The device type parameter must contain desktop, mobile, tablet, console or tv value.\r\n            <br />• The device identifier parameter is mandatory.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "API Authentication Failure: Invalid Authentication Type/Credentials Provided.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "403",
        "description": "• Missing privilege.       \r\n            <br />• Disabled Device Management Feature.\r\n            <br />• Invalid account. \r\n            <br />• Invalid device policy.",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "Calling this endpoint will register a device against an account",
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/device-policies/{devicePolicyReference}/devices \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-version\", \"string\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/accounts/{accountReference}/device-policies/{devicePolicyReference}/devices\", 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(\"https://api.fictive.com/REST/api/accounts/{accountReference}/device-policies/{devicePolicyReference}/devices\")\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[\"x-version\"] = \"string\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/device-policies/{devicePolicyReference}/devices\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\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-200",
          "language": "200",
          "code": "// OK\n\"\""
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// • The device name parameter is mandatory.. \r\n            • The device type parameter must contain desktop, mobile, tablet, console or tv value.\r\n            • The device identifier parameter is mandatory.\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// API Authentication Failure: Invalid Authentication Type/Credentials Provided.\n"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// • Missing privilege.       \r\n            • Disabled Device Management Feature.\r\n            • Invalid account. \r\n            • Invalid device policy.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}