> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usesatori.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# List API Keys

> Retrieve all API keys for your account

## `keys.list`

Lists all active API keys for the authenticated user. This endpoint requires Clerk JWT authentication (used in dashboard).

## Authentication

This endpoint uses JWT authentication instead of API key authentication:

```bash theme={null}
Authorization: Bearer <clerk_jwt_token>
```

<Info>
  This endpoint is primarily used in dashboard applications where users are authenticated via Clerk.
</Info>

## Parameters

No parameters required. Returns all keys for the authenticated user.

## Response

Returns an array of API key objects:

<ResponseField name="id" type="string">
  Internal UUID for the API key record
</ResponseField>

<ResponseField name="clerkUserId" type="string">
  Your Clerk user ID (tenant identifier)
</ResponseField>

<ResponseField name="clerkKeyId" type="string">
  Clerk's API key ID
</ResponseField>

<ResponseField name="name" type="string">
  Descriptive name for the key (e.g., "Production Key")
</ResponseField>

<ResponseField name="lastUsedAt" type="string | null">
  ISO 8601 timestamp of last usage, or null if never used
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of creation
</ResponseField>

<ResponseField name="revokedAt" type="string | null">
  ISO 8601 timestamp of revocation, or null if active
</ResponseField>

## Examples

<CodeGroup>
  ```typescript TypeScript (React) theme={null}
  import { trpc } from '@/lib/trpc';

  function APIKeysPage() {
    const { data: keys, isLoading } = trpc.keys.list.useQuery();
    
    if (isLoading) return <div>Loading...</div>;
    
    return (
      <div>
        <h2>Your API Keys</h2>
        {keys?.map((key) => (
          <div key={key.id}>
            <h3>{key.name}</h3>
            <p>Created: {new Date(key.createdAt).toLocaleDateString()}</p>
            <p>Last used: {key.lastUsedAt ? new Date(key.lastUsedAt).toLocaleDateString() : 'Never'}</p>
          </div>
        ))}
      </div>
    );
  }
  ```

  ```bash cURL theme={null}
  curl -X GET 'https://api.usesatori.sh/trpc/keys.list' \
    -H 'Authorization: Bearer <clerk_jwt_token>'
  ```
</CodeGroup>

<ResponseExample>
  ```json Success (200) theme={null}
  [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "clerkUserId": "user_372Icb...",
      "clerkKeyId": "key_2abc123...",
      "name": "Production Key",
      "lastUsedAt": "2024-01-15T10:30:00.000Z",
      "createdAt": "2024-01-01T08:00:00.000Z",
      "revokedAt": null
    },
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "clerkUserId": "user_372Icb...",
      "clerkKeyId": "key_3def456...",
      "name": "Development Key",
      "lastUsedAt": "2024-01-14T15:20:00.000Z",
      "createdAt": "2024-01-05T12:00:00.000Z",
      "revokedAt": null
    }
  ]
  ```
</ResponseExample>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Create API Key" icon="plus" href="/api-reference/keys/create">
    Generate a new API key
  </Card>

  <Card title="Revoke API Key" icon="ban" href="/api-reference/keys/revoke">
    Revoke an existing key
  </Card>
</CardGroup>
