---
title: Create an entitlement
slug: docs/demo/create-an-entitlement
description: Learn how to make a POST request to the API of a fictional website with this code example. Discover the essential headers and request body parameters provided in the example, tailored to create an entitlement for a particular account. Streamline your codi
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "BDwNYAXswmylDPW_7RMwC",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/entitlements",
    "name": "Create an entitlement",
    "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": "entitlement",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "name",
              "type": "string",
              "example": "",
              "description": "The name of entitlement"
            },
            {
              "kind": "optional",
              "name": "identifier",
              "type": "string",
              "example": "",
              "description": "The identifier of entitlement"
            },
            {
              "kind": "optional",
              "name": "startDate",
              "type": "string<date-time>",
              "example": "2021-09-21T05:33:17.5260132",
              "description": "The create date of the entitlement"
            },
            {
              "kind": "optional",
              "name": "endDate",
              "type": "string<date-time>",
              "example": "2021-09-21T05:33:17.5260132",
              "description": "The expire date of the entitlement"
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Entitlement",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Entitlement",
          "isExpanded": true,
          "description": "Account entitlement"
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "isExpanded": true,
        "statusCode": "204",
        "description": "No Content",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Bad request",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "Not Authorized",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to create new entitlements ad-hoc and assign them to an account for instant access to content",
    "examples": {
      "languages": [
        {
          "id": "HAiqv3iJpUlB_UgOG-oBM",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/entitlements \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "flS0cCjuQn5f30i9wLDsj",
          "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}/entitlements\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "5waVCLodKqRjZpbR9fvf-",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/{accountReference}/entitlements\")\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": "A7pApV-rip62a19w6GbXb",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/entitlements\"\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": "HAiqv3iJpUlB_UgOG-oBM"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-204",
          "language": "204",
          "code": "// No Content\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad request\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Not Authorized\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not found\n"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-204"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}