---
title: How do I export a single trace or session?
seoTitle: "Download a Trace or Session as JSON"
description: Download a single trace or session as JSON from the Langfuse UI, or fetch its observations with the Observations API v2.
tags: [observability, export-data, public-api]
---

# How do I export a single trace or session?

## In the UI

- **Trace:** open the trace and click **Download JSON** in the header. The file (`trace-<traceId>.json`) contains the trace, its observations, and its scores.
- **Session:** open the session and click the download icon (**Download session as JSON**). The file (`session-<sessionId>.json`) contains the session's traces and comments.

Very large inputs or outputs can be left out of the trace download. To export many traces or observations at once as CSV, JSON, or JSONL, use the export button on the table instead. See [Export data from the UI](/docs/api-and-data-platform/features/export-from-ui).

## Via the API

Fetch all observations of one trace or session with the [Observations API v2](/docs/api-and-data-platform/features/public-api#v2):

```bash
curl -u "$LANGFUSE_PUBLIC_KEY:$LANGFUSE_SECRET_KEY" \
  "https://cloud.langfuse.com/api/public/v2/observations?traceId=<traceId>&fields=core,basic,io,usage&limit=1000"
```

Use `sessionId=<sessionId>` instead of `traceId` for a session, and follow the `meta.cursor` value to fetch further pages. In the Python SDK: `langfuse.api.observations.get_many(trace_id="<traceId>", fields="core,basic,io,usage")`.

  `GET /api/public/traces/{traceId}` and `GET /api/public/sessions/{sessionId}` are deprecated. Use the Observations API v2 for new code. See [Migration of deprecated APIs](/faq/all/deprecated-api-migration#traces).

<!-- agent-instructions -->

---

## Agent Instructions

This page is part of the [Langfuse](https://langfuse.com) documentation, published as plain Markdown for AI agents. Every page is available as Markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` header. This page: `https://langfuse.com/faq/all/export-single-trace-or-session.md`.

### Querying these docs

If the answer is not on this page, query the documentation instead of guessing:

- **Semantic search** across all Langfuse docs, returning an answer with the relevant pages and excerpts. Ask a specific, self-contained question:

  ```bash
  curl -sG "https://langfuse.com/api/search-docs" --data-urlencode "query=How do I trace a LangGraph agent?"
  ```

- **Index of every page**: <https://langfuse.com/llms.txt>, with per-section indexes [llms-docs.txt](https://langfuse.com/llms-docs.txt), [llms-integrations.txt](https://langfuse.com/llms-integrations.txt), and [llms-self-hosting.txt](https://langfuse.com/llms-self-hosting.txt).

### Before writing Langfuse code

- **Install the [Langfuse Agent Skill](https://langfuse.com/docs/api-and-data-platform/features/agent-skill).** It encodes Langfuse's own best practices for instrumentation, prompt management, and evaluation, and materially improves results.
- **Read [What does a good trace look like?](https://langfuse.com/docs/observability/best-practices.md)** before instrumenting an application.
- **Verify endpoints, parameters, and response fields** against the [API reference](https://api.reference.langfuse.com) instead of inferring them from code examples.
- **Use the [Langfuse CLI](https://langfuse.com/docs/api-and-data-platform/features/cli)** (`npx @langfuse/cli api <resource> <action>`) to read or write traces, prompts, datasets, and scores from the terminal.

Found an error in these docs? Please open an issue at <https://github.com/langfuse/langfuse-docs/issues>.
