# Update Developer Workflow

> Update workflow metadata or an existing draft; published graphs are immutable.

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

## Endpoint

`PATCH /developer/v1/workflows/{definition_id}`

## Authentication

Send a GenHealth credential in the `Authorization` header:

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

Required scopes: `workflow:write`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `definition_id` | path | string | Yes | No description provided. |

## Request body

Required. JSON request body.

Schema: `WorkflowDeveloperDefinitionUpdate`.

## Request examples

### cURL

```curl
curl --request PATCH \
  --url 'https://api.umpa.genhealth.ai/developer/v1/workflows/{definition_id}' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "description": "string",
  "status": "open",
  "nodes": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "type": "string",
      "name": "string",
      "config": {
        "example_key": "string"
      },
      "position": [
        "…"
      ],
      "error_strategy": "fail",
      "retry_config": {
        "example_key": "…"
      },
      "default_value": {
        "example_key": "…"
      }
    }
  ],
  "edges": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "source_node_id": "string",
      "source_output": "default",
      "target_node_id": "string",
      "target_input": "default"
    }
  ],
  "trigger": {
    "example_key": "string"
  },
  "config": {
    "example_key": "string"
  },
  "route": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.umpa.genhealth.ai/developer/v1/workflows/{definition_id}', {
  method: 'PATCH',
  headers: {
    Authorization: 'Bearer <YOUR_API_KEY>',
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "string",
    "description": "string",
    "status": "open",
    "nodes": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "type": "string",
        "name": "string",
        "config": {
          "example_key": "string"
        },
        "position": [
          "…"
        ],
        "error_strategy": "fail",
        "retry_config": {
          "example_key": "…"
        },
        "default_value": {
          "example_key": "…"
        }
      }
    ],
    "edges": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "source_node_id": "string",
        "source_output": "default",
        "target_node_id": "string",
        "target_input": "default"
      }
    ],
    "trigger": {
      "example_key": "string"
    },
    "config": {
      "example_key": "string"
    },
    "route": "string"
  }),
});

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

### Python

```python
import json

payload = json.loads(r'''{
  "name": "string",
  "description": "string",
  "status": "open",
  "nodes": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "type": "string",
      "name": "string",
      "config": {
        "example_key": "string"
      },
      "position": [
        "…"
      ],
      "error_strategy": "fail",
      "retry_config": {
        "example_key": "…"
      },
      "default_value": {
        "example_key": "…"
      }
    }
  ],
  "edges": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "source_node_id": "string",
      "source_output": "default",
      "target_node_id": "string",
      "target_input": "default"
    }
  ],
  "trigger": {
    "example_key": "string"
  },
  "config": {
    "example_key": "string"
  },
  "route": "string"
}''')

import requests

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

data = response.json()
```

## Responses

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

### 200 response example

```json
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "string",
  "description": "string",
  "status": "open",
  "nodes": [],
  "edges": [],
  "trigger": {
    "example_key": "string"
  }
}
```

### 422 response example

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