---
sidebar_label: "API Keys"
title: "Authentication"
description: "Create an API Key and share client configuration between the CLI and Python SDK."
last_update:
  date: 2026-11-18
---

<span id="authentication" className="legacy-anchor" />

Remote CLI / SDK clients access EnvPlatform with a Bearer API Key. Browser login sessions are for platform pages and do not replace an API Key for programmatic clients.

Install the public [envloop-cli package](../cli-install.md) for the configuration commands and shared client files described here. `envloop` and `el` are equivalent for every command. See [Compatibility](resources.md) for the client and platform boundaries.

On **API Keys → Project API Keys**, select **View** to open the key's
**Overview** and **Permissions** tabs in the current browser tab. **Edit** is shown
beside View for keys you can edit. Back keeps the list's search and sorting.
Existing secrets are never displayed; **Revoke** still asks for confirmation.

## Choose the credential for your workflow

| Workflow | Use | What to verify |
|---|---|---|
| Explore Console and manage team settings | Browser sign-in | Correct workspace, project and role |
| Start using CLI / SDK interactively | `el auth login`, or a project Key with `el auth config` | Saved and effective scope match |
| Read results from a script | Read only Key | Artifact/resource access in the intended project |
| Run training, Jobs or deployments from CI | Project automation Key | Account role permits the requested action; CI stores the secret privately |
| Call a selected model from an application | Inference only Key | Allowed immutable endpoint IDs and current subject role |
| Call EnvLoop from a Runner inside a Sandbox | Nothing: the Runner declares permissions and receives a [Trial credential](#sandbox-runner-credentials) | Your submitting Key holds the declared permissions |

All Keys are project-bound. A Key's effective permissions are the intersection of its purpose and the account's current role; it cannot promote the account. For persistent team automation, use a [service account](../manage/members.md#service-accounts-for-automation) rather than assuming a teammate's personal Key survives offboarding. Never put an application Key in browser JavaScript or a public build variable.

For the shortest connection path, complete [Installation](../cli-install.md), then run `el auth login` and `el job list --limit 5`. The sections below cover manual setup, multiple projects and recovery.

## Sign in with your browser

New customers can register with email or a configured social provider such as
Google. Verify your email to receive a personal Workspace and Default project
automatically. Joining an existing team requires an invitation or access grant.

```bash
el auth login
# For a local development platform:
el auth login --base-url http://127.0.0.1:5173/api
# On an SSH session or when a browser cannot open automatically:
el auth login --no-browser --timeout-seconds 600
# A read-only Key, for example for CI that only reads results:
el auth login --read-only
```

`envloop auth login` is equivalent. The CLI opens the platform's existing Clerk sign-in page in your system browser, with the same email-code and configured social sign-in options. Copy the printed link if the browser cannot open. After signing in, choose a workspace and project, enter the **confirmation code shown in your terminal**, and select **Authorize CLI**. Approve only a login you started. Return to your terminal when the page says **CLI authorized**; the CLI verifies and saves a project-scoped Key for both CLI and SDK. The browser does not receive the Key.

Before you approve, the page lists every permission the Key will get in the selected project. The Key follows your project role. A Developer or Admin Key can read, write and delete Datasets, Runners, Profiles and Checkpoints, so `el dataset create`, `el dataset update` and `el dataset delete` work right away. A Viewer Key only reads. `el auth login --read-only` issues a read-only Key whatever your role; to write with it later, run `el auth login` again without `--read-only`. To add permissions to an existing Key, edit its permission rows on the **API Keys** page. You can also run `el auth login` again to issue a replacement, then revoke the old Key.

The page preselects the current project only when it is active and accessible in the selected workspace. Otherwise, choose a project explicitly; list order never selects a project for you.

The Key expires after 30 days and is fixed to your selected project. CLI login issues a **Project automation** Key, or a **Read only** Key for `--read-only` and for Viewer access. Each request intersects the Key's capabilities with your current Project role, so role changes and revocation take effect on the next request. These Key purposes do not grant project governance permissions. Your account status and current membership are checked on every request. Development-account login cannot authorize this flow; use your verified Clerk account. To select another project, use `el auth config project` with that project’s Key, or run login again. Existing saved project Keys are retained for later workspace/project selection. Revoke your unused login Key on the project's **API Keys** page; `auth logout` only removes local credentials.

Login uses the effective Base URL, or the official API on first use; `--base-url` selects this login's address. The local address must include `/api`. Automatic browser opening depends on the operating system and may use a window or tab. The CLI waits 300 seconds by default; `--timeout-seconds` accepts 1–600 seconds. Cancel in the page or press Ctrl-C in the terminal to stop. Denial, expiry, network failure, or unsuccessful verification preserves the previous saved connection. Network polling retries within the time limit. Environment variables still override saved credentials and scope; check `el auth config show --json` if a saved login is not being used.

If browser authorization is unavailable on your platform, create a project Key in Console and use the manual setup below.

## Create a key

Select the intended workspace and project, then open **Configure → API Keys**
from the project navigation, then select the **Project API Keys** tab to view and manage its keys.

1. Register or sign in to your platform account and verify your email. Select the intended workspace and project, then select **Create API Key** to open a separate creation page.
2. Enter a **Key name** and check **Key account**, the user or Service Account the Key represents. Keep your user account, or, if you are a Project Admin, select an active Service Account.
3. Add **Tab / Subtab / Access** permission rows matching the project navigation, for example **EXPERIMENTS → All pages**, **EXPERIMENTS → Jobs**, or **ASSETS → Datasets**. All pages covers that tab's supported pages; shared read permissions are explained in the form. Edit permits supported CLI/API creation, changes and deletion; Console Experiment remains read-only. CONFIGURE and governance require browser sign-in.
4. Asset access follows these rows; there is no separate Assets permission. Read on **ASSETS → Datasets**, **ASSETS → Checkpoints**, **ASSETS → Profiles** or **EXPERIMENTS → Runners** includes exporting and downloading their content, and Read on **EXPERIMENTS → Jobs** includes Trial artifacts. Edit also permits uploading, publishing new immutable revisions and revoking publications you own. These permissions do not submit Jobs or expand project access.
5. To clean up resources with `el setting cleanup` or `el setting resource-scope`, add **MANAGE → Resource cleanup** with Edit; **MANAGE → All supported pages** with Edit includes it. A Key with Edit on **EXPERIMENTS → All pages**, **ASSETS → All pages** and **MANAGE → Resource cleanup** can publish data, train, deploy and clean up.
6. Choose **No expiration**, **7 days**, **30 days**, **90 days**, **1 year**, or a custom local date and time, then select **Create API Key**. Each request remains limited by the account's current project role.
7. On **Save your API Key**, copy the secret into a private environment or secret manager, then select **I have saved my key** to return to the list. The list will not show the full secret again. If you leave without saving it, revoke the Key and create a replacement.
8. Revoke unused Keys on the API Keys page. Clients must switch to a valid Key after revocation. Continue with [Configure the client](#configure-the-client) to verify the connection.

Every Key is fixed to one Project and a User or Service Account. Its effective permissions are the intersection of the account's current Project role and the Key's capabilities. Viewer permits reading and downloads; Developer also permits running and managing business resources, including deletion; Admin adds project governance through a management session. Choosing Project automation does not elevate a Viewer or grant governance actions. Users can create and revoke their own project Keys; Project Admins can also issue Service Account Keys and revoke project Keys. Account disable, role changes, Key expiry and revocation affect subsequent requests. Read only and Project automation Keys can also read their own project's recorded usage (`billing.read`); no Key can read the workspace balance or ledger.

### Update a key

Use search to find a key, then open its **⋯ → Edit** menu. Change its name,
add/remove permission rows or adjust its expiration, then select **Save changes**.
The Key ID and secret stay the same, so clients keep their existing configuration.
Permission changes affect subsequent requests and remain limited by the account's
current project role. You can edit your own active keys; project administrators
can edit project keys, including Service Account keys. Expired or revoked keys
cannot be restored by editing.

The list summarizes permissions with a `+N` count. **View summary** shows complete
metadata; **All columns** reveals account, IDs, expiration and restrictions.
Unrecorded historical dates display `—`. If another update changes the key while
you edit, refresh and review the current permissions before retrying; your save
cannot overwrite a newer version.

### Inference-only keys

For an application that calls your model endpoints, select **EXPERIMENTS → Jobs / Inference** in Permissions under the project's **API Keys** and select 1–20 allowed endpoints. The selection binds immutable endpoint IDs, not names: deleting an endpoint and creating another with the same name does not authorize the replacement. The account's current role must still allow inference.

The Key can access `GET /v1/jobs/{job_id}/inference/models`, `POST /v1/jobs/{job_id}/inference/chat/completions` and `POST /v1/jobs/{job_id}/inference/completions` at `https://api.envloop.ai`. It can also read the restricted endpoint list with `GET /v1/endpoints`, and a selected endpoint's status and events with `GET /v1/endpoints/{endpoint_id}` and `GET /v1/endpoints/{endpoint_id}/events`. It cannot create, pause, update or delete endpoints, read training artifacts, or manage project members or Keys. Requests to other API routes are denied. Inference may automatically wake a selected endpoint under its existing scaling policy and remains subject to budget and lifecycle checks.

Inference access uses a separate Key; create another Key for other permissions. The **Save your API Key** page shows an OpenAI SDK example. Use an Inference only Key in an application backend that needs these calls, and keep its allowed endpoint list limited to that application's models.

## Configure the client

On Linux / macOS, run the interactive wizard after installing envloop-cli:

```bash
envloop auth config
# Base URL: https://api.envloop.ai
# API key: ********  # Each typed character is masked
envloop auth status
envloop auth status --check
envloop job list --limit 10
```

`el auth config` is equivalent. `auth config init` also opens the wizard. The wizard uses the saved Base URL, or `https://api.envloop.ai` on first use, prompts for a Key with `*` masking, then offers project selection after verification. No URL input is required. For a custom address, first run `el auth config set base-url http://127.0.0.1:5173/api`. The wizard first calls `GET /v1/me` at that Base URL and requires `auth_method=api_key` before saving, with a five-second network timeout. Authentication rejection, denied access, network/service errors or anonymous responses preserve the old configuration. Only explicit `auth config --no-check` / `auth config set api-key --no-check` saves offline and reports `not_checked (offline)`. An empty Key rechecks the existing Key for that address before keeping it; if no matching Key exists, it fails. `status` inspects local configuration; `status --check` checks the effective connection. See the check results below to distinguish authentication from Job access. Status and JSON output show whether a Key is present and its source, never the Key itself.

Backspace removes a character and its mask; Ctrl-U clears the input. Ctrl-C or Ctrl-D cancels, restores terminal settings and leaves the saved Key intact.

The wizard and `set api-key` (including `--stdin`) check the saved address, candidate Key and any saved workspace/project; environment/dotenv addresses, Keys and workspace values cannot override that verification target. Success reports `authentication_confirmed`; 401 reports `AUTHENTICATION_REJECTED`, 403 reports `AUTHORIZATION_DENIED` without a saved workspace; selected workspace denials report `WORKSPACE_ACCESS_DENIED` (403/404). A network error means the check did not reach the server; retry it. If the saved address changes during verification, `set api-key` returns `CONFIG_CHANGED` without saving the Key.

The SDK reads the same saved connection:

```python
from envloop import Client

with Client.remote() as client:
    print(client.jobs.list(limit=10))
```

The configuration wizard verifies the Key through `/v1/me` before saving. If `el auth status --help` mentions `GET /v1/me`, `status --check` also verifies the Key and scope there: `access_confirmed` means authentication succeeded; inspect `probes.jobs` and any warnings for the separate Job read. Older clients check a Job list instead. Run `el job list --limit 5` to verify Job access with either client.

## Change settings and use scripts

```bash
envloop auth config set base-url               # Save https://api.envloop.ai (default)
envloop auth config set base-url http://127.0.0.1:5173/api  # Custom address
envloop auth config set api-key                 # Masked terminal input
envloop auth config set workspace-id ws_example
envloop auth config get base-url
envloop auth config show --json
envloop auth config path
```

`auth config set base-url [URL]` saves the address without prompting for a Key or making a network request. Omitting URL saves `https://api.envloop.ai`, replacing any saved custom address.

Use `auth config set base-url` to change the saved address. Save the URL before using `set api-key`; ordinary `auth config` saves the default address automatically. Changing the saved URL restores the workspace and project last used at the new address (the scope of its saved Key) and otherwise leaves them unset; the previous address's Keys and scope stay saved, so switching back does not need another login. Writes target the saved default URL even when environment values override the effective connection. Show/status follow the CLI URL precedence, using cwd `.env.local` only when no address is saved. To read one Key from a secret manager or private file in a script:

```bash
envloop auth config set api-key --stdin < /absolute/private/platform.key
```

Do not put a Key in command arguments or enable shell tracing around credential input. `--stdin` accepts one Key with an optional final newline. A wizard or hidden-input command without a terminal fails promptly; it does not wait for unattended input.

System environment variables override saved configuration. CI can keep credentials in its secret manager without saving files:

```bash
export ENVLOOP_BASE_URL=https://api.envloop.ai
# Inject ENVLOOP_API_KEY from your CI secret manager.
el job list --limit 10
```

## Workspace selection

```bash
el auth workspace       # ↑ / ↓ select a workspace; Enter saves, Esc cancels
el auth workspace ws_example   # Select by ID in a script
el auth status            # Inspect saved and effective selection
```

The picker uses the saved connection. The production account workspace list requires a browser login session; an API Key cannot enumerate all account memberships. When that list returns 403 `ACCESS_DENIED`, the picker shows the workspace authenticated by the current Key and workspaces with locally saved Keys. To add another, run `el auth workspace ID --stdin` with its Key; a successful exact-scope check adds it to future selections. The picker rechecks the Key before switching to a saved entry. Other list errors remain errors. EnvLoop API Keys are fixed to one workspace/project pair; switch with a Key for the target pair. For a workspace without a saved Key, enter its Key with asterisk masking, or use `el auth workspace ws_example --stdin < /absolute/private/workspace.key`. The CLI requires `/v1/me` to confirm API Key authentication and the selected workspace before saving. Failures and cancellation preserve the previous selection. Verified project Keys are saved per URL, workspace and project and reused on later switches by the CLI and SDK. Logout removes all saved workspace Keys for the default URL.

Writes use saved settings and never import environment Keys. `ENVLOOP_API_KEY`, `ENVLOOP_WORKSPACE_ID`, `ENVLOOP_PROJECT_ID` and URL environment variables still override the saved selection; unset them to use it. `auth status` reports saved and effective settings separately. Changing the saved URL restores that address's saved Key scope; if it is unknown or ambiguous, workspace and project are cleared. SDK explicit parameters remain available. `auth config set workspace-id` is a low-level offline ID setting; it does not verify permission or provision a Key.

## Remove or rotate a key

```bash
envloop auth config unset workspace-id
envloop auth config unset api-key
# Equivalent local Key removal:
envloop auth logout
```

`logout` removes all locally saved Keys for the **stored default Base URL**, including its saved project Keys. It preserves the URL, workspace and Keys saved for other addresses, and does not revoke the server Key. `ENVLOOP_API_KEY` remains active until you unset or replace it. `unset base-url` removes the saved URL while retaining the address-bound Keys.

For rotation, save the new Key, run `envloop auth status --check`, then revoke the old Key in the Dashboard. Use `auth status` as the single status command. `auth login` uses the browser authorization flow above.

## Sandbox Runner credentials {#sandbox-runner-credentials}

A Sandbox does not inherit your login, and you do not pass a Key into a Job. A Runner
that calls EnvLoop from its Sandbox declares what it needs in `runner.toml`:

```toml
[metadata.permissions]
data = "write"        # "read": list, get and download Datasets, Checkpoints and Artifacts; "write" also publishes Datasets
inference = "invoke"  # call an existing Inference Job
```

Before each Trial starts, EnvLoop creates a credential for that Trial only. It has only
the declared permissions, works only in the Job's workspace and project, expires at
the Trial deadline and is revoked when the Trial ends, is cancelled or times out. Your
current project role still applies to every request it makes. EnvLoop sets
`ENVLOOP_BASE_URL`, `ENVLOOP_API_KEY`, `ENVLOOP_WORKSPACE_ID` and
`ENVLOOP_PROJECT_ID` for the Runner entrypoint, so `el` and the SDK work without
configuration, and removes the Key's value from Trial logs and outputs. These platform
values replace any Job `env` entries with the same names.

The Key you submit with must hold the declared permissions itself; a Key from
`el auth login` does. Otherwise submission fails with `422 TRIAL_PERMISSIONS_DENIED`.
If the credential cannot be created, the Trial fails with
`TRIAL_CREDENTIAL_UNAVAILABLE` or `TRIAL_CREDENTIAL_DENIED` before any Sandbox starts.
Runners without a declaration get no credential. Trial credentials do not appear in
the API Keys page.

## Storage and platform support

The default files are `~/.envloop/config.toml` (URL and optional workspace/project) and `~/.envloop/auth.json` (plaintext API Keys bound to API addresses). On POSIX, the directory is private (`0700`) and files are private (`0600`). Existing paths with unsafe ownership or permissions, symlinks, malformed files and unsupported versions are rejected. Keep this directory out of Git, images and shared folders. Set `ENVLOOP_HOME` to an absolute private directory to isolate a CI job or another client configuration.

Ordinary CLI commands automatically skip user files on non-POSIX platforms and retain URL / Key environment support. The first file persistence implementation supports POSIX only. Until Windows private ACL support is verified, use environment variables or explicit SDK arguments and set `Client.remote(..., config=False)` to disable user file access. `config=False` preserves explicit and environment configuration; it does not relax transport checks.

## Local development

When the full local platform is running, use `http://127.0.0.1:5173/api/`, adjusting the port if necessary. This trusted loopback endpoint forwards through the web proxy to the Worker and accepts the same Bearer API Key. Its `/api` prefix is retained.

For a local platform, use the documented [public development API](../reference/configuration.md) and a Key issued by that local platform. Use a separate saved connection for each platform. Public connections must use HTTPS; credentials in URLs, query / fragment components, and automatic redirects are rejected. The Key is sent only in the Authorization request header.

Do not put an EnvLoop API Key in a Task Profile, task source code, or public frontend environment variables. See [Configuration](../reference/configuration.md) for address binding and full precedence rules, and [CLI reference](../reference/cli.md) for all authentication commands.

## Project scope

Keys are issued inside a project. Key configuration saves the workspace and project returned by `/v1/me`; reads and writes carry `X-Workspace-ID` and `X-Project-ID`. To add or switch projects, use `el auth workspace WORKSPACE_ID --project-id PROJECT_ID --stdin` with that project’s Key. Later omit `--stdin` to reuse its cached Key. The interactive picker offers project selection when that workspace has multiple saved project Keys. `auth status` shows both saved and effective IDs; `ENVLOOP_PROJECT_ID` can select a project but cannot expand Key permissions. Rotation validates both IDs and rejects concurrent configuration/credential changes.

A saved Base URL takes priority over cwd `.env.local`; system address variables still override it. For development explicitly save `http://127.0.0.1:5173/api` or set `ENVLOOP_BASE_URL`. Inspect `auth status --json` if a request goes to an unexpected address.


## Choose a project

```bash
el auth config project
el auth config project PROJECT_ID --stdin < /absolute/private/project.key
el auth status --check
```

The selector shows project names and their project_id. You can also copy **Project ID** from the project's **Settings** page. Interactive configuration offers project selection after verifying the Key. When an API Key cannot list all account projects, the selector shows its verified project and saved projects; a new project requires its own Key. The CLI verifies the exact workspace/project through `/v1/me` before saving. Failure or cancellation preserves the previous configuration. Keys are cached by API address/workspace/project, and environment variables still take precedence.

Official Runners are shared across authorized projects in the same environment. Key and private Dataset permissions still apply, and each Job belongs to the selected project. `envloop auth config project` is equivalent to `el`; keep the client updated and verify the target platform supports the requested operation.
