# Every API key in an organization, newest first: members' and the organization's own (Admins only) (/api/organizations/list_organization_api_keys)

`GET /v1/organizations/{organizationId}/api-keys`

Operation name: `list_organization_api_keys`

Each active API key in the organization, with its `kind`: a member's personal key with its person (`person`), or an organization key (no person; `createdBy`), as the person's own list shows keys: name, first characters, access, last use, expiry (null: none) and `unused`. Never a key itself. Its `id` is what `revoke_organization_api_key` takes. API keys can't call it.

## Authentication

An OAuth access token for the person who allowed your tool: register a client, then the authorization code flow with PKCE (S256). Send it as `Authorization: Bearer <token>` on every route that needs a signed-in person. Calls with a token are limited per person, across all their apps, to 120 calls a minute and 10,000 a UTC day; calls that start AI runs or knowledge base reads (creating an organization, starting a knowledge base read, rebuilding categories, retrying topics or rechecking) also to 10 a minute and 200 a UTC day. Over a limit a call answers 429 `rate_limited` with `Retry-After` and `details.retryAfter` in seconds, and changes nothing.

## Path parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `organizationId` | path | string | yes | A Heuristic id: a uuid, in any case (it is read in lower case). Anything else answers 400 `validation_error`. |

## Query parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | How many items to return, 1 to 100 (50 when left out). |
| `cursor` | query | string | no | Where the next page starts: the `meta.nextCursor` of the previous page. Leave out for the first page. |
| `search` | query | string | no | Only keys whose name, person's name or email, or (organization keys) creator's name or email holds this text, ignoring capitals. |
| `kind` | query | string | no | Only keys of this kind. |

## Responses

### 200

One page of the organization's API keys

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The key's id: what the organization's `revoke_api_key` takes."
          },
          "name": {
            "type": "string"
          },
          "start": {
            "type": "string",
            "description": "The key's first characters, shown as \"ha_7Qm2k…\" so the person can tell keys apart."
          },
          "organizationId": {
            "type": "string"
          },
          "organizationName": {
            "type": "string"
          },
          "access": {
            "type": "string",
            "enum": [
              "full",
              "read"
            ],
            "description": "`full`: changes what the person can; `read`: only reads."
          },
          "createdAt": {
            "type": "string"
          },
          "lastUsedAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "The last call made with the key while it was valid; null when never."
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it stops working; null for a key without expiry."
          },
          "unused": {
            "type": "boolean",
            "description": "No call for more than 90 days (since its creation when never used)."
          },
          "kind": {
            "type": "string",
            "enum": [
              "member",
              "organization"
            ],
            "description": "`member`: a member's personal key, acting as that person; `organization`: the organization's own key."
          },
          "person": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "userId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "userId",
              "name"
            ],
            "description": "The member a `member` key belongs to and acts as; null for an `organization` key, which acts for no person."
          },
          "createdBy": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "userId": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "userId",
              "name"
            ],
            "description": "Who created an `organization` key; null once they left (a former member) and for `member` keys."
          }
        },
        "required": [
          "id",
          "name",
          "start",
          "organizationId",
          "organizationName",
          "access",
          "createdAt",
          "lastUsedAt",
          "expiresAt",
          "unused",
          "kind",
          "person",
          "createdBy"
        ]
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "nextCursor": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "nextCursor"
      ]
    }
  },
  "required": [
    "data",
    "meta"
  ]
}
```

### 400

Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {}
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 401

Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {}
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 403

Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {}
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 404

Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {}
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

## Example request

```bash
curl "https://staging.heuristic.app/v1/organizations/{organizationId}/api-keys" \
  -H "Authorization: Bearer <access token>"
```
