---
docId: doc_e40a5ed37fb74713b4a1b6458f83c628
title: Get usage by actor
description: "Read messages grouped by who generated them."
api:
  group: estadisticas
  auth: bearer
  operations:
    - operationId: getUsageActors
      method: GET
      path: /v1/usage/actors
      postmanName: Get usage by actor
---

<script>
  import { Note, Ways } from '$lib/components';
</script>

# Get usage by actor

Read messages grouped by actor: automated agents, workspace users, contacts, or other groups recorded by Platica. It counts charged messages by default; `universe=all` counts all messages.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/usage/actors \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.usage.actors();
```

</Ways.Way>
</Ways>

## Query parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `workspace` | string | Workspace ID. Required when your credential covers several workspaces ([list workspaces](/api-reference/workspaces)); without it the answer is `400` | When the credential has several |
| `startDate` | string | ISO 8601 start date with offset. If omitted, uses the start of the billing period | — |
| `endDate` | string | ISO 8601 end date with offset. If omitted, uses the end of the billing period | — |
| `universe` | enum | `billable` (default) counts only charged messages; `all` includes failed/non-billable messages | — |

## Response

```json
{
  "status": "success",
  "data": {
    "workspaceId": "g6yCA16pkWl5eXo7KszB",
    "billingPeriod": {
      "startDate": "2026-06-01T00:00:00.000Z",
      "endDate": "2026-06-30T23:59:59.999Z"
    },
    "universe": "billable",
    "actors": {
      "range": {
        "startDate": "2026-06-01T00:00:00.000Z",
        "endDate": "2026-06-30T23:59:59.999Z"
      },
      "freshness": {
        "source": "daily_aggregations",
        "lastUpdated": "2026-06-29T18:31:10.000Z",
        "expectedLagSeconds": 30
      },
      "actorTypes": [
        { "actorType": "Agente IA / automático", "messages": 870 },
        { "actorType": "Usuarios del workspace", "messages": 80 }
      ],
      "workspaceUsers": [
        { "userId": "user_123", "email": "ana@example.com", "messages": 45 }
      ],
      "summary": {
        "totalMessages": 1200
      }
    }
  }
}
```

## Response fields

| Field | Description |
|-------|-------------|
| `workspaceId` | Workspace ID |
| `billingPeriod` | Active billing period for the workspace |
| `universe` | Requested universe: `billable` or `all` |
| `actors.range` | Effective date range evaluated |
| `actors.actorTypes` | Messages per actor type with `actorType` and `messages` |
| `actors.workspaceUsers` | Messages per workspace user with `userId`, `email`, and `messages` |
| `actors.summary.totalMessages` | Total messages of the requested universe in the range |
| `actors.freshness` | Latest update and expected lag |

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | A query parameter is not valid: one the endpoint does not know, a date that is not ISO 8601 with offset, or a value outside the allowed list (`universe`). `details.issues` says which one |
| `400` | `INVALID_REQUEST` | Your credential covers several workspaces and you did not send `?workspace=`, or you sent one it does not cover. `details.available` lists the IDs you can use and `details.requested` the one you sent |
| `401` | `UNAUTHENTICATED` | The credential is missing or invalid |
| `403` | `FORBIDDEN` | With an OAuth token, the person has no access to the dashboard (statistics) in that workspace. The message is `Missing dashboard permission` |
| `404` | `NOT_FOUND` | The workspace no longer exists. This is rare |

```json
{
  "code": 403,
  "error": "Forbidden - You don't have permission for this resource",
  "details": {
    "code": "FORBIDDEN",
    "message": "Missing dashboard permission"
  }
}
```

The general error format is in [Errors](/api-reference/errors).
