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

# Gerar URL de download

> Gera uma presigned URL temporária para download de um ficheiro do S3. A URL expira em 1 hora.



## OpenAPI

````yaml /openapi.json get /attachments/download
openapi: 3.0.3
info:
  title: Sendaki Transactional API
  description: >-
    API transacional do Sendaki — envia emails e gere anexos a partir da tua
    aplicação. Autenticada por API key. Domínios de envio são geridos no
    workspace (app.sendaki.tech), não por esta API.
  version: 1.0.0
servers:
  - url: https://awsapi.sendaki.tech
    description: Produção
security:
  - apiKey: []
tags:
  - name: Emails
    description: Envia emails transacionais.
  - name: Attachments
    description: Upload e download de ficheiros anexados aos emails.
paths:
  /attachments/download:
    get:
      tags:
        - Attachments
      summary: Gerar URL de download
      description: >-
        Gera uma presigned URL temporária para download de um ficheiro do S3. A
        URL expira em 1 hora.
      operationId: getAttachmentUrl
      parameters:
        - name: key
          in: query
          required: true
          description: Key do ficheiro no S3, devolvida por POST /attachments/presign.
          schema:
            type: string
          example: attachments/org123/1778360121432-fatura-001.pdf
      responses:
        '200':
          description: Presigned URL de download gerada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PresignResult'
        '400':
          description: key em falta
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              example:
                error: key é obrigatória
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Ficheiro não encontrado no S3
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              example:
                error: Anexo não encontrado
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    PresignResult:
      type: object
      properties:
        url:
          type: string
          description: URL temporária para PUT (upload) ou GET (download) directo no S3.
        key:
          type: string
          description: Identificador único do ficheiro no S3.
        expires_in:
          type: integer
          description: Segundos até a URL expirar (3600 = 1 hora).
    ErrorMessage:
      type: object
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: API key em falta ou inválida
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
          example:
            message: Unauthorized
    ServerError:
      description: Erro interno do servidor
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
          example:
            error: mensagem do erro
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key gerada em app.sendaki.tech → Settings → API Keys.

````