# applyTaskTemplate

Run a TASK template against a contact: creates one task, assigned to the acting user, linked to the contact (and any dealIds). Title/description render the template's merge fields + spintax against that contact, and the RELATIVE dueOffset resolves from now, snapped to its preferred time-of-day. Rejects a template not of type TASK. overrides { title?, description?, endDate?, timezone?, taskType?, autoCompleteOnNoteAdded?, autoCompleteOnReassignment? } replace what the template would produce for this one apply: an endDate override skips the relative due date, and what is not overridable (origin, supporting-file links, the contact/deal links) still applies. Send timezone with any endDate override: the task is stored and read back in it, and without it keeps the TEMPLATE's zone, so an instant chosen in one zone can render as a different day. Template ids: listContentTemplates(type: TASK). A whole saved SOP is applyTaskSet, not this per step.

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

## Variables

- `templateId`: `ID!` (required)
- `contactId`: `ID!` (required)
- `dealIds`: `[ID!]`
- `overrides`: `ApplyTaskTemplateOverridesInput`. Per-apply overrides for `applyTaskTemplate`. Each field REPLACES the value the template would have produced; omitted fields keep the template's. `endDate` skips the relative due-date resolution entirely. Everything the template carries that is not overridable (origin, supporting-file links, the contact link) still applies, which is why an edited prefill submits through this rather than through a plain createTask.
  - `title`: `String`
  - `description`: `String`
  - `endDate`: `DateTime`
  - `timezone`: `Timezone` (one of `IDLW`, `SST`, `HST`, `AKST`, `PST`, `MST`, `AZ`, `CST`, `EST`, `AST`, `BRT`, `FNT`, `AZOT`, `UTC`, `CET`, `EET`, `MSK`, `GST`, `PKT`, `BST`, `ICT`, `JST`, `AEST`, `NCT`, `NZST`). The timezone the created task is stored in, and the zone `endDate` is read back against by the task editor. Send it alongside any `endDate` override: without it the task keeps the TEMPLATE's `preferredTimeOfDay.timezone`, so an instant chosen in US Eastern can render as the next day under a template authored in UTC+9. When present it always wins over the template's zone; when omitted the template's is kept. AZ: Arizona: MST all year, no DST.
  - `taskType`: `String`
  - `autoCompleteOnNoteAdded`: `Boolean`
  - `autoCompleteOnReassignment`: `Boolean`

## Response (data, an example)

```json
{
  "workflowAutomationsMutation": {
    "applyTaskTemplate": {
      "id": "<ID>",
      "title": "…",
      "description": "…",
      "endDate": "2026-01-01T00:00:00.000Z",
      "completedAt": "2026-01-01T00:00:00.000Z"
    }
  }
}
```

## 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": "applyTaskTemplate",
    "variables": {
      "templateId": "<templateId>",
      "contactId": "<contactId>"
    }
  }'
```
