GET /workspaces/usage
Returns agent execution history for a workspace. Results combine current executions, archived rows, and edited chats (see Item fields). Responses are sorted by created_at descending, then id descending.
Your API token must be allowed to use agents (use_agents), and you must have access to the workspace—the same layers as other agent and file API routes (Sanctum authentication, workspace access check).
Code Examples
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token (API key). The token must include the use_agents ability. |
| x-workspace-id | integer | Yes | Numeric workspace ID. Invalid or missing values produce a 422 error. You must belong to this workspace or the API returns 403. |
| Accept | string | No | Use application/json if your client needs an explicit JSON accept header. |
Query parameters
| Parameter | Type | Required | Description | Default / rules |
|---|---|---|---|---|
| range | string | No | Relative window: 1d, 7d, or 30d. Ignored if both start_date and end_date are sent. | If no date parameters are sent, the effective default is 30d. |
| start_date | date (YYYY-MM-DD) | Conditional | Start of a custom range (inclusive). | Required with end_date. |
| end_date | date (YYYY-MM-DD) | Conditional | End of a custom range (inclusive). Must be greater than or equal to start_date. | Required with start_date. The span cannot exceed 90 days; otherwise 422. |
| user_id | integer | No | Filter by the user who ran the agent. | Without workspace permission to read other users’ activity, you only see your own executions; filtering by another user’s id returns 403. |
| type | string | No | Agent type filter: all, chat, image, text, voiceover, video, code. | all or omitted means no type filter. |
| page | integer | No | Page number. | Default 1, minimum 1. |
| per_page | integer | No | Page size. | Default 20, between 1 and 100. |
- With
start_date+end_date: the inclusive range is capped at 90 days. - With
range: the window is relative to the end of the current day (1dlast 24 hours from that instant;7d/30dlast seven or thirty calendar days from that end). - If the
usage_history_min_datefeature is enabled in app settings, the effective start of the range is not earlier than that date (silent clamp).
- Listings are cached about 60 seconds per workspace, filters, and page. Identical requests within that window may return the same payload.
Response
has_more: the service requests per_page + 1 rows; if the extra row exists, has_more is true and only the first per_page items appear in items.
Item fields
| Field | Description |
|---|---|
| id | Execution id, or a synthetic id such as chat-edited-{user_openai_id} for edited chats. |
| created_at | Timestamp of the execution. |
| user_id | User who ran the agent. |
| type | Agent type from the agent definition (for example chat, image, text, voiceover, video, code). |
| status | succeeded or failed (non-success statuses map to failed). |
| Email of the executing user. | |
| credits | Credits charged; 0 when status is not succeeded. |
| name | Agent title. |
| slug | Agent slug. |
| output | For current rows: for image, video, and voiceover this is the real output; for other types it is the fixed text This content is only available on Tess. For archived: This item was deleted. For edited: This item was edited. |
| root_id | Conversation root for chats, when present. |
| execution_origin | Taken from execution metadata when available. |
| source | current, archived, or edited. |
| used_model | Model name when stored (user_openai.used_model or archived JSON); null for edited rows in the current implementation. |
| tokens | Object { "input", "output", "total" } when detailed_credits indicates token billing; otherwise null (common for image, video, voiceover). |
| link | URL or app path to open the resource when applicable; null for archived and edited, and for types without a link. Chat (current): path /dashboard/user/ai/chat/ai-chat/{slug}?_chat_id={id} using root_id when set, else row id. Image / video / voiceover (current): signed or public URL from storage when output is usable; otherwise null. |
Errors
| Status | When |
|---|---|
| 401 | Missing or invalid authentication (Sanctum). |
| 403 | No access to the workspace, or user_id targets another user without permission to view their executions. |
| 422 | Invalid query parameters (Laravel validation), invalid or missing workspace id, invalid dates, or a custom range longer than 90 days. |
{ "message": "..." } with a translated message.