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

# Execute workflow and wait for the result

> Start an execution of the workflow and wait for it to finish, up to timeoutSeconds.
Returns 200 with the result once the execution completes, fails or is cancelled.
Returns 202 when it has not finished in time, or when it is paused or awaiting
confirmation. The execution keeps running; follow it with GET /executions/{executionId}.
This call is not idempotent: on a gateway timeout, look the execution up instead of retrying.



## OpenAPI

````yaml https://odyssey.asteroid.ai/agents/v2/openapi.yaml post /workflows/{workflowId}/execute/sync
openapi: 3.1.0
info:
  title: Agent Service
  version: v1
servers:
  - description: V2 API
    url: https://odyssey.asteroid.ai/agents/v2
security:
  - ApiKeyAuth: []
tags:
  - name: Agents
  - name: Environments
  - name: Schedules
  - name: Execution
  - name: Files
  - name: Agent Profiles
  - name: Agent Profile Pools
  - name: Workflows
  - name: Execution Batches
  - name: Scheduled Executions
  - name: Schema
  - name: Documentation
  - name: Context
  - name: Admin Customer Activity
  - name: Reference
  - name: Workflow Tags
  - name: Vault
  - name: Workflow Versions
paths:
  /workflows/{workflowId}/execute/sync:
    post:
      tags:
        - Workflows
      summary: Execute workflow and wait for the result
      description: >-
        Start an execution of the workflow and wait for it to finish, up to
        timeoutSeconds.

        Returns 200 with the result once the execution completes, fails or is
        cancelled.

        Returns 202 when it has not finished in time, or when it is paused or
        awaiting

        confirmation. The execution keeps running; follow it with GET
        /executions/{executionId}.

        This call is not idempotent: on a gateway timeout, look the execution up
        instead of retrying.
      operationId: WorkflowExecuteSyncPost
      parameters:
        - description: The ID of the workflow to execute
          in: path
          name: workflowId
          required: true
          schema:
            $ref: '#/components/schemas/Common.uuid'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Workflows.Workflow.ExecuteSyncRequest'
        description: Execution request parameters
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workflows.Workflow.ExecuteSyncResponse'
          description: The request has succeeded.
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workflows.Workflow.ExecuteSyncResponse'
          description: >-
            The request has been accepted for processing, but processing has not
            yet completed.
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Common.Error'
          description: An unexpected error response.
components:
  schemas:
    Common.uuid:
      format: uuid
      type: string
    Workflows.Workflow.ExecuteSyncRequest:
      description: Request to execute a workflow and wait for the result
      properties:
        agentProfileId:
          allOf:
            - $ref: '#/components/schemas/Common.uuid'
          description: >-
            The ID of the agent profile to use for this execution. Mutually
            exclusive with agentProfilePoolId.
        agentProfilePoolId:
          allOf:
            - $ref: '#/components/schemas/Common.uuid'
          description: >-
            The ID of the agent profile pool to select a profile from. Mutually
            exclusive with agentProfileId.
        dynamicData:
          deprecated: true
          description: >-
            Deprecated: Use 'inputs' instead. Inputs to be merged into the
            placeholders defined in prompts
          type: object
          unevaluatedProperties: {}
          x-hidden: true
        executionOptions:
          allOf:
            - $ref: '#/components/schemas/Agents.Agent.ExecutionOptions'
          description: >-
            Per-execution runtime options that override or extend the workflow's
            default settings.
        inputs:
          description: Inputs to be merged into the placeholders defined in prompts
          type: object
          unevaluatedProperties: {}
        metadata:
          description: >-
            Optional metadata key-value pairs (string keys and string values)
            for organizing and filtering executions
          type: object
          unevaluatedProperties:
            type: string
        onCapacityLimit:
          allOf:
            - $ref: '#/components/schemas/Agents.Agent.OnCapacityLimit'
          description: >-
            What to do when the execution cannot start right now because the
            organisation is at

            its concurrency limit or every profile in the pool is in use.
            "reject" (the default)

            fails the request as today. "queue" accepts it: the execution is
            created in the

            "queued" status under the returned ID and starts automatically,
            oldest first, as

            capacity frees. Temp files cannot be queued.
        tempFiles:
          description: >-
            Array of temporary files to attach to the execution. Must have been
            pre-uploaded using the stage file endpoint
          items:
            $ref: '#/components/schemas/Agents.Files.TempFile'
          type: array
        timeoutSeconds:
          default: 25
          description: >-
            Seconds to wait for the execution to finish before returning 202.
            Defaults to 25.
          maximum: 25
          minimum: 1
          type: integer
        version:
          description: >-
            The version of the workflow to execute. If not provided, the
            published version is used.
          type: integer
      type: object
    Workflows.Workflow.ExecuteSyncResponse:
      description: Response from executing a workflow and waiting for the result
      properties:
        executionId:
          allOf:
            - $ref: '#/components/schemas/Common.uuid'
          description: The ID of the newly created execution
        executionResult:
          allOf:
            - $ref: '#/components/schemas/Agents.Execution.ExecutionResult'
          description: >-
            Outcome, reasoning and result data. Present on 200 when the
            execution recorded a result.
        status:
          allOf:
            - $ref: '#/components/schemas/Agents.Execution.Status'
          description: >-
            The execution's status when the call returned: terminal on 200, the
            current status on 202
      required:
        - executionId
        - status
      type: object
    Common.Error:
      properties:
        code:
          format: int32
          type: integer
        message:
          type: string
      required:
        - code
        - message
      type: object
    Agents.Agent.ExecutionOptions:
      description: Per-execution runtime options.
      properties:
        softTimeoutMins:
          description: >-
            Soft timeout in minutes. When the execution has been running longer
            than this value, a message is injected on every subsequent step
            urging the agent to wrap up and produce output. Must be greater than
            0 and less than the agent's hard timeout (max_timeout_mins).
          minimum: 1
          type: integer
        variantKey:
          description: >-
            Identifies which variant this execution is for, scoping its shared
            files and scripts to a per-variant subdirectory under each node's
            shared folder. It does not change which workflow or version runs.
            Normalised to a filesystem-safe slug by the server. Requires the
            workflow to have `variant_mode` enabled, and a variant-mode workflow
            requires it on every execution.
          type: string
      type: object
    Agents.Agent.OnCapacityLimit:
      description: >-
        Behaviour when the organisation or profile pool has no capacity for the
        execution
      enum:
        - reject
        - queue
      type: string
    Agents.Files.TempFile:
      properties:
        id:
          $ref: '#/components/schemas/Common.uuid'
        name:
          type: string
      required:
        - id
        - name
      type: object
    Agents.Execution.ExecutionResult:
      description: Execution result containing outcome, reasoning, and result data
      properties:
        createdAt:
          description: When the result was created
          format: date-time
          type: string
        executionId:
          allOf:
            - $ref: '#/components/schemas/Common.uuid'
          description: Execution this result belongs to
        id:
          allOf:
            - $ref: '#/components/schemas/Common.uuid'
          description: Unique identifier for the result
        outcome:
          description: Outcome of the execution (success or failure)
          type: string
        reasoning:
          description: AI reasoning for the outcome
          type: string
        result:
          description: Result data as JSON
      required:
        - id
        - executionId
        - outcome
        - reasoning
        - result
        - createdAt
      type: object
    Agents.Execution.Status:
      enum:
        - queued
        - starting
        - running
        - paused
        - awaiting_confirmation
        - completed
        - cancelled
        - failed
        - paused_by_agent
      type: string
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: X-Api-Key
      type: apiKey

````