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

API

Add Repositories to an Origin App Installation via the API

Extend a selected-mode installation's repository grant with POST https://api.cursor.com/v1/origin/namespaces/{namespaceSlug}/installations/{installationId}/repos. Official reference: Origin API → Add App Installation Repositories (OpenAPI OriginService_AddAppInstallationRepositories). Changelog: September 16, 2026.

Origin is in Early Beta and subject to change. Authenticate with a Cursor user credential that holds namespace:installations:write on the target namespace. App JWTs, installation tokens (oit_…), and service accounts cannot change an installation's repositories. Availability: Early Beta per the API overview.

The write is additive: listed repository ids are unioned with the current selection. A request whose repositories are all already granted succeeds without changing anything. Scopes never change on this call. A first install still needs a namespace admin's consent in the browser — this endpoint cannot perform a first install.

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

Path parameters

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

Request body

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

Response

200 returns the updated AppInstallation (id, appId, target, repoSelectionMode, scopes, timestamps).

Failures that grant nothing

Condition Result
A listed repository is outside the namespace FailedPrecondition (HTTP 400)
Installation already covers every repo (repoSelectionMode is all) FailedPrecondition (HTTP 400)
Installation is suspended FailedPrecondition (HTTP 400)
Installation predates per-installation scopes FailedPrecondition (HTTP 400)
Installation missing or wrong namespace 404 (message may name the consent page when the app was never installed)

Related

Pitfalls

  • Partner/app tokens cannot call this — use a user credential with namespace:installations:write.
  • This never widens scopes. Ask for scopes at install or re-consent time.