> ## 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 bounded chunk of extracted artifact text

> Return an artifact's extracted text in chunks of up to `maxBytes`. Pass `pages` (for example `121-124`) to read only those PDF pages, such as the pages around a search passage; `pages` in the response gives each page's offsets and a `webUrl` for citing it. The UUID in an /artifacts/{id} viewer URL is its artifactId, and a `fileId` in any response is the same ID.

To continue, pass `nextCursor` as `cursor` with the same `maxBytes` and `pages`. A cursor from the deprecated file text read continues here too. If `textRevision` changes, start again without a cursor. Returns 409 `text_unavailable` when the artifact has no extracted text; download the original instead.

Organization-owned artifacts and empty text are free; each nonempty catalog chunk costs $0.01, including repeats.



## OpenAPI

````yaml /openapi.json get /artifacts/{artifactId}/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:
  /artifacts/{artifactId}/text:
    get:
      tags:
        - Artifacts
      summary: Read a bounded chunk of extracted artifact text
      description: >-
        Return an artifact's extracted text in chunks of up to `maxBytes`. Pass
        `pages` (for example `121-124`) to read only those PDF pages, such as
        the pages around a search passage; `pages` in the response gives each
        page's offsets and a `webUrl` for citing it. The UUID in an
        /artifacts/{id} viewer URL is its artifactId, and a `fileId` in any
        response is the same ID.


        To continue, pass `nextCursor` as `cursor` with the same `maxBytes` and
        `pages`. A cursor from the deprecated file text read continues here too.
        If `textRevision` changes, start again without a cursor. Returns 409
        `text_unavailable` when the artifact has no extracted text; download the
        original instead.


        Organization-owned artifacts and empty text are free; each nonempty
        catalog chunk costs $0.01, including repeats.
      operationId: getArtifactText
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: artifactId
          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
            pattern: ^[1-9]\d{0,5}(?:-[1-9]\d{0,5})?$
            description: >-
              Read only these 1-based PDF pages, as "121" or "121-124", instead
              of reading from the start. A response holds whole pages up to
              maxBytes; continue with nextCursor and the same pages and
              maxBytes. Pages past the end are left out. 409 pages_unavailable
              when the text has no page boundaries.
          required: false
          description: >-
            Read only these 1-based PDF pages, as "121" or "121-124", instead of
            reading from the start. A response holds whole pages up to maxBytes;
            continue with nextCursor and the same pages and maxBytes. Pages past
            the end are left out. 409 pages_unavailable when the text has no
            page boundaries.
          name: pages
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 8192
            description: >-
              Opaque nextCursor, bound to caller scope, artifact, maxBytes,
              pages and text revision; it does not expire.
          required: false
          description: >-
            Opaque nextCursor, bound to caller scope, artifact, maxBytes, pages
            and text revision; it does not expire.
          name: cursor
          in: query
      responses:
        '200':
          description: A revision-bound text chunk with byte location and continuation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2ArtifactText'
        '400':
          description: >-
            invalid_request or invalid_cursor. For invalid, expired, differently
            bound or changed-revision cursors, restart without cursor. Pages
            that start after the last page are invalid_request; details give the
            page count.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '403':
          description: >-
            download_restricted: visible artifact is restricted from content
            export.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '404':
          description: 'not_found: artifact is missing or inaccessible.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
        '409':
          description: >-
            text_unavailable: the artifact has no extracted text. Download the
            original instead. pages_unavailable: the text has no page
            boundaries; read it without pages.
          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: storage or continuation dependency failed.
            Retry the same request after Retry-After seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2CodedError'
      security:
        - bearerAuth: []
components:
  schemas:
    V2ArtifactText:
      type: object
      properties:
        artifactId:
          type: string
          format: uuid
        textRevision:
          type: string
          maxLength: 68
          description: >-
            Identifies this version of the extracted text (not the artifact
            version). If it changes, earlier cursors stop working.
        versionId:
          type: string
          nullable: true
          description: >-
            Version of the artifact this text was extracted from, or null when
            unknown. Currently always null.
        text:
          type: string
          maxLength: 65536
          description: >-
            Existing UTF-8 extracted text, at most maxBytes UTF-8 bytes. Empty
            available text is a successful terminal response. Page markers, if
            present, remain in text.
        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
        pages:
          type: array
          items:
            type: object
            properties:
              page:
                type: integer
                minimum: 0
                exclusiveMinimum: true
                description: 1-based PDF page.
              startOffsetBytes:
                type: integer
                minimum: 0
                description: >-
                  Inclusive UTF-8 byte offset in this text revision where this
                  page starts in text.
              endOffsetBytes:
                type: integer
                minimum: 0
                description: >-
                  Exclusive UTF-8 byte offset in this text revision where this
                  page ends in text.
              webUrl:
                type: string
                format: uri
                description: >-
                  The artifact open at this page in Effective, for citing facts
                  on it.
            required:
              - page
              - startOffsetBytes
              - endOffsetBytes
              - webUrl
          description: >-
            Pages in text, by offset in this text revision. A page read lists
            every returned page. A read without pages lists only pages whose
            `--- Page N ---` marker is in this chunk. Empty when the text has no
            page boundaries.
        totalPages:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
          description: Number of the last page in the text on page reads; null otherwise.
        nextCursor:
          type: string
          nullable: true
          description: >-
            Continue with the same artifact, maxBytes and pages, or null at the
            end of the text or requested pages. Retry the same request safely;
            deduplicate by revision and start offset.
      required:
        - artifactId
        - textRevision
        - versionId
        - text
        - location
        - pages
        - totalPages
        - 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
                - osha
              description: Dataset needed for dataset_not_enabled.
            businessCode:
              type: string
              description: The rater’s own refusal code, for business_rejection.
            violations:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    description: Authored or built-in constraint code
                  message:
                    type: string
                    description: Authored message for the failed constraint
                  path:
                    type: string
                    description: Input path of the offending value; empty for the request
                  value:
                    nullable: true
                    description: Offending input value, size-bounded by the runtime
                  constraint:
                    type: string
                    description: The constraint the value failed, as text
                  cite:
                    type: string
                    nullable: true
                    description: >-
                      Filing citation of the constraint, when the source cites
                      one
                required:
                  - code
                  - message
                  - path
                  - value
                  - constraint
                  - cite
                additionalProperties: false
              maxItems: 256
              description: >-
                Each input constraint the submission failed, for invalid_inputs
                and business_rejection.
            violationsTruncated:
              type: boolean
              description: >-
                True when the rater reported more violations than violations
                holds.
            executionId:
              type: string
              description: >-
                The recorded execution of a failed rating, for rater rating
                failures.
            accessUrl:
              type: string
              nullable: true
              format: uri
              description: Not currently returned.
          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.