---
title: "Create Sync Chat Turn"
method: POST
path: "/agent-loop/sync-chat/turns"
tags: ["sync-chat"]
---

# Create Sync Chat Turn

`POST /agent-loop/sync-chat/turns`

Open or extend the caller's sync-chat thread.

Renderer-facing (Stytch session gates the call; the thread is the
caller's own). Writes a pending sync_chat_turns row, mints a handoff JWT
carrying caps=['sync-chat-turn'] bound to this turn, stores it in Redis,
and returns the handoff code the renderer forwards to agent-service.
No workspace or snapshot coupling.

## Request body

- CreateSyncChatTurnRequest — Renderer body for opening/extending the caller's sync-chat thread. parent_turn_id is null for the first message, the prior turn's id thereafter. id lets the client supply the turn id (optimistic UI).
  - `parent_turn_id` string, nullable
  - `user_message` string, nullable
  - `id` string, nullable
  - `connected_sources` ConnectedSourceSelection[], nullable
    - `adapter` 'github' | 'slack' | 'uploaded_file', required — Type of source adapter (github, uploaded_file, etc.)
    - `selection` union, required
      - GitHubSourceSelection — User's selection when connecting a GitHub source
        - `repo` string, required
        - `branch` string, required
      - SlackSourceSelection — User's selection when connecting a Slack source
        - `slack_team_id` string, required
        - `channel_id` string, required
      - UploadedFileSourceSelection — User's selection when connecting an uploaded file source
        - `file_id` string, required
        - `visibility` 'private' | 'public' — Visibility level of a source

## Response `200`

Successful Response

- CreateSyncChatTurnResponse
  - `turn_id` string, required
  - `handoff_code` string, required — Single-use code redeemable at /agent-loop/internal/agent-token/redeem for the sync-chat agent-svc JWT (caps=['sync-chat-turn']) bound to this turn. 60s TTL.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/tryscott/apis/one-shot-api.md) · [All operations](https://skmtc.net/tryscott/apis/one-shot-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tryscott/one-shot-api/versions/28bdface01df/schema)
