---
title: "keys - Xata"
description: "Commands for managing API keys"
source: "https://xata.io/docs/cli/keys"
---

Skip to main content

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

## ​Subcommands

### ​User Keys

#### ​list

List API keys for the current user.

```
xata keys user list [--json] [-h|--help]
```

​

\--json

boolean

Output in JSON format (default: false)

​

-h, --help

boolean

Print help information and exit

**Aliases:** `ls`

#### ​create

Create an API key for the current user.

```
xata keys user create [--name <name>] [--expiry <date>] [--json] [-h|--help]
```

​

\--name

string

API key name

​

\--expiry

string

Expiration date (ISO format) or empty for no expiry

​

\--json

boolean

Output in JSON format (default: false)

​

-h, --help

boolean

Print help information and exit

#### ​delete

Delete an API key for the current user.

```
xata keys user delete <keyId>...
```

​

keyId

string\[]

required

One or more API key IDs to delete

### ​Organization Keys

#### ​list

List API keys for an organization.

```
xata keys organization list [--organization <id>] [--json] [-h|--help]
```

​

\--organization

string

Organization ID

​

\--json

boolean

Output in JSON format (default: false)

​

-h, --help

boolean

Print help information and exit

**Aliases:** `ls`

#### ​create

Create an API key for an organization.

```
xata keys organization create [--organization <id>] [--name <name>] [--expiry <date>] [--json] [-h|--help]
```

​

\--organization

string

Organization ID

​

\--name

string

API key name

​

\--expiry

string

Expiration date (ISO format) or empty for no expiry

​

\--json

boolean

Output in JSON format (default: false)

​

-h, --help

boolean

Print help information and exit

#### ​delete

Delete an API key for an organization.

```
xata keys organization delete <keyId>...
```

​

keyId

string\[]

required

One or more API key IDs to delete

## ​Global Flags

​

-h, --help

boolean

Print help information and exit

Was this page helpful?

[Previous](/docs/cli/init)

[organization](/docs/cli/organization)

[Next](/docs/cli/organization)
