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

# Download attachment

> Returns the attachment bytes. Authenticate with `Authorization: Bearer <API_KEY>`. The response is the file itself (not a redirect), so clients can fetch the URL from `attachments[].url` with the same API key they use for the rest of the API.



## OpenAPI

````yaml https://api.openmail.sh/openapi.json get /v1/attachments/{messageId}/{filename}
openapi: 3.0.3
info:
  title: OpenMail API
  description: >-
    Email infrastructure API for AI agents. Create inboxes, send and receive
    email, and get real-time notifications via webhooks.
  version: 1.0.0
  license:
    name: Proprietary
servers:
  - url: https://api.openmail.sh
security:
  - bearerAuth: []
tags:
  - name: pods
    description: Isolated sub-accounts for your end users or tenants
  - name: inboxes
    description: Email inboxes and their webhook configuration
  - name: domains
    description: >-
      Custom domains: add your own sending/receiving domain, publish DNS, and
      verify it
  - name: messages
    description: Sending and listing messages
  - name: threads
    description: Conversation threads and read status
  - name: attachments
    description: Downloading and extracting text from attachments
  - name: policy
    description: >-
      Correspondent policy — provider-enforced allow/block rules and allowlist
      mode, scoped per account, pod, or inbox. Account-wide key only.
  - name: feedback
    description: Reporting bugs, friction, and feature requests to the OpenMail team
paths:
  /v1/attachments/{messageId}/{filename}:
    get:
      tags:
        - attachments
      summary: Download attachment
      description: >-
        Returns the attachment bytes. Authenticate with `Authorization: Bearer
        <API_KEY>`. The response is the file itself (not a redirect), so clients
        can fetch the URL from `attachments[].url` with the same API key they
        use for the rest of the API.
      operationId: getAttachment
      parameters:
        - schema:
            type: string
          in: path
          name: messageId
          required: true
        - schema:
            type: string
          in: path
          name: filename
          required: true
      responses:
        '200':
          description: Attachment file bytes
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '404':
          description: Attachment not found
          content:
            application/json:
              schema:
                description: Attachment not found
                allOf:
                  - $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      additionalProperties: true
      properties:
        error:
          type: string
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````