---
title: "POST /api/v1/two-way-sync/{spaceId}/bind"
method: POST
path: "/api/v1/two-way-sync/{spaceId}/bind"
---

# POST /api/v1/two-way-sync/{spaceId}/bind

`POST /api/v1/two-way-sync/{spaceId}/bind`

## Request

- Base URL: `https://falconer.com` (the document declares no server; this is the origin it was published from)
- URL: `https://falconer.com/api/v1/two-way-sync/{spaceId}/bind`
- Auth: none declared

## Path parameters

- `spaceId` integer, required: Space id, from GET /spaces.

## Headers

- `x-organization-id` string: Required when using OAuth bearer tokens.

## Request body

- BindRepositoryRequest
  - `repository` string, required: owner/repo, from GET /github/repositories.
  - `branch` string, required
  - `basePath` string: Repository folder to sync; the repository root when omitted.
  - `mergeStrategy` 'direct_commit' | 'review_request' | 'pull_request', required
  - `direction` 'import' | 'export': import (default) pulls the repository in. export binds without importing; run POST /two-way-sync/{spaceId}/export next. Export needs direct_commit.
  - `setUpDocsite` boolean: Also reserve a docs site seeded from the repository docs config.

## Response `202`

Bound; the first import is running.

- TwoWaySyncRunStarted
  - `spaceId` integer, required
  - `folderId` integer, required: The Space root folder's ID, for /nav and /folders.
  - `repository` string, required
  - `taskId` string, nullable, required: Poll GET /two-way-sync/{spaceId}/runs/{taskId}. null when no run started: an export bind, or a retry folded into a run already queued.

## Other responses

- `400`: Bad request, or a folder that is not the sync root
- `403`: Two-way sync is not enabled or permission is missing
- `404`: Folder or repository not found
- `409`: The folder or the repository path is already synced
- `412`: The merge strategy cannot be used for this bind
- `422`: The Space overlaps a synced folder or holds other metadata

---

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