> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://ref.scoutos.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://ref.scoutos.com/_mcp/server.

# Execute a workflow with config

POST https://api.scoutos.com/v2/workflows/execute
Content-Type: application/json

Reference: https://ref.scoutos.com/api-sdk/endpoints/workflows/run-with-config

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `environment` (string, optional, nullable) — Specifies the execution environment for the workflow. The available environments include: - `production`: The production environment, where workflows are executed under live conditions. - `staging`: A staging environment used for testing prior to production deployment. - `development`: A development environment used for testing new changes. - `console`: The console environment, runs latest changes on a workflow.
- `revision_id` (string, optional, nullable)
- `session_id` (string, optional, nullable)

### Body (application/json)

This endpoint expects a src__handlers__workflows_execute_with_config__ReqBody.

- `workflow_config` (WorkflowConfig-Input, required)
- `workflow_key` (string, optional, nullable)
- `inputs` (map from string to SrcHandlersWorkflowsExecuteWithConfigReqBodyInputs, optional)
- `streaming` (boolean, optional, default: false)

## Response

### 200

Successful Response

- `workflows_runWithConfig_Response_200`
  - WorkflowsRunWithConfigResponse2000: WorkflowsRunWithConfigResponse2000
  - WorkflowRunResponse: WorkflowRunResponse

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### WorkflowConfig-Input

- `workflow_display_name` (string, optional, default: Untitled)
- `workflow_schema_version` (string, optional, default: 1.0)
- `workflow_img_url` (string, optional, nullable)
- `workflow_description` (string, optional, nullable)
- `blocks` (list of Block-Input, optional)
- `notes` (list of WorkflowNote-Input, optional)
- `placeholders` (list of Placeholder-Input, optional)
- `tags` (list of string, optional)
- `is_tool` (boolean, optional, default: false)

### SrcHandlersWorkflowsExecuteWithConfigReqBodyInputs

- boolean
- map from string to any
- double
- integer
- list of any
- string

### WorkflowsRunWithConfigResponse2000

- WorkflowRunStarted: WorkflowRunStarted
- WorkflowRunCompleted: WorkflowRunCompleted
- WorkflowRunFailed: WorkflowRunFailed
- BlockRunStarted: BlockRunStarted
- BlockRunCompleted: BlockRunCompleted
- BlockRunFailed: BlockRunFailed
- BlockStateUpdated: BlockStateUpdated

### WorkflowRunResponse

- `run` (WorkflowRun, required)
- `workflow_id` (string, required)
- `output_block_id` (string, optional, default: )

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### Block-Input

- `block_archetype_id` (string, required)
- `block_display_name` (string, required)
- `block_id` (string, required)
- `block_inputs` (BlockInputBlockInputs, optional)
- `is_output` (boolean, optional, default: false)
- `dependencies` (list of Dependency, optional)
- `input_schema` (BlockInputInputSchema, optional)
- `ui` (NodeUI, optional)
- `trigger_config` (BlockInputTriggerConfig, optional, nullable)
- `ignore_error` (boolean, optional, default: false) — If true, will continue down the branch of the failed block
- `block_config` (list of BlockInputBlockConfigItems, optional, deprecated)
- `output_schema` (list of any, optional, deprecated)

### WorkflowNote-Input

- `id` (string, required)
- `bgColor` (string, required)
- `content` (string, optional, default: )
- `author` (string, optional, default: Your name)
- `ui` (NodeUI, optional)

### Placeholder-Input

- `block_id` (string, required)
- `type` (enum, required)
  - Allowed values: `triggerPlaceholder`, `blockPlaceholder`
- `ui` (NodeUI, optional)
- `dependencies` (list of Dependency, optional)

### WorkflowRunStarted

- `organization_id` (string, required)
- `environment` (enum, required)
  - Allowed values: `development`, `preview`, `production`, `test`
- `data` (WorkflowRunStartedData, required)
- `price` (string, required)
- `event_type` (string, required)
- `version` (string, required)
- `id` (string, optional) — The unique identifier of the event
- `correlation_id` (string, optional) — Identifies the root cause of the event. If not set, it defaults to the event id.
- `name` (enum, optional, default: workflow_run_started)
  - Allowed values: `workflow_run_started`
- `timestamp` (string, optional) — The timestamp of the event as UTC ISO 8601 string

