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

> ## Agent Instructions
> Public hosts only: console https://omnimux.ai/dashboard · API https://api.omnimux.ai · docs https://docs.omnimux.ai.
> Gateway auth is Authorization: Bearer sk-… on https://api.omnimux.ai/v1 (OpenAI-compatible Chat Completions and related paths).
> Discover pages from /llms.txt; full site dump /llms-full.txt; product skill /skill.md; docs search MCP /mcp. Prefer .md page URLs for Markdown.
> Default docs locale is en; zh mirrors the same relative paths. Do not invent model ids not present on live pricing or the complete API pages.

# Export My Usage Logs

> Stream the authenticated user’s visible logs; verify the terminal success record.

* This account-management user API accepts a permitted user access token or dashboard login session; an `sk-` generation key is not accepted. Personal access tokens require `usage:read`; see [Security and keys](https://docs.omnimux.ai/en/faqs/security.md).
* It exports only the authenticated account’s own visible logs, under the same visibility rules as that account’s log list. Supplying another username or channel filter does not grant other users’ records.
* The operator controls regular-user export availability. Each account can run one export at a time. Business rejections such as a busy export, excessive time span or disabled export can still return **HTTP 200**; read `success`.

## Confirming a complete export

A successful stream uses `application/x-ndjson`, with one log object per line and a **terminal result object**, for example `{"success":true,"message":"","data":{"count":1}}`. The count excludes the result object. No matching records still produces a successful count of 0.

Treat the export as complete only after reading terminal `success: true` and verifying that the record count matches `data.count`. A later failure can end the stream with `success: false`. A disconnection, cancellation or missing terminal result leaves a partial export. HTTP 200 or a few records alone do not establish completion.

## Time span and record fields

The operator sets the maximum span, defaulting to 365 days. Negative timestamps, a start after the effective end, invalid search patterns, and an excessive span are rejected before streaming; divide a longer interval into permitted ranges. This does not set retention or delete logs. An omitted start reaches back the maximum range from the effective end; an omitted end uses now.

Records follow the own-account list order. `id` is an export-local display position, not a database row ID or a cursor for incremental synchronization. `quota` is raw internal quota: `quota ÷ 500000 = USD`, `1 USD = 10 积分`; do not label the raw number as points. Internal administrative information retains the own-account list’s visibility rules.

This read operation does not generate content or incur generation charges. Cross-account administrator exports are outside this contract.

```json 200 NDJSON theme={null}
{"id":1,"user_id":42,"created_at":1791979200,"type":2,"content":"","username":"example-user","token_name":"example-key","model_name":"","quota":500,"prompt_tokens":10,"completion_tokens":5,"use_time":1,"is_stream":false,"channel":0,"channel_name":"","token_id":1,"group":"","ip":"","request_id":"example-request-id","other":"{}"}
{"success":true,"message":"","data":{"count":1}}
```

```json 401 theme={null}
{
  "success": false,
  "code": "AUTH_UNAUTHORIZED",
  "message": "Invalid user credential"
}
```

```json 403 theme={null}
{
  "success": false,
  "code": "ACCESS_TOKEN_SCOPE_DENIED",
  "message": "Permission denied"
}
```

```json 500 theme={null}
{
  "success": false,
  "code": "AUTH_INTERNAL_ERROR",
  "message": "Internal authentication error"
}
```


## OpenAPI

````yaml openapi/ops/account/en/usage-log-export.json GET /api/log/self/export
openapi: 3.1.0
info:
  title: Export My Usage Logs
  version: 1.0.0
  description: >-
    Stream the authenticated user’s visible logs; verify the terminal success
    record.
servers:
  - url: https://omnimux.ai
security: []
paths:
  /api/log/self/export:
    get:
      summary: Export My Usage Logs
      description: >-
        Stream the authenticated user’s visible logs; verify the terminal
        success record.
      operationId: exportOwnUsageLogs
      parameters:
        - name: type
          in: query
          required: false
          description: Log type; 0 includes all types.
          schema:
            type: integer
        - name: start_timestamp
          in: query
          required: false
          description: >-
            Start as Unix seconds. Omission uses the configured maximum range
            before the effective end.
          schema:
            type: integer
            minimum: 0
        - name: end_timestamp
          in: query
          required: false
          description: >-
            End as Unix seconds. Omission uses now; future times are capped at
            now for the range check.
          schema:
            type: integer
            minimum: 0
        - name: model_name
          in: query
          required: false
          description: Model-name filter.
          schema:
            type: string
        - name: token_name
          in: query
          required: false
          description: Gateway-key name filter.
          schema:
            type: string
        - name: group
          in: query
          required: false
          description: Request-group filter.
          schema:
            type: string
        - name: request_id
          in: query
          required: false
          description: Gateway request-ID filter.
          schema:
            type: string
        - name: upstream_request_id
          in: query
          required: false
          description: Upstream request-ID filter.
          schema:
            type: string
      responses:
        '200':
          description: >-
            Export stream, or a business rejection before streaming. HTTP 200
            alone does not prove completion.
          headers:
            Cache-Control:
              schema:
                type: string
              example: no-store
          content:
            application/x-ndjson:
              schema:
                type: string
                description: >-
                  One log object per line; the last line is a
                  success/message/data.count result. A later failure can emit
                  success:false; a missing terminal result also means incomplete
                  export.
              example: >
                {"id":1,"user_id":42,"created_at":1791979200,"type":2,"content":"","username":"example-user","token_name":"example-key","model_name":"","quota":500,"prompt_tokens":10,"completion_tokens":5,"use_time":1,"is_stream":false,"channel":0,"channel_name":"","token_id":1,"group":"","ip":"","request_id":"example-request-id","other":"{}"}

                {"success":true,"message":"","data":{"count":1}}
            application/json:
              schema:
                $ref: '#/components/schemas/ExportResult'
              example:
                success: false
                message: Another log export is running. Try again after it finishes.
        '401':
          description: Missing or invalid user credential.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
              example:
                success: false
                code: AUTH_UNAUTHORIZED
                message: Invalid user credential
        '403':
          description: The user credential lacks permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
              example:
                success: false
                code: ACCESS_TOKEN_SCOPE_DENIED
                message: Permission denied
        '500':
          description: Internal authentication error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
              example:
                success: false
                code: AUTH_INTERNAL_ERROR
                message: Internal authentication error
      security:
        - UserAccessToken: []
components:
  schemas:
    ExportResult:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
        message:
          type: string
        message_key:
          type: string
          description: Optional localization key.
        message_params:
          type: object
          additionalProperties: true
        data:
          type: object
          properties:
            count:
              type: integer
              minimum: 0
    AuthError:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          const: false
        code:
          type: string
        message:
          type: string
  securitySchemes:
    UserAccessToken:
      type: http
      scheme: bearer
      bearerFormat: user access token
      description: >-
        User access token with usage:read, not an sk- generation key. A
        dashboard login session is also supported.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.