# List API keys

`opensend api-keys list`

The API keys of the workspace, with what each may do and when it was last used.

Needs the scope: `api_keys:read`

## Flags

- `--q` (string): Text to search for. Only items that contain it are returned. Up to 40 characters.
- `--limit` (integer): How many items to return, from 1 to 100. Without it you get 25.
- `--offset` (integer): How many items to skip. Use it with `limit` to read the next page. Default: `0`.
- `--after` (string): The id of the last item you have. The answer starts with the item that follows it, which reads a long list without skipping or repeating when it changes meanwhile. Up to 64 characters.
- `--before` (string): The id of the first item you have. The answer ends with the item just before it. Give this or `after`, not both. Up to 64 characters.
- `--access` (string): Only keys with this access: `full` or `sending`. One of: `full`, `sending`.
- `--mode` (string): Only keys in this mode: `live` or `test`. One of: `live`, `test`.

## Returns

The command prints the answer: as JSON when its output goes to a file or another program, and as a table or a list of fields in a terminal. When the API refuses, the error goes to the error stream and the command ends with a code that names the failure. [Output and scripts](https://opensend.sh/docs/scripting) lists the codes.

- `object` ("list"): Always `list`.
- `data` (object[]): The items on this page.
- `data[].object` ("api_key"): Always `api_key`.
- `data[].id` (string): The id of the key.
- `data[].name` (string): The name you gave the key.
- `data[].access` (string): What the key may do: `full` for everything, `sending` for sending email and nothing else. One of: `full`, `sending`.
- `data[].mode` (string): `live` for a key that sends real email, `test` for a key whose emails are simulated and reach nobody. One of: `live`, `test`.
- `data[].preview` (string): The start of the key, enough to recognise it.
- `data[].domainId` (string | null): The id of the one domain a sending key may send from, or `null` when it may send from any.
- `data[].domain` (string | null): The name of that domain, or `null`.
- `data[].lastUsedAt` (string | null): When the key last made a request, or `null` if it never has.
- `data[].createdAt` (string): When the key was made.
- `total` (integer): How many items match in all, on every page together.
- `hasMore` (boolean): Whether more items follow this page.

## Example

CLI:

```bash
opensend api-keys list --access full
```

Answer:

```json
{
  "object": "list",
  "data": [
    {
      "object": "api_key",
      "id": "key_04",
      "name": "Backend",
      "access": "full",
      "mode": "live",
      "preview": "os_...cd88",
      "domainId": null,
      "domain": null,
      "lastUsedAt": "2026-11-27T09:30:00.000Z",
      "createdAt": "2026-11-27T09:30:00.000Z"
    },
    {
      "object": "api_key",
      "id": "key_01",
      "name": "Production server",
      "access": "full",
      "mode": "live",
      "preview": "os_...45a1",
      "domainId": null,
      "domain": null,
      "lastUsedAt": "2026-11-27T09:28:00.000Z",
      "createdAt": "2026-11-13T09:30:00.000Z"
    }
  ],
  "total": 2,
  "hasMore": false
}
```
