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

# Check and run an unsaved report

> Validates a report definition against the catalogue and runs it, without storing anything. Use it to check a definition before create_report or update_report. A 422 names the block and field that is wrong and lists the valid ids.



## OpenAPI

````yaml https://cool.jobmojito.com/functions/v1/openapi post /report-preview
openapi: 3.1.0
info:
  title: JobMojito API
  version: 1.0.0
  description: >-
    Public API for JobMojito, served by Supabase Edge Functions. Authenticate
    with a Supabase JWT access token via the Authorization header.
servers:
  - url: https://cool.jobmojito.com/functions/v1
    description: Production
security: []
tags:
  - name: Interviews
    description: >-
      Create, configure and manage interview / coaching / assessment
      definitions.
  - name: Coaching catalogue
    description: >-
      Directories (pages) of the coaching portal catalogue that group coaching
      sessions and carry custom content pages.
  - name: Results
    description: >-
      Interview results, transcripts, reports, re-attempt requests and
      analytics.
  - name: Reports
    description: >-
      Custom reports: read the catalogue of datasets, build a report definition,
      check it, save it and run it.
  - name: Candidates
    description: List and manage candidates.
  - name: Knowledge base
    description: Upload documents used to generate knowledge-base interviews.
  - name: Resume & Form verification
    description: Pre-screen candidates from resumes and forms.
  - name: Admin
    description: >-
      Account administration — invite team/coaching users, manage sub-merchants
      and avatar templates.
