> ## Documentation Index
> Fetch the complete documentation index at: https://zenskar.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Reference: Usage events

> This document presents the screens, fields, permissions, API operations, and troubleshooting of usage events.

## Usage Events screen: controls, columns, and filters

The **Usage Events** screen lists the [usage-event collections](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#usage-event-collection) of your [organization](https://zenskar.com/docs/20260301/zenskar-modules/settings/glossary.md#organization). To open it, go to **Usage** > **Usage Events**.

### Controls

| Control | Description |
| - | - |
| **Search Usage Event** | Finds usage-event collections whose name contains the text that you enter. Selecting a result opens the screen of the usage-event collection. |
| **ADD USAGE EVENT** | Opens the **Add Usage Event** screen. |
| **FILTER** | Adds a filter to the list. See [Filters](#filters). |

### Columns

| Column | Content | Sortable |
| - | - | - |
| **Name** | The name of the usage-event collection. Click the row to open the screen of the usage-event collection. | Yes |
| **API Slug** | The [API slug](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#api-slug) of the usage-event collection. | Yes |
| **S3 Ingestion** | Whether [S3 ingestion](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#s3-ingestion) is on for the usage-event collection. | No |
| **S3 Directory** | The folder that Zenskar reads in the S3 bucket, or a dash when S3 ingestion is off. | No |
| **Data Schema** | **View** opens the **Data Schema** window. The window shows the [data schema](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#data-schema) as JSON. | Yes |
| **Created At** | The date when the usage-event collection was created. | Yes |

Click a sortable column header to sort in ascending order. Click it again to sort in descending order. Click it a third time to remove the sorting.

### Filters

| Filter | Values | Conditions |
| - | - | - |
| **Name** | Text | Conditions for text, such as **contains** and **equals** |
| **API Slug** | Text | Conditions for text, such as **contains** and **equals** |
| **Created At** | A date | Conditions for dates, such as **is before** |

After you set a filter, click **APPLY FILTER**. To remove all filters, click **Clear All Filters**.

## Add Usage Event screen: fields and their rules

**ADD USAGE EVENT** on the **Usage Events** screen opens the **Add Usage Event** screen. It creates a usage-event collection.

### Fields

| Field | Required | Default | Details |
| - | - | - | - |
| **Usage Event Name** | Yes | None | The name of the usage-event collection. |
| **API Slug Endpoint** | Yes | Follows the name | The API slug, after `https://api.zenskar.com/usage/`. Spaces become underscores. |
| **Follow the usage event name** | No | Selected | While selected, the API slug follows the name. Clear it to enter a different API slug. |
| **Enable S3 ingestion for this usage event** | No | Off | Turns on S3 ingestion for the usage-event collection. It shows only when your organization has a [bucket connection](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#bucket-connection). Otherwise, the screen links to **Settings**. |
| **S3 Directory Name** | When S3 ingestion is on | The API slug | The folder that Zenskar reads, after the name of the bucket. |
| **Error / DLQ Directory Name** | No | None | The [error folder](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#error-folder) in the [ingestion-error bucket](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#ingestion-error-bucket). It shows only when S3 ingestion is on and your organization has an ingestion-error bucket. |
| **Root Fields** | Yes | `customer_id` (String), `timestamp` (DateTime64) | The two [root fields](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#root-field). |
| **Your Data Schema** | No | None | The [data fields](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#data-field). **+ ADD NEW DATA FIELD** adds a row with **Data field** and **Data type**. The delete icon removes a row before you save. Spaces in a name become underscores. |
| **Data type** | Yes, for each data field | String | One of String, Int64, Float64, Date32, DateTime64, UUID, and Bool. See [Data fields: the details that you add](https://zenskar.com/docs/20260301/zenskar-modules/usage/concepts/usage-events.md#data-fields-the-details-that-you-add). |
| **Order By** | Yes | `timestamp` | The field that orders the [usage events](https://zenskar.com/docs/20260301/zenskar-modules/usage/glossary.md#usage-event) of the usage-event collection. |
| **Data Schema Preview** | Not applicable | Not applicable | The data schema as JSON. |

### Actions

| Action | Description |
| - | - |
| **ADD USAGE EVENT** | Creates the usage-event collection. The **Usage Events** list opens. |
| **CANCEL** | Returns to the previous screen without creating the usage-event collection. |

### Constraints: what each field accepts

| Property | Constraint |
| - | - |
| **Usage Event Name** | The name can contain letters, digits, underscores, and spaces. |
| | The name cannot change after you create the usage-event collection. |
| **API Slug Endpoint** | The API slug is in lowercase. |
| | The API slug starts and ends with a letter or a digit. |
| | In between, the API slug can also contain underscores and hyphens. |
| | The API slug must be unique in your organization. |
| | The API slug cannot change after you create the usage-event collection. |
| **Error / DLQ Directory Name** | The error folder is a relative path without a trailing slash. |
| **Root Fields** | The root fields cannot change. |
| **Your Data Schema** | Two data fields cannot have the same name. |
| | A data field cannot be removed or renamed after you create the usage-event collection. |
| | The data type of a data field cannot change after you create the usage-event collection. |
| **Order By** | The field cannot change. |

## Usage-event collection screen: details, data fields, S3 ingestion, and usage events

Clicking a usage-event collection on the **Usage Events** screen opens the screen of the usage-event collection. The screen shows the name of the usage-event collection as its title.

### Details

| Item | Description |
| - | - |
| **API Slug Endpoint** | `https://api.zenskar.com/usage/` followed by the API slug. The copy icon copies it. |
| **Data Schema** | **View** opens the **Data Schema** window. The window shows the data schema as JSON. |
| **Sample Request** | **View** opens the **Sample Request** window. See [Sample Request window](#sample-request-window). |

### Sample Request window

| Item | Description |
| - | - |
| Request | A `curl` request to the [API endpoint](https://developer.mozilla.org/en-US/docs/Glossary/REST), with the `organisation` header filled in, `<your-api-key>` in the `x-api-key` header, and a sample usage event after `--data-raw`. Write `timestamp` as `YYYY-MM-DD HH:MM:SS`. The request also accepts a JSON array of usage events. |
| Copy icon | Copies the request. |
| **Create an API Key** | Opens **Settings** > **API Keys**. |

### New field to data schema

**NEW FIELD TO DATA SCHEMA** expands a form that adds a data field. Usage events that arrived before the data field was added have no value for it.

| Field or action | Details |
| - | - |
| **Data field name** | It is required. Spaces become underscores. |
| **Data field type** | It is required. The default is String. It is one of the seven data types. |
| **SUBMIT** | Adds the data field to the data schema. |
| **CANCEL** | Closes the form without adding a data field. |

| Property | Constraint |
| - | - |
| **Data field name** | When the name matches an existing data field, Zenskar keeps the existing data field and its data type. Zenskar adds nothing. |
| | A data field cannot be removed or renamed after you add it. |
| **Data field type** | The data type cannot change after you add the data field. |

### S3 Ingestion

When your organization has no bucket connection, this area links to **Settings** instead of showing the controls.

| Field or action | Details |
| - | - |
| Switch | Turns S3 ingestion on or off for the usage-event collection. Turning it on opens the folder fields. Turning it off takes effect right away, without a confirmation. Turning it off clears the folder and the error folder. |
| **S3 Directory Name** | The folder that Zenskar reads, after the name of the bucket. The default is the API slug. |
| **Error / DLQ Directory Name** | It is optional. It holds the error folder in the ingestion-error bucket. It shows only when your organization has an ingestion-error bucket. |
| **Edit** | Opens the folder fields while S3 ingestion is on. The bucket can change only in **Settings** > **S3 Ingestion**. |
| **SAVE** | Saves the folders. |
| **CANCEL** | Discards the changes to the folders. |

| Property | Constraint |
| - | - |
| **S3 Directory Name** | The folder is a relative path without a trailing slash. |
| | The path cannot have `.` or `..` as a part. |
| Files in the folder | Zenskar reads only the files that arrive after S3 ingestion is turned on. |

### Events Table

The **Events Table** shows the 20 usage events with the latest `timestamp`. The newest usage event comes first. The table has one column for each field. A usage event can take a few seconds to show.

| Control | Description |
| - | - |
| **DOWNLOAD EVENTS** | Opens the **Export Events** window. See [Export Events window](#export-events-window). |
| **UPLOAD CSV** | Opens the **Upload CSV** window. See [Upload CSV window](#upload-csv-window). |
| Arrow next to **UPLOAD CSV** | Shows **Add a single event**. It opens the **Add New Event** panel. See [Add New Event panel](#add-new-event-panel). |
| **FILTER** | Adds a filter on a field. The conditions depend on the data type of the field. After you set a filter, click **APPLY FILTER**. To remove all filters, click **Clear All Filters**. |
| **REFRESH TABLE** | Shows usage events that just arrived. |

### Add New Event panel

| Field | Required | Details |
| - | - | - |
| **Customer ID** | Yes | The value of `customer_id`. |
| **Timestamp** | Yes | **Date** and **Time**. |
| One entry for each data field | No | Labeled with the name and the data type of the data field. A Bool data field has **True** and **False**. |

**ADD EVENT** stores the usage event. It closes the panel. **CANCEL** closes the panel without adding a usage event.

| Property | Constraint |
| - | - |
| Int64 data field | The value is a whole number. |

### Upload CSV window

| Item | Description |
| - | - |
| **Click to upload** | Selects a CSV file. You can also drag the file into the window. |
| **Date Format**, **Timestamp Format** | They show when the file has dates and timestamps. Each list shows the formats that Zenskar detects in the file. |
| **Preview** | Shows the rows as Zenskar reads them. |
| **Processed CSV** | Downloads the rows as Zenskar reads them. |
| **Download sample CSV file** | Downloads `sample.csv`, with the columns of the data schema and 100 rows of example values. |
| **IMPORT CSV DATA** | Checks every row against the data schema. Then it stores the usage events. |
| **CANCEL** | Closes the window without uploading. |

| Property | Constraint |
| - | - |
| File | The file can be at most 100 MB. |
| | The file has one column for each field, with the field names as headers: `customer_id`, `timestamp`, and each data field without `data.` in front. |
| | The file has no other columns. |
| Rows | If one row fails the check against the data schema, Zenskar stores none of the rows. The dashboard shows the number of the row. |

### Export Events window

| Item | Description |
| - | - |
| Number of usage events | The number of usage events that the download holds, and the expected duration. |
| **Use filters** | It shows when the **Events Table** has filters. It is on by default. It lists the filters. Turn it off to download all usage events. |
| **EXPORT** | Downloads the usage events as `events_export.csv`. Keep the window open until the download finishes. |

| Property | Constraint |
| - | - |
| Download | One download holds at most 50,000 usage events. |

## Permissions

| Action | Required permission |
| - | - |
| View usage-event collections, their screens, and their usage events | **Can Read Usage Event**, in the **USAGE\_EVENT** group |
| Open the sample request | **Can Read Usage Event** |
| Download usage events | **Can Read Usage Event** |
| Create a usage-event collection | **Can Read Usage Event** and **Can Create Usage Event** |
| Upload usage events from a CSV file, or add a single usage event | **Can Read Usage Event** and **Can Create Usage Event** |
| Add a data field | **Can Read Usage Event** and **Can Update Usage Event** |
| Set up, change, or turn off S3 ingestion for a usage-event collection | **Can Read Usage Event** and **Can Update Usage Event** |

The default **Owner** role has every permission. The default **User** role has read permissions only.

Sending usage events through the API needs an API key. See [API keys](https://zenskar.com/docs/20260301/zenskar-modules/settings/api-keys.md).

## API reference

| Operation | API reference |
| - | - |
| List usage-event collections | [List usage events](https://zenskar.com/docs/api-reference/usage-events/list-usage-events.md) |
| Get a usage-event collection by its ID | [Get usage event by ID](https://zenskar.com/docs/api-reference/usage-events/get-usage-event-by-id.md) |
| Get a usage-event collection by its API slug | [Get usage event by slug](https://zenskar.com/docs/api-reference/usage-events/get-usage-event-by-slug.md) |
| Create a usage-event collection | [Create usage event](https://zenskar.com/docs/api-reference/usage-events/create-usage-event.md) |
| Update a usage-event collection | [Update usage event](https://zenskar.com/docs/api-reference/usage-events/update-usage-event.md) |

The API reference names these operations "usage event". Each operation acts on a usage-event collection. Sending usage events to a usage-event collection uses its API endpoint, which the API reference does not list. See [Send usage events through the API](https://zenskar.com/docs/20260301/zenskar-modules/usage/how-to-guides/usage-events.md#send-usage-events-through-the-api).

## Troubleshooting

| Problem | Cause | Solution |
| - | - | - |
| Zenskar rejects a new usage-event collection. | Another usage-event collection in your organization has the same API slug. | Choose another API slug. |
| The **Add Usage Event** screen does not save. | Two data fields have the same name. | Rename or remove one of the data fields. |
| A new usage-event collection does not appear in **Usage Events**. | Creation took longer than usual and continues in the background. | Check **Usage Events** again later, and create the usage-event collection again if it still does not appear. |
| S3 ingestion is off for a usage-event collection that you created with S3 ingestion on. | Zenskar created the usage-event collection but could not turn on S3 ingestion. | Turn on S3 ingestion from the screen of the usage-event collection, as in [Set up S3 ingestion for a usage-event collection](https://zenskar.com/docs/20260301/zenskar-modules/usage/how-to-guides/usage-events.md#set-up-s3-ingestion-for-a-usage-event-collection). |
| A new data field does not appear, or its data type did not change. | The data schema already had a data field with that name. Zenskar added nothing. | Add the data field with a name that the data schema does not have. |
| A usage event does not show in the **Events Table**. | The usage event arrived a few seconds ago. | Click **REFRESH TABLE**. |
| An older usage event does not show in the **Events Table**. | The table shows only the 20 usage events with the latest `timestamp`. | Filter the table, or download the usage events. |
| Zenskar rejects a CSV file before the upload starts. | The columns do not match the fields of the data schema. | Make the headers match the field names, with one column for each field, as in [Upload usage events from a CSV file](https://zenskar.com/docs/20260301/zenskar-modules/usage/how-to-guides/usage-events.md#upload-usage-events-from-a-csv-file). |
| A CSV upload stores no usage events. | One row failed the check against the data schema. | Fix the row whose number the dashboard shows, and upload the file again. |
| Some usage events appear twice after a second CSV upload. | The first upload stopped partway. The second upload stored the same rows again. | Check the **Events Table** before you upload a file again. |
| Zenskar does not download the usage events. | The download holds more than 50,000 usage events. | Add filters until the number is 50,000 or less. |
| Zenskar does not read files that were in the S3 folder before. | Zenskar reads only the files that arrive after S3 ingestion is turned on. | Upload the files to the folder again. |
| Rejected S3 files cannot be found. | Your organization has no ingestion-error bucket. | Add an ingestion-error bucket, as in [Change the bucket connection](https://zenskar.com/docs/20260301/zenskar-modules/usage/how-to-guides/s3-ingestion.md#change-the-bucket-connection). |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.