Braintrust Datasets API
The Datasets API from Braintrust — 6 operation(s) for datasets.
The Datasets API from Braintrust — 6 operation(s) for datasets.
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-datasets-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 Datasets 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: Datasets
paths:
/v1/dataset:
post:
tags:
- Datasets
security:
- bearerAuth: []
- {}
operationId: postDataset
description: Create a new dataset. If there is an existing dataset in the project with the same name as the one specified in the request, will return the existing dataset unmodified
summary: Create dataset
requestBody:
description: Any desired information about the new dataset object
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/CreateDataset'
responses:
'200':
description: Returns the new dataset object
content:
application/json:
schema:
$ref: '#/components/schemas/Dataset'
'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: getDataset
tags:
- Datasets
description: List out all datasets. The datasets are sorted by creation date, with the most recently-created datasets coming first
summary: List datasets
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/AppLimitParam'
- $ref: '#/components/parameters/StartingAfter'
- $ref: '#/components/parameters/EndingBefore'
- $ref: '#/components/parameters/Ids'
- $ref: '#/components/parameters/DatasetName'
- $ref: '#/components/parameters/ProjectName'
- $ref: '#/components/parameters/ProjectIdQuery'
- $ref: '#/components/parameters/OrgName'
responses:
'200':
description: Returns a list of dataset objects
content:
application/json:
schema:
type: object
properties:
objects:
type: array
items:
$ref: '#/components/schemas/Dataset'
description: A list of dataset 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/dataset/{dataset_id}:
get:
operationId: getDatasetId
tags:
- Datasets
description: Get a dataset object by its id
summary: Get dataset
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
responses:
'200':
description: Returns the dataset object
content:
application/json:
schema:
$ref: '#/components/schemas/Dataset'
'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: patchDatasetId
tags:
- Datasets
description: Partially update a dataset 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 dataset
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
requestBody:
description: Fields to update
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/PatchDataset'
responses:
'200':
description: Returns the dataset object
content:
application/json:
schema:
$ref: '#/components/schemas/Dataset'
'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: deleteDatasetId
tags:
- Datasets
description: Delete a dataset object by its id
summary: Delete dataset
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
responses:
'200':
description: Returns the deleted dataset object
content:
application/json:
schema:
$ref: '#/components/schemas/Dataset'
'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/dataset/{dataset_id}/insert:
post:
operationId: postDatasetIdInsert
tags:
- Datasets
description: Insert a set of events into the dataset
summary: Insert dataset events
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
requestBody:
description: An array of dataset events to insert
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/InsertDatasetEventRequest'
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/dataset/{dataset_id}/fetch:
post:
operationId: postDatasetIdFetch
tags:
- Datasets
description: Fetch the events in a dataset. 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 dataset (POST form)
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
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/FetchDatasetEventsResponse'
'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: getDatasetIdFetch
tags:
- Datasets
description: Fetch the events in a dataset. 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 dataset (GET form)
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
- $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/FetchDatasetEventsResponse'
'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/dataset/{dataset_id}/feedback:
post:
operationId: postDatasetIdFeedback
tags:
- Datasets
description: Log feedback for a set of dataset events
summary: Feedback for dataset events
security:
- bearerAuth: []
- {}
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
requestBody:
description: An array of feedback objects
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackDatasetEventRequest'
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/dataset/{dataset_id}/summarize:
get:
operationId: getDatasetIdSummarize
tags:
- Datasets
description: Summarize dataset
summary: Summarize dataset
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/DatasetIdParam'
- $ref: '#/components/parameters/SummarizeData'
responses:
'200':
description: Dataset summary
content:
application/json:
schema:
$ref: '#/components/schemas/SummarizeDatasetResponse'
'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`'
FeedbackDatasetItem:
type: object
properties:
id:
type: string
description: The id of the dataset event to log feedback for. This is the row `id` returned by `POST /v1/dataset/{dataset_id}/insert`
comment:
type: string
nullable: true
description: An optional comment string to log about the dataset event
metadata:
type: object
nullable: true
additionalProperties:
nullable: true
description: A dictionary with additional data about the feedback. If you have a `user_id`, you can log it here and access it in the Braintrust UI. Note, this metadata does not correspond to the main event itself, but rather the audit log attached to the event.
source:
type: string
nullable: true
enum:
- app
- api
- external
- null
description: The source of the feedback. Must be one of "external" (default), "app", or "api"
tags:
type: array
nullable: true
items:
type: string
description: A list of tags to log
required:
- id
DatasetIdParam:
type: string
format: uuid
description: Dataset id
SummarizeDatasetResponse:
type: object
properties:
project_name:
type: string
description: Name of the project that the dataset belongs to
dataset_name:
type: string
description: Name of the dataset
project_url:
type: string
format: uri
description: URL to the project's page in the Braintrust app
dataset_url:
type: string
format: uri
description: URL to the dataset's page in the Braintrust app
data_summary:
$ref: '#/components/schemas/DataSummary'
required:
- project_name
- dataset_name
- project_url
- dataset_url
description: Summary of a dataset
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
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.'
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
DataSummary:
type: object
nullable: true
properties:
total_records:
type: integer
minimum: 0
description: Total number of records in the dataset
required:
- total_records
description: Summary of a dataset's data
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
nullable: true
description: Created timestamp of the original event. Used to help sort in the UI
required:
- object_type
- object_id
- id
description: Indicates the event was copied from another object.
Ids:
anyOf:
- type: string
format: uuid
- type: array
items:
type: string
format: uuid
description: Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Dataset:
type: object
properties:
id:
type: string
format: uuid
description: Unique identifier for the dataset
project_id:
type: string
format: uuid
description: Unique identifier for the project that the dataset belongs under
name:
type: string
description: Name of the dataset. Within a project, dataset names are unique
description:
type: string
nullable: true
description: Textual description of the dataset
created:
type: string
nullable: true
format: date-time
description: Date of dataset creation
deleted_at:
type: string
nullable: true
format: date-time
description: Date of dataset deletion, or null if the dataset is still active
user_id:
type: string
nullable: true
format: uuid
description: Identifies the user who created the dataset
tags:
type: array
nullable: true
items:
type: string
description: A list of tags for the dataset
metadata:
type: object
nullable: true
additionalProperties:
nullable: true
description: User-controlled metadata about the dataset
url_slug:
type: string
description: URL slug for the dataset. used to construct dataset URLs
required:
- id
- project_id
- name
- url_slug
InsertDatasetEventRequest:
type: object
properties:
events:
type: array
items:
$ref: '#/components/schemas/InsertDatasetEvent'
description: A list of dataset events to insert
required:
- events
FetchLimitParam:
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
# --- truncated at 32 KB (56 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/braintrust/refs/heads/main/openapi/braintrust-datasets-api-openapi.yml