Skip to content

Agents > Oz CLI

Creating and managing API keys

Choose and create Warp API keys for ad hoc requests, external factory integrations, cloud agents, and self-hosted workers.

Open in ChatGPT ↗
Ask ChatGPT about this page
Open in Claude ↗
Ask Claude about this page
Copied!

Warp API keys authenticate requests to the Warp Platform API, the Oz CLI, and self-hosted workers. Choose the key for the caller, not for where the work runs.

  • Ad hoc API requests - Use a personal API key with a short expiration, such as 1 day. Requests authenticate as you and respect your visibility and access controls. The Enterprise Analytics API accepts only personal keys.
  • External systems submitting factory work - Use an agent API key scoped to the target factory’s foreman agent. For example, give an internal service this key to call POST /factory/{uid}/runs. Find the foreman before creating the key.
  • Other unattended runs - Use an agent key for a cloud agent on your team when requests must act as that agent rather than as you.

An agent key authenticates as the selected agent, not as the person who created the key. Selecting an agent does not grant unrestricted factory access. See factory API permissions and attribution for submission and task-list permissions.

  1. In the Warp Factories web app, open the factory your integration will call.
  2. Open Agents or Workers, depending on the factory, and choose Foreman in the type filter.
  3. Note the configured name on the foreman’s card. Don’t assume it is Foreman or the factory’s name.

When creating the key, choose Agent and select this existing foreman in the “Agent” dropdown. The picker shows agent names without factory labels. If names are duplicated, don’t guess: use the foreman’s UID with oz api-key create --agent instead.

Self-hosted worker API keys authenticate managed oz-agent-worker daemons as your team. Use this key type with the Docker, Kubernetes, Direct, or Command backend. You don’t need to select an agent when creating one.

As a best practice, use different keys for the worker and the external integration, even if one job starts both processes: a self-hosted worker key for the worker and a foreman agent key for factory submissions. Worker authentication is team-wide, not specific to a factory or agent, and does not require separate keys. Connecting a worker does not grant the caller permission to submit factory work.

Create all three key types in the Warp Factories web app user settings. Creating team-owned agent or worker keys requires permission to manage team API keys. For an agent key, you also need permission to act as the selected agent.

  1. Open the Warp Factories web app user settings page.
  2. Click Factory API keys, then Generate new token.
  3. Under “Type,” select Self-hosted worker. The key is tied to your team and does not require an agent selection.
  4. Enter a name for the key and choose when it expires.
  5. Click Create key.
  6. In the “Copy API key” dialog, copy the key and store it securely. The key is shown only once.

Expected outcome: The key appears in the API keys list with a Team badge and the expiration you selected.

  1. Open the Warp Factories web app user settings page.
  2. Click Factory API keys, then Generate new token.
  3. Choose the type:
    • Personal - Authenticates as your Warp account.
    • Agent - Authenticates as the agent you choose in the “Agent” dropdown. For a factory integration, select the target factory’s foreman, not an arbitrary agent or a generic default account.
  4. Enter a name for the key. In the “Expiration” dropdown, choose when it expires. The default is 90 days; for ad hoc personal keys, change it to 1 day.
  5. Click Create key.
  6. Copy the raw API key and store it securely. You won’t be able to see it again after closing the dialog.
  1. In the Warp app, click your profile photo in the top-right corner, then click Settings.
  2. In the sidebar, expand Cloud platform and click API keys.
  3. In the API Keys section, click + Create API Key.
  4. Pick Personal for a personal key, or Agent / Team for an agent key tied to your team. (The toggle may still read Team in older versions of the desktop app.)
  5. Name the key. In the “Expiration” dropdown, choose when it expires. For ad hoc personal keys, choose 1 day.
  6. Click Create key.
  7. Copy the raw API key and store it securely. You won’t be able to see it again after closing the dialog.

To create a self-hosted worker key, use the Warp Factories web app flow.

How key type affects billing and GitHub access

Section titled “How key type affects billing and GitHub access”

