# updateWorkflow

```graphql
mutation UpdateWorkflow($projectReference: String!, $workflowId: String!, $input: UpdateWorkflowInput!) {
  updateWorkflow(projectReference: $projectReference, workflowId: $workflowId, input: $input) {
    id
    name
    description
    target
    sourcePath
    source
    version
    schedulable
    editMode
    sourceOnlyReasons
  }
}
```

Change the description, version or schedulable flag of a structured workflow, where an omitted field keeps its value; returns the updated workflow source document. Requires project.runs.write.

## Arguments

| Name                     | Type                 | Required | Description                                                               |
| ------------------------ | -------------------- | -------- | ------------------------------------------------------------------------- |
| `projectReference`       | String!              | Yes      |                                                                           |
| `workflowId`             | String!              | Yes      |                                                                           |
| `input`                  | UpdateWorkflowInput! | Yes      |                                                                           |
| `input.description`      | String               |          | Omit it to keep the description; null clears it.                          |
| `input.version`          | String               |          | Omit it to keep the version; null clears it.                              |
| `input.schedulable`      | Boolean              |          | Omit it to keep the value.                                                |
| `input.sourceTargetKind` | WriteTargetKind      |          | The source to write; default project. One of `project`, `preview_branch`. |
| `input.targetBranchId`   | ID                   |          | Required with the kind preview\_branch.                                   |

## Variables

```json
{
  "projectReference": "string",
  "workflowId": "string",
  "input": {}
}
```

## Responses

| Status | Description                                 |
| ------ | ------------------------------------------- |
| 200    | The WorkflowSource! in data.updateWorkflow. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdateWorkflow($projectReference: String!, $workflowId: String!, $input: UpdateWorkflowInput!) {\n  updateWorkflow(projectReference: $projectReference, workflowId: $workflowId, input: $input) {\n    id\n    name\n    description\n    target\n    sourcePath\n    source\n    version\n    schedulable\n    editMode\n    sourceOnlyReasons\n  }\n}",
  "variables": {
    "projectReference": "string",
    "workflowId": "string",
    "input": {}
  }
}'
```

## Example response

```json
{
  "data": {
    "updateWorkflow": {
      "id": "string",
      "name": "string",
      "description": "string",
      "target": "string",
      "sourcePath": "string",
      "source": "string",
      "version": "string",
      "schedulable": false,
      "editMode": "structured",
      "sourceOnlyReasons": [
        "string"
      ]
    }
  }
}
```
