Authentication
The UpCloud API uses HTTP Bearer authentication. An API token is required to authenticate with the UpCloud API. You can create an API token in the UpCloud control panel or using the API directly.
Bearer token authentication
The recommended way to authenticate with the UpCloud API is by using Bearer tokens. When making requests, include your API token in the Authorization header.
API tokens can be created with specific permissions, IP restrictions, and expiration times for enhanced security.
Request headers
- Name
Authorization- Type
- string
- Description
Bearer token in the format:
Bearer ucat_XXXXX
- Name
Content-Type- Type
- string
- Description
Set to
application/jsonfor JSON requests.
- Name
Accept- Type
- string
- Description
Set to
application/jsonorapplication/xml.
Request
curl -X GET https://api.upcloud.com/1.3/account \
-H "Authorization: Bearer ucat_01DQE3AJDEBFEKECFM558TGH2F"
HTTP Basic authentication
HTTP Basic authentication with a username and password can also be used to authenticate with the UpCloud API. However, use of this authentication method is discouraged and will be deprecated at a later date.
We recommend using an API subaccount with HTTP Basic authentication. The subaccount can be created in the UpCloud control panel's People page.
Error response
If authentication fails, the API returns an HTTP 401 error response with the error code AUTHENTICATION_FAILED.
Request
curl -X GET https://api.upcloud.com/1.3/account \
-u your_username:your_password
Creating API tokens
You can create API tokens using the UpCloud control panel or the upctl command-line tool. Tokens can be configured with:
- Name
name- Type
- string
- Description
A descriptive name for the token.
- Name
expires-in- Type
- string
- Description
Token expiration time (e.g.,
1h,24h,7d).
- Name
allow-ip-range- Type
- string
- Description
IP ranges allowed to use this token.
Request
upctl account token create \
--name terraform \
--expires-in 1h \
--allow-ip-range 1.2.3.4 \
--allow-ip-range ::/0 \
--allow-ip-range 2.3.4.0/24