Appearance
Check Usage
Monitor your API usage and quota.
Endpoint
GET /api/user/usageHeaders
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | Your API key |
Response
Success (200)
json
{
"plan": "pro",
"quota": 5000,
"used": 1234,
"remaining": 3766,
"percent_used": 24.68,
"reset_date": "2024-02-01T00:00:00.000Z",
"last_reset": "2024-01-01T00:00:00.000Z"
}Fields
| Field | Type | Description |
|---|---|---|
plan | string | Current plan: free, pro, business, past_due, or canceled |
quota | integer | Monthly image generation limit |
used | integer | Images generated this month |
remaining | integer | Images remaining this month |
percent_used | float | Usage percentage (0-100) |
reset_date | string | Next quota reset date (ISO 8601) |
last_reset | string | Last quota reset date (ISO 8601) |
Example
bash
curl https://ogimageapi.io/api/user/usage \
-H "X-API-Key: og_your_api_key"Response:
json
{
"plan": "pro",
"quota": 5000,
"used": 847,
"remaining": 4153,
"percent_used": 16.94,
"reset_date": "2024-02-01T00:00:00.000Z",
"last_reset": "2024-01-01T00:00:00.000Z"
}Usage Tips
Monitoring Usage
Check your usage regularly to avoid hitting limits:
javascript
async function checkUsage() {
const response = await fetch('https://ogimageapi.io/api/user/usage', {
headers: { 'X-API-Key': process.env.OG_IMAGE_API_KEY }
});
const data = await response.json();
if (data.percent_used > 80) {
console.warn(`Warning: ${data.percent_used}% of quota used`);
}
return data;
}Quota Alerts
We automatically send email alerts at:
- 80% of quota used
- 95% of quota used
What Happens at 100%?
When you reach your quota limit:
- API returns
429 QUOTA_EXCEEDED - Usage resets on the 1st of each month
- Consider upgrading for higher limits
Error Responses
| Status | Code | Description |
|---|---|---|
| 401 | MISSING_API_KEY | No API key provided |
| 401 | INVALID_API_KEY | Invalid API key |
| 500 | FETCH_FAILED | Server error |