Skip to main content
    Ivy Biosciences Docs/Call the platform/API/Reference/Reference/Sync/POST /harness/sessions/{sessionId}/sync

    POST /harness/sessions/{sessionId}/sync

    Sync session state

    Auth: required. Send an ivy_ API key (Authorization: Bearer ivy_… or X-Ivy-Api-Key), a Clerk session JWT (Authorization: Bearer …) or the Clerk __session cookie (browser sessions). See Authentication.

    Push local changes to the server using version vectors for conflict detection.

    Conflict resolution modes:

    • merge (default) — LWW; returns conflicts array when true concurrent edits detected
    • force_local — client state wins unconditionally
    • force_remote — server state wins; response includes full state

    Request

    Path parameters

    sessionIdstring (uuid)

    Session UUID (UUIDv7 — time-ordered)

    Request body

    clientIdstring

    Identifier of the client submitting changes

    localVersioninteger

    Client's last-known session version number

    localVectorobject

    Map of clientId → logical clock counter. Used for conflict detection in multi-client sync.

    localChangesobject[]

    Changes to apply — empty array performs a read-only pull

    modeenum ("merge" | "force_local" | "force_remote")

    Responses

    200 OK

    Sync applied or conflict returned

    Response shape:

    statusenum ("success" | "conflict" | "error")
    newVersioninteger

    Server version after applying changes

    newVectorobject

    Map of clientId → logical clock counter. Used for conflict detection in multi-client sync.

    remoteChangesobject[]

    Changes from the server not yet seen by this client

    fullStateobject

    Full session state snapshot persisted in Supabase

    conflictsobject[]

    Non-empty when status is conflict — client must resolve before retrying

    400 Bad Request

    Invalid request

    Response shape: object

    401 Unauthorized

    Authentication required

    Response shape: object

    404 Not Found

    Resource not found

    Response shape: object

    curl -X POST 'https://ivybiosciences.com/api/harness/sessions/{sessionId}/sync' \
      -H "Authorization: Bearer $IVY_API_KEY" \
      -H 'Content-Type: application/json' \
      -d '{
      "clientId": "",
      "localVersion": 0,
      "localVector": {}
    }'

    Was this page helpful?

    Loading...