# List API keys

GET

/v1/tokens

```sh
curl --request GET \
  --url 'https://example.com/v1/tokens?limit=25' \
  --header 'Authorization: Bearer <token>'
```

Newest first. Never returns secrets. A tenant admin sees every key (`?principal=` for one principal’s); anyone else sees their own.

## Authorizations

- **[bearerAuth](https://docs.kindgi.com/v0.1.9/reference/api.md#bearerauth)**

## Parameters

### Query Parameters

**cursor**

string

Where the previous page ended: its `nextCursor`, as it came. A runtime that seals cursors takes one only for the same list, filters and caller, within a day; otherwise `400 bad-input`, and the list starts again without it. Absent → first page.

**limit**

integer

default: 25 >= 1 <= 100

1..100. Default 25.

**principal**

string

Tenant admins: only this principal’s keys, `user:<id>` or `service-account:<id>`.

## Responses

### 200

A page of keys.

application/json

object

**data**

required

Array\<object>

An API key. Never includes the secret. `principal` is whom it acts for; absent on a key that is a service account of its own (`service_account:<tokenId>`), as keys minted before principals are.

object

**tokenId**

required

string format: uuid

**principal**

Whom an API key acts for: a person, or a service account.

object

**kind**

required

string

Allowed values: user service-account

**id**

required

The user id, or the service account id.

string

\>= 1 characters

**role**

required

The most the key may do, under its principal’s grants: an `admin` key may administer the tenant when its principal is a tenant admin; a `member` key takes no admin action on the tenant, whoever it’s for; below it, its principal’s roles hold (a project admin’s member key administers that project).

string

Allowed values: admin member

**capabilities**

required

Framework capabilities the key carries (`env:write`, `secrets:write`, …). A caller can only grant capabilities it holds.

Array\<string>

**label**

string

**projectId**

The project the key is limited to.

string format: uuid

**createdBy**

Who minted it: `user:<id>` or `service_account:<id>`.

string

**createdAt**

required

string format: date-time

**expiresAt**

string format: date-time

**revokedAt**

Set once revoked; a revoked key never authenticates again.

string format: date-time

**lastUsedAt**

When the key last authenticated a request (updated at most once a minute).

string format: date-time

**nextCursor**

Opaque cursor for the next page. Absent when `hasMore: false`.

string

**hasMore**

required

boolean

##### Example

```json
{
  "data": [
    {
      "principal": {
        "kind": "user"
      },
      "role": "admin"
    }
  ]
}
```

### 400

Malformed cursor or `principal`.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 401

Missing / malformed / expired / revoked bearer token.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 403

A caller with no keys of its own that is not a tenant admin.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

## See also

- [`POST /v1/tokens`: Mint an API key](https://docs.kindgi.com/v0.1.9/reference/api/operations/tokensmint.md)
- [Every error code](https://docs.kindgi.com/v0.1.9/reference/errors.md)
