# Get a job task's YAML (override or pinned version)

> Source: https://docs.clonepartner.com/api-reference/jobs/get-job-task-yaml/

`GET /api/jobs/{id}/tasks/{taskKey}/yaml`

Returns the YAML used to edit a task within a job. If a per-job override
exists for the DAG node key, its YAML is returned (`is_overridden: true`);
otherwise the pinned task_versions row YAML is returned. Admin only.

**Operation ID:** `getJobTaskYaml`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Path parameters

- `id` — `integer`, `required`
  Resource ID
- `taskKey` — `string`, `required`

## Success responses

### 200

Task YAML for the job DAG node

**Content type:** `application/json`

- Type: `object`
- Properties:
  - `task_key` (`string`)
  - `task_name` (`string`)
  - `base_version` (`integer | null`)
    - Nullable: yes
  - `yaml_content` (`string`)
  - `is_overridden` (`boolean`)

## Error responses

### 400

Job has no snapshotted YAML, the snapshot fails to parse, or task_versions_snapshot is corrupt

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

### 404

Resource not found

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}
```

## Examples

### cURL

```bash
curl --request GET \
  --url 'https://your-envoy.example.com/api/jobs/YOUR_ID/tasks/YOUR_TASK_KEY/yaml' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/jobs/YOUR_ID/tasks/YOUR_TASK_KEY/yaml', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
