List service_tokens

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

GET /v1/service_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

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

service_token_namestring

Name of the service_token to search for

org_namestring

Filter search results to within a particular organization

curl -X GET "https://api.braintrust.dev/v1/service_token?limit=0&starting_after=497f6eca-6276-4993-bfeb-53cbbbba6f08&ending_before=497f6eca-6276-4993-bfeb-53cbbbba6f08&ids=497f6eca-6276-4993-bfeb-53cbbbba6f08&service_token_name=string&org_name=string" \
  -H "Authorization: Bearer <token>"

Returns a list of service_token objects

{
  "objects": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "created": "2019-08-24T14:15:22Z",
      "name": "string",
      "preview_name": "string",
      "service_account_id": "81f92c7b-60ae-411e-bc6f-e2dc93db8886",
      "service_account_email": "string",
      "service_account_name": "string",
      "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b"
    }
  ]
}

Create service_token

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

POST /v1/service_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 service_token object

name
Required
string

Name of the service token. Does not have to be unique

org_namestring

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 Service token belongs in.

service_account_id
Required
string

The service account ID this service token should belong to.

curl -X POST "https://api.braintrust.dev/v1/service_token" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "org_name": "string",
    "service_account_id": "string"
  }'

Returns an object containing the raw service token. This is the only time the raw API key will be exposed

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "preview_name": "string",
  "service_account_id": "81f92c7b-60ae-411e-bc6f-e2dc93db8886",
  "service_account_email": "string",
  "service_account_name": "string",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
  "key": "string"
}

Get service_token

Get a service_token object by its id

GET /v1/service_token/{service_token_id}

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

service_token_id
Required
string

ServiceToken id

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

Returns the service_token object

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "preview_name": "string",
  "service_account_id": "81f92c7b-60ae-411e-bc6f-e2dc93db8886",
  "service_account_email": "string",
  "service_account_name": "string",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b"
}

Delete service_token

Delete a service_token object by its id

DELETE /v1/service_token/{service_token_id}

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

service_token_id
Required
string

ServiceToken id

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

Returns the deleted service_token object

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "created": "2019-08-24T14:15:22Z",
  "name": "string",
  "preview_name": "string",
  "service_account_id": "81f92c7b-60ae-411e-bc6f-e2dc93db8886",
  "service_account_email": "string",
  "service_account_name": "string",
  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b"
}

On this page