> ## 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.

# Rehydrate email message attachments from provider

> Re-downloads attachment bytes for an email message from the provider and re-uploads them to R2 storage. Used when the stored signed URL expired or the attachment was never persisted locally.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/email/messages/attachments/rehydrate
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/email/messages/attachments/rehydrate:
    post:
      tags:
        - Email
      summary: Rehydrate email message attachments from provider
      description: >-
        Re-downloads attachment bytes for an email message from the provider and
        re-uploads them to R2 storage. Used when the stored signed URL expired
        or the attachment was never persisted locally.
      operationId: post_email_messages_attachments_rehydrate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailRehydrateAttachmentsRequest'
      responses:
        '200':
          description: Attachments rehydrated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailRehydrateAttachmentsResponse'
        '400':
          description: messageId required or missing metadata
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailErrorResponse'
        '404':
          description: Message or account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailErrorResponse'
        '500':
          description: Unable to rehydrate attachments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    EmailRehydrateAttachmentsRequest:
      type: object
      properties:
        messageId:
          type: string
          description: >-
            Tether Message `_id` whose attachments should be re-downloaded from
            the provider.
      required:
        - messageId
      additionalProperties: true
      example:
        messageId: 665f1a0c0e0a4b001a2c9f60
    EmailRehydrateAttachmentsResponse:
      type: object
      description: >-
        Returned after `POST /api/email/messages/attachments/rehydrate`
        re-uploads provider-side attachments into R2. Includes the updated
        message and the count of re-uploaded attachments.
      properties:
        message:
          type: object
          description: Updated email message document with refreshed attachment URLs.
          additionalProperties: true
        rehydrated:
          type: integer
          description: Number of attachments re-uploaded.
      required:
        - message
        - rehydrated
      additionalProperties: true
      example:
        message:
          _id: 665f1a0c0e0a4b001a2c9f60
          conversationId: 665f1a0c0e0a4b001a2c9f70
          channelType: email
          body: Attached the signed lease for review.
          attachments:
            - url: https://r2.tetherai.ca/org-64a1b/email/lease.pdf?signature=...
              contentType: application/pdf
              size: 184320
              filename: lease.pdf
        rehydrated: 1
    EmailErrorResponse:
      type: object
      description: >-
        Error envelope returned by Email feature endpoints. Most paths only set
        `error`; a few include `code` for diagnostic context (e.g. provider
        mismatches).
      properties:
        error:
          type: string
        message:
          type: string
        code:
          type: string
      required:
        - error
      additionalProperties: true
      example:
        error: Email account not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````