Skip to content
telemetry.dev
Esc
↑↓navigate↵open⌘Jpreview
On this page

Use the command line

Search traces, sessions, logs, and usage from a terminal, a script, or an agent's shell with the telemetry command.

The telemetry command reads the same data as the MCP server: projects, traces, sessions, logs, usage, and captured prompts and outputs. It signs in the same way and has the same read-only access to one workspace.

Connect an MCP client when you want to ask questions in Claude, ChatGPT, Cursor, or VS Code. Use the command line to look something up in a terminal, to read telemetry from a script, or to give an agent access through its shell when it can’t connect an MCP client.

Install

The command line needs Node.js 20 or later. Install it with your package manager:

npm install --global @telemetry-dev/cli
pnpm add --global @telemetry-dev/cli
yarn global add @telemetry-dev/cli
bun add --global @telemetry-dev/cli

Or run it without installing:

npx @telemetry-dev/cli login
pnpm dlx @telemetry-dev/cli login
yarn dlx @telemetry-dev/cli login
bunx @telemetry-dev/cli login

yarn global add works in Yarn 1 only. With Yarn 2 or later, use yarn dlx. The examples on this page use the installed telemetry command.

Sign in

telemetry login

login opens your browser. Choose a workspace and select Allow, as when you connect an MCP client. The command waits up to 10 minutes for you to approve.

A sign-in reads one workspace. To read another workspace, run telemetry login again and choose it. telemetry status shows the account you’re signed in with, the default project, and whether you allowed captured prompts and outputs.

Sign in without a browser

Over SSH, in a container, or anywhere the command can’t open a browser, run:

telemetry login --no-browser

Open the printed link on any device and select Allow. The browser then goes to an address that starts with http://127.0.0.1 and doesn’t load. Copy the whole address and paste it into the terminal.

Sign in from an agent’s shell

In a shell with no terminal to paste into, such as an agent’s, telemetry login --no-browser prints the link and exits. Open the link and select Allow. Then finish the sign-in with the address the browser ended on:

telemetry login --finish 'http://127.0.0.1:53124/callback?code=…'

Put the address in single quotes, because it contains &.

From version 0.1.2, a script or agent can run telemetry login --json instead. It never opens a browser or waits. It prints the link to pass on to a person, then exits:

{
  "status": "pending",
  "authorization_url": "https://telemetry.dev/api/auth/oauth2/authorize?…",
  "next": "telemetry login --finish '<address>'"
}

After the person selects Allow, telemetry login --finish '<address>' --json finishes the sign-in and prints it, with the same fields as telemetry status --json and "status": "signed_in".

Choose a project

Commands that read telemetry use one project. The command picks it in this order:

  1. The --project option, with a project name or ID, such as --project support-bot.
  2. The TELEMETRY_DEV_PROJECT environment variable.
  3. The default project that you set with telemetry use.
  4. The workspace’s project, if the workspace has only one.
telemetry projects
telemetry use support-bot

Names match without regard to letter case. If two projects have the same name, use the ID from telemetry projects.

Commands

Command What it does
telemetry projects Lists the workspace’s projects.
telemetry use <name|id> Sets the default project.
telemetry traces Finds traces, newest first. Filter with --errors, --name, --env, --session, and --user, and from version 0.1.4 with --since and --until, --framework, --service, --model, --provider, and --operation, and from version 0.1.6 with --agent and --tool.
telemetry trace <trace-id> Shows a trace’s spans as a tree, with duration, tokens, error text, and the trace’s logs. From version 0.1.4 it also prints a link to the trace in the dashboard.
telemetry sessions Finds sessions by the start of their latest trace, newest first. Filter with --range (24h, 72h, 7d, or 30d; default 24h), --errors, --contains, --agent, --model, and --user, and from version 0.1.4 with --since and --until.
telemetry logs Lists the newest logs, with counts per level. Filter with --level and --range (7d, 30d, or 90d; default 7d), and from version 0.1.4 with --since and --until.
telemetry usage Summarizes requests, errors, p95 latency, tokens, cost, and active users, compared with the period before. Set the period with --range and the breakdown with --by (model, provider, user, or operation; default model).
telemetry payload <trace-id> <span-id> Prints a span’s captured input and output.
telemetry status Shows who you’re signed in as.
telemetry logout Signs out on this machine.

