# updateTask

```graphql
mutation UpdateTask($projectReference: String!, $taskId: String!, $input: UpdateTaskInput!) {
  updateTask(projectReference: $projectReference, taskId: $taskId, input: $input) {
    id
    name
    description
    target
    sourcePath
    source
    schedulable
    editMode
    sourceOnlyReasons
  }
}
```

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

## Arguments

| Name                     | Type             | Required | Description                                                               |
| ------------------------ | ---------------- | -------- | ------------------------------------------------------------------------- |
| `projectReference`       | String!          | Yes      |                                                                           |
| `taskId`                 | String!          | Yes      |                                                                           |
| `input`                  | UpdateTaskInput! | Yes      |                                                                           |
| `input.name`             | String!          | Yes      |                                                                           |
| `input.description`      | String           |          | Omit it to keep the description; 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",
  "taskId": "string",
  "input": {
    "name": "string"
  }
}
```

## Responses

| Status | Description                         |
| ------ | ----------------------------------- |
| 200    | The TaskSource! in data.updateTask. |

## 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 UpdateTask($projectReference: String!, $taskId: String!, $input: UpdateTaskInput!) {\n  updateTask(projectReference: $projectReference, taskId: $taskId, input: $input) {\n    id\n    name\n    description\n    target\n    sourcePath\n    source\n    schedulable\n    editMode\n    sourceOnlyReasons\n  }\n}",
  "variables": {
    "projectReference": "string",
    "taskId": "string",
    "input": {
      "name": "string"
    }
  }
}'
```

## Example response

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