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

# Create a Report

Save a report query under a name for the whole organization. The query is validated the same way [Run a Report](https://docs.anycrm.anyreach.ai/api-reference/reports/run-report.md) validates it. Admins and managers only (`users:manage` or `organizations:manage`).


## OpenAPI

````yaml POST /reports
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:
    post:
      tags:
        - Reports
      summary: Create Saved Report
      operationId: create_saved_report_reports_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SaveReportBody'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedReportOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SaveReportBody:
      properties:
        name:
          type: string
          maxLength: 200
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Description
        query:
          $ref: '#/components/schemas/ReportQuery'
      type: object
      required:
        - name
        - query
      title: SaveReportBody
    SavedReportOut:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        query:
          additionalProperties: true
          type: object
          title: Query
          description: The report query (see ReportQuery).
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - name
        - query
        - created_at
        - updated_at
      title: SavedReportOut
    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.