# setEmployeeSchedule

Replace (or add) the schedule of one employee on one contact (`attachmentId` from getContactEmployees). A fresh cadence: runs already spent do not count against it. A schedule is a 5-field cron (`cronExpression`) read in an IANA `timezone`, at most once a day, and `maxRuns`, how many runs before it stops (never open-ended; at most five years of runs). Each run can text, email or call the contact, so it needs their yes; a card's counts.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "setEmployeeSchedule", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `attachmentId`: `ID!` (required)
- `cronExpression`: `String!` (required)
- `timezone`: `String!` (required)
- `maxRuns`: `Int!` (required)

## Response (data, an example)

```json
{
  "aiEmployeesMutation": {
    "setAiEmployeeSchedule": {
      "id": "<ID>",
      "agentId": "<ID>",
      "schedule": {
        "cronExpression": "…",
        "timezone": "…",
        "nextFireAt": "2026-01-01T00:00:00.000Z",
        "maxRuns": 0,
        "runCount": 0
      }
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "setEmployeeSchedule",
    "variables": {
      "attachmentId": "<attachmentId>",
      "cronExpression": "<String>",
      "timezone": "<String>",
      "maxRuns": 10
    }
  }'
```
