# Replace job configuration values

> Source: https://docs.clonepartner.com/api-reference/jobs/replace-job-config/

`PUT /api/jobs/{id}/config`

Replaces the persisted `job_config` object for a job. This is the manual
Job Details editor endpoint for jobs without schema-backed configuration.
If the job snapshot declares schema-backed keys, values for those keys are
validated and transformed before storing. Requires admin or superadmin role.

**Operation ID:** `replaceJobConfig`

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

## Request body

The request body is required.

### `application/json`

- Reference: `JobConfigSaveRequest`
  - Type: `object`
  - Properties:
    - `config` (`object`, `required`) — Complete persisted job_config object keyed by config key.
      - Description: Complete persisted job_config object keyed by config key.
      - Additional properties: allowed

## Success responses

### 200

Config object saved

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

- Reference: `JobConfigSaveResponse`
  - Type: `object`
  - Properties:
    - `ok` (`boolean`, `required`)
    - `config` (`object`, `required`) — Stored job_config object after validation/transforms for schema-backed keys.
      - Description: Stored job_config object after validation/transforms for schema-backed keys.
      - Additional properties: allowed

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

### 403

Insufficient permissions


### 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/config' \
  --header 'Authorization: Bearer $API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "config": {}
}'
```

### JavaScript (fetch)

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

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