Api key
API Key plugin endpoints for creating, managing, and verifying API keys.
/api-key/create
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Name of the Api Key
Expiration time of the Api Key in seconds
User Id of the user that the Api Key belongs to. Useful for server-side only.
Prefix of the Api Key
Remaining number of requests. Server side only
Metadata of the Api Key
Amount to refill the remaining count of the Api Key. Server Only Property
Interval to refill the Api Key in milliseconds. Server Only Property.
The duration in milliseconds where each request is counted. Once the maxRequests is reached, the request will be rejected until the timeWindow has passed, at which point the timeWindow will be reset. Server Only Property.
Maximum amount of requests allowed within a window. Once the maxRequests is reached, the request will be rejected until the timeWindow has passed, at which point the timeWindow will be reset. Server Only Property.
Whether the key has rate limiting enabled. Server Only Property.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/api-key/create" \ -H "Content-Type: application/json" \ -d '{ "expiresIn": "string", "remaining": "string" }'{
"id": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"name": "string",
"prefix": "string",
"start": "string",
"key": "string",
"enabled": true,
"expiresAt": "2019-08-24T14:15:22Z",
"userId": "string",
"lastRefillAt": "2019-08-24T14:15:22Z",
"lastRequest": "2019-08-24T14:15:22Z",
"metadata": {},
"rateLimitMax": 0,
"rateLimitTimeWindow": 0,
"remaining": 0,
"refillAmount": 0,
"refillInterval": 0,
"rateLimitEnabled": true,
"requestCount": 0,
"permissions": {
"property1": [
"string"
],
"property2": [
"string"
]
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/api-key/get
Authorization
bearerAuth Bearer token authentication
In: header
Query Parameters
The id of the Api Key
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/api-key/get"{
"id": "string",
"name": "string",
"start": "string",
"prefix": "string",
"userId": "string",
"refillInterval": 0,
"refillAmount": 0,
"lastRefillAt": "2019-08-24T14:15:22Z",
"enabled": true,
"rateLimitEnabled": true,
"rateLimitTimeWindow": 0,
"rateLimitMax": 0,
"requestCount": 0,
"remaining": 0,
"lastRequest": "2019-08-24T14:15:22Z",
"expiresAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"metadata": {},
"permissions": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/api-key/update
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The id of the Api Key
The name of the key
Whether the Api Key is enabled or not
The number of remaining requests
The refill amount
The refill interval
The metadata of the Api Key
Expiration time of the Api Key in seconds
Whether the key has rate limiting enabled.
The duration in milliseconds where each request is counted.
Maximum amount of requests allowed within a window. Once the maxRequests is reached, the request will be rejected until the timeWindow has passed, at which point the timeWindow will be reset.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/api-key/update" \ -H "Content-Type: application/json" \ -d '{ "keyId": "string", "expiresIn": "string", "permissions": "string" }'{
"id": "string",
"name": "string",
"start": "string",
"prefix": "string",
"userId": "string",
"refillInterval": 0,
"refillAmount": 0,
"lastRefillAt": "2019-08-24T14:15:22Z",
"enabled": true,
"rateLimitEnabled": true,
"rateLimitTimeWindow": 0,
"rateLimitMax": 0,
"requestCount": 0,
"remaining": 0,
"lastRequest": "2019-08-24T14:15:22Z",
"expiresAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"metadata": {},
"permissions": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/api-key/delete
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The id of the API key to delete
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/api-key/delete" \ -H "Content-Type: application/json" \ -d '{ "keyId": "string" }'{
"success": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}/api-key/list
Authorization
bearerAuth Bearer token authentication
In: header
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/api-key/list"[
{
"id": "string",
"name": "string",
"start": "string",
"prefix": "string",
"userId": "string",
"refillInterval": 0,
"refillAmount": 0,
"lastRefillAt": "2019-08-24T14:15:22Z",
"enabled": true,
"rateLimitEnabled": true,
"rateLimitTimeWindow": 0,
"rateLimitMax": 0,
"requestCount": 0,
"remaining": 0,
"lastRequest": "2019-08-24T14:15:22Z",
"expiresAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"metadata": {},
"permissions": "string"
}
]{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}