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

# API Keys

## Get user API keys

> Get all API keys for the authenticated user

```json
{"openapi":"3.0.0","info":{"title":"Pear Protocol Trading API","version":"1.0.0"},"servers":[{"url":"https://hl-v2.pearprotocol.io","description":"Production (Mainnet)"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api-keys":{"get":{"description":"Get all API keys for the authenticated user","operationId":"ApiKeysController_getUserApiKeys","parameters":[],"responses":{"200":{"description":"API keys retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"apiKeys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"lastUsedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}}}}}}},"401":{"description":"Unauthorized - invalid or missing token"}},"summary":"Get user API keys","tags":["API Keys"]}}}}
```

## Create API key

> Create a new API key for the authenticated user

```json
{"openapi":"3.0.0","info":{"title":"Pear Protocol Trading API","version":"1.0.0"},"servers":[{"url":"https://hl-v2.pearprotocol.io","description":"Production (Mainnet)"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api-keys":{"post":{"description":"Create a new API key for the authenticated user","operationId":"ApiKeysController_createApiKey","parameters":[],"requestBody":{"required":true,"description":"API key creation request","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Optional name for the API key"}}}}}},"responses":{"201":{"description":"API key created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"apiKey":{"type":"string"},"name":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}}}}}},"401":{"description":"Unauthorized - invalid or missing token"}},"summary":"Create API key","tags":["API Keys"]}}}}
```
