API Usage Guide
This guide covers the common parameters you need before calling Alephant APIs: authentication tokens, workspace IDs, resource IDs, date ranges, and scoped analytics filters.
Base URL
Use the API host shown in the API Reference for your environment. Examples in this guide use:
Authentication
Most workspace APIs require both an Authorization header and an X-Workspace-Id header.
Supported token types depend on the route:
PAT management routes under /api/v1/pats are JWT-only. A PAT cannot manage other PATs.
Finding Required IDs
Many APIs need IDs that come from your workspace. Use the SaaS API to list resources, then pass the returned IDs into analytics or management APIs.
If your integration only has a virtual key (vk-...), first call:
The response can include workspace.id, virtual_key.id, and an optional bound entity.id plus entity.department_id. Use workspace.id as X-Workspace-Id for workspace-scoped APIs.
Date Ranges
Analytics endpoints commonly accept dateFrom and dateTo as YYYY-MM-DD.
For /api/v1/analytics/* routes in the SaaS API:
- If you send either
dateFromordateTo, send both. - If you omit both, the service uses the current billing period where supported.
dateFrommust not be afterdateTo.
Some lower-level Analytics API endpoints use start and end instead. Check the endpoint reference before mixing parameter names.
Scoped Analytics Filters
GET /api/v1/analytics/usage supports scoped usage series. Set at most one of:
agentIdmemberIddepartmentId
Example: usage for one agent.
If more than one scope is sent, the API returns a bad request.
Common Calls
Workspace analytics overview:
Cost breakdown:
Usage history:
SaaS API vs Analytics API
Use the SaaS API (/api/v1/...) for product workflows, workspace management, and dashboard-oriented analytics.
Use the Analytics API (/v1/analytics/...) for lower-level telemetry and collector-backed analytics. These endpoints generally require the same workspace context, but their parameter names and response shapes can be more collector-specific.
When building an external integration, start with the SaaS API unless you specifically need a collector-level analytics endpoint.