Run telemetry --help for the list of commands, and telemetry <command> --help for a command’s options and examples.

telemetry traces --errors --since 2h            # failed traces in the last 2 hours
telemetry traces --name checkout --env production
telemetry traces --model gpt-5 --since 2026-10-29 --until 2026-10-30
telemetry traces --tool search_docs --errors --since 1d
telemetry trace 4bf92f3577b34da6a3ce929d0e0e4736
telemetry sessions --range 7d --errors           # sessions with a failed trace
telemetry logs --level warn --since 30m
telemetry usage --range 30d --by user

traces, sessions, and logs return 20 results by default. Use --limit for 1 to 50. When there are more results, the command prints the same command with --cursor for the next page. Keep the other options as they are; only --limit can change between pages. logs pages from version 0.1.4; in earlier versions it has no next page, so raise --limit or narrow the search with --level.

telemetry trace reads up to 2,000 spans of a trace and says so when the trace has more.

Time windows

From version 0.1.4, traces, sessions, and logs take --since and --until to choose the time they search. Each takes one of these forms:

Form Example Meaning
Duration 30m, 2h, 7d That many minutes, hours, or days before now, by telemetry.dev’s clock
Date 2026-10-29 The start of that day, in your time zone
Time without a zone 2026-10-29T14:00, 2026-10-29T14:00:30 That time in your time zone
Time with a zone 2026-10-29T14:00:00Z, 2026-10-29T14:00:00-04:00 That instant, with seconds
now --until now The same as leaving out --until

The window includes --since and excludes --until. Without --since, traces searches the project’s whole retention period, sessions the last 24 hours, and logs the last 7 days. Without --until, the window ends now. A date or a time without a zone uses your time zone’s offset on that day, so a day when the clocks change still starts at the start of your local day.

telemetry.dev doesn’t search past the project’s retention period. When --since reaches further back, the window starts at the start of the retention period, and the command says so on stderr. --range on sessions and logs can’t be combined with --since or --until.

--framework and --service match the trace. --model, --provider, and --operation, and from version 0.1.6 --agent and --tool, match traces with a span that started in the window. --framework takes the name telemetry.dev records, such as vercel-ai-sdk or langchain. --agent takes the agent name your app records on its spans. --tool matches a tool call by the tool name telemetry.dev records, or by the span name when there is none.

Read prompts and outputs

telemetry payload needs the permission to read captured prompts, outputs, and tool arguments. To grant it, run telemetry login, check Also read captured prompts, outputs, and tool arguments on the approval page, and select Allow. Without it, every other command works and payload exits with code 4.

Span IDs are in the output of telemetry trace <trace-id> --json.

telemetry payload <trace-id> <span-id>
telemetry payload <trace-id> <span-id> --field output > answer.txt

Without --field, the command prints the input and the output. --field input, --field output, or --field error prints that one field as plain text, for a pipe or a file. The command reads up to 1,000,000 characters of each field.

Captured text comes from your users, models, and tools. Output for people, including --field, removes terminal escape sequences and control characters from it. Use --json when you need the exact text.

Use the command line in scripts and agents

Add --json to any command for JSON output; login and logout take it from version 0.1.2. The data goes to stdout, and messages and progress go to stderr, so telemetry traces --json > traces.json writes only data.

projects, traces, sessions, logs, and usage print the result of the matching MCP tool as it is returned, with the fields described in What an agent can read. From version 0.1.4, the results of traces, sessions, and logs include the window telemetry.dev searched, and trace includes trace.url, the trace’s page in the dashboard. trace and payload read every page of the result and print it as one object, with complete: false when they stopped at the limit.

To check whether the command is signed in, run telemetry status --json. It exits with code 4 when it isn’t.