paths:
  /report-preview:
    post:
      tags:
        - Reports
      summary: Check and run an unsaved report
      description: >-
        Validates a report definition against the catalogue and runs it, without
        storing anything. Use it to check a definition before create_report or
        update_report. A 422 names the block and field that is wrong and lists
        the valid ids.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportPreviewRequest'
      responses:
        '200':
          description: Block results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportRunResponse'
        '401':
          description: Missing, expired or invalid access token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Your token or role may not do this (for example a hiring manager
            sharing, or a dataset your account does not include).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            Validation error. The message names the block and field, and lists
            valid ids.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    ReportPreviewRequest:
      type: object
      properties:
        merchant_id:
          type: string
          format: uuid
          description: >-
            Optional merchant to act on. Admins and sub-merchant operators only;
            other callers always use their token's merchant.
        definition:
          $ref: '#/components/schemas/ReportDefinition'
        filters:
          allOf:
            - $ref: '#/components/schemas/ReportFilters'
            - description: Applied on top of definition.filters.
        block_id:
          type: string
          description: Run only this block.
      required:
        - definition
      additionalProperties: false
    ReportRunResponse:
      type: object
      properties:
        report_id:
          type: string
          format: uuid
        title:
          type: string
        version:
          type: integer
        filters:
          type: object
          additionalProperties:
            nullable: true
          description: >-
            The filters the blocks ran with (report defaults, then your saved
            filters, then the ones you passed).
        blocks:
          type: array
          items:
            $ref: '#/components/schemas/ReportBlockResult'
      required:
        - filters
        - blocks
      additionalProperties:
        nullable: true
    Error:
      type: object
      properties:
        error:
          type: string
          example: Field is required.
        name:
          type: string
          example: interview_result_id
      required:
        - error
    ReportDefinition:
      type: object
      properties:
        schema:
          type: string
          enum:
            - jobmojito.report/v1
          description: Always "jobmojito.report/v1".
        title:
          type: string
          minLength: 1
          maxLength: 120
        description:
          type: string
          maxLength: 1000
        filters:
          $ref: '#/components/schemas/ReportFilters'
        blocks:
          type: array
          items:
            $ref: '#/components/schemas/ReportBlock'
          maxItems: 12
      required:
        - schema
        - title
        - blocks
      additionalProperties: false
      description: >-
        A custom report: report-wide filters and up to 12 blocks. Read
        report-catalog first for the dataset, field and measure ids.
      example:
        schema: jobmojito.report/v1
        title: Weekly hiring pulse
        filters:
          period:
            preset: last_30_days
        blocks:
          - id: headline
            type: kpi
            dataset: interview_results
            measures:
              - completed
              - avg_score
              - shortlisted
            compare: previous_period
          - id: trend
            type: line
            title: Completed per week
            dataset: interview_results
            dimensions:
              - field: date
                grain: week
            measures:
              - completed
            width: 8
          - id: by_position
            type: table
            title: By position
            dataset: interview_results
            dimensions:
              - position
            measures:
              - completed
              - avg_score
              - shortlisted
            sort:
              - field: completed
                dir: desc
            limit: 25
    ReportFilters:
      type: object
      properties:
        period:
          anyOf:
            - type: object
              properties:
                preset:
                  type: string
                  enum:
                    - last_7_days
                    - last_30_days
                    - last_90_days
                    - this_month
                    - last_month
                    - this_quarter
                    - last_quarter
                    - this_year
                    - last_year
                    - all_time
              required:
                - preset
              additionalProperties: false
            - type: object
              properties:
                from:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                to:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
              required:
                - from
                - to
              additionalProperties: false
          description: >-
            Either a preset, or from and to dates (YYYY-MM-DD, both inclusive,
            UTC). Default: last_30_days.
          example:
            preset: last_30_days
        position_ids:
          type: array
          items:
            type: string
            format: uuid
          maxItems: 200
          description: >-
            Only these positions (position ids from list_interviews). Empty or
            missing = all.
        interview_ids:
          type: array
          items:
            type: string
            format: uuid
          maxItems: 200
          description: >-
            Only these interviews (interview ids from list_interviews). Empty or
            missing = all.
        include_test:
          type: boolean
          description: Include test runs. Default false.
      additionalProperties: false
      description: >-
        Filters for every block of the report. Each viewer can override them for
        themselves.
    ReportBlockResult:
      type: object
      properties:
        block_id:
          type: string
        ok:
          type: boolean
          description: >-
            false when this block could not run; see error. Other blocks are
            unaffected.
        columns:
          type: array
          items:
            type: object
            additionalProperties:
              nullable: true
          description: >-
            Each column: id, kind (dimension | measure), type, label, and for
            measures a format.
        rows:
          type: array
          items:
            type: object
            additionalProperties:
              nullable: true
          description: One object per row, keyed by column id.
        truncated:
          type: boolean
          description: More rows exist than the block limit.
        previous:
          type: object
          additionalProperties:
            nullable: true
          description: 'compare previous_period: the same measures for the period before.'
        period:
          type: object
          additionalProperties:
            nullable: true
          description: >-
            The period the block covered: from, to (inclusive), snapshot (true
            when the dataset ignores the period).
        error:
          type: string
      required:
        - block_id
        - ok
      additionalProperties:
        nullable: true
    ReportBlock:
      type: object
      properties:
        id:
          type: string
          pattern: ^[A-Za-z0-9_-]{1,40}$
          example: by_position
        type:
          type: string
          enum:
            - kpi
            - table
            - bar
            - stacked_bar
            - line
            - funnel
            - text
          description: >-
            kpi: one total per measure (no dimensions; add compare
            previous_period for a change). funnel: 2+ measures as steps (no
            dimensions). table: 0-2 dimensions. bar: 1-2 dimensions.
            stacked_bar: exactly 2 dimensions. line: first dimension a date.
            text: a note, only `text`.
        title:
          type: string
          maxLength: 120
        dataset:
          type: string
          description: Dataset id from report-catalog. Not used by a text block.
          example: interview_results
        dimensions:
          type: array
          items:
            anyOf:
              - type: string
                pattern: ^[a-z][a-z0-9_]{0,40}$
              - type: object
                properties:
                  field:
                    type: string
                    pattern: ^[a-z][a-z0-9_]{0,40}$
                  grain:
                    type: string
                    enum:
                      - day
                      - week
                      - month
                      - quarter
                      - year
                    description: >-
                      For a date field: day (default), week, month, quarter or
                      year.
                required:
                  - field
                additionalProperties: false
            description: A dimension field id, or {"field", "grain"} for a date.
          maxItems: 2
        measures:
          type: array
          items:
            type: string
            pattern: ^[a-z][a-z0-9_]{0,40}$
          minItems: 1
          maxItems: 6
          description: 1 to 6 measure ids of the dataset.
          example:
            - completed
            - avg_score
        where:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                pattern: ^[a-z][a-z0-9_]{0,40}$
                description: A dimension of the block's dataset.
              op:
                type: string
                enum:
                  - eq
                  - neq
                  - in
                  - not_in
                  - gt
                  - gte
                  - lt
                  - lte
                  - between
                  - is_empty
                  - is_not_empty
              value:
                anyOf:
                  - type: string
                  - type: number
                  - type: boolean
                  - type: array
                    items:
                      anyOf:
                        - type: string
                        - type: number
                description: >-
                  One value for eq / neq / gt / gte / lt / lte, a list for in /
                  not_in, [low, high] for between, nothing for is_empty /
                  is_not_empty.
            required:
              - field
              - op
            additionalProperties: false
          maxItems: 10
        sort:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                pattern: ^[a-z][a-z0-9_]{0,40}$
                description: A dimension or measure the block selects.
              dir:
                type: string
                enum:
                  - asc
                  - desc
            required:
              - field
            additionalProperties: false
          maxItems: 3
        limit:
          type: integer
          minimum: 1
          maximum: 500
          description: Rows for a table / bar / line. Default 100 (line 500).
        width:
          type: integer
          minimum: 1
          maximum: 12
          description: Columns of a 12-column grid. Default 12.
        compare:
          type: string
          enum:
            - previous_period
          description: >-
            kpi / funnel only: also return the same numbers for the period
            before.
        text:
          type: string
          maxLength: 4000
          description: 'Text block only: the note (plain text, line breaks kept).'
      required:
        - id
        - type
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Supabase JWT — `Authorization: Bearer <token>`.'

````

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