account-tokens

Create an API token

Create a new API token. Maximum token validity is 24*365h=8760h (~1 year). Attribute allowed_ip_prefixes allows defining a list of CIDR/IP addresses from where the token is accepted. Empty list denies access from everywhere. If unset, the default list will be the IP filters of the account. If no IP filters are defined for the account either, the default will be ["0.0.0.0/0", "::0/0"], i.e. allow from any address.

post/1.3/account/tokens

Request

  • Base URL: https://api.upcloud.com
  • URL: https://api.upcloud.com/1.3/account/tokens
  • Auth: HTTP bearer

Request body

OR

Example request

{
  "expires_in": "8760h",
  "name": "my first token",
  "allowed_ip_ranges": [
    "0.0.0.0/0",
    "::/0"
  ]
}

Response

Token created successfully

idstring uuid

UUID of the token

namestring

The name of the token. Does not need to be unique.

created_atstring date-time

Token creation time.

expires_atstring date-time

The requested expiry time of the token, in RFC3339 format (2025-10-12T07:20:50.52Z). Needs to be in the future and maximum of 1 year in the future.

last_used_atstring date-time

The last time the token was used.

can_create_tokensboolean

Whether the token can create other tokens.

guiboolean

Token is for internal GUI use. Can not be used externally.

allowed_ip_rangesAccountTokensIpRange[]

List of IP ranges that are allowed to authenticate with the token. Empty list denies access from everywhere. If unset, the default list will be the IP filters of the account. If no IP filters are defined for the account either, the default will be ["0.0.0.0/0", "::/0"], i.e. allow from any address.

Example response

{
  "id": "e7b3f8a0-4c2d-11ec-bf63-0242ac130002",
  "name": "my first token",
  "created_at": "2025-11-30T08:03:15.944Z",
  "expires_at": "2025-11-30T08:03:15.944Z",
  "last_used_at": "2025-11-30T08:03:15.944Z",
  "allowed_ip_ranges": [
    "0.0.0.0/0",
    "::/0"
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.