Authentication

Session tokens (JWT) for people, API keys for code, and which one wins when both are sent.

Every request to the mlflow API must say who is calling. There are two ways to do it. People who sign in to the web app use a session token. Code, scripts and services use an API key. Both lead to the same user record, so roles and permissions work the same way for both.

Two ways to authenticate

Session tokenAPI key
ForThe web app, and short interactive scriptsCI jobs, services, notebooks, AI assistants
HeaderAuthorization: Bearer <token>X-API-Key: <key>
LifetimeAccess token: 60 minutes by default. Refresh token: 30 days by defaultUntil it expires or is revoked; you choose
Limited by scopesNoYes
Rate limited per keyNoYes

Your server's operator can change the default token lifetimes.

For anything that runs unattended, use an API key. See API keys and scopes.

Session tokens

A session token comes from signing in with your email and password.

POST/api/v1/auth/login
bash
curl -s -X POST https://app.mlflow.es/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "..."}'

The response contains three values you need:

json
{
  "access_token": "eyJ...",
  "refresh_token": "...",
  "token_type": "bearer",
  "expires_in": 3600
}
  • access_token is a signed JSON Web Token (JWT). Send it as Authorization: Bearer <access_token>. expires_in is its lifetime in seconds.
  • refresh_token is a random string. Keep it private. Use it to get a new access token before the old one expires.

Refresh and sign out

POST/api/v1/auth/refresh

Send {"refresh_token": "..."}. You receive a new access token and a new refresh token. The old refresh token stops working at once (rotation), so always store the new one.

If an old refresh token is presented again after it was exchanged, mlflow treats it as a possible theft: it revokes every session of that user and every access token already issued. Two browser tabs that refresh at almost the same moment are tolerated and only get a plain 401.

POST/api/v1/auth/logout

Send {"refresh_token": "..."} to revoke it. The response is 204. The access token cannot be revoked one by one; it expires on its own. Changing or resetting your password revokes all sessions and all access tokens of your account.

Rate limits on sign-in

Sign-in is limited to protect accounts. By default, one IP address may try 10 times per minute, and one email address from one IP address 5 times per minute; repeated failures lead to a longer wait. A limited request gets 429 with a Retry-After header. The answer is the same whether or not the account exists. Your server's operator can change these limits.

API keys

Create a key in the app under Account, on the API keys tab, and send it in the X-API-Key header:

bash
curl -s https://app.mlflow.es/api/v1/auth/me -H "X-API-Key: $MLFLOW_API_KEY"

A key acts as the user who created it, with that user's roles, and its scopes (read, write, predict, admin) can only reduce what it may do. Some actions always need a session and refuse API keys: creating API keys, changing your password, exporting or deleting your account, and billing checkout. The whole story is on API keys and scopes.

An older header name, X-PyCaret-Key, is still accepted for existing scripts. Use X-API-Key for new code.

Precedence

If one request carries both a bearer token and an API key, the bearer token is used and the key is ignored. This matches a common situation: a developer has a key in an environment variable and is also signed in to the app. If the bearer token is invalid or expired, the request fails with 401; mlflow does not fall back to the key.

Email verification

On servers that require email verification, a new account must confirm its address before it can use the API.

  • Sign-up (POST /auth/signup) answers 202 and sends a link by email. No tokens are returned; the user then signs in with the password they chose. The answer is the same for an address that is already registered, so the response does not reveal which addresses have accounts.
  • Until the address is verified, the account can sign in, call GET /auth/me, redeem the link (POST /auth/verify-email with the token from the email) and ask for a new link (POST /auth/resend-verification). All other endpoints answer 403 with code: "email_unverified".
  • API keys do not bypass this. A key whose owner is unverified gets the same 403 on every route, including GET /auth/me. Verification is done in a browser session.

GET /auth/me returns email_verification_pending, which is true while the account still has to verify. If email verification is off on your server, sign-up returns 201 with tokens and an address that is already taken returns 409. If public sign-up is disabled, it returns 403.

Errors

Status and messageMeaningWhat to do
401 "missing Authorization or X-API-Key header"No credentials were sentAdd one of the two headers
401 "invalid credentials"Wrong email or password at sign-inCheck them
401 "access token expired"The access token is older than its lifetimeRefresh it, or sign in again
401 "invalid access token" or "wrong token type (expected access)"The token is damaged, or you sent a refresh token as an access tokenSend the access token
401 "access token revoked"You changed your password, or the sessions were revokedSign in again
401 "invalid refresh token"The refresh token is unknown, expired, revoked or already usedSign in again
401 "invalid API key", "API key revoked", "API key expired"The key cannot be usedCreate a new key
403 "user inactive"An administrator deactivated the accountContact your administrator
403 email_unverifiedThe address is not verified yetVerify the email
429Too many attemptsWait for Retry-After seconds

All error bodies are described in Errors and rate limits.

Updated 2026-11-22