Serpex

Usage API

Check your credit balance and request counts

Endpoint

GET https://api.serpex.dev/api/usage

Returns your organization's credit balance, request counts for a recent period, and the 10 most recent requests. Counts cover every API key in the organization, not only the key you call with.

Calls to this endpoint are free: they do not use credits and do not count against your plan's per-second rate limit.

Authentication

Pass your API key as a Bearer token in the Authorization header.

Authorization: Bearer sk_...

The x-api-key header is also accepted as a fallback.

Query Parameters

Prop

Type

Request history is kept for 30 days, so any days value above 30 returns the same data as days=30.

The credit balance is updated about once a minute, so it can trail your most recent requests by up to a minute.

Code Examples

curl "https://api.serpex.dev/api/usage?days=7" \
  -H "Authorization: Bearer sk_your_api_key"
import { SerpexClient } from "serpex";

const client = new SerpexClient("sk_your_api_key");

const usage = await client.usage({ days: 7 });

console.log(usage.credits.balance);
console.log(usage.statistics.totalRequests);
from serpex import SerpexClient

client = SerpexClient("sk_your_api_key")

usage = client.usage({"days": 7})

print(usage.credits.balance)
print(usage.statistics.totalRequests)

Both SDKs default to 30 days when called with no arguments (client.usage()).

Response

{
  "api_key": "Production key",
  "organization_id": "org_2b7c9d",
  "period_days": 7,
  "effective_days": 7,
  "statistics": {
    "totalRequests": 1240,
    "successfulRequests": 1228,
    "failedRequests": 12,
    "noResultsRequests": 31,
    "engineStats": {
      "search": 1100,
      "crawl": 140
    }
  },
  "credits": {
    "balance": 18450,
    "totalUsed": 1550
  },
  "recent_requests": [
    {
      "id": 981234,
      "organizationId": "org_2b7c9d",
      "searchEngine": "search",
      "requestedEngine": "auto",
      "resultsCount": 10,
      "status": "success",
      "responseTime": 1240,
      "fromCache": false,
      "contentRequested": false,
      "contentPagesRequested": null,
      "contentPagesDelivered": null,
      "createdAt": "2026-09-30T10:30:00.000Z"
    }
  ]
}

Response Fields

Prop

Type

Errors

StatusBody
400{"error": "days must be a whole number from 1 to 90"}
401{"error": "API key required"} or {"error": "Invalid or inactive API key"}
500{"error": "Failed to fetch usage statistics"}

On this page