HTTP API

Throttle

GET/api/v1/throttle/plans
GET
/api/v1/throttle/plans

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Query Parameters

q?string

Full-text search query applied to the plan description

page?integer

1-indexed page number

Formatint64
Range0 <= value
page_size?integer

Page size

Formatint64
Range0 <= value
sort_by?string

Sort field (created_at, updated_at)

sort_order?string

Sort order (asc or desc)

Value in

  • "asc"
  • "desc"
tag?string

Filter by a single tag

Response Body

application/json

curl -X GET "https://example.com/api/v1/throttle/plans"
{  "pagination": {    "has_more": true,    "page": 0,    "page_size": 0,    "total": 0  },  "plans": [    {      "actions": {        "property1": {          "cost": 0        },        "property2": {          "cost": 0        }      },      "created_at": "2019-08-24T14:15:22Z",      "default_enforcement": "soft",      "description": "string",      "headers_mode": "standard",      "limits": {        "max_requests": 0,        "window_seconds": 0      },      "owner_id": "string",      "plan_id": "string",      "refund_window_seconds": 0,      "subject_namespaces": [        "string"      ],      "tags": [        "string"      ],      "updated_at": "2019-08-24T14:15:22Z"    }  ]}
POST/api/v1/throttle/plans
POST
/api/v1/throttle/plans

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Create a throttle plan.

Use internal IDs only; do not pass email addresses, phone numbers, or other PII as subject identifiers.

Response Body

application/json

curl -X POST "https://example.com/api/v1/throttle/plans" \  -H "Content-Type: application/json" \  -d '{    "limits": {      "max_requests": 0,      "window_seconds": 0    },    "plan_id": "string"  }'
{  "actions": {    "property1": {      "cost": 0    },    "property2": {      "cost": 0    }  },  "created_at": "2019-08-24T14:15:22Z",  "default_enforcement": "soft",  "description": "string",  "headers_mode": "standard",  "limits": {    "max_requests": 0,    "window_seconds": 0  },  "owner_id": "string",  "plan_id": "string",  "refund_window_seconds": 0,  "subject_namespaces": [    "string"  ],  "tags": [    "string"  ],  "updated_at": "2019-08-24T14:15:22Z"}
GET/api/v1/throttle/plans/{plan_id}
GET
/api/v1/throttle/plans/{plan_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/throttle/plans/string"
{  "actions": {    "property1": {      "cost": 0    },    "property2": {      "cost": 0    }  },  "created_at": "2019-08-24T14:15:22Z",  "default_enforcement": "soft",  "description": "string",  "headers_mode": "standard",  "limits": {    "max_requests": 0,    "window_seconds": 0  },  "owner_id": "string",  "plan_id": "string",  "refund_window_seconds": 0,  "subject_namespaces": [    "string"  ],  "tags": [    "string"  ],  "updated_at": "2019-08-24T14:15:22Z"}
PATCH/api/v1/throttle/plans/{plan_id}
PATCH
/api/v1/throttle/plans/{plan_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Partial update for a throttle plan.

Response Body

application/json

curl -X PATCH "https://example.com/api/v1/throttle/plans/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "actions": {    "property1": {      "cost": 0    },    "property2": {      "cost": 0    }  },  "created_at": "2019-08-24T14:15:22Z",  "default_enforcement": "soft",  "description": "string",  "headers_mode": "standard",  "limits": {    "max_requests": 0,    "window_seconds": 0  },  "owner_id": "string",  "plan_id": "string",  "refund_window_seconds": 0,  "subject_namespaces": [    "string"  ],  "tags": [    "string"  ],  "updated_at": "2019-08-24T14:15:22Z"}
DELETE/api/v1/throttle/plans/{plan_id}
DELETE
/api/v1/throttle/plans/{plan_id}

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Response Body

application/json

curl -X DELETE "https://example.com/api/v1/throttle/plans/string"
{  "message": "string",  "plan_id": "string"}
POST/api/v1/throttle/plans/{plan_id}/check
POST
/api/v1/throttle/plans/{plan_id}/check

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Query Parameters

enforce?string

Override the plan default enforcement: hard returns 429 on denial

Value in

  • "soft"
  • "hard"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Check + consume against a plan bucket.

Response Body

application/json

curl -X POST "https://example.com/api/v1/throttle/plans/string/check" \  -H "Content-Type: application/json" \  -d '{    "subject": "string"  }'
{  "allowed": true,  "consume_token": "string",  "limit": 0,  "reason": "string",  "remaining": 0,  "reset_after_seconds": 0,  "reset_at": 0,  "retry_after_seconds": 0}
POST/api/v1/throttle/plans/{plan_id}/peek
POST
/api/v1/throttle/plans/{plan_id}/peek

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Read-only bucket inspection.

Response Body

application/json

curl -X POST "https://example.com/api/v1/throttle/plans/string/peek" \  -H "Content-Type: application/json" \  -d '{    "subject": "string"  }'
{  "limit": 0,  "remaining": 0,  "reset_after_seconds": 0,  "reset_at": 0}
POST/api/v1/throttle/plans/{plan_id}/refund
POST
/api/v1/throttle/plans/{plan_id}/refund

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Refund a prior consume by its token.

Response Body

application/json

curl -X POST "https://example.com/api/v1/throttle/plans/string/refund" \  -H "Content-Type: application/json" \  -d '{    "consume_token": "string",    "subject": "string"  }'
{  "cost_refunded": 0,  "refunded": true}
POST/api/v1/throttle/plans/{plan_id}/reset
POST
/api/v1/throttle/plans/{plan_id}/reset

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Administratively reset a subject bucket to full capacity.

Response Body

application/json

curl -X POST "https://example.com/api/v1/throttle/plans/string/reset" \  -H "Content-Type: application/json" \  -d '{    "subject": "string"  }'
{  "message": "string"}
GET/api/v1/throttle/plans/{plan_id}/stats
GET
/api/v1/throttle/plans/{plan_id}/stats

Authorization

bearer_token
AuthorizationBearer <token>

In: header

Path Parameters

plan_id*string

Response Body

application/json

curl -X GET "https://example.com/api/v1/throttle/plans/string/stats"
{  "plan_id": "string",  "total_allowed": 0,  "total_checks": 0,  "total_denied": 0,  "total_refunded": 0}

On this page