---
title: Insert a client device policy
slug: docs/demo/insert-a-client-device-policy
description: Learn how to make a POST request to the device-policies endpoint of a fictive API using a cURL command. Our code example includes the required headers and a JSON payload with crucial fields for device policies and devices.
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "uDBX6Qkne0W2yexLiYwsM",
  "data": {
    "url": "https://api.fictive.com/REST/api/device-policies",
    "name": "Insert a client device policy",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "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": "devicePolicyDTO",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "devicePolicyReference",
              "type": "string",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "allowedDevices",
              "type": "integer<int32>",
              "example": 0,
              "description": "AllowedDevices"
            },
            {
              "kind": "optional",
              "name": "deviceChangesAllowed",
              "type": "integer<int32>",
              "example": 0,
              "description": "DeviceChangesAllowed"
            },
            {
              "kind": "optional",
              "name": "deviceChangesUnit",
              "type": "string<none | hours | days | months | years>",
              "example": "",
              "description": "DeviceChangesUnit"
            },
            {
              "kind": "optional",
              "name": "deviceChangesPeriod",
              "type": "integer<int32>",
              "example": 0,
              "description": "DeviceChangesPeriod"
            },
            {
              "kind": "optional",
              "name": "allowedPlayoutSlots",
              "type": "integer<int32>",
              "example": 0,
              "description": "AllowedPlayoutSlots"
            },
            {
              "kind": "optional",
              "name": "removeAllCustomPolicies",
              "type": "boolean",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "deviceChangesConsumed",
              "type": "integer<int32>",
              "example": 0,
              "description": "DeviceChangesConsumed"
            },
            {
              "kind": "optional",
              "name": "parentPolicyReference",
              "type": "string",
              "example": "",
              "description": "ParentPolicyReference"
            },
            {
              "kind": "optional",
              "name": "devices",
              "type": "array",
              "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[]",
              "description": "Devices"
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Devices.DevicePolicyDTO",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Devices.DevicePolicyDTO",
          "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 deviceChangesUnit parameter must contain hours, days, months or years value. \r\n            <br />• The allowedDevices parameter must contain an integer greater than 0.\r\n            <br />• The deviceChangesAllowed parameter must contain an integer greater than 0.\r\n            <br />• The deviceChangesPeriod parameter must contain an integer greater than 0.\r\n            <br />• The allowedPlayoutSlots parameter must contain an integer greater than 0.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "API Authentication Failure: Invalid Authentication Type/Credentials Provided.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "403",
        "description": "• A device management policy already exists, please update the existing policy.\r\n            <br />• Missing privilege.\r\n            <br />• Disabled Device Management Feature.",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "Calling this endpoint will insert a new device policy",
    "examples": {
      "languages": [
        {
          "id": "XubBxLlZC-rW5lA0P_Mn-",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/device-policies \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "J78AC9RTzmNNL0e8ERscm",
          "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/device-policies\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "h0yzMHXigO5HFPQfPOKuh",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/device-policies\")\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": "lc2oYNdVjkM-dSRojachR",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/device-policies\"\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": "XubBxLlZC-rW5lA0P_Mn-"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n\"\""
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// • The deviceChangesUnit parameter must contain hours, days, months or years value. \r\n            • The allowedDevices parameter must contain an integer greater than 0.\r\n            • The deviceChangesAllowed parameter must contain an integer greater than 0.\r\n            • The deviceChangesPeriod parameter must contain an integer greater than 0.\r\n            • The allowedPlayoutSlots parameter must contain an integer greater than 0.\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// API Authentication Failure: Invalid Authentication Type/Credentials Provided.\n"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// • A device management policy already exists, please update the existing policy.\r\n            • Missing privilege.\r\n            • Disabled Device Management Feature.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}