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

# Read a regulatory document's text in chunks

> Return a document's stored text in chunks of up to `maxBytes`, with the same contract as GET /files/{fileId}/text. To continue, pass `nextCursor` as `cursor` with the same `maxBytes`. Documents are updated in place: if `textRevision` changes, start again without a cursor. Returns 409 `text_unavailable` when the document has no text; download its source file instead. Each nonempty chunk costs $0.01, including repeats; failed requests are free.



## OpenAPI

````yaml /openapi.json get /insurance/regulatory-documents/{documentId}/text
openapi: 3.0.3
info:
  title: Effective API
  version: 2.0.0
  description: The public Effective REST API. Authenticate using an Effective API key.
servers:
  - url: https://api.canary.effectiveai.app/api/v2
    description: Canary
security:
  - bearerAuth: []
paths:
  /insurance/regulatory-documents/{documentId}/text:
    get:
      tags:
        - Regulatory documents
      summary: Read a regulatory document's text in chunks
      description: >-
        Return a document's stored text in chunks of up to `maxBytes`, with the
        same contract as GET /files/{fileId}/text. To continue, pass
        `nextCursor` as `cursor` with the same `maxBytes`. Documents are updated
        in place: if `textRevision` changes, start again without a cursor.
        Returns 409 `text_unavailable` when the document has no text; download
        its source file instead. Each nonempty chunk costs $0.01, including
        repeats; failed requests are free.
      operationId: getRegulatoryDocumentText
      parameters:
        - schema:
            type: string
            format: uuid
            description: Document id from listRegulatoryDocuments.
          required: true
          description: Document id from listRegulatoryDocuments.
          name: documentId
          in: path
        - schema:
            type: integer
            minimum: 4
            maximum: 65536
            default: 16384
            description: >-
              Maximum UTF-8 bytes of text per response, 4–65536 (default 16384).
              Character boundaries may shorten a chunk. Repeat unchanged with
              cursor.
          required: false
          description: >-
            Maximum UTF-8 bytes of text per response, 4–65536 (default 16384).
            Character boundaries may shorten a chunk. Repeat unchanged with
            cursor.
          name: maxBytes
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 128
            description: >-
              Opaque nextCursor. Fixed 24-hour lifetime; bound to caller,
              document, maxBytes and text revision.
          required: false
          description: >-
            Opaque nextCursor. Fixed 24-hour lifetime; bound to caller,
            document, maxBytes and text revision.
          name: cursor
          in: query
      responses:
        '200':
          description: A revision-bound text chunk with byte location and continuation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2RegulatoryDocumentText'
        '400':
          description: >-
            invalid_request or invalid_cursor. Restart without cursor after
            expiry or a changed query, filter or limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '403':
          description: 'forbidden: SERFF view permission, which covers regulatory documents.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '404':
          description: 'not_found: unknown or deleted document.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '409':
          description: >-
            text_unavailable: the document has no stored text. Use its fileId to
            download the source.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '503':
          description: >-
            temporarily_unavailable: the search embedding, a 60-second statement
            timeout or the cursor store failed. Retry after Retry-After seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
      security:
        - bearerAuth: []
components:
  schemas:
    V2RegulatoryDocumentText:
      type: object
      properties:
        documentId:
          type: string
          format: uuid
        textRevision:
          type: string
          maxLength: 68
          description: >-
            Identifies this version of the stored text. Documents are updated in
            place; if it changes, start again without a cursor.
        text:
          type: string
          maxLength: 65536
          description: >-
            Stored text, at most maxBytes UTF-8 bytes. Text extracted from PDFs
            can lose tables and layout; the source file stays the evidence.
        location:
          type: object
          properties:
            startOffsetBytes:
              type: integer
              minimum: 0
              description: Inclusive zero-based UTF-8 byte offset in this text revision.
            endOffsetBytes:
              type: integer
              minimum: 0
              description: Exclusive zero-based UTF-8 byte offset in this text revision.
          required:
            - startOffsetBytes
            - endOffsetBytes
        nextCursor:
          type: string
          nullable: true
          description: >-
            Continue with the same document and maxBytes, or null at the end.
            Retrying the same request is safe.
      required:
        - documentId
        - textRevision
        - text
        - location
        - nextCursor
    V2CodedError:
      allOf:
        - $ref: '#/components/schemas/V2Error'
        - type: object
          properties:
            code:
              type: string
              minLength: 1
              description: Stable error code. Clients must tolerate unknown future codes.
            details:
              type: array
              items:
                type: object
                properties:
                  location:
                    type: string
                    enum:
                      - path
                      - query
                      - header
                      - body
                  path:
                    type: array
                    items:
                      type: string
                      maxLength: 64
                    maxItems: 12
                  code:
                    type: string
                    enum:
                      - required
                      - invalid_type
                      - invalid_value
                      - unknown_field
                  message:
                    type: string
                    minLength: 1
                    maxLength: 200
                required:
                  - location
                  - path
                  - code
                  - message
              minItems: 1
              maxItems: 20
              description: Bounded safe validation issues; may omit some invalid fields.
            requestId:
              type: string
              minLength: 1
              maxLength: 128
              description: >-
                Existing server correlation for this HTTP attempt, when
                available.
            dataset:
              type: string
              enum:
                - naic
              description: Dataset needed for dataset_not_enabled.
          required:
            - code
    V2Error:
      type: object
      properties:
        error:
          type: string
          minLength: 1
          description: Human-readable explanation of the failure.
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Effective API key. Send Authorization: Bearer sk-eai-...'

````

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