The key type determines who the run acts as, which usage balances it can draw from, and which GitHub credentials it can use.

  • Run as you.
  • Use your eligible included and purchased usage on the team. Enterprise billing follows your contract.
  • Use your GitHub permissions by default. GitHub credentials and commit authorship depend on the run’s configuration; API authentication alone does not guarantee GitHub attribution.

Review purchase controls before relying on unattended runs.

You can authenticate with an API key in the CLI using either an environment variable or a command flag. Environment variables are recommended for security and easier reuse across multiple commands.

Via environment variable (recommended):

Terminal window
$ export WARP_API_KEY="wk-xxx..."
$ oz agent run --prompt "analyze this codebase"

Via command flag:

Terminal window
$ oz agent run --api-key "wk-xxx..." --prompt "analyze this codebase"

The Warp Factories web app API keys page lists key names, expiration, and a badge for the user, agent, or team the key authenticates as.

The Warp app’s Settings > Cloud platform > API keys also lists active keys. Its “Scope” column identifies the user or agent the key authenticates as; it is not an editable list of endpoint permissions.

The Warp app also shows:

  • Key — A masked suffix (wk-**xxxx) to help identify the key.
  • Created — When the key was created.
  • Last used — When the key was last used for authentication.

To delete an API key, find it in the Warp Factories web app or the Warp app’s API keys list and click the delete icon next to the key.

Deleted keys are immediately invalidated and cannot be recovered. Any services or scripts using the deleted key will lose access and may return an authentication_required error.

In addition to the web and Warp app surfaces, you can manage API keys directly with the Oz CLI. These commands are useful for scripting key rotation and for headless environments.

oz api-key list prints your active API keys.

  • --sort-by <FIELD> — Sort by name, created-at, last-used-at, expires-at, or scope.
  • --sort-order <DIR> — Sort direction: asc or desc.
  • --jq <FILTER> — Filter the JSON output with a jq expression (for example, --jq '.[].name').
Terminal window
oz api-key list --sort-by last-used-at --sort-order desc

oz api-key create <NAME> creates a key and prints the raw secret once. Store it securely — you can’t retrieve it again.

  • <NAME> — A name to identify the key (required).
  • --agent <UID> — Create an agent key that runs as the given cloud agent, instead of a personal key.
  • One expiration choice is required: --expires-in <DURATION> (for example, 30d, 12h, or 90m), --expires-at <RFC3339> (an exact timestamp), or --no-expiration.
  • --jq <FILTER> — Filter the JSON output with a jq expression.
Terminal window
# A short-lived personal key for ad hoc requests
oz api-key create "api-exploration" --expires-in 1d
# An integration key for the target factory's foreman
oz api-key create "factory-integration" --agent FOREMAN_AGENT_UID --expires-in 30d

Replace FOREMAN_AGENT_UID with the foreman agent’s UID, not the factory UID. To distinguish agents with the same name, use a personal key to call GET /agent/identities?factory_uid=FACTORY_UID in the Warp Platform API reference.

Include the request header X-Warp-Team-Uid: TEAM_UID, replacing TEAM_UID with the UID of the team that owns your factory and FACTORY_UID with your factory’s UID. Personal-key callers on multiple teams need this header; the factory filter does not select the active team. From the response, use the uid of the agent whose agent_type is FOREMAN. You still need permission to create a key for that agent.

oz api-key expire <NAME_OR_UID> immediately invalidates a key (also available as oz api-key delete). Expired keys can’t be recovered.

  • <NAME_OR_UID> — The name or UID of the key to expire (required).
  • --force — Skip the confirmation prompt.
Terminal window
oz api-key expire "api-exploration" --force
  • Use environment variables. Avoid passing API keys directly in commands where they may be logged or visible in shell history.
  • Set appropriate expiration. Use shorter expiration times for development and testing; consider longer durations for stable production workflows.
  • Configure team GitHub authorization for agents that write to GitHub. Personal keys authenticate as you with your GitHub permissions. Agent keys authenticate via the Warp Factories GitHub App when team GitHub authorization is configured in the Admin Panel.
  • Rotate keys periodically. Create new keys and retire old ones on a regular schedule to limit exposure from compromised credentials.
  • Store securely. Use secret managers (like 1Password CLI, HashiCorp Vault, or cloud provider secret services) rather than plain text files.