Skip to content
Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Reference

Make your first IONOS CLOUD API request in three steps: get your credentials, get an access token, then list your data centers.

Make your first request

Run the cURL commands in Bash, for example on macOS, Linux, or Windows Subsystem for Linux (WSL). In Windows PowerShell, curl is a different command, so use the CLI example below.

1

Get your credentials

Use your IONOS CLOUD username and password, and save them in environment variables. If your account uses two-factor authentication (2FA), you must use a secure token instead: create one in the Token Manager, then follow Use a secure token with 2FA. For all sign-in methods, see the Authentication reference.

2

Get an access token

Request a token from the token endpoint. Copy the value of token from the JSON response and save it in IONOS_ACCESS_TOKEN. Already have a token? Save it in IONOS_ACCESS_TOKEN and go to step 3.

3

List your data centers

Send the token in the Authorization header. The response lists your data centers in items. If items is empty, your access works and you have no data center yet. Create one in the Data Center Designer or with the API.

Username and password · cURL
# Step 1: Set your credentials
export IONOS_USERNAME="<your-username>"
export IONOS_PASSWORD="<your-password>"

# Step 2: Request an access token
curl "https://api.ionos.com/auth/v1/tokens/generate" \
  --user "$IONOS_USERNAME:$IONOS_PASSWORD"

# Copy the token from the response, then save it
export IONOS_ACCESS_TOKEN="<paste-your-token>"

# Step 3: List your data centers
curl "https://api.ionos.com/cloudapi/v6/datacenters" \
  --header "Authorization: Bearer $IONOS_ACCESS_TOKEN"

Use a secure token with 2FA

If your account uses 2FA, request the access token with your secure token. Steps 1 and 2 change. Step 3 stays the same.

Secure token · cURL
# Step 1: Set your secure token
export IONOS_SECURE_TOKEN="<your-secure-token>"

# Step 2: Request an access token
curl "https://api.ionos.com/auth/v1/tokens/generate" \
  --header "Authorization: Bearer $IONOS_SECURE_TOKEN"

# Copy the token from the response, then save it
export IONOS_ACCESS_TOKEN="<paste-your-token>"

# Step 3: List your data centers
curl "https://api.ionos.com/cloudapi/v6/datacenters" \
  --header "Authorization: Bearer $IONOS_ACCESS_TOKEN"

Got an error?

  • A 401 response means the API rejected your username, password, or token.

  • A 401 response can also mean that the user or contract is not valid.

  • A username and password work only when 2FA is off. Otherwise, use a secure token.

  • With more than one contract, the token request also needs --header "X-Contract-Number: <contract-number>". Without it, the API returns an error.

Send the request from code or the CLI

Each example lists your data centers. Python, Go, and Ruby read the token from IONOS_ACCESS_TOKEN, which you set in step 2. The CLI signs you in once and stores a token.

Next steps

Last updated

Was this helpful?