Skip to main content
POST
/
tyk
/
keys
/
{keyID}
Create custom key / Import 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
}
'
{
  "action": "added",
  "key": "5e9d9544a1dcd60001d0ed20customKey",
  "status": "ok"
}

Authorizations

X-Tyk-Authorization
string
header
required

Api key

Path Parameters

keyID
string
required

Name to give the custom key.

Query Parameters

suppress_reset
enum<string>

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.

Available options:
1
hashed
enum<boolean>

When set to true the key_hash returned will be similar to the un-hashed key name.

Available options:
true,
false

Body

application/json
access_rights
object
alias
string
allowance
number<double>
Example:

1000

apply_policies
string[] | null
Example:
["641c15dd0fffb800010197bf"]
apply_policy_id
string
deprecated

deprecated use apply_policies going forward instead to send a list of policies ids

Example:

"641c15dd0fffb800010197bf"

basic_auth_data
object
certificate
string
data_expires
integer<int64>
Example:

0

date_created
string<date-time>
Example:

"2024-03-13T03:56:46.568042549Z"

enable_detail_recording
boolean
deprecated

deprecated use enable_detailed_recording going forward instead

Example:

false

enable_detailed_recording
boolean
Example:

true

enable_http_signature_validation
boolean
Example:

false

expires
integer<int64>
Example:

1712895619

hmac_enabled
boolean
Example:

false

hmac_string
string
id_extractor_deadline
integer<int64>
is_inactive
boolean
Example:

false

jwt_data
object
last_check
integer<int64>
Example:

0

last_updated
string
Example:

"1710302206"

max_query_depth
integer
Example:

-1

meta_data
object
Example:
{
"tyk_developer_id": "62b3fb9a1d5e4f00017226f5"
}
monitor
object
oauth_client_id
string
oauth_keys
object
org_id
string
Example:

"5e9d9544a1dcd60001d0ed20"

per
number<double>
Example:

5

quota_max
integer<int64>
Example:

20000

quota_remaining
integer<int64>
Example:

20000

quota_renewal_rate
integer<int64>
Example:

31556952

quota_renews
integer<int64>
Example:

1710302205

rate
number<double>
Example:

1

rsa_certificate_id
string
session_lifetime
integer<int64>
Example:

0

smoothing
object
tags
string[] | null
Example:
["edge", "edge-eu"]
throttle_interval
number<double>
Example:

10

throttle_retry_limit
integer
Example:

1000

Response

New custom key added.

action
string
Example:

"modified"

key
string
Example:

"b13d928b9972bd18"

key_hash
string
status
string
Example:

"ok"