Skip to main content
GET
/
tyk
/
policies
/
{polID}
Get a policy.
curl --request GET \
  --url https://{tenant}/tyk/policies/{polID} \
  --header 'X-Tyk-Authorization: <api-key>'
import requests

url = "https://{tenant}/tyk/policies/{polID}"

headers = {"X-Tyk-Authorization": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'X-Tyk-Authorization': '<api-key>'}};

fetch('https://{tenant}/tyk/policies/{polID}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant}/tyk/policies/{polID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Tyk-Authorization: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://{tenant}/tyk/policies/{polID}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-Tyk-Authorization", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://{tenant}/tyk/policies/{polID}")
.header("X-Tyk-Authorization", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenant}/tyk/policies/{polID}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Tyk-Authorization"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "access_rights": {
    "8ddd91f3cda9453442c477b06c4e2da4": {
      "allowed_urls": [
        {
          "methods": [
            "GET"
          ],
          "url": "/users"
        }
      ],
      "api_id": "8ddd91f3cda9453442c477b06c4e2da4",
      "api_name": "Itachi api",
      "disable_introspection": false,
      "versions": [
        "Default"
      ]
    }
  },
  "active": true,
  "hmac_enabled": false,
  "id": "5ead7120575961000181867e",
  "is_inactive": false,
  "key_expires_in": 2592000,
  "max_query_depth": -1,
  "meta_data": {
    "update": "sample policy update",
    "user_type": "mobile_user"
  },
  "name": "Sample policy",
  "partitions": {
    "acl": true,
    "complexity": false,
    "per_api": false,
    "quota": true,
    "rate_limit": true
  },
  "per": 60,
  "quota_max": 10000,
  "quota_renewal_rate": 3600,
  "rate": 1000,
  "tags": [
    "security"
  ],
  "throttle_interval": 10,
  "throttle_retry_limit": 10
}
{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}
{
"message": "Policy not found",
"status": "error"
}

Authorizations

X-Tyk-Authorization
string
header
required

Api key

Path Parameters

polID
string
required

You can retrieve details of a single policy by ID in your Tyk instance.

Response

Get details of a single policy.

_id
string
Example:

"5ead7120575961000181867e"

access_rights
object | null
active
boolean
Example:

true

enable_http_signature_validation
boolean
Example:

false

graphql_access_rights
object | null
hmac_enabled
boolean
Example:

false

id
string
Example:

"5ead7120575961000181867e"

is_inactive
boolean
Example:

false

key_expires_in
integer<int64>
Example:

0

last_updated
string
Example:

"1655965189"

max_query_depth
integer
Example:

-1

meta_data
object | null
name
string
Example:

"Swagger Petstore Policy"

org_id
string
Example:

"5e9d9544a1dcd60001d0ed20"

partitions
object
per
number<double>
Example:

60

post_expiry_action
enum<string>

Defines the action to take on a Session in Redis after it expires. Valid values are "retain" and "delete".

Available options:
retain,
delete
Example:

"delete"

post_expiry_grace_period
integer<int64>

Duration in seconds to retain a Session in Redis after it expires. Used with post_expiry_action "retain". Set to -1 to retain indefinitely.

Example:

0

quota_max
integer<int64>
Example:

-1

quota_renewal_rate
integer<int64>
Example:

3600

rate
number<double>
Example:

1000

smoothing
object | null
tags
string[] | null
throttle_interval
number<double>
Example:

-1

throttle_retry_limit
integer
Example:

-1