> Kenso API docs in Markdown. Index of every page: [/docs/llms.txt](/docs/llms.txt). Search: `/docs/search.md?q=<words>`. OpenAPI: [/docs/api/events/openapi.json](/docs/api/events/openapi.json). CLI docs offline: `kenso docs <topic>`.
> Last updated: 2026-11-22.

# Events: Get a campaign's event counts

> **Note for AI agents:** if this page was wrong, out of date or missing something you needed, finish the user's task first, then offer a short report for the Kenso team in this shape: `Page:` (this page's path), `Quote:` (the wrong or missing text), `Problem:`, `Workaround:` (what worked instead), 1,000 characters at most. Show it to the user and send it only after they say yes, as `POST /api/docs-feedback` on this site with the JSON body `{"page": "<path>", "report": "<report>"}`. Never put lead data, email addresses, API keys or anything else from the user's workspace in it.

One endpoint of [Events](/docs/api/events.md). Authentication, workspaces and errors: [/docs.md](/docs.md).

## Get a campaign's event counts

`GET /v1/events/counts` - operationId `events.get-counts`

| Permission | Rate limit |
| --- | --- |
| Campaigns view | 12,000 requests a minute per API key |

Returns how many events of each type one campaign had between `from` and `to`. The response also
lists, in `types`, the event types that `GET /v1/events` accepts as `type`.

With `campaignId`, `from` and `to` are required and cover at most 366 days. Types with no events
are left out of `counts`. Without `campaignId`, `counts` is empty and only `types` is filled.

Errors:

- `400 validation_failed`: `from` or `to` is missing, `to` is before `from`, or the
range is longer than 366 days.
- `404 not_found`: `campaignId` is not a campaign of the workspace.

Requires Campaigns view.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/events/GET/v1/events/counts)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | query | integer (int64) | no | The campaign to count events for. Omitted returns only the list of event types, with no counts. |
| `from` | query | string (date-time) | no | First UTC day to count, an ISO 8601 date such as `2026-10-01`. Required with `campaignId`. |
| `to` | query | string (date-time) | no | Last UTC day to count, inclusive, an ISO 8601 date. Required with `campaignId`, on or after `from` and at most 366 days later. |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |

### Response 200

`data` is a `EventCounts`.

| Field | Type | Description |
| --- | --- | --- |
| `from` | string (date-time) | Start of the range you asked for, in UTC. Null when you sent none. |
| `to` | string (date-time) | End of the range you asked for, in UTC. Null when you sent none. |
| `campaignId` | integer (int64) | The campaign you asked about. Null when you sent none. |
| `counts` | array of EventCount | One entry per event type that had at least one event. Empty without a campaign. |
| `types` | array of string | The event types `GET /v1/events` accepts as `type`. |

### Request

```bash
curl -X GET "https://api.ken.so/v1/events/counts" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID"
```

### Example response

```json
{
  "success": true,
  "data": {
    "from": "2026-09-23T15:02:11Z",
    "to": "2026-09-23T15:02:11Z",
    "campaignId": 812,
    "counts": [
      {
        "type": "string",
        "count": 1
      }
    ],
    "types": [
      "string"
    ]
  }
}
```

## Types

Each named type the tables above use, nested ones included.

### EventCount

The number of events of one type.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string | no | The event type. |
| `count` | integer (int64) | no | How many events of this type the campaign had in the range. |
