Skip to content

Credit usage & balance

Retrieves your account’s credit information, including remaining credits, total usage, and total deposits.

Terminal window
curl "https://api.imagerouter.io/v1/credits" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"remaining_credits": "25.5000",
"credit_usage": "4.5000",
"total_deposits": "30.0000"
}

You can retrieve a breakdown of usage for each of your API keys by adding the by_api_key=true query parameter.

Terminal window
curl "https://api.imagerouter.io/v1/credits?by_api_key=true" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"remaining_credits": "25.5000",
"credit_usage": "4.5000",
"total_deposits": "30.0000",
"usage_by_api_key": [
{
"api_key_id": "d9eb93dc-56b1-4216-91b5-a44944508bbc",
"api_key_name": "Production Key",
"credit_usage": "4.2000",
"total_requests": 150,
"created_at": "2023-10-01T12:00:00.000Z",
"is_active": true
},
{
"api_key_id": "temp_jwt",
"api_key_name": "Temporary web token (imagerouter.io)",
"credit_usage": "0.0300",
"total_requests": 45,
"created_at": null,
"is_active": false
}
]
}

If the request fails, you will receive an error response:

{
"error": {
"message": "Failed to fetch credit information",
"type": "internal_error"
}
}
  • The endpoint only counts deposits with status COMPLETED.
  • Credit usage is calculated as: total_deposits - remaining_credits.