List API Keys
curl --request GET \
--url https://www.ninjachat.ai/api/api-keys \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.ninjachat.ai/api/api-keys"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.ninjachat.ai/api/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"keys": [
{
"id": "<string>",
"name": "<string>",
"keyPrefix": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"usageCount": 123
}
],
"stats": {
"activeKeys": 123,
"totalUsage": 123
},
"billing": {
"hasCredits": true,
"balanceCents": 123,
"balanceFormatted": "$42.50",
"rateLimit": {
"requests": 60,
"windowSeconds": 60
},
"usage": {
"chat": {
"count": 123,
"costCents": 123
},
"search": {
"count": 123,
"costCents": 123
},
"images": {
"count": 123,
"costCents": 123
},
"totalSpentCents": 123
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"message": "<string>",
"code": "<string>",
"request_id": "<string>"
}Key Management
List API Keys
List all your API keys with usage stats and billing info.
GET
/
api
/
api-keys
List API Keys
curl --request GET \
--url https://www.ninjachat.ai/api/api-keys \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.ninjachat.ai/api/api-keys"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.ninjachat.ai/api/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"keys": [
{
"id": "<string>",
"name": "<string>",
"keyPrefix": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"usageCount": 123
}
],
"stats": {
"activeKeys": 123,
"totalUsage": 123
},
"billing": {
"hasCredits": true,
"balanceCents": 123,
"balanceFormatted": "$42.50",
"rateLimit": {
"requests": 60,
"windowSeconds": 60
},
"usage": {
"chat": {
"count": 123,
"costCents": 123
},
"search": {
"count": 123,
"costCents": 123
},
"images": {
"count": 123,
"costCents": 123
},
"totalSpentCents": 123
}
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"message": "<string>",
"code": "<string>",
"request_id": "<string>"
}⌘I