> ## Documentation Index
> Fetch the complete documentation index at: https://docs.braintrust.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create project score

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



## OpenAPI

````yaml /openapi.yaml post /v1/project_score
openapi: 3.1.1
info:
  version: 1.0.0
  title: Braintrust API
  description: >-
    API specification for the backend data server. The API is hosted globally at

    https://api.braintrust.dev or in your own environment.


    You can access the OpenAPI spec for this API at
    https://github.com/braintrustdata/braintrust-openapi.
  license:
    name: Apache 2.0
servers:
  - url: https://api.braintrust.dev
security:
  - bearerAuth: []
  - {}
paths:
  /v1/project_score:
    post:
      tags:
        - ProjectScores
      summary: Create project score
      description: >-
        Create a new project score. If there is an existing project score in the
        project with the same name as the one specified in the request, will
        return the existing project score unmodified
      operationId: postProjectScore
      requestBody:
        description: Any desired information about the new project score object
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProjectScore'
      responses:
        '200':
          description: Returns the new project score object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectScore'
        '400':
          description: >-
            The request was unacceptable, often due to missing a required
            parameter
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema: {}
        '401':
          description: No valid API key provided
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema: {}
        '403':
          description: The API key doesn’t have permissions to perform the request
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema: {}
        '429':
          description: >-
            Too many requests hit the API too quickly. We recommend an
            exponential backoff of your requests
          headers:
            Retry-After:
              schema:
                type: string
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema: {}
        '500':
          description: Something went wrong on Braintrust's end. (These are rare.)
          content:
            text/plain:
              schema:
                type: string
            application/json:
              schema: {}
      security:
        - bearerAuth: []
        - {}
