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

# Preflight a file

> Sugar wrapper. Runs a preflight-only job. Async (201) by default; `sync: true` waits for the result.



## OpenAPI

````yaml /openapi.json post /jobs/preflight
openapi: 3.1.0
info:
  title: Filecheck API
  version: 1.0.0
  description: >-
    The Filecheck REST API. Submit files as jobs, fetch results, and read your
    workflows, rules, connectors, profiles, and optimize presets. All requests
    are authenticated server-side with your secret key (`sk_live_…`).
servers:
  - url: https://api.filecheck.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Jobs
    description: >-
      Submit files for preflight, fixing, optimization, validation, and
      previews.
  - name: Uploads
    description: Mint presigned credentials to upload large files directly.
  - name: Orders
    description: Attach jobs to commerce orders.
  - name: Workflows
  - name: Connectors
  - name: Rules
  - name: Profiles
  - name: OptimizePresets
paths:
  /jobs/preflight:
    post:
      tags:
        - Jobs
      summary: Preflight a file
      description: >-
        Sugar wrapper. Runs a preflight-only job. Async (201) by default; `sync:
        true` waits for the result.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JobsPreflightPost'
      responses:
        '200':
          description: 'Sync completion (sync: true)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobResponse'
        '201':
          description: Accepted, processing asynchronously
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobResponse'
        '202':
          description: Sync timed out; still pending
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobPendingResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or invalid key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: A referenced fileRef is not owned by the caller
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    JobsPreflightPost:
      title: POST /jobs/preflight
      description: >-
        Submit one or more files for preflight. By default the response is 201
        Accepted and the job runs asynchronously. Set `sync: true` to wait up to
        ~27 s for the result (200 on completion, 202 + `pending: true` on
        timeout). An optional `webhook` is called when the job reaches a
        terminal status regardless of sync mode.
      type: object
      additionalProperties: false
      required:
        - sources
      properties:
        sources:
          type: array
          minItems: 1
          maxItems: 50
          items: 94df35ba-6f68-4dc6-af09-7e33f2971df8
          description: >-
            List of files to preflight. Each becomes its own Task under a single
            Job. Even a single file must be wrapped in an array.
        sync:
          type: boolean
          default: false
          description: >-
            When true, the request waits for the job to complete (up to ~27 s).
            Returns 200 with `{ job }` on success, or 202 with `pending: true`
            on timeout. The default is false (async 201).
        webhook: bb7018eb-2dfd-443a-91bf-b0401305aeee
        metaData: dadde512-f5e6-4def-b3b3-6f37089fda86
      $defs:
        sourceObject:
          type: object
          additionalProperties: false
          oneOf:
            - required:
                - url
            - required:
                - file
            - required:
                - fileRef
          properties:
            url:
              type: string
              format: uri
              pattern: ^https?://
              description: Public or authenticated URL of the file.
            file:
              type: string
              contentEncoding: base64
              description: >-
                Inline base64-encoded file contents. String length must be ≤ 9.3
                MB (the ~7 MB decoded equivalent). Prefer `url` or `fileRef` for
                large files.
            fileRef:
              type: string
              pattern: ^upload_[A-Za-z0-9._-]+$
              description: >-
                Reference id returned by POST /uploads. Use for large files to
                avoid body-size limits.
            headers:
              type: object
              description: >-
                Optional HTTP headers sent when fetching the URL (e.g.
                Authorization).
              additionalProperties:
                type: string
              maxProperties: 16
            profileId:
              type: string
              description: >-
                Optional preflight profile id for a specific preflight profile
                (yours, or a published `preflight_standard_*`). Omit to run
                every check we cover for the file's kind.
            name:
              type: string
              description: Original filename hint (used when `file` is provided).
        webhook:
          type: object
          additionalProperties: false
          required:
            - url
          description: >-
            Endpoint called when the job reaches a terminal status (done |
            skipped | error). Inspect the separate `outcome` field for the
            verdict.
          properties:
            url:
              type: string
              format: uri
              pattern: ^https?://
              description: HTTPS endpoint to POST the job result to.
            headers:
              type: object
              description: >-
                Optional headers sent with the webhook callback (e.g.
                Authorization).
              additionalProperties:
                type: string
              maxProperties: 16
        metaData:
          type: object
          description: >-
            Free-form caller context echoed back on the response and on webhook
            callbacks. JSON-serialized payload must be ≤ 4 KB.
          additionalProperties: true
    JobResponse:
      type: object
      properties:
        job:
          $ref: '#/components/schemas/Job'
    JobPendingResponse:
      type: object
      properties:
        pending:
          type: boolean
        job:
          $ref: '#/components/schemas/Job'
    Error:
      type: object
      properties:
        error:
          type: boolean
        message:
          type: string
    Job:
      type: object
      properties:
        id:
          type: string
        createdAt:
          type:
            - string
            - 'null'
        modifiedAt:
          type:
            - string
            - 'null'
        status:
          type: string
          description: idle, incomplete, uploading, processing, ready, partial, rejected
        outcome:
          type:
            - string
            - 'null'
        channel:
          type:
            - string
            - 'null'
          enum:
            - api
            - store
            - admin
            - null
        ruleId:
          type:
            - string
            - 'null'
        workflowId:
          type:
            - string
            - 'null'
        metaData:
          type:
            - object
            - 'null'
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/Task'
        orderId:
          type:
            - string
            - 'null'
        customerId:
          type:
            - string
            - 'null'
        customerEmail:
          type:
            - string
            - 'null'
        summary:
          type: object
          description: Present on non-lean responses.
        results:
          type: object
          description: >-
            Aggregated validate / preflight / optimize results on non-lean
            responses.
    Task:
      type: object
      properties:
        id:
          type: string
        createdAt:
          type:
            - string
            - 'null'
        updatedAt:
          type:
            - string
            - 'null'
        status:
          type: string
        outcome:
          type:
            - string
            - 'null'
        fileType:
          type:
            - string
            - 'null'
        mimeType:
          type:
            - string
            - 'null'
        source:
          type:
            - string
            - 'null'
        fileRef:
          type:
            - string
            - 'null'
        clientRef:
          type:
            - string
            - 'null'
        jobId:
          type:
            - string
            - 'null'
        originalArtifact:
          type:
            - object
            - 'null'
        outputArtifacts:
          type: array
          items:
            $ref: '#/components/schemas/OutputArtifact'
        steps:
          type: array
          items:
            $ref: '#/components/schemas/Step'
    OutputArtifact:
      type: object
      properties:
        kind:
          type: string
        role:
          type: string
        bucket:
          type: string
        key:
          type: string
        downloadUrl:
          type:
            - string
            - 'null'
        expiresIn:
          type:
            - integer
            - 'null'
    Step:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          description: preflight, repreflight, autofix, optimize, validate, previews, proof
        status:
          type: string
        outcome:
          type:
            - string
            - 'null'
          enum:
            - pass
            - warn
            - fail
            - null
        reason:
          type:
            - string
            - 'null'
        params:
          type:
            - object
            - 'null'
        runtimeParams:
          type:
            - object
            - 'null'
        started:
          type:
            - string
            - 'null'
        ended:
          type:
            - string
            - 'null'
        duration:
          type:
            - number
            - 'null'
        outputs:
          type: array
          items:
            type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your secret key as a bearer token, e.g. `Authorization: Bearer
        sk_live_…`. Secret keys are server-side only.

````