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

# Download an email attachment

> Streams one attachment's bytes through Aptly from the mail provider, with
`Content-Disposition: attachment` and the attachment's file name.
`Content-Type` is the attachment's `contentType` from the message endpoint
(falling back to the provider's, then `application/octet-stream`).
`attachmentId` is an `attachments[].id` from the message endpoint. A `Range`
request header is forwarded, so large files can be fetched in parts (206).




## OpenAPI

````yaml /openapi.yaml get /api/inboxes/{channelId}/threads/{threadId}/messages/{messageId}/attachments/{attachmentId}
openapi: 3.0.3
info:
  title: Aptly API
  version: '1.1'
  description: |
    The Aptly API lets external systems work with boards, contacts, inboxes,
    tasks, files, and other Aptly resources.

    Most endpoints accept an API key in the `x-token` header. Some endpoints
    also accept a delegate token or partner bearer token, as shown in each
    operation's security requirements, and explicitly public endpoints require
    no credential. API keys are scoped to a company and may be restricted to
    specific boards and read, insert, or update permissions; requests outside
    those restrictions receive a 403 `FORBIDDEN` response.
servers:
  - url: https://core-api.getaptly.com
    description: Production
security:
  - ApiKeyHeader: []
paths:
  /api/inboxes/{channelId}/threads/{threadId}/messages/{messageId}/attachments/{attachmentId}:
    get:
      tags:
        - Inboxes
      summary: Download an email attachment
      description: >
        Streams one attachment's bytes through Aptly from the mail provider,
        with

        `Content-Disposition: attachment` and the attachment's file name.

        `Content-Type` is the attachment's `contentType` from the message
        endpoint

        (falling back to the provider's, then `application/octet-stream`).

        `attachmentId` is an `attachments[].id` from the message endpoint. A
        `Range`

        request header is forwarded, so large files can be fetched in parts
        (206).
      operationId: getInboxMessageAttachment
      parameters:
        - name: channelId
          in: path
          required: true
          schema:
            type: string
          description: External channel meta ID (`meta.id`) of the inbox.
        - name: threadId
          in: path
          required: true
          schema:
            type: string
        - name: messageId
          in: path
          required: true
          schema:
            type: string
        - name: attachmentId
          in: path
          required: true
          schema:
            type: string
        - name: Range
          in: header
          schema:
            type: string
          description: Optional byte range, e.g. `bytes=0-1048575`.
      responses:
        '200':
          description: The attachment bytes.
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '206':
          description: Partial content for a `Range` request.
        '400':
          description: Not an email message.
        '403':
          description: No access to this inbox.
        '404':
          description: Inbox, thread, message or attachment not found.
        '502':
          description: The mail provider request failed.
      security:
        - ApiKeyHeader: []
        - DelegateToken: []
        - PartnerBearer: []
components:
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-token
    DelegateToken:
      type: apiKey
      in: header
      name: Authorization
      description: 'Delegate token issued by the platform. Format: `DelegateToken <token>`'
    PartnerBearer:
      type: http
      scheme: bearer
      description: 'Partner token. Format: `Authorization: Bearer <token>`'

````

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