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

# Get signed URL for an attachment

> Return a short-lived signed R2 URL for the attachment along with the storage key (and `remappedFrom` when a stale email-attachment key was rewritten). The signed URL is used by previews that need the URL itself rather than a redirect.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/messages/attachment-url/{storageKey}
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/messages/attachment-url/{storageKey}:
    get:
      tags:
        - Messages
      summary: Get signed URL for an attachment
      description: >-
        Return a short-lived signed R2 URL for the attachment along with the
        storage key (and `remappedFrom` when a stale email-attachment key was
        rewritten). The signed URL is used by previews that need the URL itself
        rather than a redirect.
      operationId: get_messages_attachment_url
      parameters:
        - in: path
          name: storageKey
          required: true
          schema:
            type: string
          description: Full R2 storage key
        - in: query
          name: inline
          required: false
          schema:
            type: string
          description: Set to "1" or "true" to request inline content disposition for PDFs
        - in: query
          name: contentType
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Signed URL returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttachmentSignedUrlResponse'
        '400':
          description: Invalid storage key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '404':
          description: Attachment not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
        '503':
          description: Storage not configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LegacyErrorResponse'
components:
  schemas:
    AttachmentSignedUrlResponse:
      type: object
      properties:
        url:
          type: string
        storageKey:
          type: string
        remappedFrom:
          type: string
          description: Present when the key was remapped from a stale email attachment key
      additionalProperties: true
      example:
        url: https://r2.example.com/messages/65a0.../photo.jpg?token=...
        storageKey: messages/65a0e0e0e0e0e0e0e0e0e0e0/msg_67b0/photo.jpg
    LegacyErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        data: {}
      additionalProperties: true
      example:
        error: Attachment not found
        message: Attachment not found

````