---
title: "Fetch experiment (GET form)"
method: GET
path: "/v1/experiment/{experiment_id}/fetch"
tags: ["Experiments"]
---

# Fetch experiment (GET form)

`GET /v1/experiment/{experiment_id}/fetch`

Fetch the events in an experiment. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body

## Path parameters

- `experiment_id` string, uuid, required — Experiment id

## Query parameters

- `limit` integer, nullable — limit the number of traces fetched Fetch queries may be paginated if the total result size is expected to be large (e.g. project_logs which accumulate over a long time). Note that fetch queries only support pagination in descending time order (from latest to earliest `_xact_id`. Furthermore, later pages may return rows which showed up in earlier pages, except with an earlier `_xact_id`. This happens because pagination occurs over the whole version history of the event log. You will most likely want to exclude any such duplicate, outdated rows (by `id`) from your combined result set. The `limit` parameter controls the number of full traces to return. So you may end up with more individual rows than the specified limit if you are fetching events containing traces.
- `max_xact_id` string — DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument going forwards. Together, `max_xact_id` and `max_root_span_id` form a pagination cursor Since a paginated fetch query returns results in order from latest to earliest, the cursor for the next page can be found as the row with the minimum (earliest) value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating fetch queries.
- `max_root_span_id` string — DEPRECATION NOTICE: The manually-constructed pagination cursor is deprecated in favor of the explicit 'cursor' returned by object fetch requests. Please prefer the 'cursor' argument going forwards. Together, `max_xact_id` and `max_root_span_id` form a pagination cursor Since a paginated fetch query returns results in order from latest to earliest, the cursor for the next page can be found as the row with the minimum (earliest) value of the tuple `(_xact_id, root_span_id)`. See the documentation of `limit` for an overview of paginating fetch queries.
- `version` string — Retrieve a snapshot of events from a past time The version id is essentially a filter on the latest event transaction id. You can use the `max_xact_id` returned by a past fetch as the version to reproduce that exact fetch.

## Response `200`

Returns the fetched rows

- FetchExperimentEventsResponse
  - `events` ExperimentEvent[], required — A list of fetched events
    - `id` string, required — A unique identifier for the experiment event. If you don't provide one, BrainTrust will generate one for you
    - `dataset_record_id` string, nullable — If the experiment is associated to a dataset, this is the event-level dataset id this experiment event is tied to
    - `_xact_id` string, required — The transaction id of an event is unique to the network operation that processed the event insertion. Transaction ids are monotonically increasing over time and can be used to retrieve a versioned snapshot of the experiment (see the `version` parameter)
    - `created` string, date-time, required — The timestamp the experiment event was created
    - `project_id` string, uuid, required — Unique identifier for the project that the experiment belongs under
    - `experiment_id` string, uuid, required — Unique identifier for the experiment
    - `input` unknown
    - `output` unknown
    - `expected` unknown
    - `error` unknown
    - `scores` object, nullable — A dictionary of numeric values (between 0 and 1) to log. The scores should give you a variety of signals that help you determine how accurate the outputs are compared to what you expect and diagnose failures. For example, a summarization app might have one score that tells you how accurate the summary is, and another that measures the word similarity between the generated and grouth truth summary. The word similarity score could help you determine whether the summarization was covering similar concepts or not. You can use these scores to help you sort, filter, and compare experiments
    - `metadata` object, nullable — A dictionary with additional data about the test example, model outputs, or just about anything else that's relevant, that you can use to help find and analyze examples later. For example, you could log the `prompt`, example's `id`, or anything else that would be useful to slice/dice later. The values in `metadata` can be any JSON-serializable type, but its keys must be strings
    - `tags` string[], nullable — A list of tags to log
    - `metrics` object, nullable — Metrics are numerical measurements tracking the execution of the code that produced the experiment event. Use "start" and "end" to track the time span over which the experiment event was produced
      - `start` number, nullable — A unix timestamp recording when the section of code which produced the experiment event started
      - `end` number, nullable — A unix timestamp recording when the section of code which produced the experiment event finished
      - `prompt_tokens` integer, nullable — The number of tokens in the prompt used to generate the experiment event (only set if this is an LLM span)
      - `completion_tokens` integer, nullable — The number of tokens in the completion generated by the model (only set if this is an LLM span)
      - `tokens` integer, nullable — The total number of tokens in the input and output of the experiment event.
    - `context` object, nullable — Context is additional information about the code that produced the experiment event. It is essentially the textual counterpart to `metrics`. Use the `caller_*` attributes to track the location in code which produced the experiment event
      - `caller_functionname` string, nullable — The function in code which created the experiment event
      - `caller_filename` string, nullable — Name of the file in code where the experiment event was created
      - `caller_lineno` integer, nullable — Line of code where the experiment event was created
    - `span_id` string, required — A unique identifier used to link different experiment events together as part of a full trace. See the [tracing guide](https://www.braintrust.dev/docs/guides/tracing) for full details on tracing
    - `span_parents` string[], nullable — An array of the parent `span_ids` of this experiment event. This should be empty for the root span of a trace, and should most often contain just one parent element for subspans
    - `root_span_id` string, required — The `span_id` of the root of the trace this experiment event belongs to
    - `span_attributes` object, nullable — Human-identifying attributes of the span, such as name, type, etc.
      - `name` string, nullable — Name of the span, for display purposes only
      - `type` 'llm' | 'score' | 'function' | 'eval' | 'task' | 'tool' | 'null', nullable — Type of the span, for display purposes only
  - `cursor` string, nullable — Pagination cursor Pass this string directly as the `cursor` param to your next fetch request to get the next page of results. Not provided if the returned result set is empty.

## Other responses

- `400` — The request was unacceptable, often due to missing a required parameter
- `401` — No valid API key provided
- `403` — The API key doesn’t have permissions to perform the request
- `429` — Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
- `500` — Something went wrong on Braintrust's end. (These are rare.)

---

[API](https://skmtc.net/braintrustdata/apis/braintrust-api.md) · [All operations](https://skmtc.net/braintrustdata/apis/braintrust-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/braintrustdata/braintrust-api/revisions/9d216c8243fe/schema)
