# spin api-key

**Spinbox is experimental: APIs change and data may be lost.** What is built and what proves it is on [Status](https://docs.spinbox.dev/reference/status.md); what Spinbox does not do is on [Limitations](https://docs.spinbox.dev/overview/limitations.md).

> spin api-key: Manage API keys.

<!-- Generated by tools/refgen from spin:cmd/cli. Edit the source, not this file. -->

```
Manage API keys for programmatic access.

API keys can be used to authenticate with the Spinbox API without
needing an interactive login. Keys can be scoped to limit their
permissions.

Usage:
  spin api-key [flags]
  spin api-key [command]

Available Commands:
  create      Create a new API key
  list        List your API keys
  revoke      Revoke an API key

Flags:
  -h, --help[=true|false]   help for api-key

Global Flags:
      --config string        config file (default is $HOME/.spin/config.yaml)
  -o, --output string        text for a person, or json: one document of what the API answered, and no prose (default "text")
      --profile string       named profile to use; SPIN_PROFILE names it when this flag does not (default "default")
      --traceparent string   the W3C traceparent of the span this command is part of; its own span is sent to the installation unless the profile says telemetry: false

Use "spin api-key [command] --help" for more information about a command.
```

### spin api-key create

```
Create a new API key for programmatic access.

The secret key will only be shown once. Make sure to save it securely.

A key can do only what its scopes name, and needs at least one. It can never
confirm a login or administer the instance. A key with keys:delegate makes keys of
its own, run with it as SPIN_TOKEN: each holds no more than it does - its scopes,
team, projects, end and bounds - and goes when it is revoked.

Available scopes:
  workspace:read   - Read workspaces, snapshots and ports
  workspace:write  - Create, start, stop and change workspaces; open a terminal
  workspace:delete - Delete workspaces
  workspace:exec   - Run commands and read and write files in workspaces, as root;
                     made with your passkey, in the dashboard
  keys:delegate    - Make keys of its own, holding no more than it does
  team:read        - Read teams and their members
  team:write       - Manage teams and members
  settings:read    - Read user settings and SSH keys
  settings:write   - Update user settings and SSH keys

Examples:
  spin api-key create "Deploy Bot" --scope workspace:read --scope workspace:write
  spin api-key create "Read Only" --scope workspace:read --expires 30d

Usage:
  spin api-key create <name> [flags]

Flags:
      --expires string         How long the key lasts, at most a year: a whole number of d, w or y (30d, 2w, 1y), or a duration like 36h (default "90d")
  -h, --help[=true|false]      help for create
      --max-cores int32        How many cores their workspaces may hold on runners at once: a stopped one's do not count
      --max-workspaces int32   How many workspaces the key and the keys it delegates may have on a runner at once: stopped ones do not count
      --project strings        A project whose workspaces the key reaches, by id (can be repeated; default: any)
      --scope strings          Scopes for the key (can be repeated)
      --team string            The one team whose workspaces the key reaches (default: every team you are in)

Global Flags:
      --config string        config file (default is $HOME/.spin/config.yaml)
  -o, --output string        text for a person, or json: one document of what the API answered, and no prose (default "text")
      --profile string       named profile to use; SPIN_PROFILE names it when this flag does not (default "default")
      --traceparent string   the W3C traceparent of the span this command is part of; its own span is sent to the installation unless the profile says telemetry: false
```

### spin api-key list

```
List your API keys

Usage:
  spin api-key list [flags]

Flags:
  -h, --help[=true|false]   help for list

Global Flags:
      --config string        config file (default is $HOME/.spin/config.yaml)
  -o, --output string        text for a person, or json: one document of what the API answered, and no prose (default "text")
      --profile string       named profile to use; SPIN_PROFILE names it when this flag does not (default "default")
      --traceparent string   the W3C traceparent of the span this command is part of; its own span is sent to the installation unless the profile says telemetry: false
```

### spin api-key revoke

```
Revoke an API key

Usage:
  spin api-key revoke <key-id> [flags]

Flags:
  -h, --help[=true|false]   help for revoke
  -y, --yes[=true|false]    Skip confirmation

Global Flags:
      --config string        config file (default is $HOME/.spin/config.yaml)
  -o, --output string        text for a person, or json: one document of what the API answered, and no prose (default "text")
      --profile string       named profile to use; SPIN_PROFILE names it when this flag does not (default "default")
      --traceparent string   the W3C traceparent of the span this command is part of; its own span is sent to the installation unless the profile says telemetry: false
```
