Reference/API/Env Vars
GET
/v1/env_var

List env_vars

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

/v1/env_var

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

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

env_var_namestring

Name of the env_var to search for

object_typestring

The type of the object the environment variable is scoped for

Value in: "organization" | "project" | "function"

object_idstring

The id of the object the environment variable is scoped for

Format: "uuid"
curl -X GET "https://api.braintrust.dev/v1/env_var?limit=0&ids=497f6eca-6276-4993-bfeb-53cbbbba6f08&env_var_name=string&object_type=organization&object_id=497f6eca-6276-4993-bfeb-53cbbbba6f08" \
  -H "Authorization: Bearer <token>"

Returns a list of env_var objects

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "object_type": "organization",
      "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
      "name": "string",
      "created": "2019-08-24T14:15:22Z",
      "used": "2019-08-24T14:15:22Z"
    }
  ]
}

POST
/v1/env_var

Create env_var

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

/v1/env_var

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

application/jsonOptional

Any desired information about the new env_var object

object_type
Required
string

The type of the object the environment variable is scoped for

Value in: "organization" | "project" | "function"

object_id
Required
string

The id of the object the environment variable is scoped for

Format: "uuid"

name
Required
string

The name of the environment variable

valuestring | null

The value of the environment variable. Will be encrypted at rest.

curl -X POST "https://api.braintrust.dev/v1/env_var" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "object_type": "organization",
    "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
    "name": "string",
    "value": "string"
  }'

Returns the new env_var object

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "used": "2019-08-24T14:15:22Z"
}

PUT
/v1/env_var

Create or replace env_var

Create or replace env_var. If there is an existing env_var with the same name as the one specified in the request, will replace the existing env_var with the provided fields

/v1/env_var

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

application/jsonOptional

Any desired information about the new env_var object

object_type
Required
string

The type of the object the environment variable is scoped for

Value in: "organization" | "project" | "function"

object_id
Required
string

The id of the object the environment variable is scoped for

Format: "uuid"

name
Required
string

The name of the environment variable

valuestring | null

The value of the environment variable. Will be encrypted at rest.

curl -X PUT "https://api.braintrust.dev/v1/env_var" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "object_type": "organization",
    "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
    "name": "string",
    "value": "string"
  }'

Returns the new env_var object

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "used": "2019-08-24T14:15:22Z"
}

GET
/v1/env_var/{env_var_id}

Get env_var

Get an env_var object by its id

/v1/env_var/{env_var_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

env_var_id
Required
string

EnvVar id

Format: "uuid"
curl -X GET "https://api.braintrust.dev/v1/env_var/497f6eca-6276-4993-bfeb-53cbbbba6f08" \
  -H "Authorization: Bearer <token>"

Returns the env_var object

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "used": "2019-08-24T14:15:22Z"
}

PATCH
/v1/env_var/{env_var_id}

Partially update env_var

Partially update an env_var 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.

/v1/env_var/{env_var_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

Request Body

application/jsonOptional

Fields to update

name
Required
string

The name of the environment variable

valuestring | null

The value of the environment variable. Will be encrypted at rest.

Path Parameters

env_var_id
Required
string

EnvVar id

Format: "uuid"
curl -X PATCH "https://api.braintrust.dev/v1/env_var/497f6eca-6276-4993-bfeb-53cbbbba6f08" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "value": "string"
  }'

Returns the env_var object

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "used": "2019-08-24T14:15:22Z"
}

DELETE
/v1/env_var/{env_var_id}

Delete env_var

Delete an env_var object by its id

/v1/env_var/{env_var_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

env_var_id
Required
string

EnvVar id

Format: "uuid"
curl -X DELETE "https://api.braintrust.dev/v1/env_var/497f6eca-6276-4993-bfeb-53cbbbba6f08" \
  -H "Authorization: Bearer <token>"

Returns the deleted env_var object

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object_type": "organization",
  "object_id": "463a83d0-a816-4902-abba-2486e0c0a0bb",
  "name": "string",
  "created": "2019-08-24T14:15:22Z",
  "used": "2019-08-24T14:15:22Z"
}

On this page