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

# Exportar analíticas

> POST /analytics/qr/export/

Exporta analíticas agregadas — todos los tipos de métrica que permite el plan de la cuenta (`count`, `date`, `qr`, `utm`, `device`, `os`, `browser`, `geography`, y más) — como un archivo descargable, en lugar de un único payload JSON limitado a un `type` como requiere [Analíticas de QR](/es/api-reference/management-api/analytics/qr-analytics).

<Warning>
  Este es un endpoint **solo POST** — una solicitud `GET` devuelve `405 Method Not Allowed`. La especificación `management-api.json` lo indicaba anteriormente como `GET`; esto se ha corregido.
</Warning>

<Note>
  Requiere una clave de la API de gestión con cuota `MANAGEMENT_API` — consulta el [resumen de la API de gestión](/es/api-reference/management-api/overview) — además de la cuota `EXPORT_ANALYTICS_REPORT` y el permiso `ANALYTICS_CAN_EXPORT` de la cuenta. Un 403 con `"Your plan does not have export analytics report quota."` significa que el plan no incluye exportaciones.
</Note>

## Solicitud

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://management.scanova.io/analytics/qr/export/?from=2026-07-01&to=2026-08-16&file_format=xlsx' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "q": ["Q07afe81aa0034c01"],
      "filter_by": "qrid"
    }' \
    --output analytics.xlsx
  ```
</RequestExample>

Este endpoint siempre devuelve un archivo binario, no JSON — consulta los formatos de respuesta a continuación.

### Parámetros de consulta

<ParamField query="from" type="string" required>
  Fecha de inicio (`YYYY-MM-DD`), inclusiva.
</ParamField>

<ParamField query="to" type="string" required>
  Fecha de fin (`YYYY-MM-DD`), inclusiva.
</ParamField>

<ParamField query="file_format" type="string" required>
  `csv`, `xls`, `xlsx` o `pdf`. Cualquier otro valor (u omitirlo) devuelve un `400` con `"Invalid file format"`.
</ParamField>

<ParamField query="exclude_bot_scan" type="boolean" default="false">
  Excluye de la exportación los escaneos identificados como bots.
</ParamField>

### Cuerpo de la solicitud

Misma forma que [Analíticas de QR](/es/api-reference/management-api/analytics/qr-analytics#request-body):

<ParamField body="q" type="array" required>
  Identificadores para limitar la exportación — el tipo depende de `filter_by`.
</ParamField>

<ParamField body="filter_by" type="string" default="qrid">
  `qrid`, `id`, `tags` o `folder`.
</ParamField>

### Formatos de respuesta

<Tabs>
  <Tab title="csv">
    Devuelve un **archivo ZIP** (`application/zip`, `analytics.zip`) que contiene un CSV por cada tipo de métrica — no un único CSV plano. Esta es una particularidad real del formato de exportación: solicitar `csv` te da un zip, no un archivo `.csv` directamente.
  </Tab>

  <Tab title="xls / xlsx">
    Devuelve una única hoja de cálculo (`analytics.xlsx`) con una hoja por cada tipo de métrica.
  </Tab>

  <Tab title="pdf">
    Devuelve un informe de analíticas en PDF renderizado (`application/pdf`, `analytics.pdf`) — un resumen con formato en lugar de hojas sin procesar por métrica.
  </Tab>
</Tabs>

<Note>
  Si la cuenta tiene habilitadas las analíticas de [seguimiento de eventos](/es/api-reference/management-api/analytics/qr-analytics), sus métricas `count`/`engagement` se añaden automáticamente como hojas/archivos adicionales en la misma exportación — sin necesidad de ningún parámetro adicional.
</Note>

<Warning>
  A pesar de que el mensaje de error subyacente sugiere "generate Analytics Export instead", este endpoint aplica el **mismo** límite de volumen de cantidad de códigos QR/rango de fechas que [Analíticas de QR](/es/api-reference/management-api/analytics/qr-analytics#request) — todos los endpoints de analíticas comparten la misma ruta de código de validación de solicitudes. Si obtienes el `400` bajo `q`, reduce `q` o el rango de fechas; cambiar solo a este endpoint no lo evitará.
</Warning>

## Relacionado

* [Analíticas de QR](/es/api-reference/management-api/analytics/qr-analytics) — el equivalente JSON de esta exportación, limitado a los tipos de métrica que elijas.
* [Exportar analíticas en bruto](/es/api-reference/management-api/analytics/export-raw) — exporta registros de escaneo a nivel de fila en lugar de estos desgloses agregados.
* [Resumen de la API de gestión](/es/api-reference/management-api/overview) — el esquema de autenticación y la arquitectura de cuotas de la que forma parte este endpoint.


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /analytics/qr/export/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    management.scanova.io (QR codes, folders, tags, leads, forms, analytics,
    plans, shared users & roles), plus the token-creation and usage-stats
    endpoints used to authenticate against it. Every path and request/response
    shape below was verified live against a real API key and the actual running
    backend (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://management.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /analytics/qr/export/:
    post:
      summary: Export analytics
      description: >-
        Exports aggregated analytics (every metric type the plan allows) as a
        downloadable file — csv (returned as a zip of per-metric CSVs),
        xls/xlsx, or pdf. POST-only; shares its request body and volume-cap
        validation with /analytics/qr/.
      operationId: exportManagedAnalytics
      parameters:
        - name: from
          in: query
          required: true
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: true
          schema:
            type: string
            format: date
        - name: file_format
          in: query
          required: true
          schema:
            type: string
            enum:
              - csv
              - xls
              - xlsx
              - pdf
        - name: exclude_bot_scan
          in: query
          schema:
            type: boolean
            default: false
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                q:
                  type: array
                  items:
                    type: string
                filter_by:
                  type: string
                  enum:
                    - qrid
                    - tags
                    - id
                    - folder
                  default: qrid
              required:
                - q
            example:
              q:
                - Q07afe81aa0034c01
              filter_by: qrid
      responses:
        '200':
          description: >-
            Binary file download — application/zip for csv, spreadsheet mimetype
            for xls/xlsx, application/pdf for pdf.
          content:
            application/zip: {}
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: {}
            application/pdf: {}
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. management.scanova.io) — the same key sent to
        the regular API host will not authenticate.

````