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

# تشغيل إنشاء تقرير تحليلات

> POST /analytics/report/

يضع في قائمة الانتظار مهمة غير متزامنة تُنشئ تقرير بيانات مسح و/أو تحليلات يغطي مجموعة من رموز QR أو وسمًا أو مجلدًا.

<Note>
  يتطلب مفتاح واجهة برمجة تطبيقات إدارة بحصة `MANAGEMENT_API` (أو `MANAGEMENT_API_SANDBOX`) — راجع [نظرة عامة على واجهة برمجة التطبيقات للإدارة](/ar/api-reference/management-api/overview) — بالإضافة إلى حصة `EXPORT_ANALYTICS_REPORT` وصلاحية `ANALYTICS_CAN_EXPORT_REPORT` الخاصتين بالحساب.
</Note>

<ParamField body="filter_type" type="string" required>
  ما الذي تحدده `filter_data`: `qrcode` أو `tag` أو `folder`.
</ParamField>

<ParamField body="filter_data" type="string" required>
  سلسلة مُرمَّزة بصيغة JSON تحدد الهدف (الأهداف) — مثل مصفوفة JSON من `qrid`s عندما تكون `filter_type` هي `qrcode`.
</ParamField>

<ParamField body="start_date" type="string" required>
  تاريخ البدء (`YYYY-MM-DD`).
</ParamField>

<ParamField body="end_date" type="string" required>
  تاريخ الانتهاء (`YYYY-MM-DD`).
</ParamField>

<ParamField body="report_type" type="string" default="both">
  `scan_data` أو `analytics` أو `both`.
</ParamField>

<ParamField body="analytics_format" type="string" default="csv">
  تنسيق الملف لجزء التحليلات: `csv` أو `xls` أو `xlsx` أو `png` أو `jpeg` أو `pdf`.
</ParamField>

<ParamField body="scan_format" type="string" default="csv">
  تنسيق الملف لجزء بيانات المسح: نفس خيارات `analytics_format`.
</ParamField>

<ParamField body="advance_filter" type="object">
  حمولة تصفية JSON إضافية اختيارية، تُوضع فوق `filter_type`/`filter_data`.
</ParamField>

<ParamField body="exclude_bot_scan" type="boolean" default="false">
  يستبعد عمليات المسح المحددة كحركة روبوتات من التقرير.
</ParamField>

<ParamField body="is_saved" type="boolean" default="false">
  ما إذا كان يجب الاحتفاظ بهذا التقرير كإعداد مسبق محفوظ قابل لإعادة الاستخدام — راجع [تحديث تقرير تحليلات محفوظ](/ar/api-reference/management-api/analytics/report-update).
</ParamField>

<ParamField body="saved_name" type="string">
  اسم للإعداد المسبق المحفوظ، مطلوب إذا كانت `is_saved` بقيمة `true`. يجب أن يكون فريدًا لكل حساب — تكراره يُعيد `400`.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.scanova.io/analytics/report/' \
    --header 'Authorization: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "filter_type": "qrcode",
      "filter_data": "[\"Q07afe81aa0034c01\"]",
      "start_date": "2026-08-01",
      "end_date": "2026-08-31",
      "report_type": "both",
      "analytics_format": "xlsx",
      "scan_format": "csv"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": 59,
    "filter_type": "qrcode",
    "filter_data": "[\"Q07afe81aa0034c01\"]",
    "start_date": "2026-08-01",
    "end_date": "2026-08-31",
    "report_type": "both",
    "analytics_format": "xlsx",
    "scan_format": "csv",
    "status": "new",
    "report_file": null,
    "completed_on": null,
    "is_saved": false,
    "saved_name": null,
    "created": "2026-09-08T10:20:00Z",
    "requested_by_name": "Docs"
  }
  ```
</ResponseExample>

يُعيد الاستدعاء `201` فورًا بمجرد وضع المهمة في قائمة الانتظار، مع `status: "new"` — يُنشأ التقرير نفسه في الخلفية، ويتلقى الحساب بريدًا إلكترونيًا عند الاكتمال. استعلِم عن [سرد تقارير التحليلات](/ar/api-reference/management-api/analytics/report-list) لمعرفة `status` و`report_file`.

## ذو صلة

* [سرد تقارير التحليلات](/ar/api-reference/management-api/analytics/report-list) — الاستعلام عن حالة المهمة.
* [تحديث تقرير تحليلات محفوظ](/ar/api-reference/management-api/analytics/report-update) — إعادة تسمية أو إدارة إعداد مسبق محفوظ.
* [نظرة عامة على واجهة برمجة التطبيقات للإدارة](/ar/api-reference/management-api/overview) — مخطط المصادقة وبنية الحصص التي ينتمي إليها هذا الطرف.


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /analytics/report/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.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://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /analytics/report/:
    post:
      summary: Generate an analytics report
      description: >-
        Queues an async job that generates a scan-data and/or analytics report
        for the given QR codes, tags, or folders. Returns immediately — poll
        [List analytics
        reports](/api-reference/management-api/analytics/report-list) for
        `status`.
      operationId: createAnalyticsReport
      requestBody:
        content:
          application/json:
            example:
              filter_type: qrcode
              filter_data: '["Q07afe81aa0034c01"]'
              start_date: '2026-08-01'
              end_date: '2026-08-31'
              report_type: both
              analytics_format: xlsx
              scan_format: csv
      responses:
        '201':
          description: Report job queued.
          content:
            application/json:
              example:
                id: 59
                filter_type: qrcode
                filter_data: '["Q07afe81aa0034c01"]'
                start_date: '2026-08-01'
                end_date: '2026-08-31'
                report_type: both
                analytics_format: xlsx
                scan_format: csv
                status: new
                report_file: null
                completed_on: null
                is_saved: false
                saved_name: null
                created: '2026-09-08T10:20:00Z'
                requested_by_name: Docs
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. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````