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

The response shape varies slightly depending on your billing model. See Billing Models below.

Subscription (limit-based) example:

{
  "email": "[email protected]",
  "uid": "aBcDeFgHiJkLmNoPqRsTuVwXyZ12",
  "subscription": "price-starter-1k",
  "subType": "limit",
  "subActive": true,
  "calls": 842,
  "callsLimit": 1000,
  "bytesTotal": 1073741824,
  "bytesLimit": 5368709120,
  "computeTimeTotal": 384200,
  "computeTimeLimit": 600000,
  "storageUsed": 52428800,
  "storageLimit": 1073741824,
  "totalJobs": 900,
  "successJobs": 858,
  "errorJobs": 42
}

Usage (credit-based) example:

{
  "email": "[email protected]",
  "uid": "aBcDeFgHiJkLmNoPqRsTuVwXyZ12",
  "subscription": "price-growth-usage",
  "subType": "usage",
  "subActive": true,
  "calls": 15234,
  "callsLimit": -1,
  "credit": 4500,
  "bytesTotal": 2147483648,
  "bytesLimit": -1,
  "computeTimeTotal": 720000,
  "computeTimeLimit": -1,
  "storageUsed": 104857600,
  "storageLimit": -1,
  "totalJobs": 15300,
  "successJobs": 15234,
  "errorJobs": 66
}

Response Fields

FieldTypeDescription
emailstringThe email address associated with the account.
uidstringThe unique user ID for the account.
subscriptionstringThe price ID of your current subscription (e.g., "price-starter-1k").
subTypestringBilling model: "limit" (subscription call limits) or "usage" (credit-based pay-per-use). See Billing Models.
subActivebooleanWhether the subscription is currently active.
callsnumberTotal number of API calls made in the current billing period.
callsLimitnumberMaximum API calls allowed per billing period. -1 indicates unlimited (usage-based plans).
creditnumberRemaining API credits. Only present for usage-based plans (subType: "usage"). Each API call consumes one or more credits depending on the operation.
bytesTotalnumberTotal output bytes generated across all jobs. Divide by 1048576 for megabytes or 1073741824 for gigabytes.
bytesLimitnumberMaximum output bytes allowed per billing period. -1 indicates unlimited.
computeTimeTotalnumberTotal compute time used in milliseconds across all jobs in the current billing period.
computeTimeLimitnumberMaximum compute time allowed in milliseconds per billing period. -1 indicates unlimited.
storageUsednumberTotal cloud storage currently used in bytes for stored assets.
storageLimitnumberMaximum cloud storage allowed in bytes. -1 indicates unlimited.
totalJobsnumberTotal number of completed jobs (success + error).
successJobsnumberNumber of successfully completed jobs.
errorJobsnumberNumber of failed jobs.

Billing Models

cloudlayer.io offers two billing models. The subType field in the account response indicates which model your plan uses.

Limit-Based (subType: "limit")

Subscription plans with a fixed number of API calls per billing period. The calls field tracks usage against callsLimit. When calls reaches callsLimit, further API requests are rejected until the next billing period.

  • The credit field is not present in the response.
  • callsLimit, bytesLimit, computeTimeLimit, and storageLimit reflect your plan’s caps.

Usage-Based (subType: "usage")

Credit-based plans where each API call deducts from your credit balance. There is no fixed call limit per billing period.

  • The credit field is present in the response, showing your remaining balance.
  • Limit fields (callsLimit, bytesLimit, etc.) are typically -1 (unlimited).

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(`Storage used: ${(account.storageUsed / 1073741824).toFixed(2)} GB`);
console.log(`Jobs completed: ${account.successJobs}`);
console.log(`Jobs failed: ${account.errorJobs}`);

if (account.subType === "limit") {
  console.log(`Calls remaining: ${account.callsLimit - account.calls}`);
} else {
  console.log(`Credit balance: ${account.credit}`);
}

Usage Alerts

Set up an automated check to alert you when usage is 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["subType"] == "usage" and account.get("credit", 0) < 100:
    print(f"WARNING: Only {account['credit']} credits remaining!")
    # Send alert via email, Slack, etc.

if account["subType"] == "limit" and account["callsLimit"] > 0:
    usage_pct = account["calls"] / account["callsLimit"] * 100
    if usage_pct > 90:
        print(f"WARNING: {usage_pct:.0f}% of call limit used!")

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 storageUsed is approaching your storageLimit, use the Assets endpoint to review and clean up old generated files.