GET/v1/project
List projects
List out all projects. The projects are sorted by creation date, with the most recently-created projects coming first
Authorization
AuthorizationRequiredBearer <token>
Most 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
limitinteger
Limit the number of objects to return
Minimum:0starting_afterstring
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
"uuid"ending_beforestring
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
"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
project_namestring
Name of the project to search for
org_namestring
Filter search results to within a particular organization
| Status code | Description |
|---|---|
200 | Returns a list of project objects |
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.) |
POST/v1/project
Create project
Create a new project. If there is an existing project with the same name as the one specified in the request, will return the existing project unmodified
Authorization
AuthorizationRequiredBearer <token>
Most 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 (Optional)
Any desired information about the new project object
nameRequiredstring
Name of the project
org_namestring | null
For nearly all users, this parameter should be unnecessary. But in the rare case that your API key belongs to multiple organizations, you may specify the name of the organization the project belongs in.
| Status code | Description |
|---|---|
200 | Returns the new project object |
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.) |
GET/v1/project/{project_id}
Get project
Get a project object by its id
Authorization
AuthorizationRequiredBearer <token>
Most 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
project_idRequiredstring
Project id
Format:"uuid"| Status code | Description |
|---|---|
200 | Returns the project object |
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.) |
PATCH/v1/project/{project_id}
Partially update project
Partially update a project 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
AuthorizationRequiredBearer <token>
Most 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 (Optional)
Fields to update
namestring | null
Name of the project
settingsobject | null
Project settings. Patch operations replace all settings, so make sure you include all settings you want to keep.
Path Parameters
project_idRequiredstring
Project id
Format:"uuid"| Status code | Description |
|---|---|
200 | Returns the project object |
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.) |
DELETE/v1/project/{project_id}
Delete project
Delete a project object by its id
Authorization
AuthorizationRequiredBearer <token>
Most 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
project_idRequiredstring
Project id
Format:"uuid"| Status code | Description |
|---|---|
200 | Returns the deleted project object |
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.) |
POST/v1/project_logs/{project_id}/insert
Insert project logs events
Insert a set of events into the project logs
Authorization
AuthorizationRequiredBearer <token>
Most 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 (Optional)
An array of project logs events to insert
eventsRequiredarray<Any properties in object, object>
A list of project logs events to insert
Path Parameters
project_idRequiredstring
Project id
Format:"uuid"| Status code | Description |
|---|---|
200 | Returns the inserted row ids |
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.) |
GET/v1/project_logs/{project_id}/fetch
Fetch project logs (GET form)
Fetch the events in a project logs. Equivalent to the POST form of the same path, but with the parameters in the URL query rather than in the request body
Authorization
AuthorizationRequiredBearer <token>
Most 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
project_idRequiredstring
Project id
Format:"uuid"Query Parameters
limitinteger
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.
0max_xact_idstring
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_idstring
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.
versionstring
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.
| Status code | Description |
|---|---|
200 | Returns the fetched rows |
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.) |
POST/v1/project_logs/{project_id}/fetch
Fetch project logs (POST form)
Fetch the events in a project logs. Equivalent to the GET form of the same path, but with the parameters in the request body rather than in the URL query
Authorization
AuthorizationRequiredBearer <token>
Most 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 (Optional)
Filters for the fetch query
limitinteger | null
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.
0cursorstring | null
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
max_xact_idstring | null
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_idstring | null
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.
filtersarray<object> | null
A list of filters on the events to fetch. Currently, only path-lookup type filters are supported, but we may add more in the future
versionstring | null
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.
Path Parameters
project_idRequiredstring
Project id
Format:"uuid"| Status code | Description |
|---|---|
200 | Returns the fetched rows |
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.) |
POST/v1/project_logs/{project_id}/feedback
Feedback for project logs events
Log feedback for a set of project logs events
Authorization
AuthorizationRequiredBearer <token>
Most 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 (Optional)
An array of feedback objects
feedbackRequiredarray<object>
A list of project logs feedback items
Path Parameters
project_idRequiredstring
Project id
Format:"uuid"| Status code | Description |
|---|---|
200 | No return value |
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.) |