Skip to main content

Request authentication

Depending on the product or its resource, the following are used instead of a username and password to work with Selectel product APIs and authenticate requests:

  • IAM tokens are issued to service users. Token lifetime is 24 hours. IAM tokens are passed in the X-Auth-Token header and have different scopes:

    • Account IAM tokens (iam_token_account_scoped) — for managing resources linked to the account;
    • Project IAM tokens (iam_token_project_scoped) — for managing resources linked to the project;
  • static tokens (static_token) — issued to users with access to the control panel and used to manage resources linked to the account. Token lifetime is unlimited. Static tokens are passed in the X-Token header.

The request URL can be found in the list of URLs.

You can limit API access to addresses that include https://api.selectel.ru.

Account IAM token (X-Auth-Token)

For your information

An account IAM token can only be issued to a service user.

The token is passed in the X-Auth-Token header.

An account IAM token (iam_token_account_scoped) provides access to manage most Selectel products and OpenStack API objects, similar to using a username and password in the my.selectel.ru control panel. It allows you to manage account resources.

Token lifetime is 24 hours.

The token allows you to manage:

Get an account IAM token

An account IAM token can be issued to service users that have a permission with the Account scope selected.

For your information

If you are using Windows, replace single quotes ('') with double quotes ("") in your requests. We also recommend using PowerShell for requests instead of CMD.

  1. Perform the request:
curl -i -XPOST \
-H 'Content-Type: application/json' \
-d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"<username>","domain":{"name":"<account_id>"},"password":"<password>"}}},"scope":{"domain":{"name":"<account_id>"}}}}' \
'https://cloud.api.selcloud.ru/identity/v3/auth/tokens'

Specify:

  • <username> — service user name. You can find the name in the control panel: in the top menu, click IAMService Users section (the section is available only to the account owner and users with the iam.admin role);
  • <account_id> — account number. You can find it in the control panel in the upper-right corner;
  • <password> — service user password; you can see it when creating a user or change it to a new one.

Upon successful authentication, you will receive a 201 Created response in the following format:

HTTP/2 201
X-Subject-Token: token
  1. Check the X-Subject-Token header for the token.

Project IAM token (X-Auth-Token)

For your information

A project IAM token can only be issued to a service user.

The token is passed in the X-Auth-Token header.

A project IAM token (iam_token_project_scoped) provides access to manage most Selectel products and OpenStack API objects, similar to using a username and password in the my.selectel.ru control panel. It allows you to manage project resources.

Token lifetime is 24 hours.

The token allows you to manage:

Get a project IAM token

A project IAM token can be issued to service users that have a permission where:

For your information

If you are using Windows, replace single quotes ('') with double quotes ("") in your requests. We also recommend using PowerShell for requests instead of CMD.

  1. Perform the request:
curl -i -XPOST \
-H 'Content-Type: application/json' \
-d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"<username>","domain":{"name":"<account_id>"},"password":"<password>"}}},"scope":{"project":{"name":"<project_name>","domain":{"name":"<account_id>"}}}}}' \
'https://cloud.api.selcloud.ru/identity/v3/auth/tokens'

Specify:

  • <username> — service user name. You can find the name in the control panel: in the top menu, click IAMService Users section (the section is available only to the account owner and users with the iam.admin role);
  • <account_id> — account number. You can find it in the control panel in the upper-right corner;
  • <password> — service user password; you can see it when creating a user or change it to a new one;
  • <project_name> — project name.

Upon successful authentication, you will receive a 201 Created response in the following format:

HTTP/2 201
X-Subject-Token: token
  1. Check the X-Subject-Token header for the token.

Static token (X-Token)

For your information

An X-Token can only be issued to a user with access to the control panel.

The token is passed in the request header X-Token.

A static token (static_token) provides full access to manage all Selectel products, except for OpenStack API objects, similar to using a username and password in the my.selectel.ru control panel.

Token lifetime is unlimited.

For APIs that do not support account IAM tokens and project IAM tokens, the static token is the only method for:

Get a static token

  1. In the control panel, in the upper-right corner, open the menu (account number) and select Profile.
  2. Go to the Access section → API Keys tab.
  3. Click Add key.
  4. Enter the key name.
  5. Click Add.

API token support

APIAccount IAM tokenProject IAM tokenStatic token
IAM
Federations
Balance
Statistics
Reports
Transactions
Dedicated servers
Cloud platform projects and resources
Project quotas and limits
Managed Databases
Managed Kubernetes
Container Registry
Secrets
Certificates
Let’s Encrypt® certificates
Swift
Object Storage
CDN
DNS hosting (actual)
DNS hosting (legacy)
Selectel email service
IP address management service
Audit logs
Cloud for 1C
Mobile farm
Tickets
Attachments