KyPanelDocs

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

Who
root, reseller (ACL: create-user-session); customer
API tokens
API tokens can't use this endpoint
Operation
listTokensForAccount · ky call listTokensForAccount

Parameters

NameIn
idpath

Responses

  • 200 OK
    Body
    FieldType
    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

Who
root, reseller (ACL: create-user-session); customer
API tokens
API tokens can't use this endpoint
Operation
createTokenForAccount · ky call createTokenForAccount

Parameters

NameIn
idpath

Request body

FieldType
allowed_ipsarray of string
expires_atinteger
namestring
scopesarray of string

Responses

  • 201 Created
    Body
    FieldType
    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}

Who
root, reseller (ACL: create-user-session); customer
API tokens
API tokens can't use this endpoint
Operation
revokeTokenForAccount · ky call revokeTokenForAccount

Parameters

NameIn
idpath
tidpath

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.

Who
public
API tokens
any valid token
Operation
tokenSelf · ky call tokenSelf

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

Who
root
API tokens
API tokens can't use this endpoint
Operation
listTokens · ky call listTokens

Responses

  • 200 OK
    Body
    FieldType
    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

Who
root
API tokens
API tokens can't use this endpoint
Operation
createToken · ky call createToken

Request body

FieldType
allowed_ipsarray of string
expires_atinteger
namestring
scopesarray of string

Responses

  • 201 Created
    Body
    FieldType
    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}

Who
root
API tokens
API tokens can't use this endpoint
Operation
revokeToken · ky call revokeToken

Parameters

NameIn
tidpath

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