# inboxjot api-keys

Create, rotate and revoke API keys.

## api-keys list

List API keys.

```sh
inboxjot api-keys list [options]
```

| Option                | Description                                 |
| --------------------- | ------------------------------------------- |
| `-n, --limit <LIMIT>` | Show at most this many rows. Default: `50`. |
| `--all`               | Show every row, one page after another.     |
| `--after <CURSOR>`    | Show the rows after this cursor.            |
| `--before <CURSOR>`   | Show the rows before this cursor.           |

```sh
inboxjot api-keys list
```

## api-keys inspect

Show an API key and its usage.

```sh
inboxjot api-keys inspect <KEY_ID>
```

| Argument | Description           |
| -------- | --------------------- |
| `KEY_ID` | API key ID. Required. |

```sh
inboxjot api-keys inspect api_123
```

## api-keys create

Create an API key and print it once.

```sh
inboxjot api-keys create [options]
```

| Option                      | Description                                                                       |
| --------------------------- | --------------------------------------------------------------------------------- |
| `--name <NAME>`             | Name of the key, such as Production.                                              |
| `--permission <PERMISSION>` | What the key can do. One of `sending`, `full`.                                    |
| `--domain <DOMAIN>`         | Limit a sending key to this domain name or ID.                                    |
| `--expires-in <EXPIRES_IN>` | When the key stops working. One of `never`, `30d`, `90d`, `1y`. Default: `never`. |
| `--allow-ip <IP>`           | Accept requests only from this IP address.                                        |

```sh
inboxjot api-keys create --name Production --permission sending --domain acme.com
inboxjot api-keys create --name CI --permission full --expires-in 90d --allow-ip 203.0.113.7
```

## api-keys revoke

Revoke an API key.

```sh
inboxjot api-keys revoke <KEY_ID>
```

| Argument | Description           |
| -------- | --------------------- |
| `KEY_ID` | API key ID. Required. |

```sh
inboxjot api-keys revoke api_123
```

## api-keys rotate

Replace the secret of an API key and print the new key once.

```sh
inboxjot api-keys rotate <KEY_ID> [options]
```

| Argument | Description           |
| -------- | --------------------- |
| `KEY_ID` | API key ID. Required. |

| Option                                      | Description                                                                   |
| ------------------------------------------- | ----------------------------------------------------------------------------- |
| `--old-key-expires-in <OLD_KEY_EXPIRES_IN>` | When the old secret stops working. One of `now`, `1h`, `24h`. Default: `now`. |

```sh
inboxjot api-keys rotate api_123 --old-key-expires-in 1h
```
