---
title: "Bulk-upsert a ctq-tasks manifest push"
method: POST
path: "/api/goal/sync"
tags: ["Goal"]
---

# Bulk-upsert a ctq-tasks manifest push

`POST /api/goal/sync`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/goal/sync`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

T440. Replaces N individual add/advance/link calls with one idempotent, transactional upsert. Correlation key is `(tenantId, projectId, external_ref.local_id)`. See docs/tech/ctq-tasks-sync.md.

## Request body

- object
  - `project_id` integer, nullable
  - `tasks` object[], required
    - `local_id` string, required
    - `title` string, required
    - `status` string, required
    - `do` string
    - `done_when` string
    - `deps` string[]
    - `model` string
    - `exec` string
    - `area` string
    - `created_by` string
    - `blocker` string, nullable
    - `reason` string, nullable
    - `order_index` integer
    - `brief` object, nullable: Six-section cold-executor brief; every field required when the object is present at all.
      - `intent` string, required
      - `decisions` string, required
      - `pointers` string, required
      - `rejected` string, required
      - `doneWhen` string, required
      - `gotchas` string, required

## Response `200`

Sync result.

- object
  - `mapping` object: local_id -> { node_id, updated_at } for every task in the payload.
  - `created` integer
  - `updated` integer
  - `skipped` integer: Hash-unchanged tasks — no write happened.
  - `depsAdded` integer
  - `depsRemoved` integer
  - `warnings` object[]
    - `localId` string
    - `kind` 'unresolved_dep' | 'cycle' | 'error'
    - `message` string

## Other responses

- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