Exit codes

Code Meaning
0 Success
1 The request failed
2 The command or its options are not valid
4 You are not signed in, the sign-in expired, or access is denied
130 Interrupted with Ctrl-C

Errors

From version 0.1.1, with --json, an error is one line of JSON on stderr and stdout stays empty:

{"error":{"code":"not_signed_in","message":"You're not signed in. Run `telemetry login` first.","hint":"telemetry login","retryable":false,"exit_code":4,"cli_version":"0.1.2"}}

Branch on code, because the wording of message can change. hint is a command to run next, when there is one. telemetry login needs a person at a browser, so an agent should run telemetry login --json and pass the link on instead. retryable is true when running the same command again may succeed. Ctrl-C exits with 130 and no JSON, and status --json reports a missing sign-in as data on stdout with exit code 4.

Code Exit Meaning
invalid_arguments 2 An option or argument is not valid, by the command’s checks or telemetry.dev’s
unknown_command 2 There is no command with that name
project_not_found 2 No project in the workspace has that name or ID
invalid_cursor 2 --cursor isn’t from an earlier page of this command with the same options
project_ambiguous 2 Several projects have that name; pass its ID
project_required 2 The workspace has several projects and none was chosen
no_projects 1 The workspace has no projects yet
not_signed_in 4 No sign-in is saved for this deployment
sign_in_expired 4 The sign-in expired or was disconnected
payloads_not_allowed 4 The sign-in doesn’t include reading captured prompts and outputs
access_denied 4 The account no longer has access to the workspace
sign_in_failed 4 The sign-in was cancelled, refused, or used an address from another sign-in
no_pending_sign_in 4 login --finish found no sign-in waiting to finish
trace_not_found 1 No trace has that ID, or it is past the project’s retention
span_not_found 1 The trace has no span with that ID, or it is past the project’s retention
unreachable 1 telemetry.dev could not be reached
timeout 1 telemetry.dev took too long to answer
server_error 1 telemetry.dev failed to complete the request; try again
tool_error 1 telemetry.dev returned another error; message says what it was
result_too_large 1 The result was too large to read; narrow it with filters or --limit
server_unsupported 1 The telemetry.dev deployment doesn’t support an option you used and would have ignored it
request_failed 1 The request failed for another reason
failed 1 The command failed for another reason
internal 1 An unexpected error, such as a configuration file the command couldn’t read or write

New codes may be added, and existing codes keep their meaning. Version 0.1.2 added invalid_cursor, access_denied, trace_not_found, span_not_found, and server_error; version 0.1.1 reports those errors as tool_error. sign_in_failed and no_pending_sign_in appear in JSON only from 0.1.2, when login takes --json. Version 0.1.4 added server_unsupported, and from that version a time window that telemetry.dev refuses, such as one that ends before the retention period, is invalid_arguments with telemetry.dev’s reason. From version 0.1.6, a deployment that refuses --agent or --tool because it doesn’t know them also gives server_unsupported.

Environment variables

Variable Default Purpose
TELEMETRY_DEV_PROJECT None The project to read when you don’t pass --project
TELEMETRY_DEV_URL https://telemetry.dev The telemetry.dev deployment to sign in to
TELEMETRY_DEV_CONFIG_DIR ~/.config/telemetry-dev Where the sign-in is saved. The default follows XDG_CONFIG_HOME when it is set.
NO_COLOR None Turns off color, like --no-color

The saved sign-in holds a token that reads your workspace, and only your user can read the file. Keep it private.

Sign out

telemetry logout

logout revokes the sign-in at telemetry.dev and removes it from this machine. If telemetry.dev doesn’t confirm the revocation, the command says so. From version 0.1.2, telemetry logout --json prints {"was_signed_in": true, "revoked": false} in that case, and revoked is null when there was no sign-in. To remove the command line’s access from your account, open your user menu, select Account, and disconnect it under Connected apps, as described in Disconnect an agent.

Last updated on October 30, 2026

Was this page helpful?