curl --request POST \
--url https://{tenant}/api/portal/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"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,
"is_inactive": false,
"key_expires_in": 2592000,
"max_query_depth": -1,
"meta_data": {
"email": "[email protected]",
"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": "663b4bbd5715ec323b424dca",
"Meta": null,
"Status": "OK"
}Creating policy definitions is slightly different to the core API, API definitions are wrapped inside an api_definition field and event handlers, such as webhooks are not embedded in the main api_definition object (though they can be), webhooks are instead appended as references into the hook_references field, the API will embed the correct webhook data into the event handler interface.
curl --request POST \
--url https://{tenant}/api/portal/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"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,
"is_inactive": false,
"key_expires_in": 2592000,
"max_query_depth": -1,
"meta_data": {
"email": "[email protected]",
"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": "663b4bbd5715ec323b424dca",
"Meta": null,
"Status": "OK"
}The Tyk Dashboard API Access Credentials
Show child attributes
Show child attributes
"d1dfc6a927a046c54c0ed470f19757cc"
"Rate Limit Proxy API"
false
Show child attributes
Show child attributes
Show child attributes
Delay is a hold-off between smoothing events and controls how frequently the current allowance will step up or down (in seconds).
x >= 1Enabled indicates if rate limit smoothing is active.
Step is the increment by which the current allowance will be increased or decreased each time a smoothing event is emitted.
x >= 1Threshold is the initial rate limit beyond which smoothing will be applied. It is a count of requests during the per interval and should be less than the maximum configured rate.
x >= 1Trigger is a fraction (typically in the range 0.1-1.0) of the step at which point a smoothing event will be emitted as the request rate approaches the current allowance.
x >= 0Must be a multiple of 0.01["Default", "v2"]Show child attributes
Delay is a hold-off between smoothing events and controls how frequently the current allowance will step up or down (in seconds).
x >= 1Enabled indicates if rate limit smoothing is active.
Step is the increment by which the current allowance will be increased or decreased each time a smoothing event is emitted.
x >= 1Threshold is the initial rate limit beyond which smoothing will be applied. It is a count of requests during the per interval and should be less than the maximum configured rate.
x >= 1Trigger is a fraction (typically in the range 0.1-1.0) of the step at which point a smoothing event will be emitted as the request rate approaches the current allowance.
x >= 0Must be a multiple of 0.01Was this page helpful?