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

# Segment Document

> Splits each section of the reference document into sentences.
The Evaluate Document Completeness operation (`POST /tools/evaluations/text/documents/completeness`) uses the same split for the reference annotations.

To make `referenceAnnotations` for the Evaluate Document Completeness operation, do these steps:
1. Send the reference document to this operation.
2. Add `importance`, `alignment` and `categories` to each span that you want to annotate.
3. Send the annotated spans to the Evaluate Document Completeness operation in `referenceAnnotations`. Use the same `language` and `referenceDocument`.

The Evaluate Document Completeness operation uses `sectionId`, `start` and `end` to find the sentence for an annotation.
The `text` must also be equal to the text of the sentence.

If you change the language or the reference document, you should get new spans.

The API does not split a section that contains only whitespace. Such a section has no spans.

This operation does not use a language model. It does not use credits.




## OpenAPI

````yaml /api-reference/auto-generated-openapi.yml post /tools/evaluations/text/documents/segment
openapi: 3.0.0
info:
  title: Corti API
  version: 2.0.0
servers:
  - url: https://api.{environment}.corti.app/v2/
    variables:
      environment:
        default: eu
        enum:
          - us
          - eu
security:
  - AuthorizationHeader:
      - bearer
tags:
  - name: Interactions
  - name: Recordings
  - name: Transcripts
  - name: Facts
  - name: Codes
  - name: FHIR
  - name: Languages
  - name: Guided Documents
  - name: Guided Templates
  - name: Guided Sections
  - name: Documents (Classic)
  - name: Templates (Classic)
  - name: Evaluations
paths:
  /tools/evaluations/text/documents/segment:
    post:
      tags:
        - Evaluations
      summary: Segment Document
      description: >
        Splits each section of the reference document into sentences.

        The Evaluate Document Completeness operation (`POST
        /tools/evaluations/text/documents/completeness`) uses the same split for
        the reference annotations.


        To make `referenceAnnotations` for the Evaluate Document Completeness
        operation, do these steps:

        1. Send the reference document to this operation.

        2. Add `importance`, `alignment` and `categories` to each span that you
        want to annotate.

        3. Send the annotated spans to the Evaluate Document Completeness
        operation in `referenceAnnotations`. Use the same `language` and
        `referenceDocument`.


        The Evaluate Document Completeness operation uses `sectionId`, `start`
        and `end` to find the sentence for an annotation.

        The `text` must also be equal to the text of the sentence.


        If you change the language or the reference document, you should get new
        spans.


        The API does not split a section that contains only whitespace. Such a
        section has no spans.


        This operation does not use a language model. It does not use credits.
      operationId: evaluations_documents_segment
      parameters:
        - $ref: '#/components/parameters/Tenant-Name'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluationSegmentRequest'
            example:
              language: en
              referenceDocument:
                assessment: >-
                  Concern for acute ischaemic stroke requiring urgent
                  thrombolysis assessment. Follow-up in one week.
      responses:
        '200':
          description: The segments of the input document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluationSegmentResponse'
              example:
                spans:
                  - start: 0
                    end: 76
                    text: >-
                      Concern for acute ischaemic stroke requiring urgent
                      thrombolysis assessment.
                    sectionId: assessment
                  - start: 77
                    end: 99
                    text: Follow-up in one week.
                    sectionId: assessment
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/EvaluationForbidden'
        '500':
          $ref: '#/components/responses/EvaluationInternalError'
        '502':
          $ref: '#/components/responses/EvaluationBadGateway'
components:
  parameters:
    Tenant-Name:
      name: Tenant-Name
      in: header
      description: >-
        Identifies a distinct entity within Corti's multi-tenant system. Ensures
        correct routing and authentication of the request.
      required: true
      example: base
      schema:
        type: string
        description: >-
          Identifies a distinct entity within Corti's multi-tenant system.
          Ensures correct routing and authentication of the request.
        example: base
  schemas:
    EvaluationSegmentRequest:
      type: object
      required:
        - language
        - referenceDocument
      properties:
        language:
          $ref: '#/components/schemas/EvaluationLanguage'
        referenceDocument:
          $ref: '#/components/schemas/EvaluationDocument'
    EvaluationSegmentResponse:
      type: object
      required:
        - spans
      properties:
        spans:
          type: array
          description: >-
            The sentences of the segmented document. The order is the order of
            the sections in the request, and then the order in the text.
          items:
            $ref: '#/components/schemas/EvaluationDocumentSpan'
    EvaluationLanguage:
      type: string
      description: |
        The language of the documents, as a BCP-47 language tag.
        For example `en` or `en-US`.
      example: en
    EvaluationDocument:
      type: object
      description: >
        A document. Each key is a section ID. Each value is the text of that
        section.

        Section IDs must not be empty.


        The API processes the sections in the order of the request.

        The spans and claims in the response are in the order of the sections in
        the request, and then in the order in the text.
      minProperties: 1
      additionalProperties:
        type: string
      example:
        subjective: Patient reports right knee pain for two weeks.
        plan: Follow-up in one week.
    EvaluationDocumentSpan:
      type: object
      description: >
        A sentence in a section of a document.

        `start` and `end` are character offsets in the text of the section. The
        API counts Unicode code points.

        `start` is inclusive. `end` is exclusive.
      required:
        - start
        - end
        - text
        - sectionId
      properties:
        start:
          type: integer
          minimum: 0
          description: The offset of the first character of the sentence.
        end:
          type: integer
          minimum: 0
          description: The offset after the last character of the sentence.
        text:
          type: string
          minLength: 1
          description: >-
            The text of the sentence. The text has no whitespace at the start or
            at the end.
        sectionId:
          type: string
          minLength: 1
          description: The section ID in the document.
    ErrorResponse:
      type: object
      required:
        - requestid
        - status
        - type
        - detail
      properties:
        requestid:
          type: string
        status:
          type: integer
        type:
          type: string
        detail:
          type: string
        validationErrors:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationForbidden:
      description: The access token does not have the scope for evaluations.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationInternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationBadGateway:
      description: The API could not complete the evaluation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    AuthorizationHeader:
      type: http
      description: Input your token
      scheme: bearer

````

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