API

CliEvent

Operations

Every route this entity exposes. Each route links to its own reference on this page.

Method Route SDK operation Returns
POST /api/v1/cli_events create Success

Examples

One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.

Golang

Construct client as shown in the Golang setup, then call the operations:

created, err := client.CliEvent(nil).Create(map[string]any{"event": "example", "properties": map[string]any{}}, nil)
if err != nil {
    panic(err)
}
fmt.Println(created)

Lua

Construct client as shown in the Lua setup, then call the operations:

local created, err = client:CliEvent():create({ event = "example", properties = {} })

PHP

Construct client as shown in the PHP setup, then call the operations:

$created = $client->CliEvent()->create(["event" => "example", "properties" => []]);

Python

Construct client as shown in the Python setup, then call the operations:

created = client.CliEvent().create({ "event": "example", "properties": {} })

Ruby

Construct client as shown in the Ruby setup, then call the operations:

created = client.CliEvent.create({ "event" => "example", "properties" => {} })

TypeScript

Construct client as shown in the TypeScript setup, then call the operations:

const created = await client.CliEvent().create({ event: "example", properties: {} })

Fields

Field Type Required Description
event string Yes Event
properties object Yes Properties

create

POST /api/v1/cli_events

Operation ID: api_v1_cli_events.

Authentication: bearer token (bearerAuth).

Request body

application/json

Property Type Required Description
event enum: cli_command, cli_command_started, cli_command_completed Yes
properties object Yes
properties.agent_mode boolean Yes
properties.arch enum: x86_64, aarch64 Yes
properties.cli_name enum: com, vex Yes
properties.cli_version string Yes
properties.command string Yes
properties.duration_ms integer No Required for cli_command and legacy completion events
properties.invocation_id string Yes
properties.json_mode boolean Yes
properties.os enum: linux, macos, windows Yes
properties.success boolean No Required for cli_command and legacy completion events

Responses

200: Success

application/json

The response is object.

202: Accepted; command events are queued and legacy starts ignored. Does not confirm PostHog ingestion
400: Invalid CLI event
401: Bearer authentication required
403: Forbidden
404: Not found
413: Event exceeds 4 KiB
422: Unprocessable entity
429: Rate limit exceeded
502: Bad gateway