# assignEmployeeToContact

Put one AI employee on one contact, optionally on a schedule, the contact card's Add. From then on it answers the contact's texts, emails and calls, and a schedule runs it on that cadence. 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). The employee must be switched on and from this organization. Many contacts with no schedule: attachEmployeeToContacts. Needs their yes; a card's counts.

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

## Variables

- `contactId`: `ID!` (required)
- `employeeId`: `ID!` (required)
- `schedule`: `AiEmployeeScheduleInput`
  - `cronExpression`: `String!` (required)
  - `timezone`: `String!` (required)
  - `maxRuns`: `Int!` (required)
  - `instruction`: `String`

## Response (data, an example)

```json
{
  "aiEmployeesMutation": {
    "assignAiEmployeeToContact": {
      "id": "<ID>",
      "agentId": "<ID>",
      "status": "ACTIVE",
      "schedule": {
        "nextFireAt": "2026-01-01T00:00:00.000Z",
        "maxRuns": 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": "assignEmployeeToContact",
    "variables": {
      "contactId": "<contactId>",
      "employeeId": "<employeeId>"
    }
  }'
```
