Braintrust Credentials API

The Credentials API from Braintrust — 3 operation(s) for credentials.

OpenAPI Specification

braintrust-data-credentials-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Braintrust REST ACL Credentials API
  description: The Braintrust REST API for building, evaluating, and observing AI applications. The API is organized around REST, uses predictable resource-oriented URLs under https://api.braintrust.dev/v1, accepts and returns JSON, and authenticates with a Bearer API key. This specification covers the core documented resource surface - projects, experiments, datasets, logs/spans, prompts, functions and scorers, evals, project configuration, organization/ACL management, credentials, and the OpenAI-compatible AI proxy.
  termsOfService: https://www.braintrust.dev/legal/terms-of-service
  contact:
    name: Braintrust Support
    email: support@braintrust.dev
    url: https://www.braintrust.dev/docs
  version: '1.0'
servers:
- url: https://api.braintrust.dev
  description: US data plane (default)
- url: https://api-eu.braintrust.dev
  description: EU data plane
security:
- bearerAuth: []
tags:
- name: Credentials
paths:
  /v1/api_key:
    get:
      operationId: getApiKey
      tags:
      - Credentials
      summary: List api_keys
      parameters:
      - $ref: '#/components/parameters/Limit'
      - name: org_name
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Returns a list of API keys (without secret values).
          content:
            application/json:
              schema:
                type: object
                properties:
                  objects:
                    type: array
                    items:
                      $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/api_key/{api_key_id}:
    parameters:
    - name: api_key_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    get:
      operationId: getApiKeyId
      tags:
      - Credentials
      summary: Get api_key
      responses:
        '200':
          description: Returns the API key object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
    delete:
      operationId: deleteApiKeyId
      tags:
      - Credentials
      summary: Delete api_key
      responses:
        '200':
          description: Returns the deleted API key object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/ai_secret:
    get:
      operationId: getAiSecret
      tags:
      - Credentials
      summary: List ai_secrets
      parameters:
      - $ref: '#/components/parameters/Limit'
      - name: org_name
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Returns a list of AI secrets (without secret values).
          content:
            application/json:
              schema:
                type: object
                properties:
                  objects:
                    type: array
                    items:
                      $ref: '#/components/schemas/AiSecret'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: postAiSecret
      tags:
      - Credentials
      summary: Create ai_secret
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                type:
                  type: string
                  description: Provider type, e.g. openai, anthropic.
                secret:
                  type: string
                metadata:
                  type: object
                  additionalProperties: true
      responses:
        '200':
          description: Returns the new AI secret object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiSecret'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    Unauthorized:
      description: Authentication failed - missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  parameters:
    Limit:
      name: limit
      in: query
      description: Limit the number of objects to return.
      schema:
        type: integer
        minimum: 0
  schemas:
    AiSecret:
      type: object
      properties:
        id:
          type: string
          format: uuid
        org_id:
          type: string
          format: uuid
          nullable: true
        name:
          type: string
        type:
          type: string
          nullable: true
        metadata:
          type: object
          nullable: true
          additionalProperties: true
        created:
          type: string
          format: date-time
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: string
          description: A human-readable error message.
    ApiKey:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        preview_name:
          type: string
          nullable: true
        user_id:
          type: string
          format: uuid
          nullable: true
        org_id:
          type: string
          format: uuid
          nullable: true
        created:
          type: string
          format: date-time
          nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key or JWT
      description: 'Authenticate requests with your Braintrust API key in the Authorization header, e.g. `Authorization: Bearer $BRAINTRUST_API_KEY`.'