---
title: Get Policy Keys by Type
slug: single-connect-api-3-0-3/get-policy-keys-by-type
description: Learn how to use curl to easily make GET requests with custom headers and parameters to retrieve policy keys by type and receive the response in JSON format. This code example will help you streamline your API calls and obtain the desired data efficiently
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "W3GUmu9u6g_5qoYmTL8OA",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByType/POLICYKEYTYPE",
    "method": "GET",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "List Policy Keys by Type",
        "jsonExample": "[\n    {\n        \"dbId\": 377572,\n        \"userCreate\": \"admin\",\n        \"userUpdate\": null,\n        \"creationDate\": 1581608151289,\n        \"lastUpdate\": null,\n        \"key\": \"date\",\n        \"description\": null,\n        \"userBehaviorRate\": null,\n        \"type\": \"BLACK\",\n        \"deviceTypes\": [\n            \"linux\"\n        ],\n        \"taskName\": null,\n        \"xmlContent\": null\n    }\n]"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method lists the policy keys by referring the type of the policy key in request URL.</p>\n<p>Possible values of type: WHITE, BLACK, XML_FILE, TACACS_ATTRIBUTE, RADIUS_ATTRIBUTE, USER:_BEHAVIOR, PRIVILEGED_TASK</p>",
    "examples": {
      "languages": [
        {
          "id": "8EJeuM5U9XZjk2PRliXD6",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url {{url}}/aioc-rest-web/rest/policy/getPolicyKeysByType/POLICYKEYTYPE \\\n     --header 'accept: application/json'"
        },
        {
          "id": "Dk5bsJLM9zEmAOsBttsVY",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByType/POLICYKEYTYPE\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "3TQnnXyrIjpbOvLxbrOmf",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByType/POLICYKEYTYPE\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "_CfQygv2j-v-wuR2bnFO7",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/policy/getPolicyKeysByType/POLICYKEYTYPE\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "8EJeuM5U9XZjk2PRliXD6"
    },
    "results": {
      "languages": [
        {
          "id": "_-HWiNgiiLzJkdma_DGty",
          "language": "200",
          "code": "[\n    {\n        \"dbId\": 377572,\n        \"userCreate\": \"admin\",\n        \"userUpdate\": null,\n        \"creationDate\": 1581608151289,\n        \"lastUpdate\": null,\n        \"key\": \"date\",\n        \"description\": null,\n        \"userBehaviorRate\": null,\n        \"type\": \"BLACK\",\n        \"deviceTypes\": [\n            \"linux\"\n        ],\n        \"taskName\": null,\n        \"xmlContent\": null\n    }\n]"
        }
      ],
      "selectedLanguageId": "_-HWiNgiiLzJkdma_DGty"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}