---
title: List API Keys
url: https://platform.claude.com/docs/en/api/csharp/organization/api_keys/list
---

# List API Keys

`ApiKeyListPage Organization.ApiKeys.List(parameters, cancellationToken = default)`

**GET** `/v1/organizations/api_keys`

List API Keys

## Parameters

- `ApiKeyListParams parameters`

  - `string afterID` (query parameter)

    ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.

  - `string beforeID` (query parameter)

    ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.

  - `string? createdByUserID` (query parameter)

    Filter by the ID of the User who created the object.

  - `long limit` (query parameter)

    Number of items to return per page.

    Defaults to `20`. Ranges from `1` to `1000`.

    minimum: 1, maximum: 1000

  - `Status? status` (query parameter)

    Filter by API key status.

    - `Active("active")`

    - `Archived("archived")`

    - `Expired("expired")`

    - `Inactive("inactive")`

  - `string? workspaceID` (query parameter)

    Filter by Workspace ID.

## Returns

- `class ApiKey`

  - `JsonElement Type = "api_key"`

    Object type.

    For API Keys, this is always `"api_key"`.

  - `required string ID`

    ID of the API key.

  - `required DateTimeOffset CreatedAt`

    RFC 3339 datetime string indicating when the API Key was created.

    format: date-time

  - `required ApiKeyCreatedBy? CreatedBy`

    The ID and type of the actor that created the API key, or `null` when the
    creator is not recorded (legacy, workload-identity-federated, or
    system-created keys).

    - `required Type Type`

      Type of the actor that created the object.

      - `ServiceAccount("service_account")`

      - `User("user")`

    - `required string ID`

      ID of the actor that created the object.

  - `required DateTimeOffset? ExpiresAt`

    RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires.

    format: date-time

  - `required string Name`

    Name of the API key.

  - `required string? PartialKeyHint`

    Partially redacted hint for the API key.

  - `required Principal? Principal`

    The principal the API key acts as (a User or a Service Account), or `null` if the API key is not bound to a principal.

    - `class ApiKeyUserActor`

      - `JsonElement Type = "user_actor"`

        Principal type. Always `"user_actor"` for a User.

      - `required string UserID`

        ID of the User the API key acts as.

    - `class ApiKeyServiceAccountActor`

      - `JsonElement Type = "service_account_actor"`

        Principal type. Always `"service_account_actor"` for a Service Account.

      - `required string ServiceAccountID`

        ID of the Service Account the API key acts as.

  - `required Scope Scope`

    Where the API key belongs: its Workspace (`{"type": "workspace", "workspace_id": "wrkspc_..."}`, with the Workspace's real ID even when it is the organization's default Workspace), or the organization (`{"type": "organization"}`) for a principal-bound API key that has no Workspace.

    - `class ApiKeyOrganizationScope`

      - `JsonElement Type = "organization"`

        Scope type. Always `"organization"`: the API key has no Workspace. Only a principal-bound API key can have this scope.

    - `class ApiKeyWorkspaceScope`

      - `JsonElement Type = "workspace"`

        Scope type. Always `"workspace"`: the API key belongs to one Workspace.

      - `required string WorkspaceID`

        ID of the Workspace the API key belongs to, including when it is the organization's default Workspace.

  - `required Status Status`

    Status of the API key.

    - `Active("active")`

    - `Archived("archived")`

    - `Expired("expired")`

    - `Inactive("inactive")`

## Example

```csharp
using System;
using Anthropic.Models.Organization.ApiKeys;

ApiKeyListParams parameters = new();

var page = await client.Organization.ApiKeys.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

### Response (200)

```json
{
  "data": [
    {
      "id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
      "created_at": "2024-10-30T23:58:27.427722Z",
      "created_by": {
        "id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
        "type": "user"
      },
      "expires_at": "2024-10-30T23:58:27.427722Z",
      "name": "Developer Key",
      "partial_key_hint": "sk-ant-api03-R2D...igAA",
      "principal": {
        "type": "user_actor",
        "user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q"
      },
      "scope": {
        "type": "workspace",
        "workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
      },
      "status": "active",
      "type": "api_key"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id"
}
```
