Docs
Reference
API

Braintrust Data API v1.0.0

API specification for the backend data server. The API is hosted globally at https://api.braintrustdata.com or in your own environment. The v1 API is currently in preview mode and unstable until June 1, 2024. We may make backwards incompatible changes before then, as we learn from our users.

You can access the OpenAPI spec for this API at https://github.com/braintrustdata/braintrust-openapi.

Base URLs:

License: Apache 2.0

Authentication

  • HTTP Authentication, scheme: bearer
    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.

Projects

Create project

Code samples
const inputBody = JSON.stringify({
  name: "string",
  org_name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/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

Body parameter
{
  "name": "string",
  "org_name": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateProjecttrueAny desired information about the new project object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new project objectProject
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

DEPRECATED. Create or replace project

Code samples
const inputBody = JSON.stringify({
  name: "string",
  org_name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project", {
  method: "PUT",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PUT /v1/project

NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace 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, will replace the existing project with the provided fields

Body parameter
{
  "name": "string",
  "org_name": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateProjecttrueAny desired information about the new project object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new project objectProject
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline

Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

List projects

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/project

List out all projects. The projects are sorted by creation date, with the most recently-created projects coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
project_namequeryProjectNamefalseName of the project to search for
org_namequeryOrgNamefalseFilter search results to within a particular organization
idsqueryIdsfalseFilter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Detailed descriptions

starting_after: 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

ending_before: 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

Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "name": "string",
      "created": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z",
      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of project objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[Project]truenoneA list of project objects
»» idstring(uuid)truenoneUnique identifier for the project
»» org_idstring(uuid)truenoneUnique id for the organization that the project belongs under
»» namestringtruenoneName of the project
»» createdstring(date-time)¦nullfalsenoneDate of project creation
»» deleted_atstring(date-time)¦nullfalsenoneDate of project deletion, or null if the project is still active
»» user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the project

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get project

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project/{project_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/project/{project_id}

Get a project object by its id

Parameters
NameInTypeRequiredDescription
project_idpathProjectIdtrueProject id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the project objectProject
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Partially update project

Code samples
const inputBody = JSON.stringify({
  name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project/{project_id}", {
  method: "PATCH",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PATCH /v1/project/{project_id}

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.

Body parameter
{
  "name": "string"
}
Parameters
NameInTypeRequiredDescription
project_idpathProjectIdtrueProject id
bodybodyPatchProjectfalseFields to update
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the project objectProject
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Delete project

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project/{project_id}", {
  method: "DELETE",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

DELETE /v1/project/{project_id}

Delete a project object by its id

Parameters
NameInTypeRequiredDescription
project_idpathProjectIdtrueProject id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the deleted project objectProject
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Insert project logs events

Code samples
const inputBody = JSON.stringify({
  events: [
    {
      input: null,
      output: null,
      expected: null,
      scores: {
        property1: 1,
        property2: 1,
      },
      metadata: {
        property1: null,
        property2: null,
      },
      tags: ["string"],
      metrics: {
        start: 0,
        end: 0,
        prompt_tokens: 0,
        completion_tokens: 0,
        tokens: 0,
        property1: null,
        property2: null,
      },
      context: {
        caller_functionname: "string",
        caller_filename: "string",
        caller_lineno: 0,
        property1: null,
        property2: null,
      },
      span_attributes: {
        name: "string",
        type: "llm",
        property1: null,
        property2: null,
      },
      id: "string",
      _object_delete: true,
      _is_merge: false,
      _parent_id: "string",
    },
  ],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project_logs/{project_id}/insert", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/project_logs/{project_id}/insert

Insert a set of events into the project logs

Body parameter
{
  "events": [
    {
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      },
      "id": "string",
      "_object_delete": true,
      "_is_merge": false,
      "_parent_id": "string"
    }
  ]
}
Parameters
NameInTypeRequiredDescription
project_idpathProjectIdtrueProject id
bodybodyInsertProjectLogsEventRequesttrueAn array of project logs events to insert
Example responses

200 Response

{
  "row_ids": ["string"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the inserted row idsInsertEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Fetch project logs (POST form)

Code samples
const inputBody = JSON.stringify({
  limit: 0,
  cursor: "string",
  max_xact_id: "string",
  max_root_span_id: "string",
  filters: [
    {
      type: "path_lookup",
      path: ["string"],
      value: null,
    },
  ],
  version: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project_logs/{project_id}/fetch", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/project_logs/{project_id}/fetch

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

Body parameter
{
  "limit": 0,
  "cursor": "string",
  "max_xact_id": "string",
  "max_root_span_id": "string",
  "filters": [
    {
      "type": "path_lookup",
      "path": ["string"],
      "value": null
    }
  ],
  "version": "string"
}
Parameters
NameInTypeRequiredDescription
project_idpathProjectIdtrueProject id
bodybodyFetchEventsRequestfalseFilters for the fetch query
Example responses

200 Response

{
  "events": [
    {
      "id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "log_id": "g",
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_id": "string",
      "span_parents": ["string"],
      "root_span_id": "string",
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      }
    }
  ],
  "cursor": "string"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the fetched rowsFetchProjectLogsEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Fetch project logs (GET form)

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project_logs/{project_id}/fetch", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/project_logs/{project_id}/fetch

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

Parameters
NameInTypeRequiredDescription
project_idpathProjectIdtrueProject id
limitqueryFetchLimitParamfalselimit the number of traces fetched
max_xact_idqueryMaxXactIdfalseDEPRECATION 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.
max_root_span_idqueryMaxRootSpanIdfalseDEPRECATION 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.
versionqueryanyfalseRetrieve prompt at a specific version.
Detailed descriptions

limit: 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: 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: 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: Retrieve prompt at a specific version.

The version id can either be a transaction id (e.g. '1000192656880881099') or a version identifier (e.g. '81cd05ee665fdfb3').

Example responses

200 Response

{
  "events": [
    {
      "id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "log_id": "g",
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_id": "string",
      "span_parents": ["string"],
      "root_span_id": "string",
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      }
    }
  ],
  "cursor": "string"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the fetched rowsFetchProjectLogsEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Feedback for project logs events

Code samples
const inputBody = JSON.stringify({
  feedback: [
    {
      id: "string",
      scores: {
        property1: 1,
        property2: 1,
      },
      expected: null,
      comment: "string",
      metadata: {
        property1: null,
        property2: null,
      },
      source: "app",
    },
  ],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "text/plain",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/project_logs/{project_id}/feedback", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/project_logs/{project_id}/feedback

Log feedback for a set of project logs events

Body parameter
{
  "feedback": [
    {
      "id": "string",
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "expected": null,
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Parameters
NameInTypeRequiredDescription
project_idpathProjectIdtrueProject id
bodybodyFeedbackProjectLogsEventRequesttrueAn array of feedback objects
Example responses

400 Response

"string"
null
Responses
StatusMeaningDescriptionSchema
200OKNo return valueNone
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Experiments

Create experiment

Code samples
const inputBody = JSON.stringify({
  project_id: "405d8375-3514-403b-8c43-83ae74cfe0e9",
  name: "string",
  description: "string",
  repo_info: {
    commit: "string",
    branch: "string",
    tag: "string",
    dirty: true,
    author_name: "string",
    author_email: "string",
    commit_message: "string",
    commit_time: "string",
    git_diff: "string",
  },
  base_exp_id: "4838cee2-a665-4545-aa9f-483678c01a6b",
  dataset_id: "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  dataset_version: "string",
  public: true,
  metadata: {
    property1: null,
    property2: null,
  },
  ensure_new: true,
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/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

Body parameter
{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "ensure_new": true
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateExperimenttrueAny desired information about the new experiment object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "commit": "string",
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "deleted_at": "2019-08-24T14:15:22Z",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new experiment objectExperiment
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

DEPRECATED. Create or replace experiment

Code samples
const inputBody = JSON.stringify({
  project_id: "405d8375-3514-403b-8c43-83ae74cfe0e9",
  name: "string",
  description: "string",
  repo_info: {
    commit: "string",
    branch: "string",
    tag: "string",
    dirty: true,
    author_name: "string",
    author_email: "string",
    commit_message: "string",
    commit_time: "string",
    git_diff: "string",
  },
  base_exp_id: "4838cee2-a665-4545-aa9f-483678c01a6b",
  dataset_id: "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  dataset_version: "string",
  public: true,
  metadata: {
    property1: null,
    property2: null,
  },
  ensure_new: true,
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment", {
  method: "PUT",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PUT /v1/experiment

NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace 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, will replace the existing experiment with the provided fields

Body parameter
{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "ensure_new": true
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateExperimenttrueAny desired information about the new experiment object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "commit": "string",
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "deleted_at": "2019-08-24T14:15:22Z",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new experiment objectExperiment
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline

Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

List experiments

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/experiment

List out all experiments. The experiments are sorted by creation date, with the most recently-created experiments coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
experiment_namequeryExperimentNamefalseName of the experiment to search for
project_namequeryProjectNamefalseName of the project to search for
org_namequeryOrgNamefalseFilter search results to within a particular organization
idsqueryIdsfalseFilter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Detailed descriptions

starting_after: 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

ending_before: 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

Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "name": "string",
      "description": "string",
      "created": "2019-08-24T14:15:22Z",
      "repo_info": {
        "commit": "string",
        "branch": "string",
        "tag": "string",
        "dirty": true,
        "author_name": "string",
        "author_email": "string",
        "commit_message": "string",
        "commit_time": "string",
        "git_diff": "string"
      },
      "commit": "string",
      "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
      "deleted_at": "2019-08-24T14:15:22Z",
      "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
      "dataset_version": "string",
      "public": true,
      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
      "metadata": {
        "property1": null,
        "property2": null
      }
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of experiment objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[Experiment]truenoneA list of experiment objects
»» idstring(uuid)truenoneUnique identifier for the experiment
»» project_idstring(uuid)truenoneUnique identifier for the project that the experiment belongs under
»» namestringtruenoneName of the experiment. Within a project, experiment names are unique
»» descriptionstring¦nullfalsenoneTextual description of the experiment
»» createdstring(date-time)¦nullfalsenoneDate of experiment creation
»» repo_infoRepoInfo¦nullfalsenoneMetadata about the state of the repo when the experiment was created
»»» commitstring¦nullfalsenoneSHA of most recent commit
»»» branchstring¦nullfalsenoneName of the branch the most recent commit belongs to
»»» tagstring¦nullfalsenoneName of the tag on the most recent commit
»»» dirtyboolean¦nullfalsenoneWhether or not the repo had uncommitted changes when snapshotted
»»» author_namestring¦nullfalsenoneName of the author of the most recent commit
»»» author_emailstring¦nullfalsenoneEmail of the author of the most recent commit
»»» commit_messagestring¦nullfalsenoneMost recent commit message
»»» commit_timestring¦nullfalsenoneTime of the most recent commit
»»» git_diffstring¦nullfalsenoneIf the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit.
»» commitstring¦nullfalsenoneCommit, taken directly from repo_info.commit
»» base_exp_idstring(uuid)¦nullfalsenoneId of default base experiment to compare against when viewing this experiment
»» deleted_atstring(date-time)¦nullfalsenoneDate of experiment deletion, or null if the experiment is still active
»» dataset_idstring(uuid)¦nullfalsenoneIdentifier of the linked dataset, or null if the experiment is not linked to a dataset
»» dataset_versionstring¦nullfalsenoneVersion number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
»» publicbooleantruenoneWhether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
»» user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the experiment
»» metadataobject¦nullfalsenoneUser-controlled metadata about the experiment
»»» additionalPropertiesanyfalsenonenone

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get experiment

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment/{experiment_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/experiment/{experiment_id}

Get an experiment object by its id

Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "commit": "string",
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "deleted_at": "2019-08-24T14:15:22Z",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the experiment objectExperiment
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Partially update experiment

Code samples
const inputBody = JSON.stringify({
  name: "string",
  description: "string",
  repo_info: {
    commit: "string",
    branch: "string",
    tag: "string",
    dirty: true,
    author_name: "string",
    author_email: "string",
    commit_message: "string",
    commit_time: "string",
    git_diff: "string",
  },
  base_exp_id: "4838cee2-a665-4545-aa9f-483678c01a6b",
  dataset_id: "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  dataset_version: "string",
  public: true,
  metadata: {
    property1: null,
    property2: null,
  },
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment/{experiment_id}", {
  method: "PATCH",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PATCH /v1/experiment/{experiment_id}

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.

Body parameter
{
  "name": "string",
  "description": "string",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "metadata": {
    "property1": null,
    "property2": null
  }
}
Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
bodybodyPatchExperimentfalseFields to update
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "commit": "string",
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "deleted_at": "2019-08-24T14:15:22Z",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the experiment objectExperiment
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Delete experiment

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment/{experiment_id}", {
  method: "DELETE",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

DELETE /v1/experiment/{experiment_id}

Delete an experiment object by its id

Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "commit": "string",
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "deleted_at": "2019-08-24T14:15:22Z",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the deleted experiment objectExperiment
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Insert experiment events

Code samples
const inputBody = JSON.stringify({
  events: [
    {
      input: null,
      output: null,
      expected: null,
      scores: {
        property1: 1,
        property2: 1,
      },
      metadata: {
        property1: null,
        property2: null,
      },
      tags: ["string"],
      metrics: {
        start: 0,
        end: 0,
        prompt_tokens: 0,
        completion_tokens: 0,
        tokens: 0,
        property1: null,
        property2: null,
      },
      context: {
        caller_functionname: "string",
        caller_filename: "string",
        caller_lineno: 0,
        property1: null,
        property2: null,
      },
      span_attributes: {
        name: "string",
        type: "llm",
        property1: null,
        property2: null,
      },
      id: "string",
      dataset_record_id: "string",
      _object_delete: true,
      _is_merge: false,
      _parent_id: "string",
    },
  ],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment/{experiment_id}/insert", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/experiment/{experiment_id}/insert

Insert a set of events into the experiment

Body parameter
{
  "events": [
    {
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      },
      "id": "string",
      "dataset_record_id": "string",
      "_object_delete": true,
      "_is_merge": false,
      "_parent_id": "string"
    }
  ]
}
Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
bodybodyInsertExperimentEventRequesttrueAn array of experiment events to insert
Example responses

200 Response

{
  "row_ids": ["string"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the inserted row idsInsertEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Fetch experiment (POST form)

Code samples
const inputBody = JSON.stringify({
  limit: 0,
  cursor: "string",
  max_xact_id: "string",
  max_root_span_id: "string",
  filters: [
    {
      type: "path_lookup",
      path: ["string"],
      value: null,
    },
  ],
  version: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment/{experiment_id}/fetch", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/experiment/{experiment_id}/fetch

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

Body parameter
{
  "limit": 0,
  "cursor": "string",
  "max_xact_id": "string",
  "max_root_span_id": "string",
  "filters": [
    {
      "type": "path_lookup",
      "path": ["string"],
      "value": null
    }
  ],
  "version": "string"
}
Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
bodybodyFetchEventsRequestfalseFilters for the fetch query
Example responses

200 Response

{
  "events": [
    {
      "id": "string",
      "dataset_record_id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "experiment_id": "916afd89-cac5-4339-9c59-dd068abdfa69",
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_id": "string",
      "span_parents": ["string"],
      "root_span_id": "string",
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      }
    }
  ],
  "cursor": "string"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the fetched rowsFetchExperimentEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Fetch experiment (GET form)

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment/{experiment_id}/fetch", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

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

Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
limitqueryFetchLimitParamfalselimit the number of traces fetched
max_xact_idqueryMaxXactIdfalseDEPRECATION 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.
max_root_span_idqueryMaxRootSpanIdfalseDEPRECATION 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.
versionqueryanyfalseRetrieve prompt at a specific version.
Detailed descriptions

limit: 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: 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: 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: Retrieve prompt at a specific version.

The version id can either be a transaction id (e.g. '1000192656880881099') or a version identifier (e.g. '81cd05ee665fdfb3').

Example responses

200 Response

{
  "events": [
    {
      "id": "string",
      "dataset_record_id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "experiment_id": "916afd89-cac5-4339-9c59-dd068abdfa69",
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_id": "string",
      "span_parents": ["string"],
      "root_span_id": "string",
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      }
    }
  ],
  "cursor": "string"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the fetched rowsFetchExperimentEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Feedback for experiment events

Code samples
const inputBody = JSON.stringify({
  feedback: [
    {
      id: "string",
      scores: {
        property1: 1,
        property2: 1,
      },
      expected: null,
      comment: "string",
      metadata: {
        property1: null,
        property2: null,
      },
      source: "app",
    },
  ],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "text/plain",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/experiment/{experiment_id}/feedback", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/experiment/{experiment_id}/feedback

Log feedback for a set of experiment events

Body parameter
{
  "feedback": [
    {
      "id": "string",
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "expected": null,
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
bodybodyFeedbackExperimentEventRequesttrueAn array of feedback objects
Example responses

400 Response

"string"
null
Responses
StatusMeaningDescriptionSchema
200OKNo return valueNone
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Summarize experiment

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch(
  "https://api.braintrustdata.com/v1/experiment/{experiment_id}/summarize",
  {
    method: "GET",
 
    headers: headers,
  },
)
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/experiment/{experiment_id}/summarize

Summarize experiment

Parameters
NameInTypeRequiredDescription
experiment_idpathExperimentIdtrueExperiment id
summarize_scoresquerySummarizeScoresfalseWhether to summarize the scores and metrics. If false (or omitted), only the metadata will be returned.
comparison_experiment_idqueryComparisonExperimentIdfalseThe 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
Example responses

200 Response

{
  "project_name": "string",
  "experiment_name": "string",
  "project_url": "http://example.com",
  "experiment_url": "http://example.com",
  "comparison_experiment_name": "string",
  "scores": {
    "property1": {
      "name": "string",
      "score": 1,
      "diff": -1,
      "improvements": 0,
      "regressions": 0
    },
    "property2": {
      "name": "string",
      "score": 1,
      "diff": -1,
      "improvements": 0,
      "regressions": 0
    }
  },
  "metrics": {
    "property1": {
      "name": "string",
      "metric": 0,
      "unit": "string",
      "diff": 0,
      "improvements": 0,
      "regressions": 0
    },
    "property2": {
      "name": "string",
      "metric": 0,
      "unit": "string",
      "diff": 0,
      "improvements": 0,
      "regressions": 0
    }
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKExperiment summarySummarizeExperimentResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Datasets

Create dataset

Code samples
const inputBody = JSON.stringify({
  project_id: "405d8375-3514-403b-8c43-83ae74cfe0e9",
  name: "string",
  description: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/dataset

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

Body parameter
{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateDatasettrueAny desired information about the new dataset object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new dataset objectDataset
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

DEPRECATED. Create or replace dataset

Code samples
const inputBody = JSON.stringify({
  project_id: "405d8375-3514-403b-8c43-83ae74cfe0e9",
  name: "string",
  description: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset", {
  method: "PUT",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PUT /v1/dataset

NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace 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, will replace the existing dataset with the provided fields

Body parameter
{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateDatasettrueAny desired information about the new dataset object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new dataset objectDataset
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline

Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

List datasets

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/dataset

List out all datasets. The datasets are sorted by creation date, with the most recently-created datasets coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
dataset_namequeryDatasetNamefalseName of the dataset to search for
project_namequeryProjectNamefalseName of the project to search for
org_namequeryOrgNamefalseFilter search results to within a particular organization
idsqueryIdsfalseFilter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Detailed descriptions

starting_after: 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

ending_before: 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

Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "name": "string",
      "description": "string",
      "created": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z",
      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of dataset objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[Dataset]truenoneA list of dataset objects
»» idstring(uuid)truenoneUnique identifier for the dataset
»» project_idstring(uuid)¦nullfalsenoneUnique identifier for the project that the dataset belongs under
»» namestringtruenoneName of the dataset. Within a project, dataset names are unique
»» descriptionstring¦nullfalsenoneTextual description of the dataset
»» createdstring(date-time)¦nullfalsenoneDate of dataset creation
»» deleted_atstring(date-time)¦nullfalsenoneDate of dataset deletion, or null if the dataset is still active
»» user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the dataset

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get dataset

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/dataset/{dataset_id}

Get a dataset object by its id

Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the dataset objectDataset
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Partially update dataset

Code samples
const inputBody = JSON.stringify({
  name: "string",
  description: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}", {
  method: "PATCH",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PATCH /v1/dataset/{dataset_id}

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.

Body parameter
{
  "name": "string",
  "description": "string"
}
Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
bodybodyPatchDatasetfalseFields to update
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the dataset objectDataset
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Delete dataset

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}", {
  method: "DELETE",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

DELETE /v1/dataset/{dataset_id}

Delete a dataset object by its id

Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the deleted dataset objectDataset
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Insert dataset events

Code samples
const inputBody = JSON.stringify({
  events: [
    {
      input: null,
      expected: null,
      metadata: {
        property1: null,
        property2: null,
      },
      tags: ["string"],
      id: "string",
      _object_delete: true,
      _is_merge: false,
      _parent_id: "string",
    },
  ],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}/insert", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/dataset/{dataset_id}/insert

Insert a set of events into the dataset

Body parameter
{
  "events": [
    {
      "input": null,
      "expected": null,
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "id": "string",
      "_object_delete": true,
      "_is_merge": false,
      "_parent_id": "string"
    }
  ]
}
Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
bodybodyInsertDatasetEventRequesttrueAn array of dataset events to insert
Example responses

200 Response

{
  "row_ids": ["string"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the inserted row idsInsertEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Fetch dataset (POST form)

Code samples
const inputBody = JSON.stringify({
  limit: 0,
  cursor: "string",
  max_xact_id: "string",
  max_root_span_id: "string",
  filters: [
    {
      type: "path_lookup",
      path: ["string"],
      value: null,
    },
  ],
  version: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}/fetch", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/dataset/{dataset_id}/fetch

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

Body parameter
{
  "limit": 0,
  "cursor": "string",
  "max_xact_id": "string",
  "max_root_span_id": "string",
  "filters": [
    {
      "type": "path_lookup",
      "path": ["string"],
      "value": null
    }
  ],
  "version": "string"
}
Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
bodybodyFetchEventsRequestfalseFilters for the fetch query
Example responses

200 Response

{
  "events": [
    {
      "id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
      "input": null,
      "expected": null,
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "span_id": "string",
      "root_span_id": "string"
    }
  ],
  "cursor": "string"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the fetched rowsFetchDatasetEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Fetch dataset (GET form)

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}/fetch", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/dataset/{dataset_id}/fetch

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

Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
limitqueryFetchLimitParamfalselimit the number of traces fetched
max_xact_idqueryMaxXactIdfalseDEPRECATION 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.
max_root_span_idqueryMaxRootSpanIdfalseDEPRECATION 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.
versionqueryanyfalseRetrieve prompt at a specific version.
Detailed descriptions

limit: 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: 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: 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: Retrieve prompt at a specific version.

The version id can either be a transaction id (e.g. '1000192656880881099') or a version identifier (e.g. '81cd05ee665fdfb3').

Example responses

200 Response

{
  "events": [
    {
      "id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
      "input": null,
      "expected": null,
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "span_id": "string",
      "root_span_id": "string"
    }
  ],
  "cursor": "string"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the fetched rowsFetchDatasetEventsResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Feedback for dataset events

Code samples
const inputBody = JSON.stringify({
  feedback: [
    {
      id: "string",
      comment: "string",
      metadata: {
        property1: null,
        property2: null,
      },
      source: "app",
    },
  ],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "text/plain",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}/feedback", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/dataset/{dataset_id}/feedback

Log feedback for a set of dataset events

Body parameter
{
  "feedback": [
    {
      "id": "string",
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
bodybodyFeedbackDatasetEventRequesttrueAn array of feedback objects
Example responses

400 Response

"string"
null
Responses
StatusMeaningDescriptionSchema
200OKNo return valueNone
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Summarize dataset

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/dataset/{dataset_id}/summarize", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/dataset/{dataset_id}/summarize

Summarize dataset

Parameters
NameInTypeRequiredDescription
dataset_idpathDatasetIdtrueDataset id
summarize_dataquerySummarizeDatafalseWhether to summarize the data. If false (or omitted), only the metadata will be returned.
Example responses

200 Response

{
  "project_name": "string",
  "dataset_name": "string",
  "project_url": "http://example.com",
  "dataset_url": "http://example.com",
  "data_summary": {
    "total_records": 0
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKDataset summarySummarizeDatasetResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Prompts

Create prompt

Code samples
const inputBody = JSON.stringify({
  project_id: "405d8375-3514-403b-8c43-83ae74cfe0e9",
  name: "string",
  slug: "string",
  description: "string",
  prompt_data: {
    prompt: {
      type: "completion",
      content: "string",
    },
    options: {
      model: "string",
      params: {
        use_cache: true,
        temperature: 0,
        top_p: 0,
        max_tokens: 0,
        frequency_penalty: 0,
        presence_penalty: 0,
        response_format: {
          type: "json_object",
        },
        tool_choice: "auto",
        function_call: "auto",
        n: 0,
        stop: ["string"],
      },
      position: "string",
    },
    origin: {
      prompt_id: "string",
      project_id: "string",
      prompt_version: "string",
    },
  },
  tags: ["string"],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/prompt", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/prompt

Create a new prompt. If there is an existing prompt in the project with the same slug as the one specified in the request, will return the existing prompt unmodified

Body parameter
{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "slug": "string",
  "description": "string",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"]
}
Parameters
NameInTypeRequiredDescription
bodybodyCreatePrompttrueAny desired information about the new prompt object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "_xact_id": "string",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "log_id": "p",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "slug": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"],
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new prompt objectPrompt
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

DEPRECATED. Create or replace prompt

Code samples
const inputBody = JSON.stringify({
  project_id: "405d8375-3514-403b-8c43-83ae74cfe0e9",
  name: "string",
  slug: "string",
  description: "string",
  prompt_data: {
    prompt: {
      type: "completion",
      content: "string",
    },
    options: {
      model: "string",
      params: {
        use_cache: true,
        temperature: 0,
        top_p: 0,
        max_tokens: 0,
        frequency_penalty: 0,
        presence_penalty: 0,
        response_format: {
          type: "json_object",
        },
        tool_choice: "auto",
        function_call: "auto",
        n: 0,
        stop: ["string"],
      },
      position: "string",
    },
    origin: {
      prompt_id: "string",
      project_id: "string",
      prompt_version: "string",
    },
  },
  tags: ["string"],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/prompt", {
  method: "PUT",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PUT /v1/prompt

NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace a new prompt. If there is an existing prompt in the project with the same slug as the one specified in the request, will return the existing prompt unmodified, will replace the existing prompt with the provided fields

Body parameter
{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "slug": "string",
  "description": "string",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"]
}
Parameters
NameInTypeRequiredDescription
bodybodyCreatePrompttrueAny desired information about the new prompt object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "_xact_id": "string",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "log_id": "p",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "slug": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"],
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new prompt objectPrompt
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline

Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

List prompts

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/prompt", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/prompt

List out all prompts. The prompts are sorted by creation date, with the most recently-created prompts coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
prompt_namequeryPromptNamefalseName of the prompt to search for
project_namequeryProjectNamefalseName of the project to search for
slugquerySlugfalseRetrieve prompt with a specific slug
versionqueryanyfalseRetrieve prompt at a specific version.
org_namequeryOrgNamefalseFilter search results to within a particular organization
idsqueryIdsfalseFilter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Detailed descriptions

starting_after: 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

ending_before: 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

version: Retrieve prompt at a specific version.

The version id can either be a transaction id (e.g. '1000192656880881099') or a version identifier (e.g. '81cd05ee665fdfb3').

Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "_xact_id": "string",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "log_id": "p",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "name": "string",
      "slug": "string",
      "description": "string",
      "created": "2019-08-24T14:15:22Z",
      "prompt_data": {
        "prompt": {
          "type": "completion",
          "content": "string"
        },
        "options": {
          "model": "string",
          "params": {
            "use_cache": true,
            "temperature": 0,
            "top_p": 0,
            "max_tokens": 0,
            "frequency_penalty": 0,
            "presence_penalty": 0,
            "response_format": {
              "type": "json_object"
            },
            "tool_choice": "auto",
            "function_call": "auto",
            "n": 0,
            "stop": ["string"]
          },
          "position": "string"
        },
        "origin": {
          "prompt_id": "string",
          "project_id": "string",
          "prompt_version": "string"
        }
      },
      "tags": ["string"],
      "metadata": {
        "property1": null,
        "property2": null
      }
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of prompt objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[Prompt]truenoneA list of prompt objects
»» idstring(uuid)truenoneUnique identifier for the prompt
»» _xact_idstringtruenoneThe 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 prompt (see the version parameter)
»» project_idstring(uuid)truenoneUnique identifier for the project that the prompt belongs under
»» log_idstringtruenoneA literal 'p' which identifies the object as a project prompt
»» org_idstring(uuid)truenoneUnique identifier for the organization
»» namestringtruenoneName of the prompt
»» slugstringtruenoneUnique identifier for the prompt
»» descriptionstring¦nullfalsenoneTextual description of the prompt
»» createdstring(date-time)¦nullfalsenoneDate of prompt creation
»» prompt_dataPromptData¦nullfalsenoneThe prompt, model, and its parameters
»»» promptanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»» anonymousobjectfalsenonenone
»»»»» typestringtruenonenone
»»»»» contentstringtruenonenone

or

NameTypeRequiredRestrictionsDescription
»»»» anonymousobjectfalsenonenone
»»»»» typestringtruenonenone
»»»»» messages[anyOf]truenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»» anonymousobjectfalsenonenone
»»»»»»» contentstringfalsenonenone
»»»»»»» rolestringtruenonenone
»»»»»»» namestringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»» anonymousobjectfalsenonenone
»»»»»»» contentanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»»» anonymous[anyOf]falsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»»»»» anonymousobjectfalsenonenone
»»»»»»»»»» textstringfalsenonenone
»»»»»»»»»» typestringtruenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»»»» anonymousobjectfalsenonenone
»»»»»»»»»» image_urlobjecttruenonenone
»»»»»»»»»»» urlstringtruenonenone
»»»»»»»»»»» detailanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»»»»»»» anonymousstringfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
»»»»»»»»»» typestringtruenonenone
»»»»»»» rolestringtruenonenone
»»»»»»» namestringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»» anonymousobjectfalsenonenone
»»»»»»» rolestringtruenonenone
»»»»»»» contentstring¦nullfalsenonenone
»»»»»»» function_callobjectfalsenonenone
»»»»»»»» argumentsstringtruenonenone
»»»»»»»» namestringtruenonenone
»»»»»»» namestringfalsenonenone
»»»»»»» tool_calls[object]falsenonenone
»»»»»»»» idstringtruenonenone
»»»»»»»» functionobjecttruenonenone
»»»»»»»»» argumentsstringtruenonenone
»»»»»»»»» namestringtruenonenone
»»»»»»»» typestringtruenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»» anonymousobjectfalsenonenone
»»»»»»» contentstringfalsenonenone
»»»»»»» rolestringtruenonenone
»»»»»»» tool_call_idstringtruenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»» anonymousobjectfalsenonenone
»»»»»»» contentstringfalsenonenone
»»»»»»» namestringtruenonenone
»»»»»»» rolestringtruenonenone

continued

NameTypeRequiredRestrictionsDescription
»»»»» toolsstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»» anonymousobject¦nullfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
»»» optionsobject¦nullfalsenonenone
»»»» modelstringfalsenonenone
»»»» paramsanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»» anonymousobjectfalsenonenone
»»»»»» use_cachebooleanfalsenonenone
»»»»»» temperaturenumberfalsenonenone
»»»»»» top_pnumberfalsenonenone
»»»»»» max_tokensnumberfalsenonenone
»»»»»» frequency_penaltynumberfalsenonenone
»»»»»» presence_penaltynumberfalsenonenone
»»»»»» response_formatobject¦nullfalsenonenone
»»»»»»» typestringtruenonenone
»»»»»» tool_choiceanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»» anonymousobjectfalsenonenone
»»»»»»»» typestringtruenonenone
»»»»»»»» functionobjecttruenonenone
»»»»»»»»» namestringtruenonenone

continued

NameTypeRequiredRestrictionsDescription
»»»»»» function_callanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»» anonymousobjectfalsenonenone
»»»»»»»» namestringtruenonenone

continued

NameTypeRequiredRestrictionsDescription
»»»»»» nnumberfalsenonenone
»»»»»» stop[string]falsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»» anonymousobjectfalsenonenone
»»»»»» use_cachebooleanfalsenonenone
»»»»»» max_tokensnumbertruenonenone
»»»»»» temperaturenumbertruenonenone
»»»»»» top_pnumberfalsenonenone
»»»»»» top_knumberfalsenonenone
»»»»»» stop_sequences[string]falsenonenone
»»»»»» max_tokens_to_samplenumberfalsenoneThis is a legacy parameter that should not be used.

or

NameTypeRequiredRestrictionsDescription
»»»»» anonymousobjectfalsenonenone
»»»»»» use_cachebooleanfalsenonenone
»»»»»» temperaturenumbertruenonenone
»»»»»» maxOutputTokensnumberfalsenonenone
»»»»»» topPnumberfalsenonenone
»»»»»» topKnumberfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»» anonymousobjectfalsenonenone
»»»»»» use_cachebooleanfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
»»»» positionstringfalsenonenone
»»» originobject¦nullfalsenonenone
»»»» prompt_idstringfalsenonenone
»»»» project_idstringfalsenonenone
»»»» prompt_versionstringfalsenonenone
»» tags[string]¦nullfalsenoneA list of tags for the prompt
»» metadataobject¦nullfalsenoneUser-controlled metadata about the prompt
»»» additionalPropertiesanyfalsenonenone
Enumerated Values
PropertyValue
log_idp
typecompletion
typechat
rolesystem
typetext
anonymousauto
anonymouslow
anonymoushigh
typeimage_url
roleuser
roleassistant
typefunction
roletool
rolefunction
typejson_object
anonymousauto
anonymousnone
typefunction
anonymousauto
anonymousnone

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get prompt

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/prompt/{prompt_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/prompt/{prompt_id}

Get a prompt object by its id

Parameters
NameInTypeRequiredDescription
prompt_idpathPromptIdtruePrompt id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "_xact_id": "string",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "log_id": "p",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "slug": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"],
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the prompt objectPrompt
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Partially update prompt

Code samples
const inputBody = JSON.stringify({
  name: "string",
  description: "string",
  prompt_data: {
    prompt: {
      type: "completion",
      content: "string",
    },
    options: {
      model: "string",
      params: {
        use_cache: true,
        temperature: 0,
        top_p: 0,
        max_tokens: 0,
        frequency_penalty: 0,
        presence_penalty: 0,
        response_format: {
          type: "json_object",
        },
        tool_choice: "auto",
        function_call: "auto",
        n: 0,
        stop: ["string"],
      },
      position: "string",
    },
    origin: {
      prompt_id: "string",
      project_id: "string",
      prompt_version: "string",
    },
  },
  tags: ["string"],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/prompt/{prompt_id}", {
  method: "PATCH",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PATCH /v1/prompt/{prompt_id}

Partially update a prompt 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.

Body parameter
{
  "name": "string",
  "description": "string",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"]
}
Parameters
NameInTypeRequiredDescription
prompt_idpathPromptIdtruePrompt id
bodybodyPatchPromptfalseFields to update
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "_xact_id": "string",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "log_id": "p",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "slug": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"],
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the prompt objectPrompt
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Delete prompt

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/prompt/{prompt_id}", {
  method: "DELETE",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

DELETE /v1/prompt/{prompt_id}

Delete a prompt object by its id

Parameters
NameInTypeRequiredDescription
prompt_idpathPromptIdtruePrompt id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "_xact_id": "string",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "log_id": "p",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "slug": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"],
  "metadata": {
    "property1": null,
    "property2": null
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the deleted prompt objectPrompt
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Feedback for prompt events

Code samples
const inputBody = JSON.stringify({
  feedback: [
    {
      id: "string",
      comment: "string",
      metadata: {
        property1: null,
        property2: null,
      },
      source: "app",
    },
  ],
});
const headers = {
  "Content-Type": "application/json",
  Accept: "text/plain",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/prompt/{prompt_id}/feedback", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/prompt/{prompt_id}/feedback

Log feedback for a set of prompt events

Body parameter
{
  "feedback": [
    {
      "id": "string",
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Parameters
NameInTypeRequiredDescription
prompt_idpathPromptIdtruePrompt id
bodybodyFeedbackPromptEventRequesttrueAn array of feedback objects
Example responses

400 Response

"string"
null
Responses
StatusMeaningDescriptionSchema
200OKNo return valueNone
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Roles

Create role

Code samples
const inputBody = JSON.stringify({
  name: "string",
  description: "string",
  member_permissions: ["create"],
  member_roles: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  org_name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/role", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/role

Create a new role. If there is an existing role with the same name as the one specified in the request, will return the existing role unmodified

Body parameter
{
  "name": "string",
  "description": "string",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "org_name": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateRoletrueAny desired information about the new role object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new role objectRole
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

DEPRECATED. Create or replace role

Code samples
const inputBody = JSON.stringify({
  name: "string",
  description: "string",
  member_permissions: ["create"],
  member_roles: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  org_name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/role", {
  method: "PUT",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PUT /v1/role

NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace a new role. If there is an existing role with the same name as the one specified in the request, will return the existing role unmodified, will replace the existing role with the provided fields

Body parameter
{
  "name": "string",
  "description": "string",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "org_name": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateRoletrueAny desired information about the new role object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new role objectRole
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

List roles

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/role", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/role

List out all roles. The roles are sorted by creation date, with the most recently-created roles coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
role_namequeryRoleNamefalseName of the role to search for
org_namequeryOrgNamefalseFilter search results to within a particular organization
idsqueryIdsfalseFilter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Detailed descriptions

starting_after: 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

ending_before: 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

Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
      "created": "2019-08-24T14:15:22Z",
      "name": "string",
      "description": "string",
      "deleted_at": "2019-08-24T14:15:22Z",
      "member_permissions": ["create"],
      "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of role objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[Role]truenoneA list of role objects
»» idstring(uuid)truenoneUnique identifier for the role
»» org_idstring(uuid)¦nullfalsenoneUnique id for the organization that the role belongs under

A null org_id indicates a system role, which may be assigned to anybody and inherited by any other role, but cannot be edited.

It is forbidden to change the org after creating a role
»» user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the role
»» createdstring(date-time)¦nullfalsenoneDate of role creation
»» namestringtruenoneName of the role
»» descriptionstring¦nullfalsenoneTextual description of the role
»» deleted_atstring(date-time)¦nullfalsenoneDate of role deletion, or null if the role is still active
»» member_permissions[string]¦nullfalsenonePermissions which belong to this role
»» member_roles[string]¦nullfalsenoneIds of the roles this role inherits from

An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get role

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/role/{role_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/role/{role_id}

Get a role object by its id

Parameters
NameInTypeRequiredDescription
role_idpathRoleIdtrueRole id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the role objectRole
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Partially update role

Code samples
const inputBody = JSON.stringify({
  description: "string",
  member_permissions: ["create"],
  member_roles: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/role/{role_id}", {
  method: "PATCH",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PATCH /v1/role/{role_id}

Partially update a role 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.

Body parameter
{
  "description": "string",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "name": "string"
}
Parameters
NameInTypeRequiredDescription
role_idpathRoleIdtrueRole id
bodybodyPatchRolefalseFields to update
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the role objectRole
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Delete role

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/role/{role_id}", {
  method: "DELETE",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

DELETE /v1/role/{role_id}

Delete a role object by its id

Parameters
NameInTypeRequiredDescription
role_idpathRoleIdtrueRole id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the deleted role objectRole
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Groups

Create group

Code samples
const inputBody = JSON.stringify({
  name: "string",
  description: "string",
  member_users: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  member_groups: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  org_name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/group", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/group

Create a new group. If there is an existing group with the same name as the one specified in the request, will return the existing group unmodified

Body parameter
{
  "name": "string",
  "description": "string",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "org_name": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateGrouptrueAny desired information about the new group object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new group objectGroup
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

DEPRECATED. Create or replace group

Code samples
const inputBody = JSON.stringify({
  name: "string",
  description: "string",
  member_users: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  member_groups: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  org_name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/group", {
  method: "PUT",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PUT /v1/group

NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace a new group. If there is an existing group with the same name as the one specified in the request, will return the existing group unmodified, will replace the existing group with the provided fields

Body parameter
{
  "name": "string",
  "description": "string",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "org_name": "string"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateGrouptrueAny desired information about the new group object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new group objectGroup
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

List groups

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/group", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/group

List out all groups. The groups are sorted by creation date, with the most recently-created groups coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
group_namequeryGroupNamefalseName of the group to search for
org_namequeryOrgNamefalseFilter search results to within a particular organization
idsqueryIdsfalseFilter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Detailed descriptions

starting_after: 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

ending_before: 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

Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
      "created": "2019-08-24T14:15:22Z",
      "name": "string",
      "description": "string",
      "deleted_at": "2019-08-24T14:15:22Z",
      "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
      "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of group objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[Group]truenoneA list of group objects
»» idstring(uuid)truenoneUnique identifier for the group
»» org_idstring(uuid)truenoneUnique id for the organization that the group belongs under

It is forbidden to change the org after creating a group
»» user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the group
»» createdstring(date-time)¦nullfalsenoneDate of group creation
»» namestringtruenoneName of the group
»» descriptionstring¦nullfalsenoneTextual description of the group
»» deleted_atstring(date-time)¦nullfalsenoneDate of group deletion, or null if the group is still active
»» member_users[string]¦nullfalsenoneIds of users which belong to this group
»» member_groups[string]¦nullfalsenoneIds of the groups this group inherits from

An inheriting group has all the users contained in its member groups, as well as all of their inherited users

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get group

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/group/{group_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/group/{group_id}

Get a group object by its id

Parameters
NameInTypeRequiredDescription
group_idpathGroupIdtrueGroup id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the group objectGroup
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Partially update group

Code samples
const inputBody = JSON.stringify({
  description: "string",
  member_users: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  member_groups: ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  name: "string",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/group/{group_id}", {
  method: "PATCH",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PATCH /v1/group/{group_id}

Partially update a group 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.

Body parameter
{
  "description": "string",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "name": "string"
}
Parameters
NameInTypeRequiredDescription
group_idpathGroupIdtrueGroup id
bodybodyPatchGroupfalseFields to update
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the group objectGroup
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Delete group

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/group/{group_id}", {
  method: "DELETE",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

DELETE /v1/group/{group_id}

Delete a group object by its id

Parameters
NameInTypeRequiredDescription
group_idpathGroupIdtrueGroup id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the deleted group objectGroup
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Acls

Create acl

Code samples
const inputBody = JSON.stringify({
  object_type: "organization",
  object_id: "463a83d0-a816-4902-abba-2486e0c0a0bb",
  restrict_object_type: "organization",
  user_id: "a169451c-8525-4352-b8ca-070dd449a1a5",
  group_id: "306db4e0-7449-4501-b76f-075576fe2d8f",
  permission: "create",
  role_id: "ac4e70c8-d5be-48af-93eb-760f58fc91a9",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/acl", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/acl

Create a new acl. If there is an existing acl with the same contents as the one specified in the request, will return the existing acl unmodified

Body parameter
{
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateAcltrueAny desired information about the new acl object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "_object_org_id": "4d272dc1-1d6f-4a99-8c76-7bcbfc11ce4e",
  "created": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new acl objectAcl
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

DEPRECATED. Create or replace acl

Code samples
const inputBody = JSON.stringify({
  object_type: "organization",
  object_id: "463a83d0-a816-4902-abba-2486e0c0a0bb",
  restrict_object_type: "organization",
  user_id: "a169451c-8525-4352-b8ca-070dd449a1a5",
  group_id: "306db4e0-7449-4501-b76f-075576fe2d8f",
  permission: "create",
  role_id: "ac4e70c8-d5be-48af-93eb-760f58fc91a9",
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/acl", {
  method: "PUT",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

PUT /v1/acl

NOTE: This operation is deprecated and will be removed in a future revision of the API. Create or replace a new acl. If there is an existing acl with the same contents as the one specified in the request, will return the existing acl unmodified, will replace the existing acl with the provided fields

Body parameter
{
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}
Parameters
NameInTypeRequiredDescription
bodybodyCreateAcltrueAny desired information about the new acl object
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "_object_org_id": "4d272dc1-1d6f-4a99-8c76-7bcbfc11ce4e",
  "created": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the new acl objectAcl
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

List acls

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch(
  "https://api.braintrustdata.com/v1/acl?object_type=organization&object_id=497f6eca-6276-4993-bfeb-53cbbbba6f08",
  {
    method: "GET",
 
    headers: headers,
  },
)
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/acl

List out all acls. The acls are sorted by creation date, with the most recently-created acls coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
object_typequeryAclObjectTypetrueThe object type that the ACL applies to
object_idqueryAclObjectIdtrueThe id of the object the ACL applies to
Detailed descriptions

starting_after: 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

ending_before: 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

Enumerated Values
ParameterValue
object_typeorganization
object_typeproject
object_typeexperiment
object_typedataset
object_typeprompt
object_typeprompt_session
object_typeproject_score
object_typeproject_tag
object_typegroup
object_typerole
object_typenull
Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "object_type": "organization",
      "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
      "restrict_object_type": "organization",
      "_object_org_id": "4d272dc1-1d6f-4a99-8c76-7bcbfc11ce4e",
      "created": "2019-08-24T14:15:22Z",
      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
      "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
      "permission": "create",
      "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of acl objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[Acl]truenoneA list of acl objects
»» idstring(uuid)truenoneUnique identifier for the acl
»» object_typestringtruenoneThe object type that the ACL applies to
»» object_idstring(uuid)truenoneThe id of the object the ACL applies to
»» restrict_object_typestring¦nullfalsenoneOptionally restricts the permission grant to just the specified object type
»» _object_org_idstring(uuid)truenoneThe organization the ACL's referred object belongs to
»» createdstring(date-time)¦nullfalsenoneDate of acl creation
»» user_idstring(uuid)¦nullfalsenoneId of the user the ACL applies to. Exactly one of user_id and group_id will be provided
»» group_idstring(uuid)¦nullfalsenoneId of the group the ACL applies to. Exactly one of user_id and group_id will be provided
»» permissionstring¦nullfalsenonePermission the ACL grants. Exactly one of permission and role_id will be provided
»» role_idstring(uuid)¦nullfalsenoneId of the role the ACL grants. Exactly one of permission and role_id will be provided
Enumerated Values
PropertyValue
object_typeorganization
object_typeproject
object_typeexperiment
object_typedataset
object_typeprompt
object_typeprompt_session
object_typeproject_score
object_typeproject_tag
object_typegroup
object_typerole
object_typenull
restrict_object_typeorganization
restrict_object_typeproject
restrict_object_typeexperiment
restrict_object_typedataset
restrict_object_typeprompt
restrict_object_typeprompt_session
restrict_object_typeproject_score
restrict_object_typeproject_tag
restrict_object_typegroup
restrict_object_typerole
restrict_object_typenull
permissioncreate
permissionread
permissionupdate
permissiondelete
permissioncreate_acls
permissionread_acls
permissionupdate_acls
permissiondelete_acls
permissionnull

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get acl

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/acl/{acl_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/acl/{acl_id}

Get an acl object by its id

Parameters
NameInTypeRequiredDescription
acl_idpathAclIdtrueAcl id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "_object_org_id": "4d272dc1-1d6f-4a99-8c76-7bcbfc11ce4e",
  "created": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the acl objectAcl
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Delete acl

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/acl/{acl_id}", {
  method: "DELETE",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

DELETE /v1/acl/{acl_id}

Delete an acl object by its id

Parameters
NameInTypeRequiredDescription
acl_idpathAclIdtrueAcl id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "_object_org_id": "4d272dc1-1d6f-4a99-8c76-7bcbfc11ce4e",
  "created": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the deleted acl objectAcl
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Users

List users

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/user", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/user

List out all users. The users are sorted by creation date, with the most recently-created users coming first

Parameters
NameInTypeRequiredDescription
limitqueryAppLimitParamfalseLimit the number of objects to return
starting_afterqueryStartingAfterfalsePagination cursor id.
ending_beforequeryEndingBeforefalsePagination cursor id.
given_namequeryUserGivenNamefalseGiven name of the user to search for
family_namequeryUserFamilyNamefalseFamily name of the user to search for
emailqueryUserEmailfalseEmail of the user to search for
org_namequeryOrgNamefalseFilter search results to within a particular organization
idsqueryIdsfalseFilter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times
Detailed descriptions

starting_after: 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

ending_before: 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

Example responses

200 Response

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "given_name": "string",
      "family_name": "string",
      "email": "string",
      "avatar_url": "string",
      "created": "2019-08-24T14:15:22Z"
    }
  ]
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns a list of user objectsInline
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
» objects[User]truenoneA list of user objects
»» idstring(uuid)truenoneUnique identifier for the user
»» given_namestring¦nullfalsenoneGiven name of the user
»» family_namestring¦nullfalsenoneFamily name of the user
»» emailstring¦nullfalsenoneThe user's email
»» avatar_urlstring¦nullfalsenoneURL of the user's Avatar image
»» createdstring(date-time)¦nullfalsenoneDate of user creation

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Get user

Code samples
const headers = {
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/user/{user_id}", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1/user/{user_id}

Get a user object by its id

Parameters
NameInTypeRequiredDescription
user_idpathUserIdtrueUser id
Example responses

200 Response

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "given_name": "string",
  "family_name": "string",
  "email": "string",
  "avatar_url": "string",
  "created": "2019-08-24T14:15:22Z"
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the user objectUser
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Other

Hello world endpoint

Code samples
const headers = {
  Accept: "text/plain",
};
 
fetch("https://api.braintrustdata.com/v1", {
  method: "GET",
 
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

GET /v1

Default endpoint. Simply replies with 'Hello, World!'. Authorization is not required

Example responses

200 Response

"string"

400 Response

null
Responses
StatusMeaningDescriptionSchema
200OKHello world stringstring
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🌐
This operation does not require authentication

CrossObject

Cross-object insert

Code samples
const inputBody = JSON.stringify({
  experiment: {
    property1: {
      events: [
        {
          input: null,
          output: null,
          expected: null,
          scores: {
            property1: 1,
            property2: 1,
          },
          metadata: {
            property1: null,
            property2: null,
          },
          tags: ["string"],
          metrics: {
            start: 0,
            end: 0,
            prompt_tokens: 0,
            completion_tokens: 0,
            tokens: 0,
            property1: null,
            property2: null,
          },
          context: {
            caller_functionname: "string",
            caller_filename: "string",
            caller_lineno: 0,
            property1: null,
            property2: null,
          },
          span_attributes: {
            name: "string",
            type: "llm",
            property1: null,
            property2: null,
          },
          id: "string",
          dataset_record_id: "string",
          _object_delete: true,
          _is_merge: false,
          _parent_id: "string",
        },
      ],
      feedback: [
        {
          id: "string",
          scores: {
            property1: 1,
            property2: 1,
          },
          expected: null,
          comment: "string",
          metadata: {
            property1: null,
            property2: null,
          },
          source: "app",
        },
      ],
    },
    property2: {
      events: [
        {
          input: null,
          output: null,
          expected: null,
          scores: {
            property1: 1,
            property2: 1,
          },
          metadata: {
            property1: null,
            property2: null,
          },
          tags: ["string"],
          metrics: {
            start: 0,
            end: 0,
            prompt_tokens: 0,
            completion_tokens: 0,
            tokens: 0,
            property1: null,
            property2: null,
          },
          context: {
            caller_functionname: "string",
            caller_filename: "string",
            caller_lineno: 0,
            property1: null,
            property2: null,
          },
          span_attributes: {
            name: "string",
            type: "llm",
            property1: null,
            property2: null,
          },
          id: "string",
          dataset_record_id: "string",
          _object_delete: true,
          _is_merge: false,
          _parent_id: "string",
        },
      ],
      feedback: [
        {
          id: "string",
          scores: {
            property1: 1,
            property2: 1,
          },
          expected: null,
          comment: "string",
          metadata: {
            property1: null,
            property2: null,
          },
          source: "app",
        },
      ],
    },
  },
  dataset: {
    property1: {
      events: [
        {
          input: null,
          expected: null,
          metadata: {
            property1: null,
            property2: null,
          },
          tags: ["string"],
          id: "string",
          _object_delete: true,
          _is_merge: false,
          _parent_id: "string",
        },
      ],
      feedback: [
        {
          id: "string",
          comment: "string",
          metadata: {
            property1: null,
            property2: null,
          },
          source: "app",
        },
      ],
    },
    property2: {
      events: [
        {
          input: null,
          expected: null,
          metadata: {
            property1: null,
            property2: null,
          },
          tags: ["string"],
          id: "string",
          _object_delete: true,
          _is_merge: false,
          _parent_id: "string",
        },
      ],
      feedback: [
        {
          id: "string",
          comment: "string",
          metadata: {
            property1: null,
            property2: null,
          },
          source: "app",
        },
      ],
    },
  },
  project_logs: {
    property1: {
      events: [
        {
          input: null,
          output: null,
          expected: null,
          scores: {
            property1: 1,
            property2: 1,
          },
          metadata: {
            property1: null,
            property2: null,
          },
          tags: ["string"],
          metrics: {
            start: 0,
            end: 0,
            prompt_tokens: 0,
            completion_tokens: 0,
            tokens: 0,
            property1: null,
            property2: null,
          },
          context: {
            caller_functionname: "string",
            caller_filename: "string",
            caller_lineno: 0,
            property1: null,
            property2: null,
          },
          span_attributes: {
            name: "string",
            type: "llm",
            property1: null,
            property2: null,
          },
          id: "string",
          _object_delete: true,
          _is_merge: false,
          _parent_id: "string",
        },
      ],
      feedback: [
        {
          id: "string",
          scores: {
            property1: 1,
            property2: 1,
          },
          expected: null,
          comment: "string",
          metadata: {
            property1: null,
            property2: null,
          },
          source: "app",
        },
      ],
    },
    property2: {
      events: [
        {
          input: null,
          output: null,
          expected: null,
          scores: {
            property1: 1,
            property2: 1,
          },
          metadata: {
            property1: null,
            property2: null,
          },
          tags: ["string"],
          metrics: {
            start: 0,
            end: 0,
            prompt_tokens: 0,
            completion_tokens: 0,
            tokens: 0,
            property1: null,
            property2: null,
          },
          context: {
            caller_functionname: "string",
            caller_filename: "string",
            caller_lineno: 0,
            property1: null,
            property2: null,
          },
          span_attributes: {
            name: "string",
            type: "llm",
            property1: null,
            property2: null,
          },
          id: "string",
          _object_delete: true,
          _is_merge: false,
          _parent_id: "string",
        },
      ],
      feedback: [
        {
          id: "string",
          scores: {
            property1: 1,
            property2: 1,
          },
          expected: null,
          comment: "string",
          metadata: {
            property1: null,
            property2: null,
          },
          source: "app",
        },
      ],
    },
  },
});
const headers = {
  "Content-Type": "application/json",
  Accept: "application/json",
  Authorization: "Bearer {access-token}",
};
 
fetch("https://api.braintrustdata.com/v1/insert", {
  method: "POST",
  body: inputBody,
  headers: headers,
})
  .then(function (res) {
    return res.json();
  })
  .then(function (body) {
    console.log(body);
  });

POST /v1/insert

Insert events and feedback across object types

Body parameter
{
  "experiment": {
    "property1": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "dataset_record_id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "dataset_record_id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  },
  "dataset": {
    "property1": {
      "events": [
        {
          "input": null,
          "expected": null,
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "expected": null,
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  },
  "project_logs": {
    "property1": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  }
}
Parameters
NameInTypeRequiredDescription
bodybodyCrossObjectInsertRequestfalseA mapping from event object type -> object id -> events to insert
Example responses

200 Response

{
  "experiment": {
    "property1": {
      "row_ids": ["string"]
    },
    "property2": {
      "row_ids": ["string"]
    }
  },
  "dataset": {
    "property1": {
      "row_ids": ["string"]
    },
    "property2": {
      "row_ids": ["string"]
    }
  },
  "project_logs": {
    "property1": {
      "row_ids": ["string"]
    },
    "property2": {
      "row_ids": ["string"]
    }
  }
}

400 Response

"string"
Responses
StatusMeaningDescriptionSchema
200OKReturns the inserted row ids for the events on each individual objectCrossObjectInsertResponse
400Bad RequestThe request was unacceptable, often due to missing a required parameterInline
401UnauthorizedNo valid API key providedInline
403ForbiddenThe API key doesn’t have permissions to perform the requestInline
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requestsInline
500Internal Server ErrorSomething went wrong on Braintrust's end. (These are rare.)Inline
Response Schema

Status Code 400

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 401

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 403

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 429

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone

Status Code 500

NameTypeRequiredRestrictionsDescription
anonymousstringfalsenonenone
🔒
This endpoint requires authentication.

Schemas

ExperimentId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Experiment id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneExperiment id

DatasetId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Dataset id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneDataset id

ProjectId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Project id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneProject id

PromptId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Prompt id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenonePrompt id

RoleId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Role id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneRole id

GroupId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Group id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneGroup id

AclId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Acl id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneAcl id

UserId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

User id

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneUser id

ExperimentName

"string"

Name of the experiment to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneName of the experiment to search for

DatasetName

"string"

Name of the dataset to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneName of the dataset to search for

ProjectName

"string"

Name of the project to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneName of the project to search for

PromptName

"string"

Name of the prompt to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneName of the prompt to search for

RoleName

"string"

Name of the role to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneName of the role to search for

GroupName

"string"

Name of the group to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneName of the group to search for

OrgName

"string"

Filter search results to within a particular organization

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneFilter search results to within a particular organization

Ids

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

Filter search results to a particular set of object IDs. To specify a list of IDs, include the query param multiple times

Properties

anyOf

NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenonenone

or

NameTypeRequiredRestrictionsDescription
anonymous[string]falsenonenone

AppLimitParam

0

Limit the number of objects to return

Properties
NameTypeRequiredRestrictionsDescription
anonymousintegerfalsenoneLimit the number of objects to return

FetchLimitParam

0

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.

Properties
NameTypeRequiredRestrictionsDescription
anonymousintegerfalsenonelimit 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.

StartingAfter

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

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

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenonePagination 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

EndingBefore

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

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

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenonePagination 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

MaxXactId

"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.

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneDEPRECATION 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.

MaxRootSpanId

"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.

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneDEPRECATION 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.

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneRetrieve 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.

SummarizeScores

true

Whether to summarize the scores and metrics. If false (or omitted), only the metadata will be returned.

Properties
NameTypeRequiredRestrictionsDescription
anonymousbooleanfalsenoneWhether to summarize the scores and metrics. If false (or omitted), only the metadata will be returned.

ComparisonExperimentId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

The 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

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneThe 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

SummarizeData

true

Whether to summarize the data. If false (or omitted), only the metadata will be returned.

Properties
NameTypeRequiredRestrictionsDescription
anonymousbooleanfalsenoneWhether to summarize the data. If false (or omitted), only the metadata will be returned.

Slug

"string"

Retrieve prompt with a specific slug

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneRetrieve prompt with a specific slug

UserGivenName

"string"

Given name of the user to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneGiven name of the user to search for

UserFamilyName

"string"

Family name of the user to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneFamily name of the user to search for

UserEmail

"string"

Email of the user to search for

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneEmail of the user to search for

AclObjectType

"organization"

The object type that the ACL applies to

Properties
NameTypeRequiredRestrictionsDescription
anonymousstringfalsenoneThe object type that the ACL applies to
Enumerated Values
PropertyValue
anonymousorganization
anonymousproject
anonymousexperiment
anonymousdataset
anonymousprompt
anonymousprompt_session
anonymousproject_score
anonymousproject_tag
anonymousgroup
anonymousrole
anonymousnull

AclObjectId

"497f6eca-6276-4993-bfeb-53cbbbba6f08"

The id of the object the ACL applies to

Properties
NameTypeRequiredRestrictionsDescription
anonymousstring(uuid)falsenoneThe id of the object the ACL applies to

Project

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}
Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the project
org_idstring(uuid)truenoneUnique id for the organization that the project belongs under
namestringtruenoneName of the project
createdstring(date-time)¦nullfalsenoneDate of project creation
deleted_atstring(date-time)¦nullfalsenoneDate of project deletion, or null if the project is still active
user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the project

CreateProject

{
  "name": "string",
  "org_name": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
namestringtruenoneName of the project
org_namestring¦nullfalsenoneFor 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.

PatchProject

{
  "name": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
namestring¦nullfalsenoneName of the project

InsertEventsResponse

{
  "row_ids": ["string"]
}
Properties
NameTypeRequiredRestrictionsDescription
row_ids[string]truenoneThe ids of all rows that were inserted, aligning one-to-one with the rows provided as input

InsertProjectLogsEventReplace

{
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  },
  "id": "string",
  "_object_delete": true,
  "_is_merge": false,
  "_parent_id": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
inputanyfalsenoneThe arguments that uniquely define a user input (an arbitrary, JSON serializable object).
outputanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the output should be the result of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question.
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not. Braintrust currently does not compare output to expected for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models.
scoresobject¦nullfalsenoneA 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 logs.
» additionalPropertiesnumber¦nullfalsenonenone
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
metricsobject¦nullfalsenoneMetrics are numerical measurements tracking the execution of the code that produced the project logs event. Use "start" and "end" to track the time span over which the project logs event was produced
» additionalPropertiesanyfalsenonenone
» startnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the project logs event started
» endnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the project logs event finished
» prompt_tokensinteger¦nullfalsenoneThe number of tokens in the prompt used to generate the project logs event (only set if this is an LLM span)
» completion_tokensinteger¦nullfalsenoneThe number of tokens in the completion generated by the model (only set if this is an LLM span)
» tokensinteger¦nullfalsenoneThe total number of tokens in the input and output of the project logs event.
contextobject¦nullfalsenoneContext is additional information about the code that produced the project logs event. It is essentially the textual counterpart to metrics. Use the caller_* attributes to track the location in code which produced the project logs event
» additionalPropertiesanyfalsenonenone
» caller_functionnamestring¦nullfalsenoneThe function in code which created the project logs event
» caller_filenamestring¦nullfalsenoneName of the file in code where the project logs event was created
» caller_linenointeger¦nullfalsenoneLine of code where the project logs event was created
span_attributesobject¦nullfalsenoneHuman-identifying attributes of the span, such as name, type, etc.
» additionalPropertiesanyfalsenonenone
» namestring¦nullfalsenoneName of the span, for display purposes only
» typestring¦nullfalsenoneType of the span, for display purposes only
idstring¦nullfalsenoneA unique identifier for the project logs event. If you don't provide one, BrainTrust will generate one for you
_object_deleteboolean¦nullfalsenonePass _object_delete=true to mark the project logs event deleted. Deleted events will not show up in subsequent fetches for this project logs
_is_mergeboolean¦nullfalsenoneThe _is_merge field controls how the row is merged with any existing row with the same id in the DB. By default (or when set to false), the existing row is completely replaced by the new row. When set to true, the new row is deep-merged into the existing row

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": 5, "b": 10}}. If we merge a new row as {"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}. If we replace the new row as {"id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"b": 11, "c": 20}}
_parent_idstring¦nullfalsenoneUse the _parent_id field to create this row as a subspan of an existing row. It cannot be specified alongside _is_merge=true. Tracking hierarchical relationships are important for tracing (see the guide for full details).

For example, say we have logged a row {"id": "abc", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}. We can create a sub-span of the parent row by logging {"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}. In the webapp, only the root span row "abc" will show up in the summary view. You can view the full trace hierarchy (in this case, the "llm_call" row) by clicking on the "abc" row.
Enumerated Values
PropertyValue
typellm
typescore
typefunction
typeeval
typetask
typetool
typenull
_is_mergefalse
_is_mergenull

InsertProjectLogsEventMerge

{
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  },
  "id": "string",
  "_object_delete": true,
  "_is_merge": true,
  "_merge_paths": [["string"]]
}
Properties
NameTypeRequiredRestrictionsDescription
inputanyfalsenoneThe arguments that uniquely define a user input (an arbitrary, JSON serializable object).
outputanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the output should be the result of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question.
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not. Braintrust currently does not compare output to expected for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models.
scoresobject¦nullfalsenoneA 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 logs.
» additionalPropertiesnumber¦nullfalsenonenone
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
metricsobject¦nullfalsenoneMetrics are numerical measurements tracking the execution of the code that produced the project logs event. Use "start" and "end" to track the time span over which the project logs event was produced
» additionalPropertiesanyfalsenonenone
» startnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the project logs event started
» endnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the project logs event finished
» prompt_tokensinteger¦nullfalsenoneThe number of tokens in the prompt used to generate the project logs event (only set if this is an LLM span)
» completion_tokensinteger¦nullfalsenoneThe number of tokens in the completion generated by the model (only set if this is an LLM span)
» tokensinteger¦nullfalsenoneThe total number of tokens in the input and output of the project logs event.
contextobject¦nullfalsenoneContext is additional information about the code that produced the project logs event. It is essentially the textual counterpart to metrics. Use the caller_* attributes to track the location in code which produced the project logs event
» additionalPropertiesanyfalsenonenone
» caller_functionnamestring¦nullfalsenoneThe function in code which created the project logs event
» caller_filenamestring¦nullfalsenoneName of the file in code where the project logs event was created
» caller_linenointeger¦nullfalsenoneLine of code where the project logs event was created
span_attributesobject¦nullfalsenoneHuman-identifying attributes of the span, such as name, type, etc.
» additionalPropertiesanyfalsenonenone
» namestring¦nullfalsenoneName of the span, for display purposes only
» typestring¦nullfalsenoneType of the span, for display purposes only
idstring¦nullfalsenoneA unique identifier for the project logs event. If you don't provide one, BrainTrust will generate one for you
_object_deleteboolean¦nullfalsenonePass _object_delete=true to mark the project logs event deleted. Deleted events will not show up in subsequent fetches for this project logs
_is_mergebooleantruenoneThe _is_merge field controls how the row is merged with any existing row with the same id in the DB. By default (or when set to false), the existing row is completely replaced by the new row. When set to true, the new row is deep-merged into the existing row

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": 5, "b": 10}}. If we merge a new row as {"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}. If we replace the new row as {"id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"b": 11, "c": 20}}
_merge_paths[array]¦nullfalsenoneThe _merge_paths field allows controlling the depth of the merge. It can only be specified alongside _is_merge=true. _merge_paths is a list of paths, where each path is a list of field names. The deep merge will not descend below any of the specified merge paths.

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": {"b": 10}, "c": {"d": 20}}, "output": {"a": 20}}. If we merge a new row as {"_is_merge": true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": 30}, "bar": "baz"}, "output": {"d": 40}}, the new row will be {"id": "foo": "input": {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}. In this case, due to the merge paths, we have replaced input.a and output, but have still deep-merged input and input.c.
Enumerated Values
PropertyValue
typellm
typescore
typefunction
typeeval
typetask
typetool
typenull
_is_mergetrue

InsertProjectLogsEvent

{
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  },
  "id": "string",
  "_object_delete": true,
  "_is_merge": false,
  "_parent_id": "string"
}

A project logs event

Properties

anyOf

NameTypeRequiredRestrictionsDescription
anonymousInsertProjectLogsEventReplacefalsenonenone

or

NameTypeRequiredRestrictionsDescription
anonymousInsertProjectLogsEventMergefalsenonenone

InsertProjectLogsEventRequest

{
  "events": [
    {
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      },
      "id": "string",
      "_object_delete": true,
      "_is_merge": false,
      "_parent_id": "string"
    }
  ]
}
Properties
NameTypeRequiredRestrictionsDescription
events[InsertProjectLogsEvent]truenoneA list of project logs events to insert

ProjectLogsEvent

{
  "id": "string",
  "_xact_id": "string",
  "created": "2019-08-24T14:15:22Z",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "log_id": "g",
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_id": "string",
  "span_parents": ["string"],
  "root_span_id": "string",
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  }
}
Properties
NameTypeRequiredRestrictionsDescription
idstringtruenoneA unique identifier for the project logs event. If you don't provide one, BrainTrust will generate one for you
_xact_idstringtruenoneThe 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 project logs (see the version parameter)
createdstring(date-time)truenoneThe timestamp the project logs event was created
org_idstring(uuid)truenoneUnique id for the organization that the project belongs under
project_idstring(uuid)truenoneUnique identifier for the project
log_idstringtruenoneA literal 'g' which identifies the log as a project log
inputanyfalsenoneThe arguments that uniquely define a user input (an arbitrary, JSON serializable object).
outputanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the output should be the result of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question.
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not. Braintrust currently does not compare output to expected for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models.
scoresobject¦nullfalsenoneA 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 logs.
» additionalPropertiesnumber¦nullfalsenonenone
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
metricsobject¦nullfalsenoneMetrics are numerical measurements tracking the execution of the code that produced the project logs event. Use "start" and "end" to track the time span over which the project logs event was produced
» additionalPropertiesanyfalsenonenone
» startnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the project logs event started
» endnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the project logs event finished
» prompt_tokensinteger¦nullfalsenoneThe number of tokens in the prompt used to generate the project logs event (only set if this is an LLM span)
» completion_tokensinteger¦nullfalsenoneThe number of tokens in the completion generated by the model (only set if this is an LLM span)
» tokensinteger¦nullfalsenoneThe total number of tokens in the input and output of the project logs event.
contextobject¦nullfalsenoneContext is additional information about the code that produced the project logs event. It is essentially the textual counterpart to metrics. Use the caller_* attributes to track the location in code which produced the project logs event
» additionalPropertiesanyfalsenonenone
» caller_functionnamestring¦nullfalsenoneThe function in code which created the project logs event
» caller_filenamestring¦nullfalsenoneName of the file in code where the project logs event was created
» caller_linenointeger¦nullfalsenoneLine of code where the project logs event was created
span_idstringtruenoneA unique identifier used to link different project logs events together as part of a full trace. See the tracing guide for full details on tracing
span_parents[string]¦nullfalsenoneAn array of the parent span_ids of this project logs 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_idstringtruenoneThe span_id of the root of the trace this project logs event belongs to
span_attributesobject¦nullfalsenoneHuman-identifying attributes of the span, such as name, type, etc.
» additionalPropertiesanyfalsenonenone
» namestring¦nullfalsenoneName of the span, for display purposes only
» typestring¦nullfalsenoneType of the span, for display purposes only
Enumerated Values
PropertyValue
log_idg
typellm
typescore
typefunction
typeeval
typetask
typetool
typenull

FetchProjectLogsEventsResponse

{
  "events": [
    {
      "id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "log_id": "g",
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_id": "string",
      "span_parents": ["string"],
      "root_span_id": "string",
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      }
    }
  ],
  "cursor": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
events[ProjectLogsEvent]truenoneA list of fetched events
cursorstring¦nullfalsenonePagination 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.

PathLookupFilter

{
  "type": "path_lookup",
  "path": ["string"],
  "value": null
}

A path-lookup filter describes an equality comparison against a specific sub-field in the event row. For instance, if you wish to filter on the value of c in {"input": {"a": {"b": {"c": "hello"}}}}, pass path=["input", "a", "b", "c"] and value="hello"

Properties
NameTypeRequiredRestrictionsDescription
typestringtruenoneDenotes the type of filter as a path-lookup filter
path[string]truenoneList of fields describing the path to the value to be checked against. For instance, if you wish to filter on the value of c in {"input": {"a": {"b": {"c": "hello"}}}}, pass path=["input", "a", "b", "c"]
valueanyfalsenoneThe value to compare equality-wise against the event value at the specified path. The value must be a "primitive", that is, any JSON-serializable object except for objects and arrays. For instance, if you wish to filter on the value of "input.a.b.c" in the object {"input": {"a": {"b": {"c": "hello"}}}}, pass value="hello"
Enumerated Values
PropertyValue
typepath_lookup

FetchEventsFilters

[
  {
    "type": "path_lookup",
    "path": ["string"],
    "value": 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

Properties
NameTypeRequiredRestrictionsDescription
anonymous[PathLookupFilter]¦nullfalsenoneA list of filters on the events to fetch. Currently, only path-lookup type filters are supported, but we may add more in the future

FetchEventsRequest

{
  "limit": 0,
  "cursor": "string",
  "max_xact_id": "string",
  "max_root_span_id": "string",
  "filters": [
    {
      "type": "path_lookup",
      "path": ["string"],
      "value": null
    }
  ],
  "version": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
limitinteger¦nullfalsenonelimit 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.
cursorstring¦nullfalsenoneAn 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¦nullfalsenoneDEPRECATION 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¦nullfalsenoneDEPRECATION 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.
filtersFetchEventsFiltersfalsenoneA 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¦nullfalsenoneRetrieve 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.

FeedbackProjectLogsItem

{
  "id": "string",
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "expected": null,
  "comment": "string",
  "metadata": {
    "property1": null,
    "property2": null
  },
  "source": "app"
}
Properties
NameTypeRequiredRestrictionsDescription
idstringtruenoneThe id of the project logs event to log feedback for. This is the row id returned by POST /v1/project_logs/{project_id}/insert
scoresobject¦nullfalsenoneA dictionary of numeric values (between 0 and 1) to log. These scores will be merged into the existing scores for the project logs event
» additionalPropertiesnumber¦nullfalsenonenone
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not
commentstring¦nullfalsenoneAn optional comment string to log about the project logs event
metadataobject¦nullfalsenoneA 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.
» additionalPropertiesanyfalsenonenone
sourcestring¦nullfalsenoneThe source of the feedback. Must be one of "external" (default), "app", or "api"
Enumerated Values
PropertyValue
sourceapp
sourceapi
sourceexternal
sourcenull

FeedbackProjectLogsEventRequest

{
  "feedback": [
    {
      "id": "string",
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "expected": null,
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Properties
NameTypeRequiredRestrictionsDescription
feedback[FeedbackProjectLogsItem]truenoneA list of project logs feedback items

RepoInfo

{
  "commit": "string",
  "branch": "string",
  "tag": "string",
  "dirty": true,
  "author_name": "string",
  "author_email": "string",
  "commit_message": "string",
  "commit_time": "string",
  "git_diff": "string"
}

Metadata about the state of the repo when the experiment was created

Properties
NameTypeRequiredRestrictionsDescription
commitstring¦nullfalsenoneSHA of most recent commit
branchstring¦nullfalsenoneName of the branch the most recent commit belongs to
tagstring¦nullfalsenoneName of the tag on the most recent commit
dirtyboolean¦nullfalsenoneWhether or not the repo had uncommitted changes when snapshotted
author_namestring¦nullfalsenoneName of the author of the most recent commit
author_emailstring¦nullfalsenoneEmail of the author of the most recent commit
commit_messagestring¦nullfalsenoneMost recent commit message
commit_timestring¦nullfalsenoneTime of the most recent commit
git_diffstring¦nullfalsenoneIf the repo was dirty when run, this includes the diff between the current state of the repo and the most recent commit.

Experiment

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "commit": "string",
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "deleted_at": "2019-08-24T14:15:22Z",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "metadata": {
    "property1": null,
    "property2": null
  }
}
Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the experiment
project_idstring(uuid)truenoneUnique identifier for the project that the experiment belongs under
namestringtruenoneName of the experiment. Within a project, experiment names are unique
descriptionstring¦nullfalsenoneTextual description of the experiment
createdstring(date-time)¦nullfalsenoneDate of experiment creation
repo_infoRepoInfofalsenoneMetadata about the state of the repo when the experiment was created
commitstring¦nullfalsenoneCommit, taken directly from repo_info.commit
base_exp_idstring(uuid)¦nullfalsenoneId of default base experiment to compare against when viewing this experiment
deleted_atstring(date-time)¦nullfalsenoneDate of experiment deletion, or null if the experiment is still active
dataset_idstring(uuid)¦nullfalsenoneIdentifier of the linked dataset, or null if the experiment is not linked to a dataset
dataset_versionstring¦nullfalsenoneVersion number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
publicbooleantruenoneWhether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the experiment
metadataobject¦nullfalsenoneUser-controlled metadata about the experiment
» additionalPropertiesanyfalsenonenone

CreateExperiment

{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "ensure_new": true
}
Properties
NameTypeRequiredRestrictionsDescription
project_idstring(uuid)truenoneUnique identifier for the project that the experiment belongs under
namestring¦nullfalsenoneName of the experiment. Within a project, experiment names are unique
descriptionstring¦nullfalsenoneTextual description of the experiment
repo_infoRepoInfofalsenoneMetadata about the state of the repo when the experiment was created
base_exp_idstring(uuid)¦nullfalsenoneId of default base experiment to compare against when viewing this experiment
dataset_idstring(uuid)¦nullfalsenoneIdentifier of the linked dataset, or null if the experiment is not linked to a dataset
dataset_versionstring¦nullfalsenoneVersion number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
publicboolean¦nullfalsenoneWhether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
metadataobject¦nullfalsenoneUser-controlled metadata about the experiment
» additionalPropertiesanyfalsenonenone
ensure_newboolean¦nullfalsenoneNormally, 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.

PatchExperiment

{
  "name": "string",
  "description": "string",
  "repo_info": {
    "commit": "string",
    "branch": "string",
    "tag": "string",
    "dirty": true,
    "author_name": "string",
    "author_email": "string",
    "commit_message": "string",
    "commit_time": "string",
    "git_diff": "string"
  },
  "base_exp_id": "4838cee2-a665-4545-aa9f-483678c01a6b",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "dataset_version": "string",
  "public": true,
  "metadata": {
    "property1": null,
    "property2": null
  }
}
Properties
NameTypeRequiredRestrictionsDescription
namestring¦nullfalsenoneName of the experiment. Within a project, experiment names are unique
descriptionstring¦nullfalsenoneTextual description of the experiment
repo_infoRepoInfofalsenoneMetadata about the state of the repo when the experiment was created
base_exp_idstring(uuid)¦nullfalsenoneId of default base experiment to compare against when viewing this experiment
dataset_idstring(uuid)¦nullfalsenoneIdentifier of the linked dataset, or null if the experiment is not linked to a dataset
dataset_versionstring¦nullfalsenoneVersion number of the linked dataset the experiment was run against. This can be used to reproduce the experiment after the dataset has been modified.
publicboolean¦nullfalsenoneWhether or not the experiment is public. Public experiments can be viewed by anybody inside or outside the organization
metadataobject¦nullfalsenoneUser-controlled metadata about the experiment
» additionalPropertiesanyfalsenonenone

InsertExperimentEventReplace

{
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  },
  "id": "string",
  "dataset_record_id": "string",
  "_object_delete": true,
  "_is_merge": false,
  "_parent_id": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
inputanyfalsenoneThe arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on, Braintrust will use the input to know whether two test cases are the same between experiments, so they should not contain experiment-specific state. A simple rule of thumb is that if you run the same experiment twice, the input should be identical
outputanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the output should be the result of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not. Braintrust currently does not compare output to expected for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate your experiments while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models
scoresobject¦nullfalsenoneA 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
» additionalPropertiesnumber¦nullfalsenonenone
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
metricsobject¦nullfalsenoneMetrics 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
» additionalPropertiesanyfalsenonenone
» startnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the experiment event started
» endnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the experiment event finished
» prompt_tokensinteger¦nullfalsenoneThe number of tokens in the prompt used to generate the experiment event (only set if this is an LLM span)
» completion_tokensinteger¦nullfalsenoneThe number of tokens in the completion generated by the model (only set if this is an LLM span)
» tokensinteger¦nullfalsenoneThe total number of tokens in the input and output of the experiment event.
contextobject¦nullfalsenoneContext 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
» additionalPropertiesanyfalsenonenone
» caller_functionnamestring¦nullfalsenoneThe function in code which created the experiment event
» caller_filenamestring¦nullfalsenoneName of the file in code where the experiment event was created
» caller_linenointeger¦nullfalsenoneLine of code where the experiment event was created
span_attributesobject¦nullfalsenoneHuman-identifying attributes of the span, such as name, type, etc.
» additionalPropertiesanyfalsenonenone
» namestring¦nullfalsenoneName of the span, for display purposes only
» typestring¦nullfalsenoneType of the span, for display purposes only
idstring¦nullfalsenoneA unique identifier for the experiment event. If you don't provide one, BrainTrust will generate one for you
dataset_record_idstring¦nullfalsenoneIf the experiment is associated to a dataset, this is the event-level dataset id this experiment event is tied to
_object_deleteboolean¦nullfalsenonePass _object_delete=true to mark the experiment event deleted. Deleted events will not show up in subsequent fetches for this experiment
_is_mergeboolean¦nullfalsenoneThe _is_merge field controls how the row is merged with any existing row with the same id in the DB. By default (or when set to false), the existing row is completely replaced by the new row. When set to true, the new row is deep-merged into the existing row

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": 5, "b": 10}}. If we merge a new row as {"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}. If we replace the new row as {"id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"b": 11, "c": 20}}
_parent_idstring¦nullfalsenoneUse the _parent_id field to create this row as a subspan of an existing row. It cannot be specified alongside _is_merge=true. Tracking hierarchical relationships are important for tracing (see the guide for full details).

For example, say we have logged a row {"id": "abc", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}. We can create a sub-span of the parent row by logging {"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}. In the webapp, only the root span row "abc" will show up in the summary view. You can view the full trace hierarchy (in this case, the "llm_call" row) by clicking on the "abc" row.
Enumerated Values
PropertyValue
typellm
typescore
typefunction
typeeval
typetask
typetool
typenull
_is_mergefalse
_is_mergenull

InsertExperimentEventMerge

{
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  },
  "id": "string",
  "dataset_record_id": "string",
  "_object_delete": true,
  "_is_merge": true,
  "_merge_paths": [["string"]]
}
Properties
NameTypeRequiredRestrictionsDescription
inputanyfalsenoneThe arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on, Braintrust will use the input to know whether two test cases are the same between experiments, so they should not contain experiment-specific state. A simple rule of thumb is that if you run the same experiment twice, the input should be identical
outputanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the output should be the result of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not. Braintrust currently does not compare output to expected for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate your experiments while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models
scoresobject¦nullfalsenoneA 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
» additionalPropertiesnumber¦nullfalsenonenone
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
metricsobject¦nullfalsenoneMetrics 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
» additionalPropertiesanyfalsenonenone
» startnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the experiment event started
» endnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the experiment event finished
» prompt_tokensinteger¦nullfalsenoneThe number of tokens in the prompt used to generate the experiment event (only set if this is an LLM span)
» completion_tokensinteger¦nullfalsenoneThe number of tokens in the completion generated by the model (only set if this is an LLM span)
» tokensinteger¦nullfalsenoneThe total number of tokens in the input and output of the experiment event.
contextobject¦nullfalsenoneContext 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
» additionalPropertiesanyfalsenonenone
» caller_functionnamestring¦nullfalsenoneThe function in code which created the experiment event
» caller_filenamestring¦nullfalsenoneName of the file in code where the experiment event was created
» caller_linenointeger¦nullfalsenoneLine of code where the experiment event was created
span_attributesobject¦nullfalsenoneHuman-identifying attributes of the span, such as name, type, etc.
» additionalPropertiesanyfalsenonenone
» namestring¦nullfalsenoneName of the span, for display purposes only
» typestring¦nullfalsenoneType of the span, for display purposes only
idstring¦nullfalsenoneA unique identifier for the experiment event. If you don't provide one, BrainTrust will generate one for you
dataset_record_idstring¦nullfalsenoneIf the experiment is associated to a dataset, this is the event-level dataset id this experiment event is tied to
_object_deleteboolean¦nullfalsenonePass _object_delete=true to mark the experiment event deleted. Deleted events will not show up in subsequent fetches for this experiment
_is_mergebooleantruenoneThe _is_merge field controls how the row is merged with any existing row with the same id in the DB. By default (or when set to false), the existing row is completely replaced by the new row. When set to true, the new row is deep-merged into the existing row

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": 5, "b": 10}}. If we merge a new row as {"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}. If we replace the new row as {"id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"b": 11, "c": 20}}
_merge_paths[array]¦nullfalsenoneThe _merge_paths field allows controlling the depth of the merge. It can only be specified alongside _is_merge=true. _merge_paths is a list of paths, where each path is a list of field names. The deep merge will not descend below any of the specified merge paths.

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": {"b": 10}, "c": {"d": 20}}, "output": {"a": 20}}. If we merge a new row as {"_is_merge": true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": 30}, "bar": "baz"}, "output": {"d": 40}}, the new row will be {"id": "foo": "input": {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}. In this case, due to the merge paths, we have replaced input.a and output, but have still deep-merged input and input.c.
Enumerated Values
PropertyValue
typellm
typescore
typefunction
typeeval
typetask
typetool
typenull
_is_mergetrue

InsertExperimentEvent

{
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  },
  "id": "string",
  "dataset_record_id": "string",
  "_object_delete": true,
  "_is_merge": false,
  "_parent_id": "string"
}

An experiment event

Properties

anyOf

NameTypeRequiredRestrictionsDescription
anonymousInsertExperimentEventReplacefalsenonenone

or

NameTypeRequiredRestrictionsDescription
anonymousInsertExperimentEventMergefalsenonenone

InsertExperimentEventRequest

{
  "events": [
    {
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      },
      "id": "string",
      "dataset_record_id": "string",
      "_object_delete": true,
      "_is_merge": false,
      "_parent_id": "string"
    }
  ]
}
Properties
NameTypeRequiredRestrictionsDescription
events[InsertExperimentEvent]truenoneA list of experiment events to insert

ExperimentEvent

{
  "id": "string",
  "dataset_record_id": "string",
  "_xact_id": "string",
  "created": "2019-08-24T14:15:22Z",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "experiment_id": "916afd89-cac5-4339-9c59-dd068abdfa69",
  "input": null,
  "output": null,
  "expected": null,
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "metrics": {
    "start": 0,
    "end": 0,
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "tokens": 0,
    "property1": null,
    "property2": null
  },
  "context": {
    "caller_functionname": "string",
    "caller_filename": "string",
    "caller_lineno": 0,
    "property1": null,
    "property2": null
  },
  "span_id": "string",
  "span_parents": ["string"],
  "root_span_id": "string",
  "span_attributes": {
    "name": "string",
    "type": "llm",
    "property1": null,
    "property2": null
  }
}
Properties
NameTypeRequiredRestrictionsDescription
idstringtruenoneA unique identifier for the experiment event. If you don't provide one, BrainTrust will generate one for you
dataset_record_idstring¦nullfalsenoneIf the experiment is associated to a dataset, this is the event-level dataset id this experiment event is tied to
_xact_idstringtruenoneThe 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)
createdstring(date-time)truenoneThe timestamp the experiment event was created
project_idstring(uuid)truenoneUnique identifier for the project that the experiment belongs under
experiment_idstring(uuid)truenoneUnique identifier for the experiment
inputanyfalsenoneThe arguments that uniquely define a test case (an arbitrary, JSON serializable object). Later on, Braintrust will use the input to know whether two test cases are the same between experiments, so they should not contain experiment-specific state. A simple rule of thumb is that if you run the same experiment twice, the input should be identical
outputanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object), that allows you to determine whether the result is correct or not. For example, in an app that generates SQL queries, the output should be the result of the SQL query generated by the model, not the query itself, because there may be multiple valid queries that answer a single question
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not. Braintrust currently does not compare output to expected for you, since there are so many different ways to do that correctly. Instead, these values are just used to help you navigate your experiments while digging into analyses. However, we may later use these values to re-score outputs or fine-tune your models
scoresobject¦nullfalsenoneA 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
» additionalPropertiesnumber¦nullfalsenonenone
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
metricsobject¦nullfalsenoneMetrics 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
» additionalPropertiesanyfalsenonenone
» startnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the experiment event started
» endnumber¦nullfalsenoneA unix timestamp recording when the section of code which produced the experiment event finished
» prompt_tokensinteger¦nullfalsenoneThe number of tokens in the prompt used to generate the experiment event (only set if this is an LLM span)
» completion_tokensinteger¦nullfalsenoneThe number of tokens in the completion generated by the model (only set if this is an LLM span)
» tokensinteger¦nullfalsenoneThe total number of tokens in the input and output of the experiment event.
contextobject¦nullfalsenoneContext 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
» additionalPropertiesanyfalsenonenone
» caller_functionnamestring¦nullfalsenoneThe function in code which created the experiment event
» caller_filenamestring¦nullfalsenoneName of the file in code where the experiment event was created
» caller_linenointeger¦nullfalsenoneLine of code where the experiment event was created
span_idstringtruenoneA unique identifier used to link different experiment events together as part of a full trace. See the tracing guide for full details on tracing
span_parents[string]¦nullfalsenoneAn 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_idstringtruenoneThe span_id of the root of the trace this experiment event belongs to
span_attributesobject¦nullfalsenoneHuman-identifying attributes of the span, such as name, type, etc.
» additionalPropertiesanyfalsenonenone
» namestring¦nullfalsenoneName of the span, for display purposes only
» typestring¦nullfalsenoneType of the span, for display purposes only
Enumerated Values
PropertyValue
typellm
typescore
typefunction
typeeval
typetask
typetool
typenull

FetchExperimentEventsResponse

{
  "events": [
    {
      "id": "string",
      "dataset_record_id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "experiment_id": "916afd89-cac5-4339-9c59-dd068abdfa69",
      "input": null,
      "output": null,
      "expected": null,
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "metrics": {
        "start": 0,
        "end": 0,
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "tokens": 0,
        "property1": null,
        "property2": null
      },
      "context": {
        "caller_functionname": "string",
        "caller_filename": "string",
        "caller_lineno": 0,
        "property1": null,
        "property2": null
      },
      "span_id": "string",
      "span_parents": ["string"],
      "root_span_id": "string",
      "span_attributes": {
        "name": "string",
        "type": "llm",
        "property1": null,
        "property2": null
      }
    }
  ],
  "cursor": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
events[ExperimentEvent]truenoneA list of fetched events
cursorstring¦nullfalsenonePagination 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.

FeedbackExperimentItem

{
  "id": "string",
  "scores": {
    "property1": 1,
    "property2": 1
  },
  "expected": null,
  "comment": "string",
  "metadata": {
    "property1": null,
    "property2": null
  },
  "source": "app"
}
Properties
NameTypeRequiredRestrictionsDescription
idstringtruenoneThe id of the experiment event to log feedback for. This is the row id returned by POST /v1/experiment/{experiment_id}/insert
scoresobject¦nullfalsenoneA dictionary of numeric values (between 0 and 1) to log. These scores will be merged into the existing scores for the experiment event
» additionalPropertiesnumber¦nullfalsenonenone
expectedanyfalsenoneThe ground truth value (an arbitrary, JSON serializable object) that you'd compare to output to determine if your output value is correct or not
commentstring¦nullfalsenoneAn optional comment string to log about the experiment event
metadataobject¦nullfalsenoneA 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.
» additionalPropertiesanyfalsenonenone
sourcestring¦nullfalsenoneThe source of the feedback. Must be one of "external" (default), "app", or "api"
Enumerated Values
PropertyValue
sourceapp
sourceapi
sourceexternal
sourcenull

FeedbackExperimentEventRequest

{
  "feedback": [
    {
      "id": "string",
      "scores": {
        "property1": 1,
        "property2": 1
      },
      "expected": null,
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Properties
NameTypeRequiredRestrictionsDescription
feedback[FeedbackExperimentItem]truenoneA list of experiment feedback items

ScoreSummary

{
  "name": "string",
  "score": 1,
  "diff": -1,
  "improvements": 0,
  "regressions": 0
}

Summary of a score's performance

Properties
NameTypeRequiredRestrictionsDescription
namestringtruenoneName of the score
scorenumbertruenoneAverage score across all examples
diffnumberfalsenoneDifference in score between the current and comparison experiment
improvementsintegertruenoneNumber of improvements in the score
regressionsintegertruenoneNumber of regressions in the score

MetricSummary

{
  "name": "string",
  "metric": 0,
  "unit": "string",
  "diff": 0,
  "improvements": 0,
  "regressions": 0
}

Summary of a metric's performance

Properties
NameTypeRequiredRestrictionsDescription
namestringtruenoneName of the metric
metricnumbertruenoneAverage metric across all examples
unitstringtruenoneUnit label for the metric
diffnumberfalsenoneDifference in metric between the current and comparison experiment
improvementsintegertruenoneNumber of improvements in the metric
regressionsintegertruenoneNumber of regressions in the metric

SummarizeExperimentResponse

{
  "project_name": "string",
  "experiment_name": "string",
  "project_url": "http://example.com",
  "experiment_url": "http://example.com",
  "comparison_experiment_name": "string",
  "scores": {
    "property1": {
      "name": "string",
      "score": 1,
      "diff": -1,
      "improvements": 0,
      "regressions": 0
    },
    "property2": {
      "name": "string",
      "score": 1,
      "diff": -1,
      "improvements": 0,
      "regressions": 0
    }
  },
  "metrics": {
    "property1": {
      "name": "string",
      "metric": 0,
      "unit": "string",
      "diff": 0,
      "improvements": 0,
      "regressions": 0
    },
    "property2": {
      "name": "string",
      "metric": 0,
      "unit": "string",
      "diff": 0,
      "improvements": 0,
      "regressions": 0
    }
  }
}

Summary of an experiment

Properties
NameTypeRequiredRestrictionsDescription
project_namestringtruenoneName of the project that the experiment belongs to
experiment_namestringtruenoneName of the experiment
project_urlstring(uri)truenoneURL to the project's page in the Braintrust app
experiment_urlstring(uri)truenoneURL to the experiment's page in the Braintrust app
comparison_experiment_namestring¦nullfalsenoneThe experiment which scores are baselined against
scoresobject¦nullfalsenoneSummary of the experiment's scores
» additionalPropertiesScoreSummaryfalsenoneSummary of a score's performance
metricsobject¦nullfalsenoneSummary of the experiment's metrics
» additionalPropertiesMetricSummaryfalsenoneSummary of a metric's performance

Dataset

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}
Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the dataset
project_idstring(uuid)¦nullfalsenoneUnique identifier for the project that the dataset belongs under
namestringtruenoneName of the dataset. Within a project, dataset names are unique
descriptionstring¦nullfalsenoneTextual description of the dataset
createdstring(date-time)¦nullfalsenoneDate of dataset creation
deleted_atstring(date-time)¦nullfalsenoneDate of dataset deletion, or null if the dataset is still active
user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the dataset

CreateDataset

{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "description": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
project_idstring(uuid)¦nullfalsenoneUnique identifier for the project that the dataset belongs under
namestringtruenoneName of the dataset. Within a project, dataset names are unique
descriptionstring¦nullfalsenoneTextual description of the dataset

PatchDataset

{
  "name": "string",
  "description": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
namestring¦nullfalsenoneName of the dataset. Within a project, dataset names are unique
descriptionstring¦nullfalsenoneTextual description of the dataset

InsertDatasetEventReplace

{
  "input": null,
  "expected": null,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "id": "string",
  "_object_delete": true,
  "_is_merge": false,
  "_parent_id": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
inputanyfalsenoneThe argument that uniquely define an input case (an arbitrary, JSON serializable object)
expectedanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object)
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
idstring¦nullfalsenoneA unique identifier for the dataset event. If you don't provide one, BrainTrust will generate one for you
_object_deleteboolean¦nullfalsenonePass _object_delete=true to mark the dataset event deleted. Deleted events will not show up in subsequent fetches for this dataset
_is_mergeboolean¦nullfalsenoneThe _is_merge field controls how the row is merged with any existing row with the same id in the DB. By default (or when set to false), the existing row is completely replaced by the new row. When set to true, the new row is deep-merged into the existing row

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": 5, "b": 10}}. If we merge a new row as {"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}. If we replace the new row as {"id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"b": 11, "c": 20}}
_parent_idstring¦nullfalsenoneUse the _parent_id field to create this row as a subspan of an existing row. It cannot be specified alongside _is_merge=true. Tracking hierarchical relationships are important for tracing (see the guide for full details).

For example, say we have logged a row {"id": "abc", "input": "foo", "output": "bar", "expected": "boo", "scores": {"correctness": 0.33}}. We can create a sub-span of the parent row by logging {"_parent_id": "abc", "id": "llm_call", "input": {"prompt": "What comes after foo?"}, "output": "bar", "metrics": {"tokens": 1}}. In the webapp, only the root span row "abc" will show up in the summary view. You can view the full trace hierarchy (in this case, the "llm_call" row) by clicking on the "abc" row.
Enumerated Values
PropertyValue
_is_mergefalse
_is_mergenull

InsertDatasetEventMerge

{
  "input": null,
  "expected": null,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "id": "string",
  "_object_delete": true,
  "_is_merge": true,
  "_merge_paths": [["string"]]
}
Properties
NameTypeRequiredRestrictionsDescription
inputanyfalsenoneThe argument that uniquely define an input case (an arbitrary, JSON serializable object)
expectedanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object)
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
idstring¦nullfalsenoneA unique identifier for the dataset event. If you don't provide one, BrainTrust will generate one for you
_object_deleteboolean¦nullfalsenonePass _object_delete=true to mark the dataset event deleted. Deleted events will not show up in subsequent fetches for this dataset
_is_mergebooleantruenoneThe _is_merge field controls how the row is merged with any existing row with the same id in the DB. By default (or when set to false), the existing row is completely replaced by the new row. When set to true, the new row is deep-merged into the existing row

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": 5, "b": 10}}. If we merge a new row as {"_is_merge": true, "id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"a": 5, "b": 11, "c": 20}}. If we replace the new row as {"id": "foo", "input": {"b": 11, "c": 20}}, the new row will be {"id": "foo", "input": {"b": 11, "c": 20}}
_merge_paths[array]¦nullfalsenoneThe _merge_paths field allows controlling the depth of the merge. It can only be specified alongside _is_merge=true. _merge_paths is a list of paths, where each path is a list of field names. The deep merge will not descend below any of the specified merge paths.

For example, say there is an existing row in the DB {"id": "foo", "input": {"a": {"b": 10}, "c": {"d": 20}}, "output": {"a": 20}}. If we merge a new row as {"_is_merge": true, "_merge_paths": [["input", "a"], ["output"]], "input": {"a": {"q": 30}, "c": {"e": 30}, "bar": "baz"}, "output": {"d": 40}}, the new row will be {"id": "foo": "input": {"a": {"q": 30}, "c": {"d": 20, "e": 30}, "bar": "baz"}, "output": {"d": 40}}. In this case, due to the merge paths, we have replaced input.a and output, but have still deep-merged input and input.c.
Enumerated Values
PropertyValue
_is_mergetrue

InsertDatasetEvent

{
  "input": null,
  "expected": null,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "id": "string",
  "_object_delete": true,
  "_is_merge": false,
  "_parent_id": "string"
}

A dataset event

Properties

anyOf

NameTypeRequiredRestrictionsDescription
anonymousInsertDatasetEventReplacefalsenonenone

or

NameTypeRequiredRestrictionsDescription
anonymousInsertDatasetEventMergefalsenonenone

InsertDatasetEventRequest

{
  "events": [
    {
      "input": null,
      "expected": null,
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "id": "string",
      "_object_delete": true,
      "_is_merge": false,
      "_parent_id": "string"
    }
  ]
}
Properties
NameTypeRequiredRestrictionsDescription
events[InsertDatasetEvent]truenoneA list of dataset events to insert

DatasetEvent

{
  "id": "string",
  "_xact_id": "string",
  "created": "2019-08-24T14:15:22Z",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
  "input": null,
  "expected": null,
  "metadata": {
    "property1": null,
    "property2": null
  },
  "tags": ["string"],
  "span_id": "string",
  "root_span_id": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
idstringtruenoneA unique identifier for the dataset event. If you don't provide one, BrainTrust will generate one for you
_xact_idstringtruenoneThe 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 dataset (see the version parameter)
createdstring(date-time)truenoneThe timestamp the dataset event was created
project_idstring(uuid)¦nullfalsenoneUnique identifier for the project that the dataset belongs under
dataset_idstring(uuid)truenoneUnique identifier for the dataset
inputanyfalsenoneThe argument that uniquely define an input case (an arbitrary, JSON serializable object)
expectedanyfalsenoneThe output of your application, including post-processing (an arbitrary, JSON serializable object)
metadataobject¦nullfalsenoneA 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
» additionalPropertiesanyfalsenonenone
tags[string]¦nullfalsenoneA list of tags to log
span_idstringtruenoneA unique identifier used to link different dataset events together as part of a full trace. See the tracing guide for full details on tracing
root_span_idstringtruenoneThe span_id of the root of the trace this dataset event belongs to

FetchDatasetEventsResponse

{
  "events": [
    {
      "id": "string",
      "_xact_id": "string",
      "created": "2019-08-24T14:15:22Z",
      "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
      "dataset_id": "8c4c51f1-f6f3-43bc-b65d-7415e8ef22c0",
      "input": null,
      "expected": null,
      "metadata": {
        "property1": null,
        "property2": null
      },
      "tags": ["string"],
      "span_id": "string",
      "root_span_id": "string"
    }
  ],
  "cursor": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
events[DatasetEvent]truenoneA list of fetched events
cursorstring¦nullfalsenonePagination 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.

FeedbackDatasetItem

{
  "id": "string",
  "comment": "string",
  "metadata": {
    "property1": null,
    "property2": null
  },
  "source": "app"
}
Properties
NameTypeRequiredRestrictionsDescription
idstringtruenoneThe id of the dataset event to log feedback for. This is the row id returned by POST /v1/dataset/{dataset_id}/insert
commentstring¦nullfalsenoneAn optional comment string to log about the dataset event
metadataobject¦nullfalsenoneA 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.
» additionalPropertiesanyfalsenonenone
sourcestring¦nullfalsenoneThe source of the feedback. Must be one of "external" (default), "app", or "api"
Enumerated Values
PropertyValue
sourceapp
sourceapi
sourceexternal
sourcenull

FeedbackDatasetEventRequest

{
  "feedback": [
    {
      "id": "string",
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Properties
NameTypeRequiredRestrictionsDescription
feedback[FeedbackDatasetItem]truenoneA list of dataset feedback items

DataSummary

{
  "total_records": 0
}

Summary of a dataset's data

Properties
NameTypeRequiredRestrictionsDescription
total_recordsintegertruenoneTotal number of records in the dataset

SummarizeDatasetResponse

{
  "project_name": "string",
  "dataset_name": "string",
  "project_url": "http://example.com",
  "dataset_url": "http://example.com",
  "data_summary": {
    "total_records": 0
  }
}

Summary of a dataset

Properties
NameTypeRequiredRestrictionsDescription
project_namestringtruenoneName of the project that the dataset belongs to
dataset_namestringtruenoneName of the dataset
project_urlstring(uri)truenoneURL to the project's page in the Braintrust app
dataset_urlstring(uri)truenoneURL to the dataset's page in the Braintrust app
data_summaryDataSummaryfalsenoneSummary of a dataset's data

PromptData

{
  "prompt": {
    "type": "completion",
    "content": "string"
  },
  "options": {
    "model": "string",
    "params": {
      "use_cache": true,
      "temperature": 0,
      "top_p": 0,
      "max_tokens": 0,
      "frequency_penalty": 0,
      "presence_penalty": 0,
      "response_format": {
        "type": "json_object"
      },
      "tool_choice": "auto",
      "function_call": "auto",
      "n": 0,
      "stop": ["string"]
    },
    "position": "string"
  },
  "origin": {
    "prompt_id": "string",
    "project_id": "string",
    "prompt_version": "string"
  }
}

The prompt, model, and its parameters

Properties
NameTypeRequiredRestrictionsDescription
promptanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
» anonymousobjectfalsenonenone
»» typestringtruenonenone
»» contentstringtruenonenone

or

NameTypeRequiredRestrictionsDescription
» anonymousobjectfalsenonenone
»» typestringtruenonenone
»» messages[anyOf]truenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»» anonymousobjectfalsenonenone
»»»» contentstringfalsenonenone
»»»» rolestringtruenonenone
»»»» namestringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»» anonymousobjectfalsenonenone
»»»» contentanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»» anonymous[anyOf]falsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»» anonymousobjectfalsenonenone
»»»»»»» textstringfalsenonenone
»»»»»»» typestringtruenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»» anonymousobjectfalsenonenone
»»»»»»» image_urlobjecttruenonenone
»»»»»»»» urlstringtruenonenone
»»»»»»»» detailanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»»»»»»» anonymousstringfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
»»»»»»» typestringtruenonenone
»»»» rolestringtruenonenone
»»»» namestringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»» anonymousobjectfalsenonenone
»»»» rolestringtruenonenone
»»»» contentstring¦nullfalsenonenone
»»»» function_callobjectfalsenonenone
»»»»» argumentsstringtruenonenone
»»»»» namestringtruenonenone
»»»» namestringfalsenonenone
»»»» tool_calls[object]falsenonenone
»»»»» idstringtruenonenone
»»»»» functionobjecttruenonenone
»»»»»» argumentsstringtruenonenone
»»»»»» namestringtruenonenone
»»»»» typestringtruenonenone

or

NameTypeRequiredRestrictionsDescription
»»» anonymousobjectfalsenonenone
»»»» contentstringfalsenonenone
»»»» rolestringtruenonenone
»»»» tool_call_idstringtruenonenone

or

NameTypeRequiredRestrictionsDescription
»»» anonymousobjectfalsenonenone
»»»» contentstringfalsenonenone
»»»» namestringtruenonenone
»»»» rolestringtruenonenone

continued

NameTypeRequiredRestrictionsDescription
»» toolsstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
» anonymousobject¦nullfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
optionsobject¦nullfalsenonenone
» modelstringfalsenonenone
» paramsanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»» anonymousobjectfalsenonenone
»»» use_cachebooleanfalsenonenone
»»» temperaturenumberfalsenonenone
»»» top_pnumberfalsenonenone
»»» max_tokensnumberfalsenonenone
»»» frequency_penaltynumberfalsenonenone
»»» presence_penaltynumberfalsenonenone
»»» response_formatobject¦nullfalsenonenone
»»»» typestringtruenonenone
»»» tool_choiceanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»» anonymousobjectfalsenonenone
»»»»» typestringtruenonenone
»»»»» functionobjecttruenonenone
»»»»»» namestringtruenonenone

continued

NameTypeRequiredRestrictionsDescription
»»» function_callanyfalsenonenone

anyOf

NameTypeRequiredRestrictionsDescription
»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»» anonymousstringfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»»»» anonymousobjectfalsenonenone
»»»»» namestringtruenonenone

continued

NameTypeRequiredRestrictionsDescription
»»» nnumberfalsenonenone
»»» stop[string]falsenonenone

or

NameTypeRequiredRestrictionsDescription
»» anonymousobjectfalsenonenone
»»» use_cachebooleanfalsenonenone
»»» max_tokensnumbertruenonenone
»»» temperaturenumbertruenonenone
»»» top_pnumberfalsenonenone
»»» top_knumberfalsenonenone
»»» stop_sequences[string]falsenonenone
»»» max_tokens_to_samplenumberfalsenoneThis is a legacy parameter that should not be used.

or

NameTypeRequiredRestrictionsDescription
»» anonymousobjectfalsenonenone
»»» use_cachebooleanfalsenonenone
»»» temperaturenumbertruenonenone
»»» maxOutputTokensnumberfalsenonenone
»»» topPnumberfalsenonenone
»»» topKnumberfalsenonenone

or

NameTypeRequiredRestrictionsDescription
»» anonymousobjectfalsenonenone
»»» use_cachebooleanfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
» positionstringfalsenonenone
originobject¦nullfalsenonenone
» prompt_idstringfalsenonenone
» project_idstringfalsenonenone
» prompt_versionstringfalsenonenone
Enumerated Values
PropertyValue
typecompletion
typechat
rolesystem
typetext
anonymousauto
anonymouslow
anonymoushigh
typeimage_url
roleuser
roleassistant
typefunction
roletool
rolefunction
typejson_object
anonymousauto
anonymousnone
typefunction
anonymousauto
anonymousnone

Prompt

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "_xact_id": "string",
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "log_id": "p",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "name": "string",
  "slug": "string",
  "description": "string",
  "created": "2019-08-24T14:15:22Z",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"],
  "metadata": {
    "property1": null,
    "property2": null
  }
}
Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the prompt
_xact_idstringtruenoneThe 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 prompt (see the version parameter)
project_idstring(uuid)truenoneUnique identifier for the project that the prompt belongs under
log_idstringtruenoneA literal 'p' which identifies the object as a project prompt
org_idstring(uuid)truenoneUnique identifier for the organization
namestringtruenoneName of the prompt
slugstringtruenoneUnique identifier for the prompt
descriptionstring¦nullfalsenoneTextual description of the prompt
createdstring(date-time)¦nullfalsenoneDate of prompt creation
prompt_dataPromptDatafalsenoneThe prompt, model, and its parameters
tags[string]¦nullfalsenoneA list of tags for the prompt
metadataobject¦nullfalsenoneUser-controlled metadata about the prompt
» additionalPropertiesanyfalsenonenone
Enumerated Values
PropertyValue
log_idp

CreatePrompt

{
  "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
  "name": "string",
  "slug": "string",
  "description": "string",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"]
}
Properties
NameTypeRequiredRestrictionsDescription
project_idstring(uuid)truenoneUnique identifier for the project that the prompt belongs under
namestringtruenoneName of the prompt
slugstringtruenoneUnique identifier for the prompt
descriptionstring¦nullfalsenoneTextual description of the prompt
prompt_dataPromptDatafalsenoneThe prompt, model, and its parameters
tags[string]¦nullfalsenoneA list of tags for the prompt

PatchPrompt

{
  "name": "string",
  "description": "string",
  "prompt_data": {
    "prompt": {
      "type": "completion",
      "content": "string"
    },
    "options": {
      "model": "string",
      "params": {
        "use_cache": true,
        "temperature": 0,
        "top_p": 0,
        "max_tokens": 0,
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "response_format": {
          "type": "json_object"
        },
        "tool_choice": "auto",
        "function_call": "auto",
        "n": 0,
        "stop": ["string"]
      },
      "position": "string"
    },
    "origin": {
      "prompt_id": "string",
      "project_id": "string",
      "prompt_version": "string"
    }
  },
  "tags": ["string"]
}
Properties
NameTypeRequiredRestrictionsDescription
namestring¦nullfalsenoneName of the prompt
descriptionstring¦nullfalsenoneTextual description of the prompt
prompt_dataPromptDatafalsenoneThe prompt, model, and its parameters
tags[string]¦nullfalsenoneA list of tags for the prompt

FeedbackPromptItem

{
  "id": "string",
  "comment": "string",
  "metadata": {
    "property1": null,
    "property2": null
  },
  "source": "app"
}
Properties
NameTypeRequiredRestrictionsDescription
idstringtruenoneThe id of the prompt event to log feedback for. This is the row id returned by POST /v1/prompt/{prompt_id}/insert
commentstring¦nullfalsenoneAn optional comment string to log about the prompt event
metadataobject¦nullfalsenoneA 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.
» additionalPropertiesanyfalsenonenone
sourcestring¦nullfalsenoneThe source of the feedback. Must be one of "external" (default), "app", or "api"
Enumerated Values
PropertyValue
sourceapp
sourceapi
sourceexternal
sourcenull

FeedbackPromptEventRequest

{
  "feedback": [
    {
      "id": "string",
      "comment": "string",
      "metadata": {
        "property1": null,
        "property2": null
      },
      "source": "app"
    }
  ]
}
Properties
NameTypeRequiredRestrictionsDescription
feedback[FeedbackPromptItem]truenoneA list of prompt feedback items

Role

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

A role is a collection of permissions which can be granted as part of an ACL

Roles can consist of individual permissions, as well as a set of roles they inherit from

Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the role
org_idstring(uuid)¦nullfalsenoneUnique id for the organization that the role belongs under

A null org_id indicates a system role, which may be assigned to anybody and inherited by any other role, but cannot be edited.

It is forbidden to change the org after creating a role
user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the role
createdstring(date-time)¦nullfalsenoneDate of role creation
namestringtruenoneName of the role
descriptionstring¦nullfalsenoneTextual description of the role
deleted_atstring(date-time)¦nullfalsenoneDate of role deletion, or null if the role is still active
member_permissions[string]¦nullfalsenonePermissions which belong to this role
member_roles[string]¦nullfalsenoneIds of the roles this role inherits from

An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions

CreateRole

{
  "name": "string",
  "description": "string",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "org_name": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
namestringtruenoneName of the role
descriptionstring¦nullfalsenoneTextual description of the role
member_permissions[string]¦nullfalsenonePermissions which belong to this role
member_roles[string]¦nullfalsenoneIds of the roles this role inherits from

An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions
org_namestring¦nullfalsenoneFor 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 role belongs in.

PatchRole

{
  "description": "string",
  "member_permissions": ["create"],
  "member_roles": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "name": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
descriptionstring¦nullfalsenoneTextual description of the role
member_permissions[string]¦nullfalsenonePermissions which belong to this role
member_roles[string]¦nullfalsenoneIds of the roles this role inherits from

An inheriting role has all the permissions contained in its member roles, as well as all of their inherited permissions
namestring¦nullfalsenoneName of the role

Group

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "description": "string",
  "deleted_at": "2019-08-24T14:15:22Z",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"]
}

A group is a collection of users which can be assigned an ACL

Groups can consist of individual users, as well as a set of groups they inherit from

Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the group
org_idstring(uuid)truenoneUnique id for the organization that the group belongs under

It is forbidden to change the org after creating a group
user_idstring(uuid)¦nullfalsenoneIdentifies the user who created the group
createdstring(date-time)¦nullfalsenoneDate of group creation
namestringtruenoneName of the group
descriptionstring¦nullfalsenoneTextual description of the group
deleted_atstring(date-time)¦nullfalsenoneDate of group deletion, or null if the group is still active
member_users[string]¦nullfalsenoneIds of users which belong to this group
member_groups[string]¦nullfalsenoneIds of the groups this group inherits from

An inheriting group has all the users contained in its member groups, as well as all of their inherited users

CreateGroup

{
  "name": "string",
  "description": "string",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "org_name": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
namestringtruenoneName of the group
descriptionstring¦nullfalsenoneTextual description of the group
member_users[string]¦nullfalsenoneIds of users which belong to this group
member_groups[string]¦nullfalsenoneIds of the groups this group inherits from

An inheriting group has all the users contained in its member groups, as well as all of their inherited users
org_namestring¦nullfalsenoneFor 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 group belongs in.

PatchGroup

{
  "description": "string",
  "member_users": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "member_groups": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
  "name": "string"
}
Properties
NameTypeRequiredRestrictionsDescription
descriptionstring¦nullfalsenoneTextual description of the group
member_users[string]¦nullfalsenoneIds of users which belong to this group
member_groups[string]¦nullfalsenoneIds of the groups this group inherits from

An inheriting group has all the users contained in its member groups, as well as all of their inherited users
namestring¦nullfalsenoneName of the group

Acl

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "_object_org_id": "4d272dc1-1d6f-4a99-8c76-7bcbfc11ce4e",
  "created": "2019-08-24T14:15:22Z",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}

An ACL grants a certain permission or role to a certain user or group on an object.

ACLs are inherited across the object hierarchy. So for example, if a user has read permissions on a project, they will also have read permissions on any experiment, dataset, etc. created within that project.

To restrict a grant to a particular sub-object, you may specify restrict_object_type in the ACL.

Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the acl
object_typestringtruenoneThe object type that the ACL applies to
object_idstring(uuid)truenoneThe id of the object the ACL applies to
restrict_object_typestring¦nullfalsenoneOptionally restricts the permission grant to just the specified object type
_object_org_idstring(uuid)truenoneThe organization the ACL's referred object belongs to
createdstring(date-time)¦nullfalsenoneDate of acl creation
user_idstring(uuid)¦nullfalsenoneId of the user the ACL applies to. Exactly one of user_id and group_id will be provided
group_idstring(uuid)¦nullfalsenoneId of the group the ACL applies to. Exactly one of user_id and group_id will be provided
permissionstring¦nullfalsenonePermission the ACL grants. Exactly one of permission and role_id will be provided
role_idstring(uuid)¦nullfalsenoneId of the role the ACL grants. Exactly one of permission and role_id will be provided
Enumerated Values
PropertyValue
object_typeorganization
object_typeproject
object_typeexperiment
object_typedataset
object_typeprompt
object_typeprompt_session
object_typeproject_score
object_typeproject_tag
object_typegroup
object_typerole
object_typenull
restrict_object_typeorganization
restrict_object_typeproject
restrict_object_typeexperiment
restrict_object_typedataset
restrict_object_typeprompt
restrict_object_typeprompt_session
restrict_object_typeproject_score
restrict_object_typeproject_tag
restrict_object_typegroup
restrict_object_typerole
restrict_object_typenull
permissioncreate
permissionread
permissionupdate
permissiondelete
permissioncreate_acls
permissionread_acls
permissionupdate_acls
permissiondelete_acls
permissionnull

CreateAcl

{
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "restrict_object_type": "organization",
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "group_id": "306db4e0-7449-4501-b76f-075576fe2d8f",
  "permission": "create",
  "role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9"
}

An ACL grants a certain permission or role to a certain user or group on an object.

ACLs are inherited across the object hierarchy. So for example, if a user has read permissions on a project, they will also have read permissions on any experiment, dataset, etc. created within that project.

To restrict a grant to a particular sub-object, you may specify restrict_object_type in the ACL.

Properties
NameTypeRequiredRestrictionsDescription
object_typestringtruenoneThe object type that the ACL applies to
object_idstring(uuid)truenoneThe id of the object the ACL applies to
restrict_object_typestring¦nullfalsenoneOptionally restricts the permission grant to just the specified object type
user_idstring(uuid)¦nullfalsenoneId of the user the ACL applies to. Exactly one of user_id and group_id will be provided
group_idstring(uuid)¦nullfalsenoneId of the group the ACL applies to. Exactly one of user_id and group_id will be provided
permissionstring¦nullfalsenonePermission the ACL grants. Exactly one of permission and role_id will be provided
role_idstring(uuid)¦nullfalsenoneId of the role the ACL grants. Exactly one of permission and role_id will be provided
Enumerated Values
PropertyValue
object_typeorganization
object_typeproject
object_typeexperiment
object_typedataset
object_typeprompt
object_typeprompt_session
object_typeproject_score
object_typeproject_tag
object_typegroup
object_typerole
object_typenull
restrict_object_typeorganization
restrict_object_typeproject
restrict_object_typeexperiment
restrict_object_typedataset
restrict_object_typeprompt
restrict_object_typeprompt_session
restrict_object_typeproject_score
restrict_object_typeproject_tag
restrict_object_typegroup
restrict_object_typerole
restrict_object_typenull
permissioncreate
permissionread
permissionupdate
permissiondelete
permissioncreate_acls
permissionread_acls
permissionupdate_acls
permissiondelete_acls
permissionnull

User

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "given_name": "string",
  "family_name": "string",
  "email": "string",
  "avatar_url": "string",
  "created": "2019-08-24T14:15:22Z"
}
Properties
NameTypeRequiredRestrictionsDescription
idstring(uuid)truenoneUnique identifier for the user
given_namestring¦nullfalsenoneGiven name of the user
family_namestring¦nullfalsenoneFamily name of the user
emailstring¦nullfalsenoneThe user's email
avatar_urlstring¦nullfalsenoneURL of the user's Avatar image
createdstring(date-time)¦nullfalsenoneDate of user creation

CrossObjectInsertResponse

{
  "experiment": {
    "property1": {
      "row_ids": ["string"]
    },
    "property2": {
      "row_ids": ["string"]
    }
  },
  "dataset": {
    "property1": {
      "row_ids": ["string"]
    },
    "property2": {
      "row_ids": ["string"]
    }
  },
  "project_logs": {
    "property1": {
      "row_ids": ["string"]
    },
    "property2": {
      "row_ids": ["string"]
    }
  }
}
Properties
NameTypeRequiredRestrictionsDescription
experimentobject¦nullfalsenoneA mapping from experiment id to row ids for inserted events
» additionalPropertiesInsertEventsResponsefalsenonenone
datasetobject¦nullfalsenoneA mapping from dataset id to row ids for inserted events
» additionalPropertiesInsertEventsResponsefalsenonenone
project_logsobject¦nullfalsenoneA mapping from project id to row ids for inserted events
» additionalPropertiesInsertEventsResponsefalsenonenone

CrossObjectInsertRequest

{
  "experiment": {
    "property1": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "dataset_record_id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "dataset_record_id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  },
  "dataset": {
    "property1": {
      "events": [
        {
          "input": null,
          "expected": null,
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "expected": null,
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  },
  "project_logs": {
    "property1": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    },
    "property2": {
      "events": [
        {
          "input": null,
          "output": null,
          "expected": null,
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "metadata": {
            "property1": null,
            "property2": null
          },
          "tags": ["string"],
          "metrics": {
            "start": 0,
            "end": 0,
            "prompt_tokens": 0,
            "completion_tokens": 0,
            "tokens": 0,
            "property1": null,
            "property2": null
          },
          "context": {
            "caller_functionname": "string",
            "caller_filename": "string",
            "caller_lineno": 0,
            "property1": null,
            "property2": null
          },
          "span_attributes": {
            "name": "string",
            "type": "llm",
            "property1": null,
            "property2": null
          },
          "id": "string",
          "_object_delete": true,
          "_is_merge": false,
          "_parent_id": "string"
        }
      ],
      "feedback": [
        {
          "id": "string",
          "scores": {
            "property1": 1,
            "property2": 1
          },
          "expected": null,
          "comment": "string",
          "metadata": {
            "property1": null,
            "property2": null
          },
          "source": "app"
        }
      ]
    }
  }
}
Properties
NameTypeRequiredRestrictionsDescription
experimentobject¦nullfalsenoneA mapping from experiment id to a set of log events and feedback items to insert
» additionalPropertiesobjectfalsenonenone
»» events[InsertExperimentEvent]¦nullfalsenoneA list of experiment events to insert
»» feedback[FeedbackExperimentItem]¦nullfalsenoneA list of experiment feedback items
datasetobject¦nullfalsenoneA mapping from dataset id to a set of log events and feedback items to insert
» additionalPropertiesobjectfalsenonenone
»» events[InsertDatasetEvent]¦nullfalsenoneA list of dataset events to insert
»» feedback[FeedbackDatasetItem]¦nullfalsenoneA list of dataset feedback items
project_logsobject¦nullfalsenoneA mapping from project id to a set of log events and feedback items to insert
» additionalPropertiesobjectfalsenonenone
»» events[InsertProjectLogsEvent]¦nullfalsenoneA list of project logs events to insert
»» feedback[FeedbackProjectLogsItem]¦nullfalsenoneA list of project logs feedback items