API Keys
Manage user API keys via OAuth
Overview
Let users create and manage their API keys through your app's interface.
Authentication: OAuth token
Required Scopes: apikeys:read, apikeys:write
List API Keys
Get user's existing API keys.
Endpoint: GET /api/user/api-keys
const response = await fetch('https://hypery.ai/api/user/api-keys', {
headers: {
'Authorization': `Bearer ${oauthAccessToken}`
}
})
const { apiKeys } = await response.json()
console.log(apiKeys)response = requests.get(
'https://hypery.ai/api/user/api-keys',
headers={'Authorization': f'Bearer {oauth_token}'}
)
data = response.json()
print(data['apiKeys'])curl https://hypery.ai/api/user/api-keys \
-H "Authorization: Bearer OAUTH_TOKEN"Response:
{
"success": true,
"apiKeys": [
{
"id": "507f1f77bcf86cd799439011",
"name": "Production Key",
"key": "ak_1699564800_abc123...",
"permissions": ["ai:chat", "ai:models"],
"lastUsed": "2025-11-16T10:30:00Z",
"createdAt": "2025-11-01T10:00:00Z"
}
]
}Output Fields
Create API Key
Generate a new API key for the user.
Endpoint: POST /api/user/api-keys
const response = await fetch('https://hypery.ai/api/user/api-keys', {
method: 'POST',
headers: {
'Authorization': `Bearer ${oauthToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My API Key',
permissions: ['ai:chat', 'ai:models']
})
})
const { apiKey } = await response.json()
console.log('New key:', apiKey.key)response = requests.post(
'https://hypery.ai/api/user/api-keys',
headers={'Authorization': f'Bearer {oauth_token}'},
json={
'name': 'My API Key',
'permissions': ['ai:chat', 'ai:models']
}
)
data = response.json()
print('New key:', data['apiKey']['key'])curl -X POST https://hypery.ai/api/user/api-keys \
-H "Authorization: Bearer OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My API Key",
"permissions": ["ai:chat", "ai:models"]
}'Input Parameters
Available permissions:
ai:chat/ai:completions— Chat completionsai:models— List modelsai:images— Image generationai:embeddings— Embeddingsai:audio— TTS, transcriptions, realtime mintbilling:read— View credits/usage
See OAuth scopes.
Response:
{
"success": true,
"apiKey": {
"id": "507f...",
"name": "My API Key",
"key": "ak_1699564800_abc123...",
"permissions": ["ai:chat", "ai:models"],
"createdAt": "2025-11-16T10:30:00Z"
}
}Delete API Key
Revoke an API key.
Endpoint: DELETE /api/user/api-keys/:id
await fetch(`https://hypery.ai/api/user/api-keys/${keyId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${oauthToken}`
}
})requests.delete(
f'https://hypery.ai/api/user/api-keys/{key_id}',
headers={'Authorization': f'Bearer {oauth_token}'}
)curl -X DELETE https://hypery.ai/api/user/api-keys/KEY_ID \
-H "Authorization: Bearer OAUTH_TOKEN"Response:
{
"success": true
}Error Responses
Invalid Permissions
{
"success": false,
"error": "At least one permission is required"
}Status Code: 400
Missing Name
{
"success": false,
"error": "API key name is required"
}Status Code: 400