Get credits and rate limits
const url = 'https://api.surveycoder.io/v2/usage';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.surveycoder.io/v2/usage \ --header 'x-api-key: <x-api-key>'Returns the current credit balance, plan info, and per-key rate limit configuration for the authenticated organization.
Authorizations
Section titled “Authorizations ”Responses
Section titled “ Responses ”Usage information
object
Organization credit balance and limits.
object
Current subscription plan. Note: professional is displayed
as “Business” in the UI.
Total available credits (base + rollover). Credits never expire.
Monthly credit allocation for this plan.
Whether the organization is on a free trial.
Rate limit configuration for the current plan.
object
Maximum API requests per minute.
Maximum concurrent async jobs allowed.
object
Example
{ "success": true, "data": { "plan": "starter", "credits_remaining": 2450, "credits_monthly": 3000, "is_trial": false, "rate_limit": { "rpm": 30, "concurrent_jobs": 3 } }, "meta": { "api_version": "v1" }}Missing or invalid API key.
Standard error envelope.
object
object
Machine-readable error code. See the error reference for the full list.
Human-readable explanation of what went wrong.
Echo of the X-Request-Id header, when provided.
Link to documentation for this specific error code.
Example
{ "success": false, "error": { "code": "UNAUTHORIZED", "message": "x-api-key header is required", "doc_url": "https://docs.surveycoder.io/errors/unauthorized" }}Resource not found.
Standard error envelope.
object
object
Machine-readable error code. See the error reference for the full list.
Human-readable explanation of what went wrong.
Echo of the X-Request-Id header, when provided.
Link to documentation for this specific error code.
Example
{ "success": false, "error": { "code": "NOT_FOUND", "message": "Project not found", "doc_url": "https://docs.surveycoder.io/errors/not-found" }}