> ## Documentation Index
> Fetch the complete documentation index at: https://test-8ad8522e-feat-ai-sre.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Export insight incidents

> Export the filtered incident analytics list as a CSV file. The response is a CSV stream delivered with `Content-Disposition: attachment` — it is not a JSON envelope. CSV headers and formatted values use the request locale, falling back to the member locale and then the account locale. `time_zone` defaults to the account time zone, then `Asia/Shanghai`. Export stops after at most 100,000 rows. Valid `export_fields` keys: incident_id, title, severity, progress, channel_id, channel_name, team_id, team_name, created_at, alert_cnt, active_alert_cnt, alert_event_cnt, seconds_to_ack, seconds_to_close, closed_by, owner_id, owner_name, creator_id, creator_name, closer_id, closer_name, engaged_seconds, hours, notifications, interruptions, acknowledgements, ackers, assignments, reassignments, escalations, manual_escalations, timeout_escalations, assigned_to, raw_assigned_to, escalate_rule_name, responders, raw_responders, snooze_status, snoozed_before, ever_muted, frequency, is_rare, description, labels, fields. When `export_fields` is omitted, all columns are exported.

## Restrictions

| Aspect      | Value                                                                            |
| ----------- | -------------------------------------------------------------------------------- |
| Rate limits | **100 requests/day**; **20 requests/minute**; **10 requests/second** per account |
| Permissions | **Analytics Read** (`on-call`)                                                   |


## OpenAPI

````yaml /api-reference/on-call.openapi.en.json post /insight/incident/export
openapi: 3.1.0
info:
  title: Flashduty Open API
  description: >-
    Public HTTP API for the Flashduty incident management platform — incidents,
    notification templates, channels, schedules, monitors, RUM, and platform
    administration. Every operation is authenticated with an `app_key` query
    parameter issued from the Flashduty console under Account → APP Keys.
    Responses follow a uniform envelope: `{ request_id, data }` on success, `{
    request_id, error }` on failure.
  version: 1.0.0
servers:
  - url: https://api.flashcat.cloud
    description: Flashduty Open API
security:
  - AppKeyAuth: []
tags:
  - name: On-call/Incidents
    description: ''
  - name: On-call/Channels
    description: ''
  - name: On-call/Alerts
    description: >-
      Search, inspect, and act on alerts. Manage card views and alert processing
      pipelines.
  - name: On-call/Integrations
    description: ''
  - name: On-call/IM integrations
    description: IM integration queries, such as which integrations have war room enabled.
  - name: On-call/Schedules
    description: ''
  - name: On-call/Licenses
    description: ''
  - name: On-call/Calendars
    description: ''
  - name: On-call/Notification templates
    description: ''
  - name: On-call/Alert enrichment
    description: Custom fields, enrichment rules, and data mapping (schema, data, API).
  - name: On-call/Analytics
    description: ''
  - name: On-call/Status pages
    description: ''
  - name: On-call/Changes
    description: ''
