List experiments
List out all experiments. The experiments are sorted by creation date, with the most recently-created experiments coming first
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Query Parameters
limitintegerLimit the number of objects to return
0starting_afterstringPagination cursor id.
For example, if the final item in the last page you fetched had an id of foo, pass starting_after=foo to fetch the next page. Note: you may only pass one of starting_after and ending_before
"uuid"ending_beforestringPagination cursor id.
For example, if the initial item in the last page you fetched had an id of foo, pass ending_before=foo to fetch the previous page. Note: you may only pass one of starting_after and ending_before
"uuid"idsAny properties in string, array<string>Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
experiment_namestringName of the experiment to search for
project_namestringName of the project to search for
project_idstringProject id
"uuid"org_namestringFilter search results to within a particular organization
Returns a list of experiment objects
Create experiment
Create a new experiment. If there is an existing experiment in the project with the same name as the one specified in the request, will return the existing experiment unmodified
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Request Body
application/jsonOptionalAny desired information about the new experiment object
project_idUnique identifier for the project that the experiment belongs under
"uuid"namestringName of the experiment. Within a project, experiment names are unique
1descriptionstringTextual description of the experiment
repo_infoobjectMetadata about the state of the repo when the experiment was created
base_exp_idstringId of default base experiment to compare against when viewing this experiment
"uuid"dataset_idstringIdentifier of the linked dataset, or null if the experiment is not linked to a dataset
"uuid"dataset_versionstringVersion number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
publicbooleanWhether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
metadataobjectUser-controlled metadata about the experiment
ensure_newbooleanNormally, creating an experiment with the same name as an existing experiment will return the existing one un-modified. But if ensure_new is true, registration will generate a new experiment with a unique name in case of a conflict.
Returns the new experiment object
Get experiment
Get an experiment object by its id
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Path Parameters
experiment_idExperiment id
"uuid"Returns the experiment object
Partially update experiment
Partially update an experiment object. Specify the fields to update in the payload. Any object-type fields will be deep-merged with existing content. Currently we do not support removing fields or setting them to null.
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Request Body
application/jsonOptionalFields to update
namestringName of the experiment. Within a project, experiment names are unique
descriptionstringTextual description of the experiment
repo_infoobjectMetadata about the state of the repo when the experiment was created
base_exp_idstringId of default base experiment to compare against when viewing this experiment
"uuid"dataset_idstringIdentifier of the linked dataset, or null if the experiment is not linked to a dataset
"uuid"dataset_versionstringVersion number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
publicbooleanWhether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
metadataobjectUser-controlled metadata about the experiment
Path Parameters
experiment_idExperiment id
"uuid"Returns the experiment object
Delete experiment
Delete an experiment object by its id
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Path Parameters
experiment_idExperiment id
"uuid"Returns the deleted experiment object
Insert experiment events
Insert a set of events into the experiment
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Request Body
application/jsonOptionalAn array of experiment events to insert
eventsA list of experiment events to insert
Path Parameters
experiment_idExperiment id
"uuid"Returns the inserted row ids
Fetch experiment (GET form)
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. For more complex queries, use the POST /btql endpoint.
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Path Parameters
experiment_idExperiment id
"uuid"Query Parameters
limitintegerlimit 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.
0max_xact_idstringDEPRECATION 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_idstringDEPRECATION 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.
versionstringRetrieve 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.
Returns the fetched rows
Fetch experiment (POST form)
Fetch the events in an experiment. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query. For more complex queries, use the POST /btql endpoint.
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Request Body
application/jsonOptionalFilters for the fetch query
limitintegerlimit 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.
0cursorstringAn opaque string to be used as a cursor for the next page of results, in order from latest to earliest.
The string can be obtained directly from the cursor property of the previous fetch query
max_xact_idstringDEPRECATION 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_idstringDEPRECATION 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.
versionstringRetrieve 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.
Path Parameters
experiment_idExperiment id
"uuid"Returns the fetched rows
Feedback for experiment events
Log feedback for a set of experiment events
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Request Body
application/jsonOptionalAn array of feedback objects
feedbackA list of experiment feedback items
Path Parameters
experiment_idExperiment id
"uuid"Returns a success status
Summarize experiment
Summarize experiment
Authorization
AuthorizationMost Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
In: header
Path Parameters
experiment_idExperiment id
"uuid"Query Parameters
summarize_scoresbooleanWhether to summarize the scores and metrics. If false (or omitted), only the metadata will be returned.
comparison_experiment_idstringThe experiment to compare against, if summarizing scores and metrics. If omitted, will fall back to the base_exp_id stored in the experiment metadata, and then to the most recent experiment run in the same project. Must pass summarize_scores=true for this id to be used
"uuid"Experiment summary