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

# List API Keys

> List all API keys for the authenticated user.

## Authentication

Requires an API key in the `Authorization` header.

```bash theme={"dark"}
Authorization: Bearer YOUR_API_KEY
```

## Request

No request body required.

### Example request

```bash theme={"dark"}
curl https://encrata.com/api/keys \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Response

Returns an array of API key objects.

<ResponseField name="keys" type="array">
  <Expandable title="Key object">
    <ResponseField name="id" type="string">Unique key identifier</ResponseField>
    <ResponseField name="name" type="string">Display name for the key</ResponseField>
    <ResponseField name="key_preview" type="string">Last 4 characters of the key (e.g., `...a1b2`)</ResponseField>
    <ResponseField name="created_at" type="string">ISO 8601 creation timestamp</ResponseField>
    <ResponseField name="last_used" type="string">ISO 8601 timestamp of last use (or null)</ResponseField>
    <ResponseField name="total_requests" type="integer">Total number of requests made with this key</ResponseField>
    <ResponseField name="credits_used" type="integer">Total credits consumed by this key</ResponseField>
  </Expandable>
</ResponseField>

### Example response

```json theme={"dark"}
{
  "keys": [
    {
      "id": "key_abc123",
      "name": "Production",
      "key_preview": "...x9f2",
      "created_at": "2024-01-15T10:00:00Z",
      "last_used": "2024-03-01T14:30:00Z",
      "total_requests": 1250,
      "credits_used": 980
    }
  ]
}
```

<ResponseExample>
  ```json 200 theme={"dark"}
  {
    "keys": [
      {
        "id": "key_abc123",
        "name": "Production",
        "key_preview": "...x9f2",
        "created_at": "2024-01-15T10:00:00Z",
        "last_used": "2024-03-01T14:30:00Z",
        "total_requests": 1250,
        "credits_used": 980
      }
    ]
  }
  ```

  ```json 401 theme={"dark"}
  {
    "error": "Unauthorized"
  }
  ```
</ResponseExample>
