Sync
Package sync is data sync: link two endpoints and keep them in step, on a webhook, on a schedule, or on demand.
Package sync is data sync: link two endpoints and keep them in step, on a webhook, on a schedule, or on demand.
| Base URL | https://api.hanzo.ai |
| Operations | 6 |
| Auth | Authorization: Bearer $HANZO_API_KEY |
sync
Run reconciles one sync now — the manual re-sync, and the initial import for a link created without run=true.
POST /v1/sync/{id}/run
Run reconciles one sync now — the manual re-sync, and the initial import for a link created without run=true. The work is handed to a bounded background worker and the call answers 202 immediately, so a large mirror-in never holds the request open; queued=true means accepted, not finished.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the sync to act on, from the path. |
Get returns one sync by id.
GET /v1/sync/{id}
Get returns one sync by id. It is org-scoped: an id belonging to another tenant is the same 404 an unknown id gives, so a probe learns nothing about what exists.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the sync to act on, from the path. |
Patch updates one sync's mutable policy — direction, trigger and actor — in place.
PATCH /v1/sync/{id}
Patch updates one sync's mutable policy — direction, trigger and actor — in place. The endpoints and the kind are immutable: re-pointing a sync is a delete and a create, so a link can never silently start syncing somewhere else. A field the request omits is left as it was. Changing the direction immediately reconciles the derived outbound mirror, so turning push off stops the upstream being written to rather than merely recording the intent.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the sync to update, from the path. |
Request body — application/json (required)
| Field | Type | Required | Description |
|---|---|---|---|
actor | string | — | Actor is the loop-guard identity the sync writes as. |
direction | string | — | Direction is both, pull, push or off. |
id | string | — | ID is the sync to update, from the path. |
trigger | string | — | Trigger is webhook, poll or manual. |
Delete removes one sync and tears down the outbound mirror it derived, answering 204.
DELETE /v1/sync/{id}
Delete removes one sync and tears down the outbound mirror it derived, answering 204. The teardown is the point: without it an unsynced repository would keep force-pushing to the upstream it is no longer linked to. Org-scoped, so another tenant's id is the same 404 an unknown id gives.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the sync to act on, from the path. |
List returns every sync link the caller's org has, each with its two endpoints, its direction and trigger policy, and the time it last reconciled.
GET /v1/sync
List returns every sync link the caller's org has, each with its two endpoints, its direction and trigger policy, and the time it last reconciled. Scoped to the caller's own org — another tenant's links are structurally unreachable.
Create declares a sync between two endpoints and returns it.
POST /v1/sync
Create declares a sync between two endpoints and returns it. It is an UPSERT: re-declaring the same source and target updates that link rather than piling up duplicates, so a console that re-submits is safe. The org comes from the validated principal, never from the request, so a sync can only ever bind endpoints inside the caller's own org. A git source must be an https clone URL on the provider's own host with no embedded credentials; a target left empty is derived as a native repository named after the source. With run=true the first reconcile is queued in the background, so a large initial import never blocks this response.
Request body — application/json (required)
| Field | Type | Required | Description |
|---|---|---|---|
actor | string | — | Actor is the identity the sync writes as, used as the loop guard so its own writes do not re-trigger it. |
direction | string | — | Direction is both (the default), pull, push or off. |
kind | string | — | Kind is what is being synced. |
run | boolean | — | Run reconciles once immediately after the upsert, in the background. |
source | cloud_endpointReq | — | Source is the upstream end. |
target | cloud_endpointReq | — | Target is the downstream end. Optional for git: a native repository named after the source is derived when it is omitted |
trigger | string | — | Trigger is what starts a reconcile: webhook (the default), poll or manual. |
How is this guide?