API / add-origin-installation-repos-via-api

API

Add Origin App Installation Repositories via the API

Add repositories to an installation's selection with POST https://api.cursor.com/v1/origin/namespaces/{namespaceSlug}/installations/{installationId}/repos. Official reference: Origin API → Add App Installation Repositories.

Origin is in Early Beta and subject to change. Authenticate with a Cursor user access token that carries namespace:installations:write. App JWTs, installation tokens, and service accounts cannot change an installation's repositories. Availability: Early Beta per the API overview.

The write is additive: listed repositories are unioned with the current selection, a request whose repositories are all already granted succeeds without changing anything, and the installation's scopes never change. This endpoint cannot perform a first install.

Cost: 5 points against the user principal budget (ordinary write).

Path parameters

Param Required Meaning
namespaceSlug yes Namespace the installation belongs to
installationId yes Installation identifier

Request body

Field Required Meaning
repoIds yes Repository IDs to add. At least one required; values are deduplicated. Already-granted repos are accepted without change. Every listed repository must belong to the namespace, or the request fails and nothing is granted.
curl --request POST \
  --url 'https://api.cursor.com/v1/origin/namespaces/NAMESPACE_SLUG/installations/INSTALLATION_ID/repos' \
  --header 'Authorization: Bearer YOUR_USER_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "repoIds": [
    "repo_01k2ja2000e0080000000000q4",
    "repo_01k2ja2000e0080000000000q5"
  ]
}'

Response

The body returns the updated installation: id, appId, target (slug, id, optional type), createdAt, updatedAt, repoSelectionMode (all or selected), scopes, optional installedBy, and optional suspendedAt.

Condition Result
Any listed repo outside the namespace FailedPrecondition (HTTP 400); grants nothing
repoSelectionMode is already all FailedPrecondition (HTTP 400)
Installation suspended FailedPrecondition (HTTP 400)
Installation predates per-installation scopes FailedPrecondition (HTTP 400)
Installation missing or in another namespace 404 (message may name the consent page)

Discover repository IDs with List App Installation Repositories or Get Repo before you call. 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. Do not put a Cursor API key directly in the Origin Authorization header.

Base URL: https://api.cursor.com/v1/origin.