components:
  schemas:
    CreateProjectScore:
      type: object
      properties:
        project_id:
          type: string
          format: uuid
          description: >-
            Unique identifier for the project that the project score belongs
            under
        name:
          type: string
          description: Name of the project score
        description:
          type:
            - string
            - 'null'
          description: Textual description of the project score
        score_type:
          $ref: '#/components/schemas/ProjectScoreType'
        categories:
          $ref: '#/components/schemas/ProjectScoreCategories'
        config:
          $ref: '#/components/schemas/ProjectScoreConfig'
      required:
        - project_id
        - name
        - score_type
      description: >-
        A project score is a user-configured score, which can be
        manually-labeled through the UI
    ProjectScore:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the project score
        project_id:
          type: string
          format: uuid
          description: >-
            Unique identifier for the project that the project score belongs
            under
        user_id:
          type: string
          format: uuid
        created:
          type:
            - string
            - 'null'
          format: date-time
          description: Date of project score creation
        name:
          type: string
          description: Name of the project score
        description:
          type:
            - string
            - 'null'
          description: Textual description of the project score
        score_type:
          $ref: '#/components/schemas/ProjectScoreType'
        categories:
          $ref: '#/components/schemas/ProjectScoreCategories'
        config:
          $ref: '#/components/schemas/ProjectScoreConfig'
        position:
          type:
            - string
            - 'null'
          description: >-
            An optional LexoRank-based string that sets the sort position for
            the score in the UI
      required:
        - id
        - project_id
        - user_id
        - name
        - score_type
      description: >-
        A project score is a user-configured score, which can be
        manually-labeled through the UI
    ProjectScoreType:
      type: string
      enum:
        - slider
        - categorical
        - weighted
        - minimum
        - maximum
        - online
        - free-form
      description: The type of the configured score
      title: project_score_type_single
    ProjectScoreCategories:
      anyOf:
        - type: array
          items:
            $ref: '#/components/schemas/ProjectScoreCategory'
          description: For categorical-type project scores, the list of all categories
          title: categorical
        - type: object
          additionalProperties:
            type: number
          description: For weighted-type project scores, the weights of each score
          title: weighted
        - type: array
          items:
            type: string
          description: For minimum-type project scores, the list of included scores
          title: minimum
        - type: 'null'
    ProjectScoreConfig:
      type:
        - object
        - 'null'
      properties:
        multi_select:
          type:
            - boolean
            - 'null'
        destination:
          type:
            - string
            - 'null'
        visibility:
          type:
            - object
            - 'null'
          properties:
            users:
              type:
                - array
                - 'null'
              items:
                type: string
            groups:
              type:
                - array
                - 'null'
              items:
                type: string
        online:
          $ref: '#/components/schemas/OnlineScoreConfig'
        condition:
          $ref: '#/components/schemas/ProjectScoreCondition'
        object_types:
          type:
            - array
            - 'null'
          items:
            type: string
            enum:
              - project_logs
              - dataset
              - experiment
    ProjectScoreCategory:
      type: object
      properties:
        name:
          type: string
          description: Name of the category
        value:
          type: number
          description: Numerical value of the category. Must be between 0 and 1, inclusive
      required:
        - name
        - value
      description: For categorical-type project scores, defines a single category
    OnlineScoreConfig:
      type:
        - object
        - 'null'
      properties:
        status:
          $ref: '#/components/schemas/AutomationStatus'
        sampling_rate:
          type: number
          minimum: 0
          maximum: 1
          description: The sampling rate for online scoring
        scorers:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/SavedFunctionId'
              - anyOf:
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - function
                      id:
                        type: string
                      version:
                        type: string
                        description: The version of the function
                    required:
                      - type
                      - id
                    title: function
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - global
                      name:
                        type: string
                      function_type:
                        $ref: '#/components/schemas/FunctionTypeEnum'
                    required:
                      - type
                      - name
                    title: global
          description: >-
            The list of functions to run for online scoring. Can include
            scorers, facets, or other function types.
        btql_filter:
          type:
            - string
            - 'null'
          description: Filter logs using BTQL
        apply_to_root_span:
          type:
            - boolean
            - 'null'
          description: >-
            Whether to trigger online scoring on the root span of each trace.
            Only applies when scope is 'span' or unset.
        apply_to_span_names:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            Trigger online scoring on any spans with a name in this list. Only
            applies when scope is 'span' or unset.
        skip_logging:
          type:
            - boolean
            - 'null'
          description: Whether to skip adding scorer spans when computing scores
        scope:
          anyOf:
            - $ref: '#/components/schemas/SpanScope'
            - $ref: '#/components/schemas/TraceScope'
            - $ref: '#/components/schemas/GroupScope'
            - type: 'null'
          description: >-
            The scope at which to run the functions. Defaults to span-level
            execution.
      required:
        - sampling_rate
        - scorers
    ProjectScoreCondition:
      type:
        - object
        - 'null'
      properties:
        when:
          type: object
          properties:
            clauses:
              type:
                - array
                - 'null'
              items:
                type: string
            subspan_clauses:
              type:
                - array
                - 'null'
              items:
                type: string
            trace_clauses:
              type:
                - array
                - 'null'
              items:
                type: string
        behavior:
          type: string
          enum:
            - hidden
          default: hidden
      required:
        - when
    AutomationStatus:
      type: string
      enum:
        - active
        - paused
      description: Whether the automation is active or paused.
    SavedFunctionId:
      anyOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - function
            id:
              type: string
            version:
              type: string
              description: The version of the function
          required:
            - type
            - id
          title: function
        - type: object
          properties:
            type:
              type: string
              enum:
                - global
            name:
              type: string
            function_type:
              $ref: '#/components/schemas/FunctionTypeEnum'
          required:
            - type
            - name
          title: global
        - type: 'null'
      description: Optional function identifier that produced the classification
    FunctionTypeEnum:
      type: string
      enum:
        - llm
        - scorer
        - task
        - tool
        - custom_view
        - preprocessor
        - facet
        - classifier
        - tag
        - parameters
        - sandbox
      default: scorer
      description: The type of global function. Defaults to 'scorer'.
    SpanScope:
      type: object
      properties:
        type:
          type: string
          enum:
            - span
      required:
        - type
      description: Process individual spans
    TraceScope:
      type: object
      properties:
        type:
          type: string
          enum:
            - trace
        idle_seconds:
          type: number
          description: >-
            Consider trace complete after this many seconds of inactivity
            (default: 30)
      required:
        - type
      description: Process entire traces (all spans sharing the same root_span_id)
    GroupScope:
      type: object
      properties:
        type:
          type: string
          enum:
            - group
        group_by:
          type: string
          description: Field path to group by, e.g. metadata.session_id
        interval_seconds:
          type: number
          minimum: 1
          description: Maximum time range to include when constructing a group
        max_traces:
          type: integer
          minimum: 1
          maximum: 64
          description: >-
            Maximum number of traces to include when constructing a group
            (default/max: 64)
        placement:
          type: string
          enum:
            - first
            - each
          description: Which trace or traces to write grouped scorer results to
        idle_seconds:
          type: number
          description: 'Optional: trigger after this many seconds of inactivity'
      required:
        - type
        - group_by
        - placement
      description: Process spans/traces grouped by a field (e.g., session_id)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key or JWT
      description: >-
        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](https://www.braintrustdata.com/app/settings?subroute=api-keys).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.