---
title: "Execute workflow and wait for the result"
method: POST
path: "/agents/v2/workflows/{workflowId}/execute/sync"
tags: ["Workflows"]
---

# Execute workflow and wait for the result

`POST /agents/v2/workflows/{workflowId}/execute/sync`

## Request

- Base URL: `https://odyssey.asteroid.ai`
- URL: `https://odyssey.asteroid.ai/agents/v2/workflows/{workflowId}/execute/sync`
- Auth: API key in header `X-Api-Key`

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.

## Path parameters

- `workflowId` string, uuid, required

## Request body

- WorkflowsWorkflowExecuteSyncRequest: Request to execute a workflow and wait for the result
  - `agentProfileId` string, uuid
  - `agentProfilePoolId` string, uuid
  - `dynamicData` object: Deprecated: Use 'inputs' instead. Inputs to be merged into the placeholders defined in prompts
  - `executionOptions` AgentsAgentExecutionOptions: Per-execution runtime options.
    - `softTimeoutMins` integer: 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).
    - `variantKey` string: 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.
  - `head` boolean: Run the editable head instead of the published version. Cannot be combined with version.
  - `inputs` object: Inputs to be merged into the placeholders defined in prompts
  - `metadata` object: Optional metadata key-value pairs (string keys and string values) for organizing and filtering executions
  - `onCapacityLimit` 'reject' | 'queue': Behaviour when the organisation or profile pool has no capacity for the execution
  - `profileGroupId` string, uuid
  - `profileId` string, uuid
  - `tempFiles` AgentsFilesTempFile[]: Array of temporary files to attach to the execution. Must have been pre-uploaded using the stage file endpoint
    - `id` string, uuid, required
    - `name` string, required
  - `timeoutSeconds` integer: Seconds to wait for the execution to finish before returning 202. Defaults to 25.
  - `version` integer: The version of the workflow to execute. If neither version nor head is provided, the published version is used.

## Response `200`

The request has succeeded.

- WorkflowsWorkflowExecuteSyncResponse: Response from executing a workflow and waiting for the result
  - `awaitingConfirmation` AgentsAgentConfirmationHold: The node an execution awaiting confirmation holds at
    - `nodeId` string, uuid, required
    - `nodeName` string, required
  - `executionId` string, uuid, required
  - `executionResult` AgentsExecutionExecutionResult: Execution result containing outcome, reasoning, and result data
    - `createdAt` string, date-time, required
    - `executionId` string, uuid, required
    - `id` string, uuid, required
    - `outcome` string, required: Outcome of the execution (success or failure)
    - `reasoning` string, required
    - `result` unknown, required
  - `returnReason` 'ended' | 'needs_person' | 'status_change' | 'timed_out', required: Why a wait call returned. ended: the execution completed, failed or was cancelled. needs_person: it is paused, paused_by_agent or awaiting_confirmation and will not continue without a person. status_change: its status changed from the one it had when the call began. timed_out: the call stopped waiting before anything changed, normally because timeoutSeconds passed.
  - `status` 'queued' | 'starting' | 'running' | 'paused' | 'awaiting_confirmation' | 'completed' | 'cancelled' | 'failed' | 'paused_by_agent', required

## Other responses

- `202`: The request has been accepted for processing, but processing has not yet completed.
- `default`: An unexpected error response.

---

[API](https://skmtc.dev/asteroid/apis/agent-service.md) - [All operations](https://skmtc.dev/asteroid/apis/agent-service/llms.txt) - [OpenAPI document](https://skmtc.dev/asteroid/apis/agent-service/revisions/ccc134d1d510?raw)
