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

# Publish a draft rule

> Makes a draft live. Drafts it points at (a workflow's rule, a rule's profiles) are published with it; the response lists every id published.



## OpenAPI

````yaml /openapi.json post /rules/{id}/publish
openapi: 3.1.0
info:
  title: Filecheck API
  version: 1.1.0
  description: >-
    The Filecheck REST API. Submit files as jobs and fetch results, and set up
    your account: workflows, upload rules, preflight profiles, connectors,
    optimize presets, delivery destinations, product mappings, storefront
    settings and webhooks. 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,
      and read the results.
  - name: Uploads
    description: Presigned credentials to upload large files directly.
  - name: Orders
    description: Attach jobs to commerce orders.
  - name: Workflows
    description: >-
      What happens to a customer's files for a product: the intake rule that
      checks them on upload, the processing streams, proofing, merging and
      delivery. Products in your store map to a workflow.
  - name: Rules
    description: >-
      Upload rules: which files a product accepts (kinds, MIME types, how many),
      which preflight profile checks each kind, and what happens when a file
      fails. A workflow's intake points at one rule.
  - name: Profiles
    description: >-
      Preflight profiles: the checks run on a file (size, bleed, resolution,
      colour, fonts…) with their thresholds, severities and automatic fixes. PDF
      profiles check PDFs (and vector and office files once converted); raster
      profiles check images.
  - name: Connectors
    description: >-
      Connectors wire a product page to the Element: what the shopper chose
      (size, page count, sides, finishing) adjusts the rule's size checks for
      that upload, and what FileCheck measured in the file (page count, size,
      area) can fill the page's own inputs so the store prices from the real
      file. The cart plugins store the chosen connector per product.
  - name: Optimize presets
    description: >-
      Saved optimize settings (compression, downsampling, colour conversion)
      that optimize steps can use.
  - name: Destinations
    description: >-
      Where finished files are delivered: SFTP and FTP hotfolders, S3 buckets,
      webhooks. Workflows list the destinations they deliver to. Secrets are
      write-only.
  - name: Products
    description: >-
      Which workflow each product in your store uses. The storefront Element
      opens the mapped workflow on the product page.
  - name: Settings
    description: >-
      How the storefront Element appears on your product pages: where it mounts,
      the add-to-cart button it guards, display mode and theme.
  - name: Webhooks
    description: >-
      HTTP callbacks for job, proof, account and billing events, signed with
      X-FileCheck-Signature.
