API

Account

Retrieve information about your cloudlayer.io account, including API call counts, subscription details, storage usage, compute time, and credit balance.

Endpoint

GET /v1/account
GET /v2/account

Request

No parameters required. Authentication is via the X-API-Key header.

cURL

curl -X GET "https://api.cloudlayer.io/v2/account" \
  -H "X-API-Key: your-api-key-here"

JavaScript (fetch)

const response = await fetch("https://api.cloudlayer.io/v2/account", {
  headers: {
    "X-API-Key": "your-api-key-here",
  },
});

const account = await response.json();
console.log(account);

Python (requests)

import requests

response = requests.get(
    "https://api.cloudlayer.io/v2/account",
    headers={"X-API-Key": "your-api-key-here"},
)

account = response.json()
print(account)

Response

{
  "calls": 15234,
  "subscription": "professional",
  "bytesUsed": 1073741824,
  "computeTime": 384200,
  "creditBalance": 4500,
  "jobCounts": {
    "completed": 15100,
    "failed": 34,
    "pending": 0,
    "processing": 2
  }
}

Response Fields

FieldTypeDescription
callsnumberTotal number of API calls made in the current billing period.
subscriptionstringYour current subscription plan (e.g., "free", "starter", "professional", "enterprise").
bytesUsednumberTotal storage used in bytes across all generated assets. Divide by 1048576 for megabytes or 1073741824 for gigabytes.
computeTimenumberTotal compute time used in milliseconds across all jobs in the current billing period.
creditBalancenumberRemaining API credits. Each API call consumes one or more credits depending on the operation and output size.
jobCountsobjectBreakdown of jobs by status. See below.

jobCounts Object

FieldTypeDescription
completednumberNumber of successfully completed jobs.
failednumberNumber of failed jobs.
pendingnumberNumber of jobs waiting to be processed.
processingnumberNumber of jobs currently being processed.

Use Cases

Monitor Usage

Check your API usage to stay within plan limits:

const response = await fetch("https://api.cloudlayer.io/v2/account", {
  headers: { "X-API-Key": "your-api-key-here" },
});

const account = await response.json();

console.log(`Calls this period: ${account.calls}`);
console.log(`Credit balance: ${account.creditBalance}`);
console.log(`Storage used: ${(account.bytesUsed / 1073741824).toFixed(2)} GB`);
console.log(`Jobs completed: ${account.jobCounts.completed}`);
console.log(`Jobs failed: ${account.jobCounts.failed}`);

Usage Alerts

Set up an automated check to alert you when credits are running low:

import requests

response = requests.get(
    "https://api.cloudlayer.io/v2/account",
    headers={"X-API-Key": "your-api-key-here"},
)

account = response.json()

if account["creditBalance"] < 100:
    print(f"WARNING: Only {account['creditBalance']} credits remaining!")
    # Send alert via email, Slack, etc.

Tips

  • Billing period: The calls count resets at the beginning of each billing period. Check your dashboard for your billing cycle dates.
  • Credit consumption: Different operations consume different amounts of credits. PDF generation with large HTML or many pages may consume more credits than a simple image capture.
  • Storage management: If bytesUsed is approaching your plan’s storage limit, use the Assets endpoint to review and clean up old generated files.