Create service token
Create a new service token.
Authenticate with a service token. A service token whose service account is an organization owner can create tokens for any service account. A service token whose service account holds the Owner role on a project group can create tokens for a service account in the same organization when the target account has a permission grant on a project group it owns. The calling service account must also hold all of the target account’s permissions in the organization; otherwise the request returns 403. User API keys cannot be used.
Authorizations
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
Any desired information about the new service token object
Name of the service token. Does not have to be unique
The ID of the service account to which the token should belong. To create a service account, visit Settings > Service tokens in the Braintrust UI or call PATCH /v1/organization/members.
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.
Number of seconds from now after which the service token should expire. If omitted, the token never expires.
Response
Returns an object containing the raw service token. This is the only time the raw API key will be exposed
Unique identifier for the service token
Name of the service token
The raw service token. It will only be exposed this one time
Date of service token creation
Unique identifier for the service token
The service account email (not routable)
The service account name
Unique identifier for the organization
Date and time at which the service token expires. If null, the token never expires.