### WorkflowRunCompleted

- `organization_id` (string, required)
- `environment` (enum, required)
  - Allowed values: `development`, `preview`, `production`, `test`
- `data` (WorkflowRunCompletedData, required)
- `price` (string, required)
- `event_type` (string, required)
- `version` (string, required)
- `id` (string, optional) — The unique identifier of the event
- `correlation_id` (string, optional) — Identifies the root cause of the event. If not set, it defaults to the event id.
- `name` (enum, optional, default: workflow_run_completed)
  - Allowed values: `workflow_run_completed`
- `timestamp` (string, optional) — The timestamp of the event as UTC ISO 8601 string

### WorkflowRunFailed

- `organization_id` (string, required)
- `environment` (enum, required)
  - Allowed values: `development`, `preview`, `production`, `test`
- `data` (WorkflowRunFailedData, required)
- `price` (string, required)
- `event_type` (string, required)
- `version` (string, required)
- `id` (string, optional) — The unique identifier of the event
- `correlation_id` (string, optional) — Identifies the root cause of the event. If not set, it defaults to the event id.
- `name` (enum, optional, default: workflow_run_failed)
  - Allowed values: `workflow_run_failed`
- `timestamp` (string, optional) — The timestamp of the event as UTC ISO 8601 string

### BlockRunStarted

- `organization_id` (string, required)
- `environment` (enum, required)
  - Allowed values: `development`, `preview`, `production`, `test`
- `data` (BlockRunStartedData, required)
- `price` (string, required)
- `event_type` (string, required)
- `version` (string, required)
- `id` (string, optional) — The unique identifier of the event
- `correlation_id` (string, optional) — Identifies the root cause of the event. If not set, it defaults to the event id.
- `name` (enum, optional, default: block_run_started)
  - Allowed values: `block_run_started`
- `timestamp` (string, optional) — The timestamp of the event as UTC ISO 8601 string

### BlockRunCompleted

- `organization_id` (string, required)
- `environment` (enum, required)
  - Allowed values: `development`, `preview`, `production`, `test`
- `data` (BlockRunCompletedData, required)
- `price` (string, required)
- `event_type` (string, required)
- `version` (string, required)
- `id` (string, optional) — The unique identifier of the event
- `correlation_id` (string, optional) — Identifies the root cause of the event. If not set, it defaults to the event id.
- `name` (enum, optional, default: block_run_completed)
  - Allowed values: `block_run_completed`
- `timestamp` (string, optional) — The timestamp of the event as UTC ISO 8601 string

### BlockRunFailed

- `organization_id` (string, required)
- `environment` (enum, required)
  - Allowed values: `development`, `preview`, `production`, `test`
- `data` (BlockRunFailedData, required)
- `price` (string, required)
- `event_type` (string, required)
- `version` (string, required)
- `id` (string, optional) — The unique identifier of the event
- `correlation_id` (string, optional) — Identifies the root cause of the event. If not set, it defaults to the event id.
- `name` (enum, optional, default: block_run_failed)
  - Allowed values: `block_run_failed`
- `timestamp` (string, optional) — The timestamp of the event as UTC ISO 8601 string

### BlockStateUpdated

- `organization_id` (string, required)
- `environment` (enum, required)
  - Allowed values: `development`, `preview`, `production`, `test`
- `data` (BlockStateUpdatedData, required)
- `price` (string, required)
- `event_type` (string, required)
- `version` (string, required)
- `id` (string, optional) — The unique identifier of the event
- `correlation_id` (string, optional) — Identifies the root cause of the event. If not set, it defaults to the event id.
- `name` (enum, optional, default: block_state_updated)
  - Allowed values: `block_state_updated`
- `timestamp` (string, optional) — The timestamp of the event as UTC ISO 8601 string

### WorkflowRun

- `stop_reason` (enum, required)
  - Allowed values: `workflow_run_completed`, `workflow_run_failed`
- `session_id` (string, required)
- `workflow_run_id` (string, required)
- `state` (map from string to WorkflowRunState, optional, nullable)
- `errors` (list of string, optional)

### ValidationErrorLocItems

- string
- integer

### BlockInputBlockInputs

### Dependency

- `block_id` (string, required)
- `ui` (EdgeUI, optional)

### BlockInputInputSchema

### NodeUI

