---
title: Insert an account device policy
slug: docs/demo/insert-an-account-device-policy
description: Learn how to make a POST request to the "/device-policies" endpoint of a fictive API using the curl command. This code example includes instructions for including headers to accept and send JSON data and setting up the request body with device policy para
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "VDaPJyNMKOEh9mAHs76ZH",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/device-policies",
    "name": "Insert an account device policy",
    "method": "POST",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "accountReference",
          "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": "accountDeviceDTO",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "devicePolicyReference",
              "type": "string",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "allowedDevices",
              "type": "integer<int32>",
              "example": 0,
              "description": ""
            },
            {
              "kind": "optional",
              "name": "deviceChangesAllowed",
              "type": "integer<int32>",
              "example": 0,
              "description": ""
            },
            {
              "kind": "optional",
              "name": "deviceChangesUnit",
              "type": "string<none | hours | days | months | years>",
              "example": "",
              "description": ""
            },
            {
              "kind": "optional",
              "name": "deviceChangesPeriod",
              "type": "integer<int32>",
              "example": 0,
              "description": ""
            },
            {
              "kind": "optional",
              "name": "allowedPlayoutSlots",
              "type": "integer<int32>",
              "example": 0,
              "description": ""
            },
            {
              "kind": "optional",
              "name": "parentPolicyReference",
              "type": "string",
              "example": "",
              "description": ""
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Devices.AccountDevicePolicyDTO",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Devices.AccountDevicePolicyDTO",
          "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": "Q4Bt40Xp8ZDlWzfbIfuns",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/device-policies \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "JziobGUNVw4XnPj8ooMAG",
          "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\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "eU23UQcSduyokGgoHLrUw",
          "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\")\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": "XmeMxIWU3qE7TG1PZ3hzm",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/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": "Q4Bt40Xp8ZDlWzfbIfuns"
    },
    "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": ""
    }
  ]
}