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

# Create annotation

> Score a session, or one turn of it, on a metric. The caller becomes the annotator. The metricId is a metric id, never a revision id. A Human Evaluation metric is scored on its evaluation instead and answers 400. An annotation belongs to a case (a session, or one turn of it) and a metric, not to an evaluation: every revision of the metric shows it. See [Evaluations](https://docs.galtea.ai/concepts/product/version/session/evaluation).



## OpenAPI

````yaml /openapi.json post /annotations
openapi: 3.0.0
info:
  version: 1.0.0
  title: Product Management Service API
  description: API documentation for Product Management Service
  contact:
    name: Galtea AI
servers:
  - url: https://api.galtea.ai
security:
  - bearerAuth: []
tags: []
externalDocs:
  description: Galtea Platform Documentation
  url: https://docs.galtea.ai
paths:
  /annotations:
    post:
      tags:
        - annotations
      summary: Create annotation
      description: >-
        Score a session, or one turn of it, on a metric. The caller becomes the
        annotator. The metricId is a metric id, never a revision id. A Human
        Evaluation metric is scored on its evaluation instead and answers 400.
        An annotation belongs to a case (a session, or one turn of it) and a
        metric, not to an evaluation: every revision of the metric shows it. See
        [Evaluations](https://docs.galtea.ai/concepts/product/version/session/evaluation).
      operationId: createAnnotation
      parameters:
        - $ref: '#/components/parameters/Prefer'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAnnotationBody'
      responses:
        '201':
          description: >-
            Annotation created successfully. On `Prefer: return=minimal`, or
            when the read after the write fails, the answer has no body.
          headers:
            Location:
              schema:
                type: string
                description: The path of the new resource
              required: true
              description: The path of the new resource
            Content-Location:
              schema:
                type: string
                description: >-
                  The path of the resource in the body; absent when there is no
                  body
              required: false
              description: >-
                The path of the resource in the body; absent when there is no
                body
            Preference-Applied:
              schema:
                type: string
                enum:
                  - return=minimal
                description: 'Present when the API honored `Prefer: return=minimal`'
              required: false
              description: 'Present when the API honored `Prefer: return=minimal`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Annotation'
        '400':
          description: >-
            Invalid request body, a score outside 0 to 1, a turn that is not a
            turn of the session, or a Human Evaluation metric
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            No user group of the caller grants the session's product with
            evaluation.humanAnnotation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Session or metric not found, or of another organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The case already has an annotation on this metric
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  parameters:
    Prefer:
      schema:
        $ref: '#/components/schemas/Prefer'
      required: false
      description: >-
        Send `return=minimal` to get no body back from a write and skip reading
        the resource: a create answers `201` with only `Location`, and an update
        answers `204`.
      name: Prefer
      in: header
  schemas:
    CreateAnnotationBody:
      type: object
      properties:
        sessionId:
          type: string
          minLength: 1
          description: The session to annotate.
          example: session_123
        metricId:
          type: string
          minLength: 1
          description: >-
            Metric ID, shared by every revision of the metric. A revision ID
            answers 404.
          example: metric_123
        inferenceResultId:
          type: string
          nullable: true
          minLength: 1
          description: >-
            A turn of the session, to annotate that turn alone. Leave it out to
            annotate the whole session.
          example: inferenceResult_123
        score:
          type: number
          minimum: 0
          maximum: 1
          description: The human score, from 0 to 1.
          example: 0.75
        reason:
          type: string
          nullable: true
          example: Accurate
          description: Why the annotator gave this score.
      required:
        - sessionId
        - metricId
        - score
      additionalProperties: false
    Annotation:
      type: object
      properties:
        id:
          type: string
          example: annotation_123
        sessionId:
          type: string
          example: session_123
          description: The annotated session.
        metricId:
          type: string
          description: >-
            Metric ID, shared by every revision of the metric. A revision ID
            answers 404.
          example: metric_123
        inferenceResultId:
          type: string
          nullable: true
          example: inferenceResult_123
          description: >-
            The annotated turn of the session. Null for an annotation of the
            whole session.
        annotatorId:
          type: string
          nullable: true
          example: user_123
          description: The user who last wrote the score. Null once that user is deleted.
        score:
          type: number
          example: 0.75
          description: The human score, from 0 to 1.
        reason:
          type: string
          nullable: true
          example: Accurate
          description: Why the annotator gave this score.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - sessionId
        - metricId
        - inferenceResultId
        - annotatorId
        - score
        - reason
        - createdAt
        - updatedAt
    Error:
      type: object
      properties:
        error:
          type: string
          example: Error type
        message:
          type: string
          example: Error message description
    Prefer:
      type: string
      description: >-
        Send `return=minimal` to get no body back from a write and skip reading
        the resource: a create answers `201` with only `Location`, and an update
        answers `204`.
      example: return=minimal
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authorization. Pass your API key in the Authorization header as
        a Bearer token. Both new (`gsk_*`) and legacy (`gsk-`) API keys are
        accepted, e.g. `Authorization: Bearer gsk_...` or `Authorization: Bearer
        gsk-...`.

````

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