> ## Documentation Index
> Fetch the complete documentation index at: https://arizeai-433a7140.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Annotate Span Documents



## OpenAPI

````yaml post /v1/document_annotations
openapi: 3.1.0
info:
  title: Arize-Phoenix REST API
  description: Schema for Arize-Phoenix REST API
  version: '1.0'
servers: []
security: []
paths:
  /v1/document_annotations:
    post:
      tags:
        - spans
      summary: Annotate Span Documents
      operationId: annotateSpanDocuments
      parameters:
        - name: sync
          in: query
          required: false
          schema:
            type: boolean
            description: If set to true, the annotations are inserted synchronously.
            default: false
            title: Sync
          description: If set to true, the annotations are inserted synchronously.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnnotateSpanDocumentsRequestBody'
      responses:
        '200':
          description: Span document annotation inserted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnnotateSpanDocumentsResponseBody'
        '403':
          description: Forbidden
          content:
            text/plain:
              schema:
                type: string
        '404':
          content:
            text/plain:
              schema:
                type: string
          description: Span not found
        '422':
          content:
            text/plain:
              schema:
                type: string
          description: Invalid request - non-empty identifier not supported
components:
  schemas:
    AnnotateSpanDocumentsRequestBody:
      properties:
        data:
          items:
            $ref: '#/components/schemas/SpanDocumentAnnotationData'
          type: array
          title: Data
      type: object
      required:
        - data
      title: AnnotateSpanDocumentsRequestBody
    AnnotateSpanDocumentsResponseBody:
      properties:
        data:
          items:
            $ref: '#/components/schemas/InsertedSpanDocumentAnnotation'
          type: array
          title: Data
      type: object
      required:
        - data
      title: AnnotateSpanDocumentsResponseBody
    SpanDocumentAnnotationData:
      properties:
        name:
          type: string
          title: Name
          description: The name of the annotation
        annotator_kind:
          type: string
          enum:
            - LLM
            - CODE
            - HUMAN
          title: Annotator Kind
          description: The kind of annotator used for the annotation
        result:
          anyOf:
            - $ref: '#/components/schemas/AnnotationResult'
            - type: 'null'
          description: The result of the annotation
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Metadata for the annotation
        identifier:
          type: string
          title: Identifier
          description: >-
            The identifier of the annotation. If provided, the annotation will
            be updated if it already exists.
          default: ''
        span_id:
          type: string
          title: Span Id
          description: OpenTelemetry Span ID (hex format w/o 0x prefix)
        document_position:
          type: integer
          title: Document Position
          description: >-
            A 0 based index of the document. E.x. the first document during
            retrieval is 0
      type: object
      required:
        - name
        - annotator_kind
        - span_id
        - document_position
      title: SpanDocumentAnnotationData
    InsertedSpanDocumentAnnotation:
      properties:
        id:
          type: string
          title: Id
          description: The ID of the inserted span document annotation
      type: object
      required:
        - id
      title: InsertedSpanDocumentAnnotation
    AnnotationResult:
      properties:
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
          description: The label assigned by the annotation
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
          description: The score assigned by the annotation
        explanation:
          anyOf:
            - type: string
            - type: 'null'
          title: Explanation
          description: Explanation of the annotation result
      type: object
      title: AnnotationResult

````