# Set a per-job task YAML override

> Source: https://docs.clonepartner.com/api-reference/jobs/set-job-task-override/

`PUT /api/jobs/{id}/tasks/{taskKey}/override`

Stores a YAML override for the given DAG node key. The override wins over
the pinned task version at run time for this job only. Validated with the
same task parser/validator as the task library, plus bidirectional connector
slot checks: every slot in the DAG node's connector_mapping must be declared
in the override's `connectors` section, and the override may not introduce
slots that the job has no mapping for. Admin only.

**Operation ID:** `setJobTaskOverride`

## 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`

## Request body

The request body is required.

### `application/json`

- Type: `object`
- Properties:
  - `yaml_content` (`string`, `required`)

## Success responses

### 200

Override stored

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

- Type: `object`
- Properties:
  - `ok` (`boolean`)
  - `overridden_task_keys` (`array<string>`)
    - Items:
      - Type: `string`

## Error responses

### 400

Validation error

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

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

Example:

```json
{
  "error": "VALIDATION_ERROR",
  "message": "Invalid input"
}
```

### 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 PUT \
  --url 'https://your-envoy.example.com/api/jobs/YOUR_ID/tasks/YOUR_TASK_KEY/override' \
  --header 'Authorization: Bearer $API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "yaml_content": "string"
}'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/jobs/YOUR_ID/tasks/YOUR_TASK_KEY/override', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "yaml_content": "string"
  }),
});

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