# task

```graphql
query Task($projectReference: String!, $taskId: String!) {
  task(projectReference: $projectReference, taskId: $taskId) {
    id
    name
    description
    target
    sourcePath
    editMode
    inputSchema
    outputSchema
    schedulable
  }
}
```

Read one task definition by its ID to inspect its target, input and output schemas and whether it can be scheduled; returns the task. Requires project.runs.read.

## Arguments

| Name                        | Type                | Required | Description                                                                                                                    |
| --------------------------- | ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `projectReference`          | String!             | Yes      |                                                                                                                                |
| `taskId`                    | String!             | Yes      |                                                                                                                                |
| `input`                     | SourceSelectorInput |          |                                                                                                                                |
| `input.sourceTargetKind`    | SourceTargetKind    |          | The source to read; default runtimeTargetKind, else project. One of `project`, `main_branch`, `environment`, `preview_branch`. |
| `input.runtimeTargetKind`   | RuntimeTargetKind   |          | Used as the source to read when sourceTargetKind is omitted. One of `main_branch`, `environment`, `preview_branch`.            |
| `input.targetEnvironmentId` | ID                  |          | Required with the kind environment.                                                                                            |
| `input.targetBranchId`      | ID                  |          | Required with the kind preview\_branch.                                                                                        |

## Variables

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

## Responses

| Status | Description             |
| ------ | ----------------------- |
| 200    | The Task! in data.task. |

## 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 Task($projectReference: String!, $taskId: String!) {\n  task(projectReference: $projectReference, taskId: $taskId) {\n    id\n    name\n    description\n    target\n    sourcePath\n    editMode\n    inputSchema\n    outputSchema\n    schedulable\n  }\n}",
  "variables": {
    "projectReference": "string",
    "taskId": "string"
  }
}'
```

## Example response

```json
{
  "data": {
    "task": {
      "id": "string",
      "name": "string",
      "description": "string",
      "target": "string",
      "sourcePath": "string",
      "editMode": "structured",
      "inputSchema": {},
      "outputSchema": {},
      "schedulable": false
    }
  }
}
```
