Skip to main content
POST
/
v1
/
ai_secret
Create ai_secret
curl --request POST \
  --url https://api.braintrust.dev/v1/ai_secret \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "type": "<string>",
  "metadata": {},
  "secret": "<string>",
  "org_name": "<string>"
}'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "type": "<string>",
  "metadata": {},
  "preview_secret": "<string>"
}

Authorizations

Authorization
string
header
required

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.

Body

application/json

Any desired information about the new ai_secret object

name
string
required

Name of the AI secret

type
string | null
metadata
object | null
secret
string | null

Secret value. If omitted in a PUT request, the existing secret value will be left intact, not replaced with null.

org_name
string | 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 AI Secret belongs in.

Response

Returns the new ai_secret object

id
string<uuid>
required

Unique identifier for the AI secret

org_id
string<uuid>
required

Unique identifier for the organization

name
string
required

Name of the AI secret

created
string<date-time> | null

Date of AI secret creation

updated_at
string<date-time> | null

Date of last AI secret update

type
string | null
metadata
object | null
preview_secret
string | null