# Execute a SIM workflow

`POST /api/integration/sim/workflows/{workflowId}/execute`

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  }
]
```

- bearer: http (bearer), header JWT. Enter JWT token

Parameters:

- `workflowId` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [ExecuteWorkflowDto](https://sourcey-gauzy.pages.dev/api-reference/models/executeworkflowdto/index.md)

- `input` (optional)
  Type: object
  
  Input data for the workflow

- `timeout` (optional)
  Type: number
  
  Execution timeout in milliseconds
  
  default: 30000

- `runAsync` (optional)
  Type: boolean
  
  Run asynchronously
  
  default: false

Responses:

- 200: Workflow executed successfully

- 404: Integration or workflow not found

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/integration/sim/workflows/string/execute' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "input": {},
  "timeout": 30000,
  "runAsync": false
}'
```

### JavaScript

```javascript
const body = `{
  "input": {},
  "timeout": 30000,
  "runAsync": false
}`;

const response = await fetch('http://localhost:3000/api/integration/sim/workflows/string/execute', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "input": {},
  "timeout": 30000,
  "runAsync": false
}'''

response = requests.post(
    'http://localhost:3000/api/integration/sim/workflows/string/execute',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
