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

# Start an on-demand maintenance run



## OpenAPI

````yaml post /api/maintenance/runs
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/maintenance/runs:
    post:
      tags:
        - Iceberg maintenance
      summary: Start an on-demand maintenance run
      operationId: request_run_api_maintenance_runs_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunRequestIn'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunOut'
        '403':
          description: Not allowed (role, platform key, or Ranger denies alter).
        '404':
          description: Unknown catalog, table or run.
        '422':
          description: Invalid scope, operations or overrides.
        '502':
          description: Airflow couldn't be reached.
        '503':
          description: Maintenance is off, its DAG is paused, or the access check is down.
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    RunRequestIn:
      properties:
        scope:
          $ref: '#/components/schemas/RunScopeIn'
        operations:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Operations
          description: >-
            Operations to run: compaction, compact_deletes, rewrite_manifests,
            expire_snapshots, remove_orphans. Leave out to run every operation
            the policy enables.
        mode:
          type: string
          enum:
            - if_needed
            - force
          title: Mode
          description: >-
            if_needed skips the schedule but keeps the trigger conditions, so
            healthy tables are reported as skipped:healthy. force runs the
            selected operations regardless.
          default: if_needed
        dry_run:
          type: boolean
          title: Dry Run
          description: >-
            Run orphan removal as a dry run. The other operations have no
            dry-run mode; use the preview to see what would run.
          default: false
        overrides:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Overrides
          description: >-
            Policy fields for this run only. Never saved; locks and floors still
            apply. null is the same as {}.
        overrides_yaml:
          anyOf:
            - type: string
              maxLength: 100000
            - type: 'null'
          title: Overrides Yaml
          description: >-
            The same overrides as YAML (the portal sends this). Not with
            overrides.
        priority:
          anyOf:
            - type: string
              enum:
                - low
                - normal
                - high
            - type: 'null'
          title: Priority
          description: Overrides the policy's priority for this run.
        ignore_window:
          type: boolean
          title: Ignore Window
          description: Run outside the maintenance window.
          default: false
      additionalProperties: false
      type: object
      required:
        - scope
      title: RunRequestIn
      description: An on-demand maintenance run (§5.5).
    RunOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        dag_run_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Dag Run Id
        trigger:
          type: string
          title: Trigger
        requested_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Requested By
        status:
          type: string
          title: Status
        started_at:
          type: string
          title: Started At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
        tables_scanned:
          type: integer
          title: Tables Scanned
          default: 0
        tables_selected:
          type: integer
          title: Tables Selected
          default: 0
        batches:
          type: integer
          title: Batches
          default: 0
        request:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Request
        summary:
          additionalProperties: true
          type: object
          title: Summary
      type: object
      required:
        - id
        - trigger
        - status
        - started_at
      title: RunOut
      description: >-
        A maintenance run. ``summary`` has Task 21's shape: ``catalogs{name:
        {...}}``,

        ``top_failures``, ``worst_health``.
    RunScopeIn:
      properties:
        catalog:
          type: string
          maxLength: 128
          minLength: 1
          title: Catalog
          description: The catalog to maintain.
        namespace:
          anyOf:
            - type: string
              maxLength: 512
              minLength: 1
            - type: 'null'
          title: Namespace
          description: One schema (namespace). Nested namespaces under it are included.
        namespaces:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 100
            - type: 'null'
          title: Namespaces
          description: Several schemas. Nested namespaces under each are included.
        tables:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 1000
            - type: 'null'
          title: Tables
          description: >-
            Tables, as bare names with exactly one namespace given, or as
            namespace.table (the last dot separates the table).
      additionalProperties: false
      type: object
      required:
        - catalog
      title: RunScopeIn
      description: >-
        What an on-demand run covers: a catalog, schemas, or tables.


        Combinations (namespace vs namespaces, bare table names) are checked by

        ``OnDemandService`` so the answer can name the offending field (422
        issues).
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````

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