# Publish Developer Workflow

> Audit and publish the current draft as an immutable active version.

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

## Endpoint

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

## Authentication

Send a GenHealth credential in the `Authorization` header:

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

Required scopes: `workflow:publish`

## Parameters

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

## Request body

Optional. JSON request body.

Schema: `WorkflowPublishRequest`.

## Request examples

### cURL

```curl
curl --request POST \
  --url 'https://api.umpa.genhealth.ai/developer/v1/workflows/{definition_id}/publish' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "description": "string"
}'
```

### JavaScript

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

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

### Python

```python
import json

payload = json.loads(r'''{
  "description": "string"
}''')

import requests

response = requests.post(
    'https://api.umpa.genhealth.ai/developer/v1/workflows/{definition_id}/publish',
    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",
  "version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "version_number": 1,
  "status": "open"
}
```

### 422 response example

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