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

# Run a workflow

> Starts a workflow immediately and returns the execution that was created. The request body is
handed to the workflow's trigger step.
            
Only workflows with an instant or scheduled trigger can be run this way. The
record-triggered types expect event data about a specific record, so running one with an
arbitrary body would execute but produce a run whose history means nothing.
            
For a workflow with no response step the run is asynchronous: the execution comes back in a
non-terminal status and should be polled with the get-execution endpoint until it closes.
A run that started and then failed is a 200 carrying an execution with status failure -
the error statuses are reserved for runs that never started at all.
            
There is no idempotency key: retrying this call starts a second execution.



## OpenAPI

````yaml /developers/api-reference/openapi.json post /v1/workflows/{workflowId}/run
openapi: 3.0.0
info:
  title: Engini API
  version: v1
  description: The Engini public API.
servers:
  - url: https://api.engini.io
security:
  - Bearer: []
  - ApiKey: []
tags:
  - name: Auth
    description: Identify the caller a Developer API request is authenticated as.
  - name: On-prem agents
    description: >-
      Provision and manage agents that run Engini tasks inside a customer's
      network.
  - name: Applications
    description: >-
      Discover the applications (toolkits) available in Engini and their
      connection requirements.
  - name: Tools
    description: Browse and execute the tools exposed by Engini applications.
  - name: Toolsets
    description: Manage toolsets - named groupings of connections and tools.
  - name: McpServers
    description: >-
      Inspect and maintain MCP servers - the account-wide endpoints that expose
      Engini tools and workflows over the Model Context Protocol. Distinct from
      the MCPClient connection kind, which is Engini consuming a third-party MCP
      server.
  - name: Connections
    description: >-
      Manage connections to applications, including OAuth sign-in and
      default-connection selection.
  - name: Folders
    description: >-
      List the folders that organize workflows in each workspace and
      environment.
  - name: Workflows
    description: >-
      List workflows, and build them from a plan: search the catalog, read
      schemas and options, compile, create and update.
  - name: Executions
    description: >-
      Read execution history for workflows, table automations and app business
      rules, including per-step logs and recorded payloads.
  - name: Triggers
    description: >-
      Create triggers that fire when something changes in a connected app, and
      manage the destinations their events are delivered to.
paths:
  /v1/workflows/{workflowId}/run:
    post:
      tags:
        - Workflows
      summary: Run a workflow
      description: >-
        Starts a workflow immediately and returns the execution that was
        created. The request body is

        handed to the workflow's trigger step.
                    
        Only workflows with an instant or scheduled trigger can be run this way.
        The

        record-triggered types expect event data about a specific record, so
        running one with an

        arbitrary body would execute but produce a run whose history means
        nothing.
                    
        For a workflow with no response step the run is asynchronous: the
        execution comes back in a

        non-terminal status and should be polled with the get-execution endpoint
        until it closes.

        A run that started and then failed is a 200 carrying an execution with
        status failure -

        the error statuses are reserved for runs that never started at all.
                    
        There is no idempotency key: retrying this call starts a second
        execution.
      operationId: Workflows_RunWorkflow
      parameters:
        - name: workflowId
          in: path
          required: true
          description: Identifier of the workflow to run.
          schema:
            type: integer
            format: int32
          x-position: 1
      requestBody:
        x-name: body
        description: Trigger payload, passed to the workflow's trigger step.
        content:
          application/json:
            schema:
              type: object
              additionalProperties: {}
        x-position: 2
      responses:
        '200':
          description: The execution that was started.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionPublicDTO'
        '400':
          description: Bad request - malformed body or invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - missing or invalid bearer token or API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: |2-

                         SCOPE_READ_ONLY: the API key is not scoped to a workspace and environment (a key created before
                         keys had a scope). Reads stay available to such a key.
                         
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found - the resource does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: |2-

                         The workflow could not be started: it has no trigger step, is of a trigger type this endpoint
                         does not run, or the account's credit limit was reached before dispatch. Disabled and blocked
                         workflows may still be run manually through this endpoint.
                         
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too many requests - rate limit exceeded.
          headers:
            Retry-After:
              description: Number of seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error - an unexpected error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Bearer: []
        - ApiKey: []
      x-codeSamples:
        - lang: python
          label: Python
          source: >-
            from engini import Engini


            client = Engini()  # reads ENGINI_API_KEY


            # needs a workspace-scoped key; no idempotency key, so a retry
            starts a second run

            run = client.workflows.run(1234, {"email": "a@b.co"})

            print(run.execution_id, run.status)
        - lang: typescript
          label: TypeScript
          source: >-
            import { Engini } from "@engini/sdk";


            const client = new Engini(); // reads ENGINI_API_KEY


            // needs a workspace-scoped key; no idempotency key, so a retry
            starts a second run

            const run = await client.workflows.run(1234, { email: "a@b.co" });

            console.log(run.executionId, run.status);
        - lang: bash
          label: CLI
          source: engini workflows run 1234 --body '{"email":"a@b.co"}'