paths:
  /rules/{id}/publish:
    post:
      tags:
        - Rules
      summary: Publish a draft rule
      description: >-
        Makes a draft live. Drafts it points at (a workflow's rule, a rule's
        profiles) are published with it; the response lists every id published.
      operationId: publishRule
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The draft rule id.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule:
                    allOf:
                      - $ref: '#/components/schemas/Rule'
                      - $ref: '#/components/schemas/RecordFields'
                  published:
                    type: array
                    items:
                      type: string
                    description: Every id published, dependencies first.
        '401':
          description: Missing or invalid key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            Conflict: `code` says why (in_use, draft_reference, not_a_draft,
            not_a_catalog_record, cart_not_supported)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Rule:
      title: Rule
      description: >-
        An upload rule (intake rule): the contract for what a customer may
        upload for one product and how each file is judged at upload time, while
        the customer waits. A workflow points at exactly one rule through
        workflow.intake.ruleId, and many workflows can share a rule. For each
        uploaded file FileCheck detects the real type from the file's bytes,
        picks the matching entry in `accepts` (exact MIME type first, then the
        first entry of the same kind that is not mimeTypesStrict), optionally
        converts it to PDF, preflights it against the preflight profile that
        entry names (accepts[].preflight.profileId; profiles hold the checks and
        thresholds, a rule only points at them), and turns a failing result into
        reject / accept-with-warnings / manual-review through that entry's
        onFail. Accepted files then feed the workflow stream for their kind
        (pdf, raster or other). `cardinality` says how many files the product
        needs. A rule does no downstream processing: autofix, optimize,
        imposition, proofing and delivery are configured on the workflow.
      type: object
      additionalProperties: false
      required:
        - accepts
      properties:
        title:
          type: string
          minLength: 1
          maxLength: 120
          description: >-
            Name of the rule in the dashboard library and in workflow pickers,
            e.g. "Business Card — Front & Back". Keep it under 60 characters,
            the dashboard editor's limit.
        description:
          type: string
          maxLength: 2000
          default: ''
          description: >-
            Note for the print shop's dashboard: which product this rule is for
            and which profile it pairs with. Never shown to customers.
        instructions:
          type: string
          maxLength: 2000
          pattern: ^[^<>]*$
          default: ''
          description: >-
            Short instruction shown to the customer in the upload widget, e.g.
            "Upload a print-ready PDF with 3 mm bleed on all sides." Plain text
            only: the widget renders it as HTML in slot mode, so angle brackets
            are refused.
        tags:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 64
          uniqueItems: true
          maxItems: 50
          default: []
          description: >-
            Free labels for finding the rule in the dashboard library (e.g.
            "pdf", "business-card"). No effect on uploads.
        schemaVersion:
          type: integer
          enum:
            - 1
          default: 1
          description: Record format version. Always 1.
        cardinality:
          type: object
          additionalProperties: false
          default:
            min: 1
            max: 1
            slots: []
          description: >-
            How many files one order of this product needs: either a count range
            (min and max) or named slots (one labelled upload per slot, e.g.
            Front and Back). Omit it for exactly one file. A product page can
            override min and max per order through the job's fileCount context.
          properties:
            min:
              type: integer
              minimum: 0
              description: >-
                Fewest accepted files before the job leaves intake and the
                widget lets the customer continue. Required unless slots are set
                (then ignored). To let a customer skip uploading altogether use
                uploadOptional; min 0 alone does not do that.
            max:
              type: integer
              minimum: 1
              description: >-
                Most files the customer may upload; the widget stops offering
                uploads at this count. Must be at least min (not checked here:
                with max below min the widget can never be satisfied). Required
                unless slots are set (then ignored). There is no unlimited
                value, because the widget reads a missing max as 1, so set a
                generous number such as 50.
            slots:
              type: array
              items:
                type: string
                minLength: 1
                maxLength: 80
              uniqueItems: true
              maxItems: 50
              default: []
              description: >-
                Named upload slots in order, e.g. ["Front", "Back"]. When
                non-empty the customer gets one labelled upload area per slot,
                exactly that many files are required, min and max are ignored,
                and each file keeps its slot name (proofs are shown in slot
                order). Empty means count-range mode.
          if:
            properties:
              slots:
                minItems: 1
            required:
              - slots
          else:
            required:
              - min
              - max
        accepts:
          type: array
          minItems: 1
          maxItems: 20
          items: 42fd84ab-8a34-4e60-b8f7-104a80648f7a
          description: >-
            The file types this product takes, normally one entry per kind (the
            dashboard allows only one), each with its own MIME list, size limit,
            PDF conversion, preflight profile and failure policy. For an upload,
            the first entry whose mimeTypes lists the file's detected MIME type
            wins; failing that, the first entry of the file's kind that is not
            mimeTypesStrict. A file no entry matches is refused by the widget
            when rejectUnknownTypes is true, but one sent through the API is
            stored unchecked, so cover every kind you expect.
        rejectUnknownTypes:
          type: boolean
          default: true
          description: >-
            When true the upload widget refuses files that match no accepts
            entry; when false it lets them through and they are stored
            unchecked. Only the widget reads this: files submitted through the
            API that match no entry are always taken unchecked.
        maxTotalSize:
          type:
            - integer
            - 'null'
          minimum: 1
          default: null
          description: >-
            Intended cap on the combined size of one order's files, in bytes.
            Stored and shown in the dashboard but not enforced anywhere today;
            use accepts[].maxSize for a limit that works. Omit or null for none.
        uploadOptional:
          type: boolean
          default: false
          description: >-
            When true a customer who uploads nothing may continue: the widget's
            checkout gate opens with zero files. Once any file is uploaded,
            cardinality and onFail apply as usual, and a rejected file still
            blocks.
        channels:
          type: array
          items:
            type: string
            enum:
              - client
              - api
              - admin
              - store
          uniqueItems: true
          default: []
          description: >-
            Reserved for limiting the rule to submission channels (client = the
            storefront widget, api, admin, store). Not enforced today: leave it
            empty, which means all channels.
        ui:
          type: object
          additionalProperties: false
          default: {}
          description: >-
            Look-and-feel overrides for the storefront upload widget while it
            shows this rule. A key set here overrides the account default and is
            overridden by the host page; leave a key out to inherit. Never
            affects which files are accepted.
          properties:
            title:
              type: string
              maxLength: 120
              description: Heading shown at the top of the widget.
            subtitle:
              type: string
              maxLength: 240
              description: Smaller line under the title.
            theme:
              type: string
              enum:
                - light
                - dark
                - system
              description: >-
                Colour scheme: light, dark, or system (follow the shopper's
                device setting).
            accent:
              type:
                - string
                - 'null'
              maxLength: 64
              description: >-
                Accent colour override, e.g. #0a7cff; null inherits the
                account's brand colour.
            locale:
              type:
                - string
                - 'null'
              pattern: ^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$
              description: >-
                BCP-47 language tag for the widget's text, e.g. de or fr-CA;
                null follows the host page.
            layout:
              type: string
              enum:
                - inline
                - modal
                - drawer
                - compact
              description: Hint to the host page's SDK on how to present the widget.
            showHeader:
              type: boolean
              description: Show the title and subtitle block.
            showHelp:
              type: boolean
              description: Show the help area with helpText.
            helpText:
              type: string
              maxLength: 2000
              description: Help text shown when showHelp is true.
            submitLabel:
              type: string
              maxLength: 60
              description: >-
                Label for the host page's continue button once the upload is
                ready (the host renders the button).
            autoSubmit:
              type: boolean
              description: >-
                When true the host page moves on by itself as soon as the upload
                is ready, without a click.
            branding:
              type: string
              enum:
                - domain
                - none
                - custom
              description: >-
                Which branding the widget shows: the account's (domain), none,
                or custom.
            resultsDisplay:
              type: string
              enum:
                - full
                - list
              description: >-
                full shows each file's findings inline; list shows a compact,
                selectable file list for pairing with a separate report element.
            proofDetails:
              type: string
              enum:
                - collapsed
                - expanded
              description: >-
                How the proof dialog opens: collapsed (the print first, findings
                behind a summary button) or expanded (findings panel open).
      definitions:
        mimeType:
          type: string
          maxLength: 127
          pattern: ^[a-z0-9][a-z0-9!#$&^_.+-]*/[a-z0-9][a-z0-9!#$&^_.+-]*$
          description: >-
            A lowercase MIME type exactly as FileCheck's detection reports it,
            e.g. application/pdf, image/jpeg (never image/jpg), image/tiff
            (never image/tif).
        accept:
          type: object
          additionalProperties: false
          required:
            - kind
          description: >-
            One accepted file kind: which files it matches and how each one is
            checked and judged on upload.
          properties:
            kind:
              type: string
              enum:
                - pdf
                - raster
                - vector
                - office
                - archive
                - other
              description: >-
                The file family this entry handles, matched against the type
                FileCheck detects from the bytes. pdf: PDF (and PDF-based .ai).
                raster: JPEG, PNG, TIFF, WebP, HEIC, AVIF, GIF, BMP. vector:
                SVG, EPS/PostScript. office: Word, Excel, PowerPoint and
                OpenDocument files. archive: ZIP. other: fonts and anything
                else. Only pdf and raster can be preflighted as uploaded; vector
                and office need convertToPdf first; archive and other are stored
                as-is with no checks.
            mimeTypes:
              type: array
              items:
                $ref: '#/components/schemas/Rule/definitions/mimeType'
              uniqueItems: true
              maxItems: 50
              default: []
              description: >-
                MIME types this entry claims; each must belong to the entry's
                kind. Unless mimeTypesStrict is true the list does not narrow
                anything: every file of the kind is still accepted through the
                kind fallback and the widget offers the whole kind. For kind
                other the list is the only way the widget recognises a file, so
                it must not be empty.
            mimeTypesStrict:
              type: boolean
              default: false
              description: >-
                When true the mimeTypes list is authoritative: a file of this
                kind whose MIME type is not listed is refused, by the widget and
                by the server, e.g. raster with ["image/jpeg", "image/tiff"]
                refuses PNG. Leave false to take every file of the kind. Needs a
                non-empty mimeTypes.
            extensions:
              type: array
              items:
                type: string
                pattern: ^\.?[a-z0-9]{1,10}$
              uniqueItems: true
              maxItems: 50
              default: []
              description: >-
                File extensions for display, lowercase with a leading dot, e.g.
                [".pdf"]. Informational only: nothing matches uploads by
                extension, and the widget builds its file picker from mimeTypes.
            maxSize:
              type:
                - integer
                - 'null'
              minimum: 1
              default: null
              description: >-
                Largest single file this entry takes, in bytes (50 MB =
                52428800). Enforced by the upload widget before upload; files
                sent through the API are not checked against it. Omit or null
                for no limit.
            convertToPdf:
              type: boolean
              default: false
              description: >-
                Vector and office entries only: convert each upload to PDF on
                arrival, so it can be preflighted against a PDF profile and
                feeds the workflow's pdf stream. Without it these files are
                stored as-is and feed the other stream. Must be false for pdf,
                raster, archive and other entries.
            preflight:
              type: object
              additionalProperties: false
              required:
                - enabled
              default:
                enabled: false
                profileId: null
              description: >-
                The check run on each file of this entry while the customer
                waits. Off unless enabled is sent as true, and then it needs a
                profileId. Possible for pdf and raster entries, and for vector
                and office entries with convertToPdf true; never for archive or
                other.
              properties:
                enabled:
                  type: boolean
                  description: >-
                    Run the preflight check. Send it explicitly; with false the
                    file is accepted without a check.
                profileId:
                  type:
                    - string
                    - 'null'
                  minLength: 1
                  maxLength: 128
                  default: null
                  description: >-
                    What to check against: the id of a preflight profile record
                    (from GET /profiles, usually profile_...), or a built-in
                    conformance validation: 1a, 1b, 2a, 2b, 2u, 3a, 3b, 3u, 4,
                    4e, 4f (PDF/A) or ua1, ua2 (PDF/UA). The profile's kind must
                    match the entry: pdf entries, and vector or office entries
                    with convertToPdf, take a PDF profile or a validation id;
                    raster entries take a raster profile. Required when enabled;
                    ignored when not.
              if:
                properties:
                  enabled:
                    const: true
                required:
                  - enabled
              then:
                required:
                  - profileId
                properties:
                  profileId:
                    type: string
            onFail:
              type: string
              enum:
                - reject
                - accept_with_warnings
                - manual_review
              default: reject
              description: >-
                What a failing preflight (or a failed PDF conversion) means for
                the file. reject: not accepted; the widget blocks the customer
                until they replace it and the job waits at intake.
                accept_with_warnings: accepted anyway; the profile's
                reject-level findings show as warnings and the workflow goes
                ahead. manual_review: the widget lets the customer continue and
                marks the file as awaiting review with findings as warnings, but
                the server does not count the file as accepted, so the workflow
                waits at intake until the print shop deals with it. A file
                FileCheck cannot open is rejected under every policy.
          allOf:
            - if:
                properties:
                  kind:
                    enum:
                      - pdf
                      - raster
                      - archive
                      - other
                required:
                  - kind
              then:
                properties:
                  convertToPdf:
                    const: false
            - if:
                properties:
                  kind:
                    enum:
                      - archive
                      - other
                required:
                  - kind
              then:
                properties:
                  preflight:
                    properties:
                      enabled:
                        const: false
            - if:
                properties:
                  kind:
                    enum:
                      - vector
                      - office
                  preflight:
                    properties:
                      enabled:
                        const: true
                    required:
                      - enabled
                required:
                  - kind
                  - preflight
              then:
                required:
                  - convertToPdf
                properties:
                  convertToPdf:
                    const: true
            - if:
                properties:
                  kind:
                    const: raster
                required:
                  - kind
              then:
                properties:
                  preflight:
                    properties:
                      profileId:
                        pattern: ^(?!(1a|1b|2a|2b|2u|3a|3b|3u|4|4e|4f|ua1|ua2)$)
            - if:
                properties:
                  mimeTypesStrict:
                    const: true
                required:
                  - mimeTypesStrict
              then:
                required:
                  - mimeTypes
                properties:
                  mimeTypes:
                    minItems: 1
            - if:
                properties:
                  kind:
                    const: pdf
                required:
                  - kind
              then:
                properties:
                  mimeTypes:
                    items:
                      const: application/pdf
            - if:
                properties:
                  kind:
                    const: raster
                required:
                  - kind
              then:
                properties:
                  mimeTypes:
                    items:
                      pattern: ^image/(?!svg)(?!jpg$)(?!tif$)
            - if:
                properties:
                  kind:
                    const: vector
                required:
                  - kind
              then:
                properties:
                  mimeTypes:
                    items:
                      enum:
                        - image/svg+xml
                        - application/postscript
                        - application/eps
                        - application/illustrator
            - if:
                properties:
                  kind:
                    const: office
                required:
                  - kind
              then:
                properties:
                  mimeTypes:
                    items:
                      pattern: >-
                        ^application/(msword|vnd\.ms-excel|vnd\.ms-powerpoint|vnd\.openxmlformats-officedocument\.[a-z0-9.+-]+|vnd\.oasis\.opendocument\.[a-z0-9.+-]+)$
            - if:
                properties:
                  kind:
                    const: archive
                required:
                  - kind
              then:
                properties:
                  mimeTypes:
                    items:
                      enum:
                        - application/zip
                        - application/x-zip-compressed
                        - application/x-tar
                        - application/gzip
                        - application/x-gzip
                        - application/x-7z-compressed
                        - application/vnd.rar
                        - application/x-rar-compressed
            - if:
                properties:
                  kind:
                    const: other
                required:
                  - kind
              then:
                required:
                  - mimeTypes
                properties:
                  mimeTypes:
                    minItems: 1
                    items:
                      pattern: >-
                        ^(?!application/pdf$)(?!image/)(?!application/postscript$)(?!application/eps$)
    RecordFields:
      type: object
      properties:
        id:
          type: string
          description: The record id.
        source:
          type: string
          enum:
            - domain
            - store
          description: '`domain`: yours. `store`: a built-in catalog record.'
        customized:
          type: boolean
          description: >-
            Your own copy of a built-in record, under the same id. Revert drops
            it.
        draft:
          type: boolean
          description: Present and true on an unpublished draft.
        draftExpiresAt:
          type: string
          format: date-time
          description: When an unpublished draft is deleted.
        created:
          type: integer
          description: Unix time (seconds).
        modified:
          type: integer
          description: Unix time (seconds).
    Error:
      type: object
      properties:
        error:
          type: boolean
          const: true
        code:
          type: string
          description: >-
            Machine-readable reason, such as validation_failed,
            invalid_reference, not_found, in_use, draft_reference.
        message:
          type: string
        param:
          type: string
          description: >-
            The field at fault, as a dotted path (intake.ruleId,
            accepts.0.preflight.profileId).
        details:
          type: array
          description: Every problem found, or the records that block a delete.
          items:
            type: object
            additionalProperties: true
        requestId:
          type: string
          description: Quote it to support.
  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.

````

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