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

# Export a Report

> Queue a report export and email the caller links to the files.

Open to CRM read, like viewing the report: the files go only to the
caller's own address, and hold what they can already see.

Queues an export of any report query and emails the caller download links: an Excel file with Summary and Activities sheets, and/or the activities as CSV. The file holds every matching activity up to 50,000, and the email says when it stops short. Requires a CRM read [scope](https://docs.anycrm.anyreach.ai/authentication.md#scopes); the files only ever go to the caller's own address.


## OpenAPI

````yaml POST /reports/export
openapi: 3.1.0
info:
  title: anycrm-api
  version: 0.0.1
servers: []
security: []
tags:
  - name: Customer Intelligence
    description: >-
      Company research and ICP-fit scoring — create a research run, track its
      progress, and read back scored companies as leads.
  - name: Outreach
    description: >-
      The cold-email sending infrastructure — domains and mailboxes, over
      Primeforge and Warmforge.
  - name: AnyCard
    description: >-
      Authenticated CRUD for AnyCard, the org's digital business-card /
      lead-capture product.
  - name: AnyCard Events
    description: >-
      Event-attribution analytics for AnyCard — which captured leads converted,
      broken down by source, owner, and deal.
  - name: AnyCard Share Links
    description: >-
      Unauthenticated endpoints reached by anyone who scans a QR code or opens a
      shared AnyCard link.
  - name: AI
    description: >-
      A streaming (SSE) AI chat endpoint with account-commit actions it can take
      on the caller's behalf, and the job that fills every deal and account tab
      of an org.
  - name: Analytics Assistant
    description: >-
      The natural-language analytics assistant — a guarded text-to-SQL loop
      (SSE) that answers ad-hoc questions over the org's CRM data as a
      least-privilege, read-only database role.
  - name: Account Readiness
    description: >-
      Account Readiness Profiles — AI-scored signals on whether an account is
      ready for outreach or expansion, computed via a Temporal workflow.
  - name: Integrations
    description: >-
      Pipedream Connect — issuing connect tokens and managing the org's
      connected third-party accounts.
  - name: Feedback
    description: >-
      User-submitted platform feedback (bug reports, feature requests) — global,
      not scoped to one organization.
  - name: Public Media
    description: >-
      Unauthenticated image reads for publicly-embeddable assets (card photos,
      inline email images) — allowlisted by key shape; everything else in the
      storage bucket stays private.
  - name: Service Health
    description: Service liveness.
paths:
  /reports/export:
    post:
      tags:
        - Reports
      summary: Export Report Query
      description: |-
        Queue a report export and email the caller links to the files.

        Open to CRM read, like viewing the report: the files go only to the
        caller's own address, and hold what they can already see.
      operationId: export_report_query_reports_export_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportReportBody'
        required: true
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Export Report Query Reports Export Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ExportReportBody:
      properties:
        query:
          $ref: '#/components/schemas/ReportQuery'
        timezone:
          type: string
          title: Timezone
          description: Requester's IANA timezone.
          default: UTC
        formats:
          items:
            type: string
            enum:
              - xlsx
              - csv
          type: array
          minItems: 1
          title: Formats
          description: 'xlsx: Summary and Activities sheets. csv: the activities.'
        title:
          type: string
          maxLength: 200
          title: Title
          description: Report name.
        period_label:
          type: string
          maxLength: 200
          title: Period Label
          default: ''
        scope_label:
          type: string
          maxLength: 1000
          title: Scope Label
          description: The filters, in words.
          default: ''
        measure_label:
          type: string
          maxLength: 200
          title: Measure Label
          default: ''
      type: object
      required:
        - query
        - formats
        - title
      title: ExportReportBody
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ReportQuery:
      properties:
        entity:
          type: string
          enum:
            - activities
            - deals
            - stage_changes
            - contacts
            - outreach
          title: Entity
        filters:
          items:
            $ref: '#/components/schemas/ReportFilter'
          type: array
          maxItems: 50
          title: Filters
          description: All must match.
        filter_groups:
          items:
            items:
              $ref: '#/components/schemas/ReportFilter'
            type: array
          type: array
          maxItems: 10
          title: Filter Groups
          description: >-
            More filter groups: a record matches `filters` OR any one group (a
            group's filters all match).
        any_filters:
          items:
            $ref: '#/components/schemas/ReportFilter'
          type: array
          maxItems: 50
          title: Any Filters
          description: At least one must match (when any are given).
        period:
          anyOf:
            - $ref: '#/components/schemas/ReportPeriod'
            - type: 'null'
        measure:
          $ref: '#/components/schemas/ReportMeasure'
        view_by:
          anyOf:
            - type: string
            - type: 'null'
          title: View By
        interval:
          anyOf:
            - type: string
              enum:
                - day
                - week
                - month
                - quarter
                - year
            - type: 'null'
          title: Interval
          description: Bucket for a date view_by (default month).
        segment_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Segment By
        chart:
          type: string
          enum:
            - column
            - bar
            - pie
            - number
            - funnel
          title: Chart
          default: column
        chart_sort:
          anyOf:
            - type: string
              enum:
                - value_desc
                - value_asc
                - label_asc
                - label_desc
            - type: 'null'
          title: Chart Sort
          description: Chart order; default is the field's own order.
        compare:
          anyOf:
            - type: string
              enum:
                - previous_period
                - previous_year
            - type: 'null'
          title: Compare
          description: Also run the period before, or a year earlier.
        columns:
          items:
            type: string
          type: array
          maxItems: 40
          title: Columns
        sort:
          items:
            $ref: '#/components/schemas/ReportSort'
          type: array
          maxItems: 5
          title: Sort
      type: object
      required:
        - entity
      title: ReportQuery
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ReportFilter:
      properties:
        field:
          type: string
          title: Field
          description: Field key from GET /reports/fields.
        op:
          type: string
          title: Op
          description: One of the field's operators.
        value:
          title: Value
          description: >-
            Scalar, list (in / not_in / between), or for "period" a {"range"} or
            {"start", "end"} object. User fields accept "me".
      type: object
      required:
        - field
        - op
      title: ReportFilter
    ReportPeriod:
      properties:
        range:
          anyOf:
            - type: string
            - type: 'null'
          title: Range
          description: Preset such as "last_week" or "this_quarter".
        start:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Start
          description: Custom start date.
        end:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: End
          description: Custom end date (inclusive).
        field:
          type: string
          title: Field
          description: The date field the period applies to.
      type: object
      required:
        - field
      title: ReportPeriod
    ReportMeasure:
      properties:
        agg:
          type: string
          enum:
            - count
            - sum
            - avg
            - count_distinct
          title: Agg
          default: count
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
          description: Field for sum / avg (numbers) or count_distinct (e.g. deal).
      type: object
      title: ReportMeasure
    ReportSort:
      properties:
        field:
          type: string
          title: Field
        dir:
          type: string
          enum:
            - asc
            - desc
          title: Dir
          default: desc
      type: object
      required:
        - field
      title: ReportSort
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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