components:
  schemas:
    ExecutionPublicDTO:
      type: object
      description: >-
        Public shape of one workflow, table-automation or app-business-rule
        execution.
      additionalProperties: false
      required:
        - executionId
        - workflowId
        - type
        - triggerType
        - status
        - createdAt
        - activitiesRan
        - dataTransferred
        - dataAvailable
      properties:
        executionId:
          type: integer
          description: Identifier of the execution.
          format: int32
        workflowId:
          type: integer
          description: >-
            Identifier of the stored definition that ran. Use Type to
            distinguish a

            workflow, table automation or business rule.
          format: int32
        workspace:
          description: >-
            The workspace the execution's workflow belongs to; omitted for a row
            that predates workspaces.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/WorkspaceRefPublicDTO'
        environment:
          description: >-
            The environment (of Workspace) the execution's workflow belongs to;
            omitted for a row that predates workspaces.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/EnvironmentRefPublicDTO'
        type:
          type: string
          description: 'Kind of definition that ran: workflow, automation or businessRule.'
        triggerType:
          type: string
          description: >-
            Trigger that started the definition, for example instant, scheduled
            or recordUpdate.
        status:
          type: string
          description: >-
            Status of the execution. A status this API version does not publish
            is returned in the

            escape form "unknown:{id}" rather than being dropped, so the
            information is never

            silently lost.
        createdAt:
          type: string
          description: When the execution was queued (UTC).
          format: date-time
        startedAt:
          type: string
          description: >-
            When the execution started running (UTC); omitted while it is still
            queued.
          format: date-time
          nullable: true
        closedAt:
          type: string
          description: >-
            When the execution reached a terminal status (UTC); omitted while it
            is still open.
          format: date-time
          nullable: true
        duration:
          type: number
          description: >-
            Execution duration in seconds, fractional. Omitted while the
            execution is still open -

            a duration of zero would be a claim about how long it took, not "not
            finished yet".
          format: double
          nullable: true
        activitiesRan:
          type: integer
          description: >-
            Number of activities that ran in this execution. This is currently
            the basis for credit

            consumption, but it is deliberately not named creditsUsed: the
            mapping from activities to

            credits is a billing decision and is not frozen by this contract.
          format: int32
        dataTransferred:
          type: integer
          description: Bytes of data transferred by this execution.
          format: int32
        context:
          type: string
          description: >-
            Caller-supplied context identifier for this execution; omitted when
            not set.
          nullable: true
        createdBy:
          description: >-
            The account user who started the execution; omitted for
            system-triggered executions.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/AccountUserRefPublicDTO'
        dataAvailable:
          type: boolean
          description: >-
            Whether the execution's per-step log and payloads are still
            available. Executions past their

            workflow's retention window keep their summary row but have their
            per-step detail purged;

            those rows stay in the list with this set to false, so a wide query
            never shows silent gaps.
    ErrorResponse:
      type: object
      description: >-
        Unified machine-readable error envelope returned by every non-200
        Developer API response.
      additionalProperties: false
      required:
        - errorCode
        - message
        - requestId
        - timestamp
      properties:
        errorCode:
          type: string
          description: Machine-readable error code identifying the failure.
        message:
          type: string
          description: Human-readable error message.
        requestId:
          type: string
          description: Identifier of the request, for support/correlation.
        timestamp:
          type: string
          description: Timestamp when the error occurred (ISO 8601).
        details:
          type: array
          description: Per-field validation details, when applicable.
          nullable: true
          items:
            $ref: '#/components/schemas/ErrorDetail'
    WorkspaceRefPublicDTO:
      type: object
      description: >-
        The workspace a /v1 item belongs to, as it appears in the item's
        workspace member.
      additionalProperties: false
      required:
        - id
      properties:
        id:
          type: string
          description: Identifier of the workspace.
          format: uuid
        name:
          type: string
          description: >-
            Display name of the workspace; null for an API key, for a workspace
            the caller cannot open, and when the name could not be read.
          nullable: true
    EnvironmentRefPublicDTO:
      type: object
      description: >-
        The environment a /v1 item belongs to, as it appears in the item's
        environment member. Same rules as

        WorkspaceRefPublicDTO: Name and Type are null whenever the name is.
      additionalProperties: false
      required:
        - id
      properties:
        id:
          type: string
          description: Identifier of the environment.
          format: uuid
        name:
          type: string
          description: >-
            Display name of the environment; null when the caller cannot be
            shown it.
          nullable: true
        type:
          type: string
          description: >-
            Kind of environment: Production, Staging or Development; null when
            the name is.
          nullable: true
    AccountUserRefPublicDTO:
      type: object
      description: >-
        Reference to an account user. When present, emitted as an object rather
        than a bare identifier,

        so a consumer never has to make a second call to turn an id into
        something displayable.
      additionalProperties: false
      required:
        - id
      properties:
        id:
          type: integer
          description: Identifier of the account user.
          format: int32
        name:
          type: string
          description: >-
            Display name of the account user, or null when the name could not be
            resolved (for

            example while the user directory is unavailable). The object itself
            is never omitted.
          nullable: true
    ErrorDetail:
      type: object
      description: A single field-level error detail within an ErrorResponse.
      additionalProperties: false
      required:
        - field
        - issue
      properties:
        field:
          type: string
          description: Name of the field the issue relates to.
        issue:
          type: string
          description: Description of the issue with the field.
  securitySchemes:
    Bearer:
      type: http
      description: Enter your JWT token
      scheme: bearer
      bearerFormat: JWT
    ApiKey:
      type: apiKey
      description: >-
        Opaque Developer API key (prefix `eng_`). Authenticates as the key's
        owner and resolves the account automatically.
      name: x-api-key
      in: header

````

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