Account & billing
API keys
Manage your API keys programmatically. Each key can have a spending limit, a reset period for that limit and an expiration date.
Every endpoint on this page needs your credit ID in the x-credit-id header.
Base URL
https:/ / api.ppq.aiGET /keys
List all API keys on your account.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
include_disabled | boolean | No | Include revoked keys in the response. Default: false. |
show_key | boolean | No | Include the full api_key value of each key. Default: false. |
Response
| Field | Type | Description |
|---|---|---|
status | string | Always "success". |
data | array | Your API keys. |
data[]._id | string | MongoDB ObjectId. Use it as {id} in the other endpoints. |
data[].name | string | Key name. |
data[].api_key | string | Full key value. Only present when show_key=true. |
data[].usage_limit_usd | number | null | Spending cap in USD, or null if unlimited. |
data[].current_period_usage_usd | number | Spending in the current reset period, in USD. |
data[].total_usage_all_time_usd | number | Total spending since the key was created, in USD. |
data[].reset_period | string | null | One of "daily", "weekly", "monthly", or null. |
data[].reset_at | string (ISO 8601) | null | Next reset time, or null. |
data[].expire_at | string (ISO 8601) | null | Expiration time, or null. |
data[].created_at | string (ISO 8601) | Creation time. |
data[].updated_at | string (ISO 8601) | Last update time. |
data[].deleted_at | string (ISO 8601) | null | Revocation time, or null if the key is active. |
Example
import requests
credit_id = "YOUR_CREDIT_ID"
url = "https://api.ppq.ai/keys"
headers = {
"x-credit-id": credit_id
}
# Optional: ?include_disabled=true&show_key=true
response = requests.get(url, headers=headers)
print(response.json())POST /keys
Create a new API key. The response contains the full key; store it securely. You can also retrieve it later with GET /keys or GET /keys/{id} and show_key=true.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Key name, 1–25 characters. Must be unique on your account. |
usage_limit_usd | number | null | No | Spending cap in USD, minimum 0.01. Omit it or pass null for no limit. |
reset_period | string | No | Resets the usage counter automatically. One of "daily", "weekly", "monthly". Requires usage_limit_usd. |
expire_at | string (ISO 8601) | No | Expiration time, for example 2027-01-01T00:00:00Z. Must be in the future. |
Response
Returns 201 Created.
| Field | Type | Description |
|---|---|---|
status | string | Always "success". |
data | object | The new key. |
data._id | string | Key ID. |
data.name | string | Key name. |
data.api_key | string | Full key value. Store it securely. |
data.usage_limit_usd | number | null | Spending cap in USD, or null. |
data.reset_period | string | null | Reset period, or null. |
data.reset_at | string (ISO 8601) | null | Next reset time, or null. |
data.expire_at | string (ISO 8601) | null | Expiration time, or null. |
data.created_at | string (ISO 8601) | Creation time. |
Example
import requests
credit_id = "YOUR_CREDIT_ID"
url = "https://api.ppq.ai/keys"
headers = {
"Content-Type": "application/json",
"x-credit-id": credit_id
}
data = {
"name": "my-app-key",
"usage_limit_usd": 10.00, # optional, min $0.01
"reset_period": "monthly", # optional: daily, weekly, monthly
"expire_at": "2027-01-01T00:00:00Z" # optional, must be future datetime
}
response = requests.post(url, json=data, headers=headers)
print(response.json())GET /keys/{id}
Get one API key by its MongoDB ObjectId (_id from GET /keys).
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
show_key | boolean | No | Include the full api_key value. Default: false. |
Response
| Field | Type | Description |
|---|---|---|
status | string | Always "success". |
data | object | The key. |
data._id | string | Key ID. |
data.name | string | Key name. |
data.api_key | string | Full key value. Only present when show_key=true. |
data.created_at | string (ISO 8601) | Creation time. |
data.updated_at | string (ISO 8601) | Last update time. |
data.deleted_at | string (ISO 8601) | null | Revocation time, or null if the key is active. |
Example
import requests
credit_id = "YOUR_CREDIT_ID"
key_id = "KEY_ID" # MongoDB ObjectId from list response
url = f"https://api.ppq.ai/keys/{key_id}"
headers = {
"x-credit-id": credit_id
}
response = requests.get(url, headers=headers)
print(response.json())PATCH /keys/{id}
Update an API key. Send only the fields you want to change, and pass null to clear a field (for example, to remove a usage limit).
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | New key name, 1–25 characters. |
usage_limit_usd | number | null | No | New spending cap in USD, minimum 0.01. null removes the limit. |
reset_period | string | null | No | One of "daily", "weekly", "monthly", or null. Changing it resets current_period_usage_usd to 0. |
expire_at | string (ISO 8601) | null | No | New expiration time, for example 2028-06-01T00:00:00Z. null removes it. |
Response
| Field | Type | Description |
|---|---|---|
status | string | Always "success". |
data | object | The updated key. |
data._id | string | Key ID. |
data.name | string | Key name. |
data.usage_limit_usd | number | null | Spending cap in USD, or null. |
data.current_period_usage_usd | number | Spending in the current period, in USD. Reset to 0 if reset_period changed. |
data.reset_period | string | null | Reset period, or null. |
data.reset_at | string (ISO 8601) | null | Next reset time, or null. |
data.expire_at | string (ISO 8601) | null | Expiration time, or null. |
data.created_at | string (ISO 8601) | Creation time. |
data.updated_at | string (ISO 8601) | Last update time. |
Example
import requests
credit_id = "YOUR_CREDIT_ID"
key_id = "KEY_ID" # MongoDB ObjectId from list response
url = f"https://api.ppq.ai/keys/{key_id}"
headers = {
"Content-Type": "application/json",
"x-credit-id": credit_id
}
# Only include fields you want to update
data = {
"name": "updated-key-name",
"usage_limit_usd": 25.00,
"reset_period": "weekly",
"expire_at": "2028-06-01T00:00:00Z"
}
response = requests.patch(url, json=data, headers=headers)
print(response.json())DELETE /keys/{id}
Revoke an API key. The key is soft-deleted: it stops working immediately and cannot be restored, but still appears in GET /keys with include_disabled=true.
Response
| Field | Type | Description |
|---|---|---|
status | string | Always "success". |
message | string | Always "API key revoked successfully". |
Example
import requests
credit_id = "YOUR_CREDIT_ID"
key_id = "KEY_ID" # MongoDB ObjectId from list response
url = f"https://api.ppq.ai/keys/{key_id}"
headers = {
"x-credit-id": credit_id
}
response = requests.delete(url, headers=headers)
print(response.json())
# {"status": "success", "message": "API key revoked successfully"}