> ## Documentation Index
> Fetch the complete documentation index at: https://xata.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# keys

> Commands for managing API keys

The `keys` commands help you manage API keys for users and organizations.

## Subcommands

### User Keys

#### list

List API keys for the current user.

```bash theme={null}
xata keys user list [--json] [-h|--help]
```

<ParamField path="--json" type="boolean">
  Output in JSON format (default: false)
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

**Aliases:** `ls`

#### create

Create an API key for the current user.

```bash theme={null}
xata keys user create [--name <name>] [--expiry <date>] [--json] [-h|--help]
```

<ParamField path="--name" type="string">
  API key name
</ParamField>

<ParamField path="--expiry" type="string">
  Expiration date (ISO format) or empty for no expiry
</ParamField>

<ParamField path="--json" type="boolean">
  Output in JSON format (default: false)
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

#### delete

Delete an API key for the current user.

```bash theme={null}
xata keys user delete <keyId>...
```

<ParamField path="keyId" type="string[]" required>
  One or more API key IDs to delete
</ParamField>

### Organization Keys

#### list

List API keys for an organization.

```bash theme={null}
xata keys organization list [--organization <id>] [--json] [-h|--help]
```

<ParamField path="--organization" type="string">
  Organization ID
</ParamField>

<ParamField path="--json" type="boolean">
  Output in JSON format (default: false)
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

**Aliases:** `ls`

#### create

Create an API key for an organization.

```bash theme={null}
xata keys organization create [--organization <id>] [--name <name>] [--expiry <date>] [--json] [-h|--help]
```

<ParamField path="--organization" type="string">
  Organization ID
</ParamField>

<ParamField path="--name" type="string">
  API key name
</ParamField>

<ParamField path="--expiry" type="string">
  Expiration date (ISO format) or empty for no expiry
</ParamField>

<ParamField path="--json" type="boolean">
  Output in JSON format (default: false)
</ParamField>

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>

#### delete

Delete an API key for an organization.

```bash theme={null}
xata keys organization delete <keyId>...
```

<ParamField path="keyId" type="string[]" required>
  One or more API key IDs to delete
</ParamField>

## Global Flags

<ParamField path="-h, --help" type="boolean">
  Print help information and exit
</ParamField>