paths:
  /insight/incident/export:
    post:
      tags:
        - On-call/Analytics
      summary: Export insight incidents
      description: >-
        Export the filtered incident analytics list as a CSV file. The response
        is a CSV stream delivered with `Content-Disposition: attachment` — it is
        not a JSON envelope. CSV headers and formatted values use the request
        locale, falling back to the member locale and then the account locale.
        `time_zone` defaults to the account time zone, then `Asia/Shanghai`.
        Export stops after at most 100,000 rows. Valid `export_fields` keys:
        incident_id, title, severity, progress, channel_id, channel_name,
        team_id, team_name, created_at, alert_cnt, active_alert_cnt,
        alert_event_cnt, seconds_to_ack, seconds_to_close, closed_by, owner_id,
        owner_name, creator_id, creator_name, closer_id, closer_name,
        engaged_seconds, hours, notifications, interruptions, acknowledgements,
        ackers, assignments, reassignments, escalations, manual_escalations,
        timeout_escalations, assigned_to, raw_assigned_to, escalate_rule_name,
        responders, raw_responders, snooze_status, snoozed_before, ever_muted,
        frequency, is_rare, description, labels, fields. When `export_fields` is
        omitted, all columns are exported.
      operationId: insightIncidentExport
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InsightIncidentExportRequest'
            example:
              start_time: 1712000000
              end_time: 1712604800
              severities:
                - Critical
                - Warning
              export_fields:
                - incident_id
                - title
                - severity
                - created_at
                - seconds_to_close
              description_html_to_text: true
      responses:
        '200':
          description: Success
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
                description: >-
                  CSV file stream (`Content-Type: application/octet-stream`,
                  `Content-Disposition: attachment;
                  filename=incident_export_yyyyMMdd_HHmmss.csv`). The first row
                  holds localized column headers. Columns default to the full
                  incident field set, or the keys given in `export_fields`.
              example: >
                incident_id,title,severity,created_at

                6a86b5d6f72de50ae1ce2ffb,CPU usage above 90%,Critical,2026-01-01
                10:00:00 +0800 CST
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    InsightIncidentExportRequest:
      $ref: '#/components/schemas/InsightFilter'
    InsightFilter:
      type: object
      description: >-
        Shared filter envelope for insight and export endpoints. Severities
        accept up to 3 values; team/channel/responder/incident filters accept up
        to 100 IDs each. The time range cannot exceed one year.
      required:
        - start_time
        - end_time
      properties:
        start_time:
          type: integer
          format: int64
          description: Start time, Unix seconds. Must be greater than 0.
          exclusiveMinimum: 0
        end_time:
          type: integer
          format: int64
          description: End time, Unix seconds. Must be greater than `start_time`.
        team_ids:
          type: array
          items:
            type: integer
            format: int64
          description: Filter by team IDs. At most 100 entries.
          maxItems: 100
        channel_ids:
          type: array
          items:
            type: integer
            format: int64
          description: Filter by channel IDs. At most 100 entries.
          maxItems: 100
        responder_ids:
          type: array
          items:
            type: integer
            format: int64
          description: Filter by responder person IDs. At most 100 entries.
          maxItems: 100
        severities:
          type: array
          items:
            type: string
            enum:
              - Critical
              - Warning
              - Info
              - Ok
          description: Filter by severity. At most 3 entries.
          maxItems: 3
        incident_ids:
          type: array
          items:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          description: Filter by incident IDs (MongoDB ObjectIDs). At most 100 entries.
          maxItems: 100
        query:
          type: string
          description: Substring match on the incident title (SQL `LIKE %query%`).
        labels:
          type: object
          additionalProperties:
            type: string
          description: Label filters (exact match).
        fields:
          type: object
          additionalProperties: true
          description: Custom-field filters (exact match).
        orderby:
          type: string
          enum:
            - created_at
          description: >-
            Sort field of the incident list; only `created_at` (incident
            creation time) is supported. Used by `/insight/incident/list` only.
        asc:
          type: boolean
          description: >-
            Sort ascending when `true`, descending otherwise. Only used by
            `/insight/incident/list`.
        is_my_team:
          type: boolean
          description: >-
            Restrict results to teams the caller belongs to. When true and the
            caller has no teams, the result set is empty.
        time_zone:
          type: string
          description: >-
            IANA time zone name used to cut day/week/month buckets (e.g.
            `Asia/Shanghai`). Optional; defaults to UTC, except that
            `/insight/incident/export` falls back to the account time zone and
            then `Asia/Shanghai`.
        seconds_to_close_from:
          type: integer
          format: int64
          description: Lower bound (inclusive) on time-to-close, in seconds.
          minimum: 0
        seconds_to_close_to:
          type: integer
          format: int64
          description: >-
            Upper bound (exclusive) on time-to-close, in seconds. Must be
            greater than `seconds_to_close_from` when both are set.
          minimum: 0
        seconds_to_ack_from:
          type: integer
          format: int64
          description: Lower bound (inclusive) on time-to-acknowledge, in seconds.
          minimum: 0
        seconds_to_ack_to:
          type: integer
          format: int64
          description: >-
            Upper bound (exclusive) on time-to-acknowledge, in seconds. Must be
            greater than `seconds_to_ack_from` when both are set.
          minimum: 0
        export_fields:
          type: array
          items:
            type: string
          description: >-
            CSV column keys to include in the export, in the given order;
            unknown or duplicate keys are rejected. The valid key set differs
            per export endpoint — see each export operation's description. Only
            used by the export endpoints; at most 50 entries.
          maxItems: 50
        description_html_to_text:
          type: boolean
          description: Strip HTML markup from the description column when exporting.
        include_ever_muted:
          type: boolean
          description: >-
            Include incidents that have ever been muted. By default, they are
            excluded.
    ErrorResponse:
      type: object
      description: Response envelope for errors. `error` is required; `data` is absent.
      properties:
        request_id:
          type: string
          example: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
          description: >-
            Unique trace ID of this request; include it when reporting issues so
            logs can be located.
        error:
          $ref: '#/components/schemas/DutyError'
      required:
        - request_id
        - error
    DutyError:
      type: object
      description: >-
        Error payload inside the response envelope. Present only on non-2xx
        responses.
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            Human-readable error message, localized by the caller's
            Accept-Language. May contain field names, IDs, or other context from
            the failing request.
          example: The specified parameter template_id is not valid.
      required:
        - code
        - message
    ErrorCode:
      type: string
      description: >-
        Flashduty error code enum. Every failed API response sets `error.code`
        to one of these stable wire strings. HTTP status is informational — the
        authoritative signal is the enum value.


        | Code | HTTP | Meaning |

        |---|---|---|

        | `OK` | 200 | Reserved — not returned on real errors. |

        | `InvalidParameter` | 400 | A required parameter is missing or failed
        validation. |

        | `BadRequest` | 400 | Generic 400 used when no more specific code fits.
        |

        | `InvalidContentType` | 400 | The `Content-Type` header is not
        `application/json`. |

        | `ResourceNotFound` | 400 | The referenced resource does not exist.
        Note: returned as HTTP 400, not 404 (historical choice). |

        | `NoLicense` | 400 | The feature is license-gated and no active license
        was found. |

        | `ReferenceExist` | 400 | Deletion blocked — other entities still
        reference this resource. |

        | `Unauthorized` | 401 | `app_key` is missing, invalid, or expired. |

        | `BalanceNotEnough` | 402 | Billing-gated operation with insufficient
        account balance. |

        | `AccessDenied` | 403 | Authenticated but lacking the permission
        required for this operation. |

        | `RouteNotFound` | 404 | The request URL path is not a known route. |

        | `MethodNotAllowed` | 405 | The HTTP method is not allowed on this
        otherwise-known path. |

        | `UndonedOrderExist` | 409 | An outstanding billing order blocks this
        new one. Wait and retry. |

        | `RequestLocked` | 423 | Operation temporarily locked due to repeated
        failures. |

        | `EntityTooLarge` | 413 | Request body exceeds the configured max size.
        |

        | `RequestTooFrequently` | 429 | Rate limit hit — API-global,
        per-account, or per-integration. |

        | `RequestVerifyRequired` | 428 | Second-factor verification required
        but not supplied. |

        | `DangerousOperation` | 428 | High-risk operation requires MFA
        verification. |

        | `InternalError` | 500 | Unhandled server-side error. Include
        `request_id` in the bug report. |

        | `ServiceUnavailable` | 503 | A backend dependency is unavailable. Try
        again later. |
      enum:
        - OK
        - InvalidParameter
        - BadRequest
        - InvalidContentType
        - ResourceNotFound
        - NoLicense
        - ReferenceExist
        - Unauthorized
        - BalanceNotEnough
        - AccessDenied
        - RouteNotFound
        - MethodNotAllowed
        - UndonedOrderExist
        - RequestLocked
        - EntityTooLarge
        - RequestTooFrequently
        - RequestVerifyRequired
        - DangerousOperation
        - InternalError
        - ServiceUnavailable
      x-enumDescriptions:
        OK: Reserved — not returned on real errors.
        InvalidParameter: A required parameter is missing or failed validation.
        BadRequest: Generic 400 used when no more specific code fits.
        InvalidContentType: The `Content-Type` header is not `application/json`.
        ResourceNotFound: >-
          The referenced resource does not exist. Note: returned as HTTP 400,
          not 404 (historical choice).
        NoLicense: The feature is license-gated and no active license was found.
        ReferenceExist: Deletion blocked — other entities still reference this resource.
        Unauthorized: '`app_key` is missing, invalid, or expired.'
        BalanceNotEnough: Billing-gated operation with insufficient account balance.
        AccessDenied: Authenticated but lacking the permission required for this operation.
        RouteNotFound: The request URL path is not a known route.
        MethodNotAllowed: The HTTP method is not allowed on this otherwise-known path.
        UndonedOrderExist: An outstanding billing order blocks this new one. Wait and retry.
        RequestLocked: Operation temporarily locked due to repeated failures.
        EntityTooLarge: Request body exceeds the configured max size.
        RequestTooFrequently: Rate limit hit — API-global, per-account, or per-integration.
        RequestVerifyRequired: Second-factor verification required but not supplied.
        DangerousOperation: High-risk operation requires MFA verification.
        InternalError: Unhandled server-side error. Include `request_id` in the bug report.
        ServiceUnavailable: A backend dependency is unavailable. Try again later.
      example: InvalidParameter
  responses:
    BadRequest:
      description: Invalid request — usually a missing or malformed parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingParameter:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InvalidParameter
                  message: The specified parameter is not valid.
    Unauthorized:
      description: Missing or invalid app_key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingAppKey:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: Unauthorized
                  message: You are unauthorized.
    TooManyRequests:
      description: >-
        Rate limit hit. Either the global API limit, a per-account limit, or a
        per-integration limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: RequestTooFrequently
                  message: Request too frequently.
    ServerError:
      description: Unexpected server-side error. Include the request_id when reporting.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal:
              value:
                request_id: 01HK8XQE3Z7JM2NTFQ5YJ8P9R4
                error:
                  code: InternalError
                  message: >-
                    We encountered an internal error, and it has been reported.
                    Please try again later.
  securitySchemes:
    AppKeyAuth:
      type: apiKey
      in: query
      name: app_key
      description: >-
        App key issued from the Flashduty console under Account → APP Keys.
        Required on every public API call. Keep it secret — it grants the same
        access as the owning account.

````