# Api Key Commands

With the api key commands you can manage the api keys in the panel, from the command line.


---

### **Create a api key**

```bash
mlcli apikeys create <description>
```

> **Note:** To grant permissions to an api key via the cli, just add `--permissions <permissions>`

**Arguments:** ( [Arguments](/doc/arguments-j2OjZ768Ik) )

* `<description>` → The description for the api key

**Options:** ( [Options](/doc/options-dOVO4phHzg) )

* `--permissions` , `-p` → The permissions of the api key, *(in ", split with commas; eg.* `"admin.users.read,admin.api.*,admin.users.update"`*)\**
* `--expires`, `-e` → The expiry date for the api key"

**Flags:** ( [Flags](/doc/flags-Dqltdafq32) )

* `--admin` ,`-a` → Grants the api key all permissions, option `--permissions` will be ignored

#### Example Usage:

```bash
mlcli apikeys create serverapikey -p "admin.api,admin.users.*,admin.system.diagnose"
```


---

### Update a api key

```bash
mlcli apikeys update <id>
```

**Arguments:** ( [Arguments](/doc/arguments-j2OjZ768Ik) )

* `<id>`→ The id of the api key which should get updated

**Options:** ( [Options](/doc/options-dOVO4phHzg) )

* `--description`, `-d` → The new description for the api key, if not specified, the description remains unchanged

#### Example usage:

```bash
mlcli apikeys update 1 -u johndoe1 -e johndoe@example.net -p "*"
```


---

### **List api keys**

```bash
mlcli apikeys list
```

> **Note:** To get listed more than 10 api keys, add `-l <pagesize>` to the command above, to change page, add `-p <page>`

**Options:** ( [Options](/doc/options-dOVO4phHzg) )

* `--pagesize` , `-l` → The number of api keys which will get listed, must be between 1 and 100, *default: 10*
* `—-page` , `-p` → The which will get displayed

#### Example Usage:

```bash
mlcli apikeys list -p 2 -l 15
```


---

### Delete an api key

```bash
mlcli apikeys delete <id>
```

> **Note:** This can **not** be undone

**Arguments:** ( [Arguments](/doc/arguments-j2OjZ768Ik) )

* `<id>`→ The id of the api key which should get deleted


---