Aller au contenu principal
This page is not translated yet. Français is switched on so the navigation and URLs can be tested; the text below is the English original. Use the language selector in the header to switch back, or see the documentation home.

Authenticate to the Rescale API

Every request to the Rescale API must include an API token in the Authorization header.

Prerequisites​

  • A Rescale account with API access enabled
  • An active workspace you belong to

Steps​

1. Create an API token​

Open Preferences > API on your platform and click Add API Key. Give it a name you will recognize later. Copy the token once; the platform does not show it again.

2. Send the token with every request​

Add the header Authorization: Token <your-token> to every request.

curl -H "Authorization: Token $RESCALE_TOKEN" \
https://platform.rescale.com/api/v3/workflows/

3. Confirm the token works​

A valid token returns 200 OK. An invalid or missing token returns 401 Unauthorized.

curl -sSo /dev/null -w "%{http_code}\n" \
-H "Authorization: Token $RESCALE_TOKEN" \
https://platform.rescale.com/api/v3/workflows/

Verify it worked​

You should see 200 in the terminal. If you see 401, the token is wrong or expired. If you see 403, the token is valid but the account lacks permission for that workspace.

Token scope​

A token inherits the permissions of the user that created it. Permissions are not configurable per key.

Key lifetime​

By default keys do not expire. An organization admin can enable a max lifetime policy with a fixed number of days, for example 90. After the policy takes effect, new keys expire that many days after creation, and existing keys are unaffected.

An expired key stays visible in the UI, with a red date, until you delete it. Requests made with it return API key is no longer active. There are no email alerts on expiration.

Embedded per-job keys​

Jobs automatically receive a short-lived API key in the RESCALE_API_KEY environment variable. Use it inside pre- or post-processing scripts for chaining, fan-out, or orchestration without managing long-lived tokens. The key expires when the job completes.

import os
import requests

api_key = os.getenv("RESCALE_API_KEY")
requests.get(
"https://platform.rescale.com/api/v2/jobs/",
headers={"Authorization": f"Token {api_key}"},
)

Rotate a token​

Create a new token first, update your clients, then delete the old one.

Next steps​