- `dimensions` (Dimensions, optional, nullable)
- `position` (Position, optional, nullable)

### BlockInputTriggerConfig

### BlockInputBlockConfigItems

- BlockConfigItemBoolean: BlockConfigItemBoolean
- BlockConfigItemJson: BlockConfigItemJson
- BlockConfigItemNumber: BlockConfigItemNumber
- BlockConfigItemSelect: BlockConfigItemSelect
- BlockConfigItemTextShort: BlockConfigItemTextShort
- BlockConfigItemTextLong: BlockConfigItemTextLong
- BlockConfigItemLlm: BlockConfigItemLlm

### WorkflowRunStartedData

- `workflow_id` (string, required)
- `inputs` (WorkflowRunStartedDataInputs, required)
- `price` (double, required)
- `actor` (WorkflowActor, optional, nullable)
- `workflow_run_id` (string, optional)
- `session_id` (string, optional)
- `state` (WorkflowRunStartedDataState, optional)
- `workflow_config` (WorkflowRunStartedDataWorkflowConfig, optional)

### WorkflowRunCompletedData

- `workflow_id` (string, required)
- `workflow_run_id` (string, required)
- `output` (WorkflowRunCompletedDataOutput, required)
- `session_id` (string, required)
- `workflow_config` (WorkflowRunCompletedDataWorkflowConfig, optional)

### WorkflowRunFailedData

- `workflow_id` (string, required)
- `workflow_run_id` (string, required)
- `message` (string, required)
- `session_id` (string, required)
- `workflow_config` (WorkflowRunFailedDataWorkflowConfig, optional)

### BlockRunStartedData

- `workflow_id` (string, required)
- `workflow_run_id` (string, required)
- `config` (BlockRunStartedDataConfig, required)
- `state` (BlockRunStartedDataState, required)
- `session_id` (string, required)
- `block_type` (string, required, nullable)
- `block_id` (string, optional, nullable)
- `metadata` (BlockRunStartedDataMetadata, optional)

### BlockRunCompletedData

- `workflow_id` (string, required)
- `workflow_run_id` (string, required)
- `config` (BlockRunCompletedDataConfig, required)
- `state` (BlockRunCompletedDataState, required)
- `session_id` (string, required)
- `price` (double, required)
- `block_type` (string, required, nullable)
- `block_id` (string, optional, nullable)
- `cost` (double, optional, default: 0)
- `metadata` (BlockRunCompletedDataMetadata, optional)

### BlockRunFailedData

- `workflow_id` (string, required)
- `workflow_run_id` (string, required)
- `config` (BlockRunFailedDataConfig, required)
- `message` (string, required) — The reason why the job failed
- `state` (BlockRunFailedDataState, required)
- `session_id` (string, required)
- `block_type` (string, required, nullable)
- `block_id` (string, optional, nullable)
- `cost` (double, optional, default: 0)
- `metadata` (BlockRunFailedDataMetadata, optional)
- `status_code` (integer, optional, nullable) — The status code of the error

### BlockStateUpdatedData

- `workflow_id` (string, required)
- `workflow_run_id` (string, required)
- `block_type` (string, required) — The block archetype ID
- `update_data` (BlockStateUpdatedDataUpdateData, required)
- `block_id` (string, optional, nullable)
- `update_type` (enum, optional, default: complete) — If `complete` represents a full replacement of state, versus `partial` that indicates data must be _merged_.
  - Allowed values: `complete`, `partial`

### WorkflowRunState

- list of any
- string
- integer
- double
- map from string to any

### EdgeUI

- `edge_type` (string, optional, default: plusSign)

### Dimensions

- `width` (integer, required)
- `height` (integer, required)

### Position

- `x` (integer, required)
- `y` (integer, required)

### BlockConfigItemBoolean

- `id` (string, required)
- `display_name` (string, required)
- `type` (enum, optional, default: boolean)
  - Allowed values: `boolean`
- `default_value` (boolean, optional, nullable)
- `value` (boolean, optional, nullable)

### BlockConfigItemJson

- `id` (string, required)
- `display_name` (string, required)
- `type` (enum, optional, default: json)
  - Allowed values: `json`
- `default_value` (string, optional, nullable)
- `value` (string, optional, nullable)

### BlockConfigItemNumber

