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

# Read an attachment

> Extracts the text of an attached document and scans it for personal data. The file is read in memory and not stored. Accepts `.txt`, `.md`, `.markdown`, `.csv`, `.tsv`, `.json`, `.log`, `.pdf` and `.docx` up to 10 MB; text is truncated at 50,000 characters. Returns a bare object, not the `{ data }` envelope.

**Auth:** session. **Permission:** signed in.



## OpenAPI

````yaml /api-reference/openapi.json post /chat/attachments
openapi: 3.1.0
info:
  title: CorePillar API
  version: 1.0.0
  description: >-
    REST API for AgentHub and ModelHub. Ingestion endpoints authenticate with a
    project tracing key; all other endpoints use the signed-in user's browser
    session.
servers:
  - url: https://pillarforge.corepillar.ai/api/v1
    description: AgentHub
security: []
tags:
  - name: Ingestion
    description: 'Send traces with a tracing key: JSON ingest and OpenTelemetry (OTLP).'
  - name: Traces
    description: Read traces and spans.
  - name: Evaluations
    description: Evaluate traces with evaluator collections.
  - name: Evaluators
    description: Built-in and custom evaluators.
  - name: Evaluator collections
    description: Ordered groups of evaluators.
  - name: Organizations
    description: Organizations you belong to.
  - name: Members
    description: Organization members, invites and roles.
  - name: Projects
    description: Projects inside an organization.
  - name: SSO
    description: Okta SSO configuration.
  - name: Tracing keys
    description: Create, list and revoke project tracing keys.
  - name: Cost calculator
    description: Estimate, generate and execute scenario runs.
  - name: Synthetic
    description: Synthetic agent and data setup from source material.
  - name: Chat
    description: ModelHub chat. Served at https://modelhub.corepillar.ai/api/v1.
  - name: Auth
    description: Sign-in helpers.
  - name: E2E
    description: Internal end-to-end encryption key directory.
paths:
  /chat/attachments:
    servers:
      - url: https://modelhub.corepillar.ai/api/v1
        description: ModelHub
    post:
      tags:
        - Chat
      summary: Read an attachment
      description: >-
        Extracts the text of an attached document and scans it for personal
        data. The file is read in memory and not stored. Accepts `.txt`, `.md`,
        `.markdown`, `.csv`, `.tsv`, `.json`, `.log`, `.pdf` and `.docx` up to
        10 MB; text is truncated at 50,000 characters. Returns a bare object,
        not the `{ data }` envelope.


        **Auth:** session. **Permission:** signed in.
      operationId: chatAttachment
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '200':
          description: Extracted text and scan report.
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                  kind:
                    type: string
                  text:
                    type: string
                  chars:
                    type: integer
                  originalChars:
                    type: integer
                  truncated:
                    type: boolean
                  report:
                    $ref: '#/components/schemas/PiiReport'
        '400':
          description: No file in the `file` field (`INVALID_BODY`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
        '401':
          description: Not signed in (`UNAUTHENTICATED`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
        '413':
          description: Over 10 MB (`TOO_LARGE`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
        '422':
          description: >-
            Unsupported, empty, password-protected or unreadable file
            (`UNSUPPORTED_TYPE`, `EMPTY`, `ENCRYPTED`, `UNREADABLE`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
      security:
        - session: []
components:
  schemas:
    PiiReport:
      type: object
      additionalProperties: true
      description: >-
        What the privacy scan found: finding types, severities and offsets.
        Never contains the matched values.
  securitySchemes:
    session:
      type: apiKey
      in: cookie
      name: session
      description: >-
        The session cookie set when you sign in to AgentHub or ModelHub in a
        browser. The cookie name shown here is illustrative. There are no API
        tokens for these endpoints.

````

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