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

# Fetch readable attachment text

> Fetches extracted text for opportunity attachments, Document records, and raw text-like content for workspace attachments, including CSV, TSV, JSON, Markdown, HTML, XML, YAML, logs, and plain text. Opportunity attachment IDs are the IDs returned in opportunity aggregateAttachments and opportunitySources.attachments. Workspace attachment IDs are returned by workspace attachment endpoints. Document IDs come from document-backed surfaces.




## OpenAPI

````yaml /openapi/tools-v1.yaml get /api/tools/v1/attachments/{attachmentType}/{id}/text
openapi: 3.1.0
info:
  title: Govly Tools API
  version: 1.0.0
  description: >
    REST-callable tool surface for agent and automation workflows. Agents are
    the primary consumer, but integrations can be built on this API. Within this
    version, Govly aims to avoid breaking regressions in documented behavior;
    response objects may receive additional fields at any time. Responses are
    JSON for typed clients; MCP tools may render action results into
    text-oriented formats separately.
servers:
  - url: https://app.govly.com
security:
  - bearerApiKey: []
  - headerApiKey: []
tags:
  - name: Opportunities
    description: Search, fetch, and inspect Govly opportunity records.
  - name: Workspaces
    description: Create, update, and inspect opportunity workspaces.
  - name: Workspace Members
    description: Add users and teams to workspaces.
  - name: Workspace Attachments
    description: List and upload workspace attachments.
  - name: Workspace Comments
    description: Post comments to workspaces.
  - name: Follows
    description: Follow opportunities and related workspace activity.
  - name: Saved Searches
    description: List saved opportunity searches and cached matches.
  - name: Attachments
    description: Fetch extracted or readable attachment text.
paths:
  /api/tools/v1/attachments/{attachmentType}/{id}/text:
    get:
      tags:
        - Attachments
      summary: Fetch readable attachment text
      description: >
        Fetches extracted text for opportunity attachments, Document records,
        and raw text-like content for workspace attachments, including CSV, TSV,
        JSON, Markdown, HTML, XML, YAML, logs, and plain text. Opportunity
        attachment IDs are the IDs returned in opportunity aggregateAttachments
        and opportunitySources.attachments. Workspace attachment IDs are
        returned by workspace attachment endpoints. Document IDs come from
        document-backed surfaces.
      operationId: fetch_attachment_text
      parameters:
        - $ref: '#/components/parameters/attachmentType'
        - $ref: '#/components/parameters/id'
        - name: startOffset
          in: query
          required: false
          schema:
            type: integer
            default: 0
            minimum: 0
        - name: maxChars
          in: query
          required: false
          schema:
            type: integer
            default: 100000
            maximum: 200000
      responses:
        '200':
          description: Attachment text, or a structured status if text is unavailable.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/AttachmentText'
        '401':
          $ref: '#/components/responses/Error'
        '403':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '422':
          $ref: '#/components/responses/Error'
components:
  parameters:
    attachmentType:
      name: attachmentType
      in: path
      required: true
      schema:
        type: string
        enum:
          - opportunity
          - workspace
          - document
    id:
      name: id
      in: path
      required: true
      schema:
        type: string
  schemas:
    AttachmentText:
      type: object
      required:
        - id
        - attachmentType
        - filename
        - status
        - startOffset
        - maxChars
        - truncated
        - totalLength
      properties:
        id:
          type: string
        attachmentType:
          type: string
          enum:
            - opportunity
            - workspace
            - document
        filename:
          type: string
        contentType:
          type: string
        byteSize:
          type: integer
        status:
          type: string
          enum:
            - available
            - processing
            - failed
            - unavailable
        source:
          type:
            - string
            - 'null'
          enum:
            - text_extract
            - file
            - document
            - null
          description: >-
            text_extract for stored extracted text; file for raw text-like files
            such as CSV; document for Document extracted/markdown content.
        text:
          type:
            - string
            - 'null'
          description: >-
            Present when status is available. Long text is paginated with
            startOffset and maxChars.
        startOffset:
          type: integer
        maxChars:
          type: integer
        nextOffset:
          type:
            - integer
            - 'null'
          description: Pass as startOffset to continue reading when truncated is true.
        truncated:
          type: boolean
        totalLength:
          type: integer
        message:
          type: string
    ErrorEnvelope:
      type: object
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            type: object
            required:
              - status
              - code
              - title
              - detail
            properties:
              status:
                type: string
              code:
                type: string
              title:
                type: string
              detail:
                type: string
              source:
                type: object
                properties:
                  pointer:
                    type: string
  responses:
    Error:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: API key
    headerApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````