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.
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.
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.
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.
# 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.
# 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"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?