Reference/API/Api Keys
GET
/v1/api_key

List api_keys

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

/v1/api_key

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.

In: header


Query Parameters

limitinteger | null

Limit the number of objects to return

Minimum: 0

starting_afterstring

Pagination cursor id.

For example, if the final item in the last page you fetched had an id of foo, pass starting_after=foo to fetch the next page. Note: you may only pass one of starting_after and ending_before

Format: "uuid"

ending_beforestring

Pagination cursor id.

For example, if the initial item in the last page you fetched had an id of foo, pass ending_before=foo to fetch the previous page. Note: you may only pass one of starting_after and ending_before

Format: "uuid"

idsAny properties in string, array<string>

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

api_key_namestring

Name of the api_key to search for

org_namestring

Filter search results to within a particular organization

Status codeDescription
200Returns a list of api_key objects
400The request was unacceptable, often due to missing a required parameter
401No valid API key provided
403The API key doesn’t have permissions to perform the request
429Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
500Something went wrong on Braintrust's end. (These are rare.)
curl -X GET "https://api.braintrust.dev/v1/api_key?limit=0&starting_after=497f6eca-6276-4993-bfeb-53cbbbba6f08&ending_before=497f6eca-6276-4993-bfeb-53cbbbba6f08&ids=497f6eca-6276-4993-bfeb-53cbbbba6f08&api_key_name=string&org_name=string"

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

POST
/v1/api_key

Create api_key

Create a new api_key. It is possible to have multiple API keys with the same name. There is no de-duplication

/v1/api_key

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.

In: header


Request Body (Optional)

Any desired information about the new api_key object

name
Required
string

Name of the api key. Does not have to be unique

org_namestring | null

For nearly all users, this parameter should be unnecessary. But in the rare case that your API key belongs to multiple organizations, you may specify the name of the organization the API key belongs in.

Status codeDescription
200Returns an object containing the raw API key. This is the only time the raw API key will be exposed
400The request was unacceptable, often due to missing a required parameter
401No valid API key provided
403The API key doesn’t have permissions to perform the request
429Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
500Something went wrong on Braintrust's end. (These are rare.)
curl -X POST "https://api.braintrust.dev/v1/api_key" \
  -d '{
  "name": "string",
  "org_name": "string"
}'

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

GET
/v1/api_key/{api_key_id}

Get api_key

Get an api_key object by its id

/v1/api_key/{api_key_id}

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.

In: header


Path Parameters

api_key_id
Required
string

ApiKey id

Format: "uuid"
Status codeDescription
200Returns the api_key object
400The request was unacceptable, often due to missing a required parameter
401No valid API key provided
403The API key doesn’t have permissions to perform the request
429Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
500Something went wrong on Braintrust's end. (These are rare.)
curl -X GET "https://api.braintrust.dev/v1/api_key/497f6eca-6276-4993-bfeb-53cbbbba6f08"

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

DELETE
/v1/api_key/{api_key_id}

Delete api_key

Delete an api_key object by its id

/v1/api_key/{api_key_id}

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.

In: header


Path Parameters

api_key_id
Required
string

ApiKey id

Format: "uuid"
Status codeDescription
200Returns the deleted api_key object
400The request was unacceptable, often due to missing a required parameter
401No valid API key provided
403The API key doesn’t have permissions to perform the request
429Too many requests hit the API too quickly. We recommend an exponential backoff of your requests
500Something went wrong on Braintrust's end. (These are rare.)
curl -X DELETE "https://api.braintrust.dev/v1/api_key/497f6eca-6276-4993-bfeb-53cbbbba6f08"

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

On this page