> For the complete documentation index, see [llms.txt](https://pacifica.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pacifica.gitbook.io/docs/api-documentation/api/rate-limits/api-config-keys.md).

# API Config Keys

Pacifica offers API Config Key rate limiting on APIs that allows for more flexible limits.\
For more information around API Config Key limits, please reach out to us in the [Discord API channel](https://discord.com/channels/1325864651816435822/1378723526957334548).\
\
API Config Keys are generated via REST API. The Python SDK provides examples for how API Config Key can be generated, listed and revoked: <https://github.com/pacifica-fi/python-sdk/blob/main/rest/api_config_keys.py>.\
\
Each account can have up to 5 API Config Keys.

```
POST /api/v1/account/api_keys/create
POST /api/v1/account/api_keys/revoke
POST /api/v1/account/api_keys
```

#### Request Body:

<table><thead><tr><th width="184">Field</th><th width="98">Type</th><th width="123">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>"account"</code></td><td>string</td><td>required</td><td>User's wallet address</td><td><code>42trU9A5...</code></td></tr><tr><td><code>"signature"</code></td><td>string</td><td>required</td><td>Cryptographic signature</td><td><code>5j1Vy9Uq...</code></td></tr><tr><td><code>"timestamp"</code></td><td>integer</td><td>required</td><td>Current timestamp in milliseconds</td><td><code>1716200000000</code></td></tr><tr><td><code>"expiry_window"</code></td><td>integer</td><td>optional</td><td>Signature expiry in milliseconds</td><td><code>30000</code></td></tr></tbody></table>

#### Response

```json
{
  "data": {
    "api_key": "AbCdEfGh_2mT8x..."
  }
}
```

Note:\
API Config Keys are generated with a prefix for fast lookup\
Format: `"{8_char_prefix}_{base58_encoded_uuid}"`

### Using a Pacifica API Config Key

Pacifica's API Config Keys are used to enhance websocket rate-limiting. The default rate for an API Config Key follows the same restrictions as IP-based rate limits.\
\
Pacifica API Config Keys are used in the connection header to specify API Config Key rate limiting. Using the Python SDK as an example,

* for Websockets, add `extra_headers={"PF-API-KEY": "your_rate_limit_key"}`into `websockets.connect`
* for REST APIs, add `"PF-API-KEY": "your_rate_limit_key"` into `headers` with `{"Content-Type": "application/json"}`
