Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

pulse api sample

Audience: CLI users grabbing a quick peek at a few rows from a cohort — for debugging, sanity-checking an import, or seeding a template request.

pulse api sample returns the first N rows from a .pulse file decoded back to a map of field → value. There is no filter, no aggregation, no transformation — just a typed view of raw rows.

LLM agents using MCP: see the pulse_sample MCP tool. It returns the same shape over the MCP transport.

Synopsis

pulse api sample --input PATH [--count N] [--json]
                              [--labels FIELD=TABLE[:replace|augment]]
                              [--echo-request]
pulse api sample --request FILE|- [--count N] [--json]
                              [--labels FIELD=TABLE[:replace|augment]]
                              [--echo-request]

Name the cohort with --input, or pass a whole SampleRequest with --request — the only CLI form that samples a cohort union. Exactly one of the two is required; both, or neither, is a usage error (exit 2).

Flags

Flags are listed in the Command & flag reference. With --request (a file, or - for stdin), the file is decoded strictly — a misspelled key is PULSE_REQUEST_UNKNOWN_FIELD (exit 1); --count overrides its n (a file without n takes 10) and --labels replaces its labels. --labels needs PULSE_LABEL_TABLES_DIR or a registered label table (see Labels).

Output (text mode)

Pretty-printed JSON of the row array:

[
  {
    "order_id": 1,
    "region": "west",
    "product": "widget",
    "units": 3,
    "revenue": "29.97",
    "sold_on": "2024-01-04"
  },
  ...
]

Decimal128 values are serialised as strings to preserve precision. A date cell is its calendar day (2024-01-04) and a datetime cell RFC 3339 UTC (2024-01-04T09:30:00Z) — never the stored epoch day / second, and no zone is applied. A null cell is omitted from its row.

Output (--json)

{
  "format_version": "1.1",
  "data": [ /* row array */ ],
  "errors": [],
  "warnings": []
}

Exit codes

CodeMeaning
0Success
1Any coded error (missing or unreadable cohort, unknown request key, …) — in the envelope’s errors under --json
2Usage error (unknown flag, malformed value, neither --input nor --request, or both); no envelope

Examples

# 10 rows
pulse api sample --input sales.pulse

# 100 rows, envelope-wrapped
pulse api sample --input sales.pulse --count 100 --json

# Pipe into jq
pulse api sample --input sales.pulse --count 100 | jq '.[] | .revenue'

# A union: rows in member order (source first), each tagged in _source
cat > union.json <<'JSON'
{"union": [{"cohort": {"filename": "customers.pulse"}, "label": "real"},
           {"cohort": {"filename": "customers_twin.pulse"}, "label": "twin"}],
 "n": 20}
JSON
pulse api sample --request union.json --json

# The same request from stdin
pulse api sample --request - --json < union.json

When sample is the wrong tool

  • For filtered subsets, use pulse cohort filter to write the matching records to a new .pulse file, then sample or export that. A pulse api process request with only a FILTER_* returns no rows: process emits data only for groups, aggregations or windows.
  • For distinct values of a single field, use pulse api facet.
  • For schema-only views (types, descriptions, dictionaries), use pulse cohort inspect.