API reference
API Tokens
Keys for scripts and billing systems: admin tokens (ACL areas, allowed IPs, expiry) and account tokens.
List the account's API tokens
GET/api/v1/accounts/{id}/tokens
Parameters
| Name | In |
|---|---|
id | path |
Responses
- 200 OK
Body
Field Type areasarray of TokenScope itemsarray of StoreAPIToken - 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 500 Internal Server Error: internal
Create an account API token
POST/api/v1/accounts/{id}/tokens
Parameters
| Name | In |
|---|---|
id | path |
Request body
| Field | Type |
|---|---|
allowed_ips | array of string |
expires_at | integer |
name | string |
scopes | array of string |
Responses
- 201 Created
Body
Field Type secretstring tokenStoreAPIToken - 400 Bad Request: validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 404 Not Found: not-found
- 409 Conflict: validation
- 500 Internal Server Error: internal
Revoke an account API token
DELETE/api/v1/accounts/{id}/tokens/{tid}
Parameters
| Name | In |
|---|---|
id | path |
tid | path |
Responses
- 204 Done, no content
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 404 Not Found: not-found
- 500 Internal Server Error: internal
Who the calling API token belongs to
GET/api/v1/token
Tells an API client about the token it calls with: whose it is (the admin, or the account and its username) and what it may do. The ky CLI reads it at login.
Responses
- 200 OK
Body
map of any
- 401 Unauthorized: invalid-token
- 403 Forbidden: token-ip
- 429 Too Many Requests: too-many-attempts
- 500 Internal Server Error: internal
List your admin API tokens
GET/api/v1/tokens
Responses
- 200 OK
Body
Field Type areasarray of TokenScope itemsarray of StoreAPIToken - 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 500 Internal Server Error: internal
Create an admin API token
POST/api/v1/tokens
Request body
| Field | Type |
|---|---|
allowed_ips | array of string |
expires_at | integer |
name | string |
scopes | array of string |
Responses
- 201 Created
Body
Field Type secretstring tokenStoreAPIToken - 400 Bad Request: validation
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 404 Not Found: not-found
- 409 Conflict: validation
- 500 Internal Server Error: internal
Revoke an admin API token
DELETE/api/v1/tokens/{tid}
Parameters
| Name | In |
|---|---|
tid | path |
Responses
- 204 Done, no content
- 401 Unauthorized: no session, or an invalid or expired token
- 403 Forbidden: the caller can't use this (privileges, token scope, feature turned off)
- 404 Not Found: not-found
- 500 Internal Server Error: internal