> ## 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 /user-logs/export/

在**管理 API** 主机 (`api.scanova.io`) 上将一个异步任务加入队列，该任务会为指定日期范围生成账户活动（创建/更新/删除事件、登录和共享）的 CSV，使用您的原始管理 API 密钥进行身份验证。

```
POST https://api.scanova.io/user-logs/export/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
```

<ParamField body="fromDate" type="string">
  导出范围的开始时间，格式为 `DD/MM/YYYY HH:MM`（24 小时制），不含此时刻本身。
</ParamField>

<ParamField body="toDate" type="string">
  导出范围的结束时间，格式为 `DD/MM/YYYY HH:MM`（24 小时制），包含此时刻本身。
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.scanova.io/user-logs/export/" \
    -H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a" \
    -H "Content-Type: application/json" \
    -d '{ "fromDate": "01/09/2026 00:00", "toDate": "07/09/2026 23:59" }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": 483,
    "message": ["User Logs Export is in progress. You will receive an email on completion."]
  }
  ```
</ResponseExample>

任务入队后调用会立即返回 `200` —— `id` 是[列出用户日志导出历史](/zh/api-reference/management-api/user-logs/list)中该导出任务的 id，可在那里查询 `status`。导出完成或失败时，账户会收到一封电子邮件。

<Warning>
  `fromDate`/`toDate` **不会**同步验证。格式错误的日期字符串在此处不会产生 `400` —— 任务会被创建，只有在工作进程尝试解析时才会异步失败，最终变为 `status: "failed"` 并发送失败邮件。发送前请始终确认 `DD/MM/YYYY HH:MM` 格式。
</Warning>

如果账户的计划没有 `USER_LOGS_EXPORT` 配额，或调用者是缺少 `SHARED_USER_CAN_EXPORT_USER_LOGS` 权限的共享用户，则返回 `403`：

```json 403 theme={null}
{ "detail": "Your plan does not have user logs quota." }
```

<Note>
  已完成的导出记录及其 CSV 文件保留 14 天，之后会自动清除。
</Note>

## 相关内容

* [列出用户日志导出历史](/zh/api-reference/management-api/user-logs/list) —— 查询任务状态。
* [删除导出历史记录](/zh/api-reference/management-api/user-logs/delete) —— 提前移除任务。
* [管理 API 概述](/zh/api-reference/management-api/overview) —— 适用于此端点的身份验证方案和配额规则。


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /user-logs/export/
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:
  /user-logs/export/:
    post:
      summary: Trigger a user activity log export
      description: >-
        Queues an async job that generates a CSV of account activity
        (create/update/delete events) for the given date range and emails the
        account when it's done. Returns immediately — poll [List user log export
        history](/api-reference/management-api/user-logs/list) for `status`.
      operationId: createUserLogsExport
      requestBody:
        content:
          application/json:
            example:
              fromDate: 01/09/2026 00:00
              toDate: 07/09/2026 23:59
      responses:
        '200':
          description: Export job queued.
          content:
            application/json:
              example:
                id: 483
                message:
                  - >-
                    User Logs Export is in progress. You will receive an email
                    on completion.
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.

````