Skip to main content
PUT
/
admin
/
org
/
keys
/
{keyId}
Update key.
curl --request PUT \
  --url https://{tenant}/admin/org/keys/{keyId} \
  --header 'Admin-Auth: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "alias": "portal-key",
  "allowance": 1000,
  "apply_policies": [
    "62a0ec9092faf50001395817"
  ],
  "enable_detailed_recording": true,
  "expires": 1718439136,
  "hmac_enabled": false,
  "is_inactive": false,
  "meta_data": {
    "tyk_developer_id": "62b3fb9a1d5e4f00017226f5"
  },
  "org_id": "5e9d9544a1dcd60001d0ed20",
  "per": 60,
  "quota_max": -1,
  "quota_remaining": 0,
  "quota_renewal_rate": -1,
  "quota_renews": 1715847135,
  "rate": 1000,
  "tags": [
    "edge-eu",
    "edge"
  ],
  "throttle_interval": 0,
  "throttle_retry_limit": 0
}
'
import requests

url = "https://{tenant}/admin/org/keys/{keyId}"

payload = {
"alias": "portal-key",
"allowance": 1000,
"apply_policies": ["62a0ec9092faf50001395817"],
"enable_detailed_recording": True,
"expires": 1718439136,
"hmac_enabled": False,
"is_inactive": False,
"meta_data": { "tyk_developer_id": "62b3fb9a1d5e4f00017226f5" },
"org_id": "5e9d9544a1dcd60001d0ed20",
"per": 60,
"quota_max": -1,
"quota_remaining": 0,
"quota_renewal_rate": -1,
"quota_renews": 1715847135,
"rate": 1000,
"tags": ["edge-eu", "edge"],
"throttle_interval": 0,
"throttle_retry_limit": 0
}
headers = {
"Admin-Auth": "<api-key>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {'Admin-Auth': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alias: 'portal-key',
allowance: 1000,
apply_policies: ['62a0ec9092faf50001395817'],
enable_detailed_recording: true,
expires: 1718439136,
hmac_enabled: false,
is_inactive: false,
meta_data: {tyk_developer_id: '62b3fb9a1d5e4f00017226f5'},
org_id: '5e9d9544a1dcd60001d0ed20',
per: 60,
quota_max: -1,
quota_remaining: 0,
quota_renewal_rate: -1,
quota_renews: 1715847135,
rate: 1000,
tags: ['edge-eu', 'edge'],
throttle_interval: 0,
throttle_retry_limit: 0
})
};

fetch('https://{tenant}/admin/org/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}/admin/org/keys/{keyId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'alias' => 'portal-key',
'allowance' => 1000,
'apply_policies' => [
'62a0ec9092faf50001395817'
],
'enable_detailed_recording' => true,
'expires' => 1718439136,
'hmac_enabled' => false,
'is_inactive' => false,
'meta_data' => [
'tyk_developer_id' => '62b3fb9a1d5e4f00017226f5'
],
'org_id' => '5e9d9544a1dcd60001d0ed20',
'per' => 60,
'quota_max' => -1,
'quota_remaining' => 0,
'quota_renewal_rate' => -1,
'quota_renews' => 1715847135,
'rate' => 1000,
'tags' => [
'edge-eu',
'edge'
],
'throttle_interval' => 0,
'throttle_retry_limit' => 0
]),
CURLOPT_HTTPHEADER => [
"Admin-Auth: <api-key>",
"Content-Type: application/json"
],
]);

$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}/admin/org/keys/{keyId}"

payload := strings.NewReader("{\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"62a0ec9092faf50001395817\"\n ],\n \"enable_detailed_recording\": true,\n \"expires\": 1718439136,\n \"hmac_enabled\": false,\n \"is_inactive\": false,\n \"meta_data\": {\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_remaining\": 0,\n \"quota_renewal_rate\": -1,\n \"quota_renews\": 1715847135,\n \"rate\": 1000,\n \"tags\": [\n \"edge-eu\",\n \"edge\"\n ],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Admin-Auth", "<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.put("https://{tenant}/admin/org/keys/{keyId}")
.header("Admin-Auth", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"62a0ec9092faf50001395817\"\n ],\n \"enable_detailed_recording\": true,\n \"expires\": 1718439136,\n \"hmac_enabled\": false,\n \"is_inactive\": false,\n \"meta_data\": {\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_remaining\": 0,\n \"quota_renewal_rate\": -1,\n \"quota_renews\": 1715847135,\n \"rate\": 1000,\n \"tags\": [\n \"edge-eu\",\n \"edge\"\n ],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenant}/admin/org/keys/{keyId}")

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

request = Net::HTTP::Put.new(url)
request["Admin-Auth"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alias\": \"portal-key\",\n \"allowance\": 1000,\n \"apply_policies\": [\n \"62a0ec9092faf50001395817\"\n ],\n \"enable_detailed_recording\": true,\n \"expires\": 1718439136,\n \"hmac_enabled\": false,\n \"is_inactive\": false,\n \"meta_data\": {\n \"tyk_developer_id\": \"62b3fb9a1d5e4f00017226f5\"\n },\n \"org_id\": \"5e9d9544a1dcd60001d0ed20\",\n \"per\": 60,\n \"quota_max\": -1,\n \"quota_remaining\": 0,\n \"quota_renewal_rate\": -1,\n \"quota_renews\": 1715847135,\n \"rate\": 1000,\n \"tags\": [\n \"edge-eu\",\n \"edge\"\n ],\n \"throttle_interval\": 0,\n \"throttle_retry_limit\": 0\n}"

response = http.request(request)
puts response.read_body
{
  "Message": "Key updated",
  "Meta": null,
  "Status": "OK"
}
{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}
{
"Message": "Failed to update session object to Tyk",
"Meta": null,
"Status": "Error"
}
{
"Message": "Org key doesn't exist",
"Meta": null,
"Status": "Error"
}
{
"Message": "Updating orgID of org key is not allowed",
"Meta": null,
"Status": "Error"
}

Authorizations

Admin-Auth
string
header
required

Api key

Path Parameters

keyId
string
required

The ID of the key.

Body

application/json
access_rights
object | null
alias
string
allowance
number<double>
apply_policies
string[] | null
apply_policy_id
string
basic_auth_data
object
certificate
string
data_expires
integer<int64>
date_created
string<date-time>
enable_detailed_recording
boolean
expires
integer<int64>
hmac_enabled
boolean
hmac_string
string
id_extractor_deadline
integer<int64>
is_inactive
boolean
jwt_data
object
key_id
string
last_check
integer<int64>
last_updated
string
max_query_depth
integer
meta_data
any
monitor
object
oauth_client_id
string
oauth_keys
object | null
org_id
string
per
number<double>
quota_max
integer<int64>
quota_remaining
integer<int64>
quota_renewal_rate
integer<int64>
quota_renews
integer<int64>
rate
number<double>
session_lifetime
integer<int64>
smoothing
object | null
tags
string[] | null
throttle_interval
number<double>
throttle_retry_limit
integer

Response

Key updated

ID
string
Message
string
Meta
any
Status
string