> ## 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.

# Usage events

## Usage Events screen

The **Usage Events** screen lists the [usage-event collections](https://zenskar.com/docs/20260301/product-modules/usage/glossary.md#usage-event-collection) of your 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/product-modules/usage/glossary.md#api-slug) of the usage-event collection. | Yes |
| **S3 Ingestion** | Whether [S3 ingestion](https://zenskar.com/docs/20260301/product-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 "—" 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/product-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

**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. It can contain letters, digits, underscores, and spaces. It cannot change after you create the usage-event collection. |
| **API Slug Endpoint** | Yes | Follows the name | The API slug, after `https://api.zenskar.com/usage/`. It is in lowercase. Spaces become underscores. It starts and ends with a letter or a digit. In between, it can also contain underscores and hyphens. It must be unique in your organization. It cannot change after you create the usage-event collection. |
| **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/product-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 in the [ingestion-error bucket](https://zenskar.com/docs/20260301/product-modules/usage/glossary.md#ingestion-error-bucket). It shows only when S3 ingestion is on and your organization has an ingestion-error bucket. Use a relative path without a trailing slash. |
| **Root Fields** | Yes | `customer_id` (String), `timestamp` (DateTime64) | The two [root fields](https://zenskar.com/docs/20260301/product-modules/usage/glossary.md#root-field). They cannot change. |
| **Your Data Schema** | No | None | The [data fields](https://zenskar.com/docs/20260301/product-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. Two data fields cannot have the same name. |
| **Data type** | Yes, for each data field | String | One of String, Int64, Float64, Date32, DateTime64, UUID, and Bool. See [Data fields](https://zenskar.com/docs/20260301/product-modules/usage/concepts/usage-events.md#data-fields). |
| **Order By** | Yes | `timestamp` | The field that orders the [usage events](https://zenskar.com/docs/20260301/product-modules/usage/glossary.md#usage-event) of the usage-event collection. It cannot change. |
| **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. |

## Usage-event collection screen

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 slug endpoint](https://zenskar.com/docs/20260301/product-modules/usage/glossary.md#api-slug-endpoint), 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. You cannot remove or rename a data field after you add it. You cannot change its data type either. 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. When the name matches an existing data field, Zenskar keeps the existing data field. Zenskar adds nothing. |
| **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. |

### 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. |
| **S3 Directory Name** | The folder that Zenskar reads, after the name of the bucket. The default is the API slug. Use a relative path without a trailing slash, and without `.` or `..` as a part of the path. |
| **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. |

### 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**. An Int64 data field takes only whole numbers. |

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

### Upload CSV window

| Item | Description |
| - | - |
| **Click to upload** | Selects a CSV file of at most 100 MB. You can also drag the file into the window. The file needs one column for each field, with the field names as headers: `customer_id`, `timestamp`, and each data field without `data.` in front. |
| **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. If one row fails the check, Zenskar stores none of the rows. Zenskar shows the number of the row. |
| **CANCEL** | Closes the window without uploading. |

### Export Events window

| Item | Description |
| - | - |
| Number of usage events | The number of usage events that the download holds, and the expected duration. At most 50,000 usage events can be downloaded at a time. |
| **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. |

## Permissions

| Action | Required permissions in the roles UI |
| - | - |
| 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/product-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 slug endpoint. The API reference does not list the API slug endpoint. See [Send usage events through the API](https://zenskar.com/docs/20260301/product-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. | See [Set up S3 ingestion for a usage-event collection](https://zenskar.com/docs/20260301/product-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. | See [Upload usage events from a CSV file](https://zenskar.com/docs/20260301/product-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 Zenskar 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. | See [Change the bucket connection](https://zenskar.com/docs/20260301/product-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.