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

# Run a flow now

> Starts the flow immediately. Pass several consumers to run it as configured for each of them, or exactly one consumer together with settings — settings apply to a single consumer's run. `GET /syncs/{syncid}/flows/{flowid}/settings` lists the settings this flow accepts. The response echoes the settings that were applied and anything worth knowing about the run.

Send `preflight: true` to get that answer without starting anything: the same request is checked the same way, and a refusal comes back as a blocking warning instead of an error.



## OpenAPI

````yaml post /syncs/{syncid}/flows/{flowid}/execute
openapi: 3.1.0
info:
  title: Chift API
  description: >-
    The Chift API is a universal API giving you access to financial data from
    the software of your clients. It helps software companies to offer native
    integrations to their clients without the effort needed to maintain those
    native integrations. By using the APIs (Accounting, POS, eCommerce) of
    Chift, you connect once and allow your clients to use their software
    packages.
  version: 1.0.0
servers:
  - url: https://api.chift.eu
    description: Chift
security:
  - bearerAuth: []
paths:
  /syncs/{syncid}/flows/{flowid}/execute:
    post:
      tags:
        - Syncs
      summary: Run a flow now
      description: >-
        Starts the flow immediately. Pass several consumers to run it as
        configured for each of them, or exactly one consumer together with
        settings — settings apply to a single consumer's run. `GET
        /syncs/{syncid}/flows/{flowid}/settings` lists the settings this flow
        accepts. The response echoes the settings that were applied and anything
        worth knowing about the run.


        Send `preflight: true` to get that answer without starting anything: the
        same request is checked the same way, and a refusal comes back as a
        blocking warning instead of an error.
      operationId: syncs_execute_flow
      parameters:
        - name: syncid
          in: path
          required: true
          schema:
            type: string
            title: Syncid
        - name: flowid
          in: path
          required: true
          schema:
            type: string
            title: Flowid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteFlowRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecuteFlowResponse'
        '400':
          content:
            application/json:
              example:
                message: You cannot execute for all consumers on marketplace accounts
                status: error
              schema:
                $ref: '#/components/schemas/ChiftError'
          description: Bad Request
        '404':
          content:
            application/json:
              example:
                message: The flow does not exist
                status: error
              schema:
                $ref: '#/components/schemas/ChiftError'
          description: Not Found
        '409':
          content:
            application/json:
              example:
                message: An execution of this flow is already running for this consumer
                status: error
              schema:
                $ref: '#/components/schemas/ChiftError'
          description: Conflict
        '422':
          content:
            application/json:
              example:
                message: This flow cannot apply one of the settings
                status: error
              schema:
                $ref: '#/components/schemas/ChiftError'
          description: Unprocessable Entity
components:
  schemas:
    ExecuteFlowRequest:
      properties:
        consumers:
          items:
            anyOf:
              - type: string
                format: uuid
              - type: string
          type: array
          title: Consumers
          description: >-
            Consumer ids, or the single value 'all' for every consumer of the
            sync.
        settings:
          $ref: '#/components/schemas/FlowSettings'
          default:
            write_mode: normal
            import_mode: normal
            verbose_logs: false
            extra: {}
        preflight:
          type: boolean
          title: Preflight
          description: >-
            Check the request without starting anything. Everything that decides
            whether the run may start is evaluated, and a refusal comes back as
            a blocking warning rather than an error, so you can warn someone
            before they confirm.
          default: false
        only:
          anyOf:
            - $ref: '#/components/schemas/OnlyObjects'
            - type: 'null'
          description: >-
            An agentic sync only, for exactly one consumer: book these objects
            only.
      additionalProperties: false
      type: object
      title: ExecuteFlowRequest
      description: >-
        Run a flow now.


        Settings apply to a single consumer: pass several only for a plain run
        with no settings.
    ExecuteFlowResponse:
      properties:
        resolved_settings:
          $ref: '#/components/schemas/FlowSettings'
        chainexecutionid:
          anyOf:
            - type: string
            - type: 'null'
          title: Chainexecutionid
          description: 'Unset for a preflight: nothing was started.'
        consumers:
          items:
            $ref: '#/components/schemas/ExecutionConsumerResult'
          type: array
          title: Consumers
        preview_executionid:
          anyOf:
            - type: string
            - type: 'null'
          title: Preview Executionid
        warnings:
          items:
            $ref: '#/components/schemas/ExecutionWarning'
          type: array
          title: Warnings
        blocked:
          type: boolean
          title: Blocked
          description: >-
            Only a preflight reports this: the same request sent for real would
            be refused.
          default: false
      type: object
      required:
        - resolved_settings
      title: ExecuteFlowResponse
    ChiftError:
      properties:
        message:
          type: string
          title: Message
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          default: error
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
          default: ''
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      required:
        - message
      title: ChiftError
    FlowSettings:
      properties:
        force_from_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Force From Date
        force_to_date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Force To Date
        write_mode:
          $ref: '#/components/schemas/WriteMode'
          default: normal
        import_mode:
          $ref: '#/components/schemas/ImportMode'
          default: normal
        verbose_logs:
          type: boolean
          title: Verbose Logs
          default: false
        extra:
          additionalProperties: true
          type: object
          title: Extra
          default: {}
      additionalProperties: false
      type: object
      title: FlowSettings
      description: >-
        The settings one execution was started with.


        Shared by every sync and never subclassed, so
        ``flow.settings.<setting>`` has one static type

        everywhere. Per-sync variance lives in :class:`FlowSettingsSpec` (which
        settings a sync supports, its

        tooltips, its extra fields) — never in this model.


        Read it through the derived properties rather than the raw fields: they
        are the only thing a

        sync should branch on, and they are what keeps a setting's scope from
        leaking into another's.
    OnlyObjects:
      properties:
        capability:
          type: string
          title: Capability
          description: The capability's key, e.g. `spend_to_accounting.SupplierInvoices`.
        ids:
          items:
            type: string
          type: array
          maxItems: 100
          minItems: 1
          title: Ids
          description: The source objects' ids.
        scope:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Scope
          description: >-
            Where the ids are, for a capability whose objects are only unique
            within something the consumer runs several of, e.g. `{"location_id":
            "paris"}`. Exactly the keys the capability is scoped on.
      additionalProperties: false
      type: object
      required:
        - capability
        - ids
      title: OnlyObjects
      description: >-
        Book these source objects of one capability of an agentic sync, whatever
        its cadence; again when

        ``import_mode`` is ``force_reimport``.
    ExecutionConsumerResult:
      properties:
        consumerid:
          type: string
          title: Consumerid
        status:
          type: string
          title: Status
      type: object
      required:
        - consumerid
        - status
      title: ExecutionConsumerResult
    ExecutionWarning:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        blocking:
          type: boolean
          title: Blocking
          default: false
      type: object
      required:
        - code
        - message
      title: ExecutionWarning
      description: >-
        Something the caller should know before or after launching. A blocking
        one refuses the run.
    WriteMode:
      type: string
      enum:
        - normal
        - debug
        - preview
      title: WriteMode
      description: >-
        What an execution may write.


        Its scope is writes and nothing else: it never changes which period
        runs, what gets skipped, or

        how much is logged. ``PREVIEW`` is ``DEBUG`` plus a recorder.
    ImportMode:
      type: string
      enum:
        - normal
        - force_reimport
        - IMPORT_ONLY_MISSING_DAYS
        - REIMPORT_ENTIRE_PERIOD
      title: ImportMode
      description: >-
        How an execution interprets the sync state already recorded in the
        datastores.


        ``NORMAL`` treats the datastore as authoritative: anything not recorded
        as a success is

        retried. ``FORCE_REIMPORT`` ignores those records and re-exports
        everything in range; each

        sync decides how its own tracking datastores are reconciled.


        Its scope is state, not period: it never chooses which dates run, and it
        never deletes

        anything on its own.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        This access token needs to be included in each of your request to the
        Chift API.

````

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