---
title: Sync Chat Template
description: "Republishes the template published from this chat at the commit of the chat's READY production deployment, like Sync from Repo in the template settings. Only templates connected to a GitHub repository can be synced, by the template's author or an owner of the team the template is shared with. Call it after a production deployment is ready, for example from a GitHub Actions workflow."
docs_index: /docs/llms.txt
lastUpdated: 2026-11-27
badge: "POST"
---

> For an index of all documentation, see [/docs/llms.txt](/docs/llms.txt).

Republishes the template published from this chat at the commit of the chat's READY production deployment, like Sync from Repo in the template settings. Only templates connected to a GitHub repository can be synced, by the template's author or an owner of the team the template is shared with. Call it after a production deployment is ready, for example from a GitHub Actions workflow.

#### `POST /v2/chats/{chatId}/template/sync`

## Usage

```typescript
import { v0 } from 'v0'

const result = await v0.chats.syncTemplate({
  chatId: 'chat_abc123',
  expectedGitSha: '3f2c1ab',
})

console.log(result)
```

```bash
curl -X POST "https://api.v0.dev/v2/chats/chat_abc123/template/sync"   -H "Authorization: Bearer $V0_API_KEY"   -H "Content-Type: application/json"   -d '{"expectedGitSha":"3f2c1ab"}'
```

## API Signature

### Request

#### Path Parameters

- `chatId: string` The unique identifier of the chat the template is published from.
  - **Minimum length:** 1

#### Request Body

- `expectedGitSha?: string` Commit you expect the production deployment to be on, such as the commit of the deployment that triggered your workflow. A full SHA or a prefix of at least 7 characters. If production is on a different commit, the request fails with 409 and nothing is published.

### Response

- `templateId: string` ID of the template published from this chat, as shown in its v0.app/templates URL.
- `gitSha: string` Commit the template is pinned to after the sync.
- `previousGitSha: string | null` Commit the template was pinned to before the sync, or null if none was recorded.
- `changed: boolean` Whether the sync published a new template version. False when the template was already pinned to the production commit.

---

For a semantic overview of all documentation, see [/docs/sitemap.md](/docs/sitemap.md)

For an index of all available documentation, see [/docs/llms.txt](/docs/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/docs/agents.md](/docs/agents.md)