Cursor Origin
The Origin Migration API: Transition and Detach a Mirrored Repo
The Origin Migration API lets operators move repositories between GitHub and Origin mirrors from a script they run as a Cursor user. Origin Apps can't call it. Its four endpoints retry a failed initial mirror, follow the resulting transition job, and permanently detach a mirror so the repository becomes native. The API is in Early Beta and may change.

On this page
Who is the Origin Migration API for?
Cursor describes it as an API for operators migrating repositories between GitHub and Origin mirrors. You call its endpoints from a migration script that you run as a Cursor user. Sign in with origin auth login, or pass a Cursor API key through origin api. The endpoints use the Origin API base URL, https://api.cursor.com/v1/origin, and the same error model. Because Origin is in Early Beta and subject to change, the docs tell you to review the OpenAPI specification whenever you update an integration.
Scopes are the guardrail. repository:mirror:write, repository:mirror:delete and repository:mirror:read are user policy scopes, and the caller must also administer the repository on its upstream GitHub source. An Origin App can't request repository:mirror:write or repository:mirror:delete during installation, and it can't call these endpoints at all. An app can request repository:mirror:read, but only to read the mirror field on Get Repo.
This is covered hands-on in Cursor Compile 2026 — 1 short Unit, free to read.
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.
What do the four endpoints do?
Two endpoints change a repository, and two report on a transition. Each requires one of the three mirror scopes.
- Endpoint
- Transition Repo Mirror
- Method and path
POST /v1/origin/repos/{ownerSlug}/{repoName}/mirror:transition- Scope
repository:mirror:write
- Endpoint
- Detach Repo Mirror
- Method and path
DELETE /v1/origin/repos/{ownerSlug}/{repoName}/mirror- Scope
repository:mirror:delete
- Endpoint
- Get Mirror Transition Job
- Method and path
GET /v1/origin/repos/{ownerSlug}/{repoName}/mirror/transition-jobs/{jobId}- Scope
repository:mirror:read
- Endpoint
- Get Active Mirror Transition Job
- Method and path
GET /v1/origin/repos/{ownerSlug}/{repoName}/mirror/transition-jobs:active- Scope
repository:mirror:read
| Endpoint | Method and path | Scope |
|---|---|---|
| Transition Repo Mirror | POST /v1/origin/repos/{ownerSlug}/{repoName}/mirror:transition | repository:mirror:write |
| Detach Repo Mirror | DELETE /v1/origin/repos/{ownerSlug}/{repoName}/mirror | repository:mirror:delete |
| Get Mirror Transition Job | GET /v1/origin/repos/{ownerSlug}/{repoName}/mirror/transition-jobs/{jobId} | repository:mirror:read |
| Get Active Mirror Transition Job | GET /v1/origin/repos/{ownerSlug}/{repoName}/mirror/transition-jobs:active | repository:mirror:read |
Endpoints from Cursor's Origin Migration API documentation, checked October 28, 2026.
Transition Repo Mirror starts a mirror-state change on a mirrored repository and returns the job that tracks it. The only transition the docs allow today is initial_to_inbound, which retries a mirror whose initial sync failed and brings it to inbound. While the job runs, the repository's mirror status reads as transitioning.
A caller who doesn't administer the repository on the mirror's upstream source gets 403. A repository that isn't in the transition's expected start state, or that already has an active transition job, returns FailedPrecondition with HTTP 400.
How do you follow a mirror transition job?
A transition runs as a job, so your script has to poll. The docs give two read endpoints for that, and they say which field to trust.
Get Mirror Transition Job returns one job by ID, and an unknown ID returns 404. Its status is one of queued, running, succeeded, failed_rolled_back, requires_attention or superseded. Three of those are terminal: succeeded, failed_rolled_back and superseded. requires_attention needs operator intervention, so a script should stop and report it instead of polling on.
The phase field gives progress detail, with values such as draining-writes, initializing-mirror-fetch, verifying-integrity and rolling-back. The docs warn that new phases can appear as the transition process evolves, so poll status for completion and don't match on phases. A failed job carries a stable lastErrorCode, such as InboundMirrorDrainTimeout or MirrorIntegrityMismatch, with a readable lastErrorMessage. During the write-drain window, the job also reports drainUntil.
Get Active Mirror Transition Job is the simpler one to poll. It returns the repository's active job and its most recent terminal job. Both fields are optional, so a repository that has never transitioned returns an empty object. Once activeJob disappears, lastJob tells you how the transition ended. From a terminal, origin repo mirror status shows the mirror status and any transition job, and its --watch flag polls until the job succeeds, fails and rolls back, or is superseded.
What happens when you detach a mirror?
Detaching permanently disconnects a mirrored repository from its upstream source and makes it a native Origin repository. Cursor says it is not reversible through this API, so read its behavior before you put it in a script.
- The repository keeps its current contents and becomes a native repository, and syncing stops in both directions. Origin keeps the mirror's deploy key but doesn't use it while the repository is detached.
- For an
inboundrepository, Origin stops the mirror and waits up to 2 minutes for its last fetch from GitHub, so a fetch already underway can't overwrite pushes made after the detach. - If that fetch fails, or Origin can't resolve the repository's GitHub remote, the request returns
FailedPreconditionwith HTTP 400. Other failures return errors such asUnavailable(503) orDeadlineExceeded(408). In each case the repository stays mirrored, so you fix the cause and retry. - When the GitHub App installation is gone or suspended, or the GitHub repository no longer exists, Origin detaches without a last fetch.
- A repository that never had a mirror returns
FailedPrecondition, while detaching an already-detached repository succeeds without effect. A detach that races another change to the mirror state also returnsFailedPrecondition.
Success is a 204 No Content with an empty body. Detaching needs repository:mirror:delete, the scope the docs call Admin, and apps can never hold it.
The Origin CLI has a matching command, origin repo mirror detach, which permanently disconnects a repository from GitHub and asks for confirmation unless you pass -y. To verify a migration, origin repo verify-migration compares a GitHub repository's settings with its Origin counterpart, for one repository or every repository in a namespace.
When should you use the API instead of the Origin UI to detach a mirror?
For one repository at a time, the web UI does the same job. In the UI, you mirror with Sync from GitHub on the codebase home. You detach from Settings, then General, with Detach from GitHub under Danger Zone.
The mirror docs describe the result the same way the API docs do. Syncing stops, the Origin copy becomes a standalone Origin-hosted repository, and Origin becomes the source of truth. Pushes to the Origin remote no longer flow to GitHub, and your GitHub repository is not affected.
Use the API when a script has to work through many repositories. It adds job reporting that the UI docs don't describe: transition jobs with statuses, phases and error codes. It also has stricter access rules, since it needs a user token with the mirror scopes plus admin rights on the upstream source. The prerequisites for mirroring still apply, including the Cursor GitHub app on the owning org or account and GitHub admin access on the repository.
Before you detach anything, know what a mirror carries. The mirror docs list Git history, branches and tags, browsable and searchable code, GitHub pull requests you can review in Cursor, and ongoing updates. GitHub Issues and GitHub Actions workflows and secrets don't sync. Origin also skips GitHub branches named origin or origin/..., so they can't overwrite an Origin-only workspace. Issues and CI configuration stay on GitHub, so a detach that ends a migration leaves them behind there.
Frequently asked questions
Can an Origin App call the Migration API?
No. An Origin App can't request the write or delete mirror scopes during installation, and it can't call these endpoints. It can request repository:mirror:read, but only to read the mirror field on Get Repo.
What does the initial_to_inbound transition do?
It retries a mirror whose initial sync failed and brings it to inbound. It is the only transition value the docs list today.
How do I know a mirror transition finished?
Poll the job's status field, not its phase. Succeeded, failed_rolled_back and superseded are terminal, and requires_attention needs an operator. You can also poll the active-job endpoint and read lastJob once activeJob disappears.
Can I reattach a repository after detaching it?
Not through this API. Cursor says detaching is not reversible through it, and syncing stops in both directions once the repository becomes native.
Sources & last verified
- Cursor docs: Origin Migration API
- Cursor docs: Origin API
- Cursor docs: Mirror a GitHub repository
- Cursor docs: Origin CLI commands
Cursor ships frequently. Facts verified against primary sources on October 28, 2026.