# taskSource

```graphql
query TaskSource($projectReference: String!, $taskId: String!) {
  taskSource(projectReference: $projectReference, taskId: $taskId) {
    id
    name
    description
    target
    sourcePath
    source
    schedulable
    editMode
    sourceOnlyReasons
  }
}
```

Read the editable source behind one task before changing it; returns the task source document with its source text, edit mode and the reasons it can only be edited as source. Requires project.runs.read.

## Arguments

| Name                        | Type                    | Required | Description                                                                                                         |
| --------------------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `projectReference`          | String!                 | Yes      |                                                                                                                     |
| `taskId`                    | String!                 | Yes      |                                                                                                                     |
| `input`                     | SourceReadSelectorInput |          |                                                                                                                     |
| `input.sourceTargetKind`    | WriteTargetKind         |          | The source to read; default runtimeTargetKind, else project. One of `project`, `preview_branch`.                    |
| `input.runtimeTargetKind`   | RuntimeTargetKind       |          | Used as the source to read when sourceTargetKind is omitted. One of `main_branch`, `environment`, `preview_branch`. |
| `input.targetBranchId`      | ID                      |          | Required with the kind preview\_branch.                                                                             |
| `input.targetEnvironmentId` | ID                      |          | Not supported for source reads; a non-null value is refused as invalid\_input.                                      |

## Variables

```json
{
  "projectReference": "string",
  "taskId": "string"
}
```

## Responses

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

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query TaskSource($projectReference: String!, $taskId: String!) {\n  taskSource(projectReference: $projectReference, taskId: $taskId) {\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"
  }
}'
```

## Example response

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