
Sync an Origin Repo Mirror via the API
Synchronize one ref of a mirrored repository from its upstream source with POST https://api.cursor.com/v1/origin/repos/{ownerSlug}/{repoName}:syncMirror. Official reference: Origin API → Sync Mirror.
Origin is in Early Beta and subject to change. Authenticate with an installation access token or a Cursor user access token that carries repository:contents:read (docs list Sync a mirrored repository under that scope). Availability: Early Beta per the API overview.
Returns HTTP 200 when the sync target is satisfied (synced: true), or HTTP 202 when the sync is still pending (synced: false). wait=false (default) schedules the sync and usually returns 202; it returns 200 immediately when sha is already reachable from ref. wait=true blocks until satisfied or the wait budget (~2 minutes) expires; expiry still returns 202 and the sync continues in the background. Repositories that do not pull from an upstream source are rejected.
You can also address by stable repository ID: send _ as the owner slug and the repository ID as the name (POST /v1/origin/repos/_/REPO_ID:syncMirror).
Mirror-state changes (Transition, Force Cutover, Detach) live on the Origin Migration API. Sync Mirror stays on the Origin API page.
Path parameters
| Param | Required | Meaning |
|---|---|---|
ownerSlug |
yes | Owning entity slug, or _ when using the repository ID form |
repoName |
yes | Repo name unique to the owner, or the repository ID when ownerSlug is _ |
Request body
| Field | Required | Meaning |
|---|---|---|
ref |
yes | Full git ref name. Must start with refs/ (for example refs/heads/main or refs/tags/v1). Short names such as main are rejected with INVALID_ARGUMENT. |
wait |
no | When true, block until synced or the wait budget expires. Defaults to false. |
sha |
no | Optional full commit object ID (40- or 64-character hex). Omit to wait on the tip of ref. When set and reachable from ref, the call returns early. Other values are rejected with INVALID_ARGUMENT. |
curl --request POST \
--url 'https://api.cursor.com/v1/origin/repos/OWNER_SLUG/REPO_NAME:syncMirror' \
--header 'Authorization: Bearer YOUR_ORIGIN_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"ref": "refs/heads/main",
"wait": true
}'
Response
| Field | Meaning |
|---|---|
synced |
true when the sync target is satisfied (HTTP 200); false while still pending (HTTP 202). Always present. |
{
"synced": true
}
For interactive or scripted user calls, prefer origin api after origin auth login (or CURSOR_API_KEY) so the CLI exchanges a personal user API key for a short-lived user access token. App integrations should mint installation tokens just in time. Do not put a Cursor API key directly in the Origin Authorization header.
Base URL: https://api.cursor.com/v1/origin.