# Run Developer Workflow

> Start an active published workflow with idempotent retry semantics.

Source: [https://genhealth.ai/docs/workflows/api-reference/v1/workflow-developer-api/run-developer-workflow](https://genhealth.ai/docs/workflows/api-reference/v1/workflow-developer-api/run-developer-workflow)

## Endpoint

`POST /developer/v1/workflows/{definition_id}/runs`

## Authentication

Send a GenHealth credential in the `Authorization` header:

```http
Authorization: Bearer <YOUR_API_KEY>
Accept: application/json
```

Required scopes: `workflow:run`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `definition_id` | path | string | Yes | No description provided. |
| `draft` | query | boolean | No | No description provided. Default: false. |

## Request body

Required. JSON request body.

Schema: `WorkflowDeveloperRunTriggerRequest`.

## Request examples

### cURL

```curl
curl --request POST \
  --url 'https://api.umpa.genhealth.ai/developer/v1/workflows/{definition_id}/runs?draft=false' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "idempotency_key": "string",
  "trigger_data": {
    "example_key": "string"
  }
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.umpa.genhealth.ai/developer/v1/workflows/{definition_id}/runs?draft=false', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <YOUR_API_KEY>',
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "idempotency_key": "string",
    "trigger_data": {
      "example_key": "string"
    }
  }),
});

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

### Python

```python
import json

payload = json.loads(r'''{
  "idempotency_key": "string",
  "trigger_data": {
    "example_key": "string"
  }
}''')

import requests

response = requests.post(
    'https://api.umpa.genhealth.ai/developer/v1/workflows/{definition_id}/runs?draft=false',
    headers={
        'Authorization': 'Bearer <YOUR_API_KEY>',
        'Accept': 'application/json',
        'Content-Type': 'application/json',
    },
    json=payload,
)

data = response.json()
```

## Responses

| Status | Description |
| --- | --- |
| 202 | Successful Response |
| 422 | Validation Error |

### 202 response example

```json
{
  "run_id": "string",
  "status": "open"
}
```

### 422 response example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```
