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

# Update a custom report

> Replaces the definition of a report you own or may edit. Send the version you read; if someone changed the report since, you get 409 and should get it again. A report shared with others keeps your change as a draft until it is published in the admin, so viewers never see a half-finished report.



## OpenAPI

````yaml https://cool.jobmojito.com/functions/v1/openapi post /report-update
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-update:
    post:
      tags:
        - Reports
      summary: Update a custom report
      description: >-
        Replaces the definition of a report you own or may edit. Send the
        version you read; if someone changed the report since, you get 409 and
        should get it again. A report shared with others keeps your change as a
        draft until it is published in the admin, so viewers never see a
        half-finished report.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportUpdateRequest'
      responses:
        '200':
          description: Report saved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportSaveResponse'
        '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'
        '404':
          description: No report with this id, or it is not shared with you.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The report changed since you read it; get it again and retry with
            the new version.
          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:
    ReportUpdateRequest:
      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.
        id:
          type: string
          format: uuid
          description: Report id (from list_reports).
        version:
          type: integer
          minimum: 1
          description: >-
            The version you read (get_report / list_reports). A stale version is
            refused with 409.
        definition:
          allOf:
            - $ref: '#/components/schemas/ReportDefinition'
            - description: The whole new definition (it replaces the old one).
        target:
          type: string
          enum:
            - published
            - draft
          description: >-
            published (default) or draft. A private report always publishes.
            Through the MCP server a shared report always gets a draft that its
            owner publishes in the admin.
      required:
        - id
        - version
        - definition
      additionalProperties: false
    ReportSaveResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
        version:
          type: integer
          description: Send it back with the next update.
        published:
          type: boolean
          description: >-
            false when the change was stored as a draft the owner publishes in
            the admin.
        admin_url:
          type: string
          description: Open the report in the JobMojito admin.
      required:
        - id
        - version
        - published
        - admin_url
      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.
    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.