- `id` (string, required)
- `display_name` (string, required)
- `type` (enum, optional, default: number)
  - Allowed values: `number`
- `default_value` (BlockConfigItemNumberDefaultValue, optional, nullable)
- `minimum_value` (BlockConfigItemNumberMinimumValue, optional, nullable)
- `maximum_value` (BlockConfigItemNumberMaximumValue, optional, nullable)
- `value` (BlockConfigItemNumberValue, optional, nullable)

### BlockConfigItemSelect

- `id` (string, required)
- `display_name` (string, required)
- `options` (list of SelectOptionItem, required)
- `type` (enum, optional, default: select)
  - Allowed values: `select`
- `selected_option` (integer, optional, nullable)
- `value` (string, optional, nullable)

### BlockConfigItemTextShort

- `id` (string, required)
- `display_name` (string, required)
- `type` (enum, optional, default: text-short)
  - Allowed values: `text-short`
- `default_value` (string, optional, nullable)
- `value` (string, optional, nullable)

### BlockConfigItemTextLong

- `id` (string, required)
- `display_name` (string, required)
- `type` (enum, optional, default: text-long)
  - Allowed values: `text-long`
- `default_value` (string, optional, nullable)
- `value` (BlockConfigItemTextLongValue, optional, nullable)

### BlockConfigItemLlm

- `id` (string, required)
- `display_name` (string, required)
- `type` (enum, optional, default: prompt)
  - Allowed values: `prompt`
- `value` (list of Prompt, optional, nullable)

### WorkflowRunStartedDataInputs

### WorkflowActor

- `id` (string, required)
- `type` (enum, required)
  - Allowed values: `external`, `scoutos`

### WorkflowRunStartedDataState

### WorkflowRunStartedDataWorkflowConfig

### WorkflowRunCompletedDataOutput

### WorkflowRunCompletedDataWorkflowConfig

### WorkflowRunFailedDataWorkflowConfig

### BlockRunStartedDataConfig

### BlockRunStartedDataState

### BlockRunStartedDataMetadata

### BlockRunCompletedDataConfig

### BlockRunCompletedDataState

### BlockRunCompletedDataMetadata

### BlockRunFailedDataConfig

### BlockRunFailedDataState

### BlockRunFailedDataMetadata

### BlockStateUpdatedDataUpdateData

### BlockConfigItemNumberDefaultValue

- integer
- double

### BlockConfigItemNumberMinimumValue

- integer
- double

### BlockConfigItemNumberMaximumValue

- integer
- double

### BlockConfigItemNumberValue

- integer
- double

### SelectOptionItem

- `name` (string, required)
- `id` (string, optional)
- `color_hex` (string, optional, nullable)

### BlockConfigItemTextLongValue

- string
- BlockConfigItemTextLongValue1: list of Prompt

### Prompt

- `id` (string, required)
- `role` (enum, required)
  - Allowed values: `assistant`, `user`, `system`
- `content` (string, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "organization_id": "org_9f8b7c6d5e4a3b2c1d0e",
  "id": "evt_1234567890abcdef",
  "correlation_id": "corr_abcdef1234567890",
  "name": "workflow_run_started",
  "environment": "development",
  "timestamp": "2024-06-15T12:34:56Z",
  "data": {
    "actor": {
      "id": "user_9876543210fedcba",
      "type": "external"
    },
    "workflow_id": "wf_0011223344556677",
    "workflow_run_id": "run_8899aabbccddeeff",
    "inputs": {},
    "session_id": "sess_1122334455667788",
    "state": {},
    "workflow_config": {},
    "price": 1.1
  },
  "price": "1.10",
  "event_type": "workflow_event",
  "version": "1.0"
}
```

**SDK Code**

```python
import requests

url = "https://api.scoutos.com/v2/workflows/execute"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```typescript
import { ScoutClient } from "scoutos";

const client = new ScoutClient({ apiKey: "YOUR_API_KEY" });
await client.workflows.runWithConfig({
    environment: "environment",
    revision_id: "revision_id",
    session_id: "session_id",
    workflow_config: {}
});

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.scoutos.com/v2/workflows/execute"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.scoutos.com/v2/workflows/execute")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.scoutos.com/v2/workflows/execute")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.scoutos.com/v2/workflows/execute', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.scoutos.com/v2/workflows/execute");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.scoutos.com/v2/workflows/execute")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```