List policies.
curl --request GET \
--url https://{tenant}/tyk/policies \
--header 'X-Tyk-Authorization: <api-key>'import requests
url = "https://{tenant}/tyk/policies"
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', 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",
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"
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")
.header("X-Tyk-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/policies")
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[
{
"_id": "",
"access_rights": {
"8ddd91f3cda9453442c477b06c4e2da4": {
"allowance_scope": "",
"allowed_types": [],
"allowed_urls": [
{
"methods": [
"GET"
],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi api",
"disable_introspection": false,
"field_access_rights": [],
"limit": {
"max_query_depth": 0,
"per": 0,
"quota_max": 0,
"quota_remaining": 0,
"quota_renewal_rate": 0,
"quota_renews": 0,
"rate": 0,
"smoothing": {
"delay": 30,
"enabled": false,
"step": 100,
"threshold": 500,
"trigger": 0.8
},
"throttle_interval": 0,
"throttle_retry_limit": 0
},
"restricted_types": [],
"versions": [
"Default"
]
}
},
"active": true,
"enable_http_signature_validation": false,
"graphql_access_rights": null,
"hmac_enabled": false,
"id": "5ead7120575961000181867e",
"is_inactive": false,
"key_expires_in": 2592000,
"last_updated": "1716980105",
"max_query_depth": -1,
"meta_data": {
"user_type": "mobile_user"
},
"name": "Sample policy",
"org_id": "664a14650619d40001f1f00f",
"partitions": {
"acl": true,
"complexity": false,
"per_api": false,
"quota": true,
"rate_limit": true
},
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"smoothing": {
"delay": 30,
"enabled": false,
"step": 100,
"threshold": 500,
"trigger": 0.8
},
"tags": [
"security"
],
"throttle_interval": 10,
"throttle_retry_limit": 10
}
]{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}Policies
List policies.
Retrieve all the policies in your Tyk instance. Returns an array policies.
GET
/
tyk
/
policies
List policies.
curl --request GET \
--url https://{tenant}/tyk/policies \
--header 'X-Tyk-Authorization: <api-key>'import requests
url = "https://{tenant}/tyk/policies"
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', 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",
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"
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")
.header("X-Tyk-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/policies")
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[
{
"_id": "",
"access_rights": {
"8ddd91f3cda9453442c477b06c4e2da4": {
"allowance_scope": "",
"allowed_types": [],
"allowed_urls": [
{
"methods": [
"GET"
],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi api",
"disable_introspection": false,
"field_access_rights": [],
"limit": {
"max_query_depth": 0,
"per": 0,
"quota_max": 0,
"quota_remaining": 0,
"quota_renewal_rate": 0,
"quota_renews": 0,
"rate": 0,
"smoothing": {
"delay": 30,
"enabled": false,
"step": 100,
"threshold": 500,
"trigger": 0.8
},
"throttle_interval": 0,
"throttle_retry_limit": 0
},
"restricted_types": [],
"versions": [
"Default"
]
}
},
"active": true,
"enable_http_signature_validation": false,
"graphql_access_rights": null,
"hmac_enabled": false,
"id": "5ead7120575961000181867e",
"is_inactive": false,
"key_expires_in": 2592000,
"last_updated": "1716980105",
"max_query_depth": -1,
"meta_data": {
"user_type": "mobile_user"
},
"name": "Sample policy",
"org_id": "664a14650619d40001f1f00f",
"partitions": {
"acl": true,
"complexity": false,
"per_api": false,
"quota": true,
"rate_limit": true
},
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"smoothing": {
"delay": 30,
"enabled": false,
"step": 100,
"threshold": 500,
"trigger": 0.8
},
"tags": [
"security"
],
"throttle_interval": 10,
"throttle_retry_limit": 10
}
]{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}Authorizations
Api key
Response
List of all policies.
Example:
"5ead7120575961000181867e"
Show child attributes
Show child attributes
Example:
true
Example:
false
Show child attributes
Show child attributes
Example:
false
Example:
"5ead7120575961000181867e"
Example:
false
Example:
0
Example:
"1655965189"
Example:
-1
Show child attributes
Show child attributes
Example:
"Swagger Petstore Policy"
Example:
"5e9d9544a1dcd60001d0ed20"
Show child attributes
Show child attributes
Example:
60
Example:
-1
Example:
3600
Example:
1000
Show child attributes
Show child attributes
Example:
-1
Example:
-1
Was this page helpful?
⌘I