Braintrust Experiments API
The Experiments API from Braintrust — 6 operation(s) for experiments.
The Experiments API from Braintrust — 6 operation(s) for experiments.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/braintrust-experiments-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
version: 1.0.0
title: Braintrust Acls Experiments API
description: 'API specification for the backend data server. The API is hosted globally at
https://api.braintrust.dev or in your own environment.
You can access the OpenAPI spec for this API at https://github.com/braintrustdata/braintrust-openapi.'
license:
name: Apache 2.0
servers:
- url: https://api.braintrust.dev
security:
- bearerAuth: []
- {}
tags:
- name: Experiments
paths:
/v1/experiment:
post:
tags:
- Experiments
security:
- bearerAuth: []
- {}
operationId: postExperiment
description: 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
summary: Create experiment
requestBody:
description: Any desired information about the new experiment object
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/CreateExperiment'
responses:
'200':
description: Returns the new experiment object
content:
application/json:
schema:
$ref: '#/components/schemas/Experiment'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
get:
operationId: getExperiment
tags:
- Experiments
description: List out all experiments. The experiments are sorted by creation date, with the most recently-created experiments coming first
summary: List experiments
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/AppLimitWithDefaultParam'
- $ref: '#/components/parameters/StartingAfter'
- $ref: '#/components/parameters/EndingBefore'
- $ref: '#/components/parameters/Ids'
- $ref: '#/components/parameters/ExperimentName'
- $ref: '#/components/parameters/ProjectName'
- $ref: '#/components/parameters/ProjectIdQuery'
- $ref: '#/components/parameters/OrgName'
responses:
'200':
description: Returns a list of experiment objects
content:
application/json:
schema:
type: object
properties:
objects:
type: array
items:
$ref: '#/components/schemas/Experiment'
description: A list of experiment objects
required:
- objects
additionalProperties: false
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
/v1/experiment/{experiment_id}:
get:
operationId: getExperimentId
tags:
- Experiments
description: Get an experiment object by its id
summary: Get experiment
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
responses:
'200':
description: Returns the experiment object
content:
application/json:
schema:
$ref: '#/components/schemas/Experiment'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
patch:
operationId: patchExperimentId
tags:
- Experiments
description: 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.
summary: Partially update experiment
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
requestBody:
description: Fields to update
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/PatchExperiment'
responses:
'200':
description: Returns the experiment object
content:
application/json:
schema:
$ref: '#/components/schemas/Experiment'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
delete:
operationId: deleteExperimentId
tags:
- Experiments
description: Delete an experiment object by its id
summary: Delete experiment
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
responses:
'200':
description: Returns the deleted experiment object
content:
application/json:
schema:
$ref: '#/components/schemas/Experiment'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
/v1/experiment/{experiment_id}/insert:
post:
operationId: postExperimentIdInsert
tags:
- Experiments
description: Insert a set of events into the experiment
summary: Insert experiment events
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
requestBody:
description: An array of experiment events to insert
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/InsertExperimentEventRequest'
responses:
'200':
description: Returns the inserted row ids
content:
application/json:
schema:
$ref: '#/components/schemas/InsertEventsResponse'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
/v1/experiment/{experiment_id}/fetch:
post:
operationId: postExperimentIdFetch
tags:
- Experiments
description: 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.
summary: Fetch experiment (POST form)
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
requestBody:
description: Filters for the fetch query
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/FetchEventsRequest'
responses:
'200':
description: Returns the fetched rows
content:
application/json:
schema:
$ref: '#/components/schemas/FetchExperimentEventsResponse'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
get:
operationId: getExperimentIdFetch
tags:
- Experiments
description: 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.
summary: Fetch experiment (GET form)
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
- $ref: '#/components/parameters/FetchLimitParam'
- $ref: '#/components/parameters/MaxXactId'
- $ref: '#/components/parameters/MaxRootSpanId'
- $ref: '#/components/parameters/Version'
responses:
'200':
description: Returns the fetched rows
content:
application/json:
schema:
$ref: '#/components/schemas/FetchExperimentEventsResponse'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
/v1/experiment/{experiment_id}/feedback:
post:
operationId: postExperimentIdFeedback
tags:
- Experiments
description: Log feedback for a set of experiment events
summary: Feedback for experiment events
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
requestBody:
description: An array of feedback objects
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackExperimentEventRequest'
responses:
'200':
description: Returns a success status
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackResponseSchema'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
/v1/experiment/{experiment_id}/summarize:
get:
operationId: getExperimentIdSummarize
tags:
- Experiments
description: Summarize experiment
summary: Summarize experiment
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/ExperimentIdParam'
- $ref: '#/components/parameters/SummarizeScores'
- $ref: '#/components/parameters/ComparisonExperimentId'
responses:
'200':
description: Experiment summary
content:
application/json:
schema:
$ref: '#/components/schemas/SummarizeExperimentResponse'
'400':
description: The request was unacceptable, often due to missing a required parameter
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'401':
description: No valid API key provided
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'403':
description: The API key doesn’t have permissions to perform the request
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'429':
description: Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
headers:
Retry-After:
schema:
type: string
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
'500':
description: Something went wrong on Braintrust's end. (These are rare.)
content:
text/plain:
schema:
type: string
application/json:
schema:
nullable: true
components:
schemas:
OrgName:
type: string
description: Filter search results to within a particular organization
StartingAfter:
type: string
format: uuid
description: 'Pagination 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`'
Experiment:
type: object
properties:
id:
type: string
format: uuid
description: Unique identifier for the experiment
project_id:
type: string
format: uuid
description: Unique identifier for the project that the experiment belongs under
name:
type: string
description: Name of the experiment. Within a project, experiment names are unique
description:
type: string
nullable: true
description: Textual description of the experiment
created:
type: string
nullable: true
format: date-time
description: Date of experiment creation
repo_info:
$ref: '#/components/schemas/RepoInfo'
commit:
type: string
nullable: true
description: Commit, taken directly from `repo_info.commit`
base_exp_id:
type: string
nullable: true
format: uuid
description: Id of default base experiment to compare against when viewing this experiment
deleted_at:
type: string
nullable: true
format: date-time
description: Date of experiment deletion, or null if the experiment is still active
dataset_id:
type: string
nullable: true
format: uuid
description: Identifier of the linked dataset, or null if the experiment is not linked to a dataset
dataset_version:
type: string
nullable: true
description: Version number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
internal_metadata:
type: object
nullable: true
properties:
dataset_filter:
type: object
nullable: true
additionalProperties:
nullable: true
description: BTQL filter payload used to evaluate a subset of a linked dataset.
additionalProperties:
nullable: true
description: Braintrust-controlled metadata about the experiment.
parameters_id:
type: string
nullable: true
format: uuid
description: Identifier of the linked saved parameters object, or null if the experiment is not linked to saved parameters
parameters_version:
type: string
nullable: true
description: Version number of the linked saved parameters object the experiment was run against.
public:
type: boolean
description: Whether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
user_id:
type: string
nullable: true
format: uuid
description: Identifies the user who created the experiment
metadata:
type: object
nullable: true
additionalProperties:
nullable: true
description: User-controlled metadata about the experiment
tags:
type: array
nullable: true
items:
type: string
description: A list of tags for the experiment
required:
- id
- project_id
- name
- public
MaxXactId:
type: string
description: '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.'
FetchPaginationCursor:
type: string
nullable: true
description: 'An 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'
FetchEventsRequest:
type: object
properties:
limit:
$ref: '#/components/schemas/FetchLimit'
cursor:
$ref: '#/components/schemas/FetchPaginationCursor'
max_xact_id:
$ref: '#/components/schemas/MaxXactId'
nullable: true
max_root_span_id:
$ref: '#/components/schemas/MaxRootSpanId'
nullable: true
version:
$ref: '#/components/schemas/Version'
nullable: true
ExperimentName:
type: string
description: Name of the experiment to search for
FetchLimit:
type: integer
nullable: true
minimum: 0
description: '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.'
FeedbackExperimentEventRequest:
type: object
properties:
feedback:
type: array
items:
$ref: '#/components/schemas/FeedbackExperimentItem'
description: A list of experiment feedback items
required:
- feedback
EndingBefore:
type: string
format: uuid
description: 'Pagination 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`'
InsertEventsResponse:
type: object
properties:
row_ids:
type: array
items:
type: string
description: The ids of all rows that were inserted, aligning one-to-one with the rows provided as input
required:
- row_ids
SummarizeExperimentResponse:
type: object
properties:
project_name:
type: string
description: Name of the project that the experiment belongs to
experiment_name:
type: string
description: Name of the experiment
project_url:
type: string
format: uri
description: URL to the project's page in the Braintrust app
experiment_url:
type: string
format: uri
description: URL to the experiment's page in the Braintrust app
comparison_experiment_name:
type: string
nullable: true
description: The experiment which scores are baselined against
scores:
type: object
nullable: true
additionalProperties:
$ref: '#/components/schemas/ScoreSummary'
description: Summary of the experiment's scores
metrics:
type: object
nullable: true
additionalProperties:
$ref: '#/components/schemas/MetricSummary'
description: Summary of the experiment's metrics
required:
- project_name
- experiment_name
- project_url
- experiment_url
description: Summary of an experiment
ObjectReferenceNullish:
type: object
nullable: true
properties:
object_type:
type: string
enum:
- project_logs
- experiment
- dataset
- prompt
- function
- prompt_session
description: Type of the object the event is originating from.
object_id:
type: string
format: uuid
description: ID of the object the event is originating from.
id:
type: string
description: ID of the original event.
_xact_id:
type: string
nullable: true
description: Transaction ID of the original event.
created:
type: string
nullab
# --- truncated at 32 KB (78 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/braintrust/refs/heads/main/openapi/braintrust-experiments-api-openapi.yml