curl --request POST \
--url https://{tenant}/tyk/keys/{keyID} \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"access_rights": {
"itachi-api": {
"allowed_urls": [
{
"methods": [
"GET"
],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi api",
"limit": {
"per": 60,
"quota_max": 10000,
"quota_remaining": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"throttle_interval": 10,
"throttle_retry_limit": 10
},
"versions": [
"Default"
]
}
},
"alias": "portal-key",
"allowance": 1000,
"apply_policies": [
"5ead7120575961000181867e"
],
"date_created": "2024-08-09T14:40:34.87614+03:00",
"enable_detailed_recording": true,
"last_updated": "1723203634",
"meta_data": {
"new-update-key-sample": "update-key-sample",
"tyk_developer_id": "62b3fb9a1d5e4f00017226f5",
"update": "sample policy update",
"user_type": "mobile_user"
},
"org_id": "5e9d9544a1dcd60001d0ed20",
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"quota_renews": 1723207234,
"rate": 1000,
"tags": [
"security",
"edge",
"edge-eu"
],
"throttle_interval": 10,
"throttle_retry_limit": 10
}
'import requests
url = "https://{tenant}/tyk/keys/{keyID}"
payload = {
"access_rights": { "itachi-api": {
"allowed_urls": [
{
"methods": ["GET"],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi api",
"limit": {
"per": 60,
"quota_max": 10000,
"quota_remaining": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"throttle_interval": 10,
"throttle_retry_limit": 10
},
"versions": ["Default"]
} },
"alias": "portal-key",
"allowance": 1000,
"apply_policies": ["5ead7120575961000181867e"],
"date_created": "2024-08-09T14:40:34.87614+03:00",
"enable_detailed_recording": True,
"last_updated": "1723203634",
"meta_data": {
"new-update-key-sample": "update-key-sample",
"tyk_developer_id": "62b3fb9a1d5e4f00017226f5",
"update": "sample policy update",
"user_type": "mobile_user"
},
"org_id": "5e9d9544a1dcd60001d0ed20",
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"quota_renews": 1723207234,
"rate": 1000,
"tags": ["security", "edge", "edge-eu"],
"throttle_interval": 10,
"throttle_retry_limit": 10
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tyk-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
access_rights: {
'itachi-api': {
allowed_urls: [{methods: ['GET'], url: '/users'}],
api_id: '8ddd91f3cda9453442c477b06c4e2da4',
api_name: 'Itachi api',
limit: {
per: 60,
quota_max: 10000,
quota_remaining: 10000,
quota_renewal_rate: 3600,
rate: 1000,
throttle_interval: 10,
throttle_retry_limit: 10
},
versions: ['Default']
}
},
alias: 'portal-key',
allowance: 1000,
apply_policies: ['5ead7120575961000181867e'],
date_created: '2024-08-09T14:40:34.87614+03:00',
enable_detailed_recording: true,
last_updated: '1723203634',
meta_data: {
'new-update-key-sample': 'update-key-sample',
tyk_developer_id: '62b3fb9a1d5e4f00017226f5',
update: 'sample policy update',
user_type: 'mobile_user'
},
org_id: '5e9d9544a1dcd60001d0ed20',
per: 60,
quota_max: 10000,
quota_renewal_rate: 3600,
quota_renews: 1723207234,
rate: 1000,
tags: ['security', 'edge', 'edge-eu'],
throttle_interval: 10,
throttle_retry_limit: 10
})
};
fetch('https://{tenant}/tyk/keys/{keyID}', 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/keys/{keyID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'access_rights' => [
'itachi-api' => [
'allowed_urls' => [
[
'methods' => [
'GET'
],
'url' => '/users'
]
],
'api_id' => '8ddd91f3cda9453442c477b06c4e2da4',
'api_name' => 'Itachi api',
'limit' => [
'per' => 60,
'quota_max' => 10000,
'quota_remaining' => 10000,
'quota_renewal_rate' => 3600,
'rate' => 1000,
'throttle_interval' => 10,
'throttle_retry_limit' => 10
],
'versions' => [
'Default'
]
]
],
'alias' => 'portal-key',
'allowance' => 1000,
'apply_policies' => [
'5ead7120575961000181867e'
],
'date_created' => '2024-08-09T14:40:34.87614+03:00',
'enable_detailed_recording' => true,
'last_updated' => '1723203634',
'meta_data' => [
'new-update-key-sample' => 'update-key-sample',
'tyk_developer_id' => '62b3fb9a1d5e4f00017226f5',
'update' => 'sample policy update',
'user_type' => 'mobile_user'
],
'org_id' => '5e9d9544a1dcd60001d0ed20',
'per' => 60,
'quota_max' => 10000,
'quota_renewal_rate' => 3600,
'quota_renews' => 1723207234,
'rate' => 1000,
'tags' => [
'security',
'edge',
'edge-eu'
],
'throttle_interval' => 10,
'throttle_retry_limit' => 10
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/tyk/keys/{keyID}"
payload := strings.NewReader("{\n \"access_rights\": {\n \"itachi-api\": {\n \"allowed_urls\": [\n {\n \"methods\": [\n \"GET\"\n ],\n \"url\": \"/users\"\n }\n ],\n \"api_id\": \"8ddd91f3cda9453442c477b06c4e2da4\",\n \"api_name\": \"Itachi api\",\n \"limit\": {\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_remaining\": 10000,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n },\n \"versions\": [\n \"Default\"\n ]\n }\n },\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"5ead7120575961000181867e\"\n ],\n \"date_created\": \"2024-08-09T14:40:34.87614+03:00\",\n \"enable_detailed_recording\": true,\n \"last_updated\": \"1723203634\",\n \"meta_data\": {\n \"new-update-key-sample\": \"update-key-sample\",\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\",\n \"update\": \"sample policy update\",\n \"user_type\": \"mobile_user\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_renewal_rate\": 3600,\n \"quota_renews\": 1723207234,\n \"rate\": 1000,\n \"tags\": [\n \"security\",\n \"edge\",\n \"edge-eu\"\n ],\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tyk-Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{tenant}/tyk/keys/{keyID}")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"access_rights\": {\n \"itachi-api\": {\n \"allowed_urls\": [\n {\n \"methods\": [\n \"GET\"\n ],\n \"url\": \"/users\"\n }\n ],\n \"api_id\": \"8ddd91f3cda9453442c477b06c4e2da4\",\n \"api_name\": \"Itachi api\",\n \"limit\": {\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_remaining\": 10000,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n },\n \"versions\": [\n \"Default\"\n ]\n }\n },\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"5ead7120575961000181867e\"\n ],\n \"date_created\": \"2024-08-09T14:40:34.87614+03:00\",\n \"enable_detailed_recording\": true,\n \"last_updated\": \"1723203634\",\n \"meta_data\": {\n \"new-update-key-sample\": \"update-key-sample\",\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\",\n \"update\": \"sample policy update\",\n \"user_type\": \"mobile_user\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_renewal_rate\": 3600,\n \"quota_renews\": 1723207234,\n \"rate\": 1000,\n \"tags\": [\n \"security\",\n \"edge\",\n \"edge-eu\"\n ],\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/keys/{keyID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"access_rights\": {\n \"itachi-api\": {\n \"allowed_urls\": [\n {\n \"methods\": [\n \"GET\"\n ],\n \"url\": \"/users\"\n }\n ],\n \"api_id\": \"8ddd91f3cda9453442c477b06c4e2da4\",\n \"api_name\": \"Itachi api\",\n \"limit\": {\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_remaining\": 10000,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n },\n \"versions\": [\n \"Default\"\n ]\n }\n },\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"5ead7120575961000181867e\"\n ],\n \"date_created\": \"2024-08-09T14:40:34.87614+03:00\",\n \"enable_detailed_recording\": true,\n \"last_updated\": \"1723203634\",\n \"meta_data\": {\n \"new-update-key-sample\": \"update-key-sample\",\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\",\n \"update\": \"sample policy update\",\n \"user_type\": \"mobile_user\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_renewal_rate\": 3600,\n \"quota_renews\": 1723207234,\n \"rate\": 1000,\n \"tags\": [\n \"security\",\n \"edge\",\n \"edge-eu\"\n ],\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n}"
response = http.request(request)
puts response.read_body{
"action": "added",
"key": "5e9d9544a1dcd60001d0ed20customKey",
"status": "ok"
}{
"message": "Request malformed",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}{
"message": "Failed to create key, ensure security settings are correct.",
"status": "error"
}Create custom key / Import key
You can use this endpoint to import existing keys into Tyk or to create a new custom key.
curl --request POST \
--url https://{tenant}/tyk/keys/{keyID} \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"access_rights": {
"itachi-api": {
"allowed_urls": [
{
"methods": [
"GET"
],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi api",
"limit": {
"per": 60,
"quota_max": 10000,
"quota_remaining": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"throttle_interval": 10,
"throttle_retry_limit": 10
},
"versions": [
"Default"
]
}
},
"alias": "portal-key",
"allowance": 1000,
"apply_policies": [
"5ead7120575961000181867e"
],
"date_created": "2024-08-09T14:40:34.87614+03:00",
"enable_detailed_recording": true,
"last_updated": "1723203634",
"meta_data": {
"new-update-key-sample": "update-key-sample",
"tyk_developer_id": "62b3fb9a1d5e4f00017226f5",
"update": "sample policy update",
"user_type": "mobile_user"
},
"org_id": "5e9d9544a1dcd60001d0ed20",
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"quota_renews": 1723207234,
"rate": 1000,
"tags": [
"security",
"edge",
"edge-eu"
],
"throttle_interval": 10,
"throttle_retry_limit": 10
}
'import requests
url = "https://{tenant}/tyk/keys/{keyID}"
payload = {
"access_rights": { "itachi-api": {
"allowed_urls": [
{
"methods": ["GET"],
"url": "/users"
}
],
"api_id": "8ddd91f3cda9453442c477b06c4e2da4",
"api_name": "Itachi api",
"limit": {
"per": 60,
"quota_max": 10000,
"quota_remaining": 10000,
"quota_renewal_rate": 3600,
"rate": 1000,
"throttle_interval": 10,
"throttle_retry_limit": 10
},
"versions": ["Default"]
} },
"alias": "portal-key",
"allowance": 1000,
"apply_policies": ["5ead7120575961000181867e"],
"date_created": "2024-08-09T14:40:34.87614+03:00",
"enable_detailed_recording": True,
"last_updated": "1723203634",
"meta_data": {
"new-update-key-sample": "update-key-sample",
"tyk_developer_id": "62b3fb9a1d5e4f00017226f5",
"update": "sample policy update",
"user_type": "mobile_user"
},
"org_id": "5e9d9544a1dcd60001d0ed20",
"per": 60,
"quota_max": 10000,
"quota_renewal_rate": 3600,
"quota_renews": 1723207234,
"rate": 1000,
"tags": ["security", "edge", "edge-eu"],
"throttle_interval": 10,
"throttle_retry_limit": 10
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tyk-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
access_rights: {
'itachi-api': {
allowed_urls: [{methods: ['GET'], url: '/users'}],
api_id: '8ddd91f3cda9453442c477b06c4e2da4',
api_name: 'Itachi api',
limit: {
per: 60,
quota_max: 10000,
quota_remaining: 10000,
quota_renewal_rate: 3600,
rate: 1000,
throttle_interval: 10,
throttle_retry_limit: 10
},
versions: ['Default']
}
},
alias: 'portal-key',
allowance: 1000,
apply_policies: ['5ead7120575961000181867e'],
date_created: '2024-08-09T14:40:34.87614+03:00',
enable_detailed_recording: true,
last_updated: '1723203634',
meta_data: {
'new-update-key-sample': 'update-key-sample',
tyk_developer_id: '62b3fb9a1d5e4f00017226f5',
update: 'sample policy update',
user_type: 'mobile_user'
},
org_id: '5e9d9544a1dcd60001d0ed20',
per: 60,
quota_max: 10000,
quota_renewal_rate: 3600,
quota_renews: 1723207234,
rate: 1000,
tags: ['security', 'edge', 'edge-eu'],
throttle_interval: 10,
throttle_retry_limit: 10
})
};
fetch('https://{tenant}/tyk/keys/{keyID}', 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/keys/{keyID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'access_rights' => [
'itachi-api' => [
'allowed_urls' => [
[
'methods' => [
'GET'
],
'url' => '/users'
]
],
'api_id' => '8ddd91f3cda9453442c477b06c4e2da4',
'api_name' => 'Itachi api',
'limit' => [
'per' => 60,
'quota_max' => 10000,
'quota_remaining' => 10000,
'quota_renewal_rate' => 3600,
'rate' => 1000,
'throttle_interval' => 10,
'throttle_retry_limit' => 10
],
'versions' => [
'Default'
]
]
],
'alias' => 'portal-key',
'allowance' => 1000,
'apply_policies' => [
'5ead7120575961000181867e'
],
'date_created' => '2024-08-09T14:40:34.87614+03:00',
'enable_detailed_recording' => true,
'last_updated' => '1723203634',
'meta_data' => [
'new-update-key-sample' => 'update-key-sample',
'tyk_developer_id' => '62b3fb9a1d5e4f00017226f5',
'update' => 'sample policy update',
'user_type' => 'mobile_user'
],
'org_id' => '5e9d9544a1dcd60001d0ed20',
'per' => 60,
'quota_max' => 10000,
'quota_renewal_rate' => 3600,
'quota_renews' => 1723207234,
'rate' => 1000,
'tags' => [
'security',
'edge',
'edge-eu'
],
'throttle_interval' => 10,
'throttle_retry_limit' => 10
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/tyk/keys/{keyID}"
payload := strings.NewReader("{\n \"access_rights\": {\n \"itachi-api\": {\n \"allowed_urls\": [\n {\n \"methods\": [\n \"GET\"\n ],\n \"url\": \"/users\"\n }\n ],\n \"api_id\": \"8ddd91f3cda9453442c477b06c4e2da4\",\n \"api_name\": \"Itachi api\",\n \"limit\": {\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_remaining\": 10000,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n },\n \"versions\": [\n \"Default\"\n ]\n }\n },\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"5ead7120575961000181867e\"\n ],\n \"date_created\": \"2024-08-09T14:40:34.87614+03:00\",\n \"enable_detailed_recording\": true,\n \"last_updated\": \"1723203634\",\n \"meta_data\": {\n \"new-update-key-sample\": \"update-key-sample\",\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\",\n \"update\": \"sample policy update\",\n \"user_type\": \"mobile_user\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_renewal_rate\": 3600,\n \"quota_renews\": 1723207234,\n \"rate\": 1000,\n \"tags\": [\n \"security\",\n \"edge\",\n \"edge-eu\"\n ],\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tyk-Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{tenant}/tyk/keys/{keyID}")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"access_rights\": {\n \"itachi-api\": {\n \"allowed_urls\": [\n {\n \"methods\": [\n \"GET\"\n ],\n \"url\": \"/users\"\n }\n ],\n \"api_id\": \"8ddd91f3cda9453442c477b06c4e2da4\",\n \"api_name\": \"Itachi api\",\n \"limit\": {\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_remaining\": 10000,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n },\n \"versions\": [\n \"Default\"\n ]\n }\n },\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"5ead7120575961000181867e\"\n ],\n \"date_created\": \"2024-08-09T14:40:34.87614+03:00\",\n \"enable_detailed_recording\": true,\n \"last_updated\": \"1723203634\",\n \"meta_data\": {\n \"new-update-key-sample\": \"update-key-sample\",\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\",\n \"update\": \"sample policy update\",\n \"user_type\": \"mobile_user\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_renewal_rate\": 3600,\n \"quota_renews\": 1723207234,\n \"rate\": 1000,\n \"tags\": [\n \"security\",\n \"edge\",\n \"edge-eu\"\n ],\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/keys/{keyID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"access_rights\": {\n \"itachi-api\": {\n \"allowed_urls\": [\n {\n \"methods\": [\n \"GET\"\n ],\n \"url\": \"/users\"\n }\n ],\n \"api_id\": \"8ddd91f3cda9453442c477b06c4e2da4\",\n \"api_name\": \"Itachi api\",\n \"limit\": {\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_remaining\": 10000,\n \"quota_renewal_rate\": 3600,\n \"rate\": 1000,\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n },\n \"versions\": [\n \"Default\"\n ]\n }\n },\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"5ead7120575961000181867e\"\n ],\n \"date_created\": \"2024-08-09T14:40:34.87614+03:00\",\n \"enable_detailed_recording\": true,\n \"last_updated\": \"1723203634\",\n \"meta_data\": {\n \"new-update-key-sample\": \"update-key-sample\",\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\",\n \"update\": \"sample policy update\",\n \"user_type\": \"mobile_user\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": 10000,\n \"quota_renewal_rate\": 3600,\n \"quota_renews\": 1723207234,\n \"rate\": 1000,\n \"tags\": [\n \"security\",\n \"edge\",\n \"edge-eu\"\n ],\n \"throttle_interval\": 10,\n \"throttle_retry_limit\": 10\n}"
response = http.request(request)
puts response.read_body{
"action": "added",
"key": "5e9d9544a1dcd60001d0ed20customKey",
"status": "ok"
}{
"message": "Request malformed",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}{
"message": "Failed to create key, ensure security settings are correct.",
"status": "error"
}Authorizations
Api key
Path Parameters
Name to give the custom key.
Query Parameters
Adding the suppress_reset parameter and setting it to 1, will cause Tyk not to reset the quota limit that is in the current live quota manager. By default Tyk will reset the quota in the live quota manager (initialising it) when adding a key. Adding the suppress_reset flag to the URL parameters will avoid this behaviour.
1 When set to true the key_hash returned will be similar to the un-hashed key name.
Body
Show child attributes
Show child attributes
"portal-developer@example.org"
1000
["641c15dd0fffb800010197bf"]
deprecated use apply_policies going forward instead to send a list of policies ids
"641c15dd0fffb800010197bf"
Show child attributes
Show child attributes
0
"2024-03-13T03:56:46.568042549Z"
deprecated use enable_detailed_recording going forward instead
false
true
false
1712895619
false
false
Show child attributes
Show child attributes
0
"1710302206"
-1
Show child attributes
Show child attributes
{
"tyk_developer_id": "62b3fb9a1d5e4f00017226f5"
}
Show child attributes
Show child attributes
Show child attributes
Show child attributes
"5e9d9544a1dcd60001d0ed20"
5
Defines the action to take on a Session in Redis after it expires. Valid values are "retain" and "delete".
retain, delete "delete"
Duration in seconds to retain a Session in Redis after it expires. Used with post_expiry_action "retain". Set to -1 to retain indefinitely.
0
20000
20000
31556952
1710302205
1
0
Show child attributes
Show child attributes
["edge", "edge-eu"]
10
1000
Was this page helpful?