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

# Stream a signed export download (token-authenticated)

> Public endpoint — the JWT in the path is the authorisation credential. Validates the signature, the `exp` claim, the `sub`/`aud` pair against the row, then streams the CSV file with `Content-Disposition: attachment`. Tokens expire 10 minutes after minting; a fresh one can be fetched from `GET /exports/{id}`.




## OpenAPI

````yaml /openapi.yaml get /exports/download/{token}
openapi: 3.0.0
info:
  title: ConsentFly
  version: 1.1.0
  description: >
    API REST do ConsentFly para gerenciar consentimentos e evidências de
    privacidade em escala. Autentique cada chamada com `Authorization: Bearer
    sk-...` (API Key). Cada requisição bem-sucedida consome **1 unidade** da
    cota mensal do plano. Gere sua API Key em `/dashboard/api-keys`.
  contact: {}
servers:
  - url: https://www.consentfly.com.br/api/v1
    description: Produção
security:
  - ApiKeyAuth: []
tags:
  - name: Consents
    description: Capturar, listar, atualizar e auditar registros de consentimento.
  - name: DSAR
    description: >-
      Direito ao esquecimento por titular e recibo canônico para evidência
      regulatória.
  - name: Exports
    description: >-
      Exportação CSV em streaming síncrono ou via job assíncrono para volumes
      grandes.
paths:
  /exports/download/{token}:
    get:
      tags:
        - Exports
      summary: Stream a signed export download (token-authenticated)
      description: >
        Public endpoint — the JWT in the path is the authorisation credential.
        Validates the signature, the `exp` claim, the `sub`/`aud` pair against
        the row, then streams the CSV file with `Content-Disposition:
        attachment`. Tokens expire 10 minutes after minting; a fresh one can be
        fetched from `GET /exports/{id}`.
      parameters:
        - name: token
          in: path
          required: true
          description: Signed JWT minted by `GET /exports/{id}/download`
          schema:
            type: string
      responses:
        '200':
          description: CSV body
          content:
            text/csv:
              schema:
                type: string
                format: binary
        '401':
          description: Token invalid or expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIErrorResponse'
        '410':
          description: Export expired (file deleted by the cleanup cron)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIErrorResponse'
        '500':
          $ref: '#/components/responses/InternalError'
      security: []
components:
  schemas:
    utils.APIErrorResponse:
      type: object
      description: Envelope JSON padrão de erro da API.
      properties:
        error:
          type: string
          description: >-
            Código legível por máquina (ex. `unauthorized`, `quota_exceeded`,
            `plan_required`).
          example: unauthorized
        message:
          type: string
          description: Mensagem legível por humano. Para 5xx é genérica.
          example: Invalid or missing API key
  responses:
    InternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/utils.APIErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        Autenticação por API Key no formato `Authorization: Bearer sk-...`
        (sempre inclua o prefixo `Bearer`).

        Gere sua chave em `/dashboard/api-keys` após criar a conta e
        verificar o e-mail. A chave é exibida **uma única vez** no momento
        da criação — armazene em variável de ambiente no seu backend.
        Nunca exponha em código client-side.

````