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

# kosli list trail-events

> List the events of a trail.

## Synopsis

```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
kosli list trail-events TRAIL-NAME [flags]
```

List the events of a trail.
Each event has a `type`, a `timestamp` and, when it was reported for a commit, its `git_commit_info`.

The events are paged by cursor. A page that has a next page ends with the `--after` value that fetches it,
and a page that has a previous page with the `--before` value that fetches it.
A cursor holds only a position, so repeat the `--sort` and `--page-limit` of the command that printed it.
In JSON output the same cursors are the `after` and `before` query parameters of `_links.next.href` and `_links.prev.href`.

## Flags

| Flag | Type | Description |
| :- | :- | :- |
| `--after` | string | \[optional] The cursor of the next page, as printed after the previous page of events. Repeat the `--sort` and `--page-limit` that page was listed with. Cannot be combined with `--before`. |
| `--before` | string | \[optional] The cursor of the previous page, as printed after the following page of events. Repeat the `--sort` and `--page-limit` that page was listed with. Cannot be combined with `--after`. |
| `-f`, `--flow` | string | The Kosli flow name. |
| `-h`, `--help` | bool | help for trail-events |
| `-o`, `--output` | string | \[defaulted] The format of the output. Valid formats are: \[table, json]. (default "table") |
| `-n`, `--page-limit` | int | \[defaulted] The number of events per page, from 1 to 100. (default 50) |
| `--sort` | string | \[defaulted] The order of the events: newest or oldest first. Valid values are: \[newest, oldest]. (default "newest") |

## Flags inherited from parent commands

| Flag | Type | Description |
| :- | :- | :- |
| `-a`, `--api-token` | string | The Kosli API token. |
| `-c`, `--config-file` | string | \[optional] The Kosli config file path. Config is read from this path or the default only, never implicitly from the current directory. (default "\$HOME/.kosli.yml") |
| `--debug` | bool | \[optional] Print debug logs to stdout. |
| `-H`, `--host` | string | \[defaulted] The Kosli endpoint. Must start with https\://, unless it is localhost or a loopback address such as 127.0.0.1. (default "[https://app.kosli.com](https://app.kosli.com)") |
| `--http-proxy` | string | \[optional] The HTTP proxy URL including protocol and port number. e.g. `http://proxy-server-ip:proxy-port` |
| `-r`, `--max-api-retries` | int | \[defaulted] How many times should API calls be retried when the API host is not reachable. (default 3) |
| `--org` | string | The Kosli organization. |
| `-q`, `--quiet` | bool | \[optional] Suppress non-critical warning messages. Errors and normal output are not affected. If both `--quiet` and `--debug` are set, `--debug` wins. |

## JSON output

With `--output json`, this command prints the response of the [List trail events](https://docs.kosli.com/api-reference/trails/list-trail-events.md) API operation as the server returned it. The shape follows the server's published API spec, not the CLI version.

## Examples Use Cases

These examples all assume that the flags  `--api-token`, `--org`, `--host`, (and `--flow`, `--trail` when required), are [set/provided](https://docs.kosli.com/getting_started/install.md#assigning-flags-via-environment-variables).

> [accordion] list the events of a trail
>
> ```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
> kosli list trail-events yourTrailName 
>
> ```

> [accordion] list the events of a trail, oldest first
>
> ```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
> kosli list trail-events yourTrailName 
> 	--sort oldest 
>
> ```

> [accordion] list the 10 newest events of a trail
>
> ```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
> kosli list trail-events yourTrailName 
> 	--page-limit 10 
>
> ```

> [accordion] list the next page of events, with the cursor the previous command printed
>
> ```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
> ```

> [accordion] and the same --sort and --page-limit
>
> ```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
> kosli list trail-events yourTrailName 
> 	--page-limit 10 
> 	--after yourCursor 
>
> ```

> [accordion] list the events of a trail (in JSON)
>
> ```shell theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
> kosli list trail-events yourTrailName 
> 	--output json
> ```


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