---
title: "Update a source connection"
method: PATCH
path: "/v1/spaces/{spaceId}/source/connection"
tags: ["Git"]
---

# Update a source connection

`PATCH /v1/spaces/{spaceId}/source/connection`

## Request

- Base URL: `https://api.spacefast.com`
- URL: `https://api.spacefast.com/v1/spaces/{spaceId}/source/connection`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.spacefast.com/v1/auth/oauth2/authorize`, token URL `https://api.spacefast.com/v1/auth/oauth2/token`; client credentials, token URL `https://api.spacefast.com/v1/auth/oauth2/token`, scopes: `spaces:write`)

Updates build defaults, branch behavior, and repository URLs. Close open source workspaces before you change repository URLs.

## Path parameters

- `spaceId` string, required

## Request body

- object
  - `connectionType` 'connected' | 'hosted'
  - `productionBranch` string
  - `credential` string, nullable
  - `autoDeployProduction` boolean
  - `autoDeployPreviews` boolean
  - `githubPreviewCommentsEnabled` boolean, nullable: Controls GitHub preview comments for this Space. Set null to use the team setting.
  - `buildSettings` object: Sparse per-request build setting overrides applied over saved settings.
    - `rootDirectory` string, nullable
    - `installDirectory` string, nullable
    - `installCommand` string, nullable
    - `buildCommand` string, nullable
    - `outputDirectory` string, nullable
    - `ignoredBuildCommand` string, nullable
    - `frameworkPreset` string, nullable
    - `platformPreset` string, nullable
    - `allowUnsupportedPlatformFeatures` boolean
    - `timeoutSeconds` integer

## Response `200`

Response for status 200

- object
  - `$schema` string, uri: Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
  - `data` object, required
    - `id` string, required: Repository connection id (`rpc_`).
    - `spaceId` string, required
    - `provider` 'github' | 'gitlab' | 'bitbucket' | 'generic', required: Git host family for the repository connection.
    - `connectionType` 'connected' | 'hosted', required
    - `repositoryId` string, nullable, required
    - `installationId` string, nullable, required: Repository app installation id, when configured.
    - `cloneUrlConfigured` boolean, required: Whether a repository clone URL is configured.
    - `upstreamUrlConfigured` boolean, required: Whether an upstream repository URL is configured.
    - `forkState` object, nullable: Initial main-branch remix progress, backed by its durable operation.
      - `copied` boolean, required
      - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled', required
    - `repositoryName` string, required
    - `repositoryFullName` string, required
    - `defaultBranch` string, required
    - `productionBranch` string, required
    - `credentialConfigured` boolean, required
    - `autoDeployProduction` boolean, required
    - `autoDeployPreviews` boolean, required
    - `githubPreviewCommentsEnabled` boolean, nullable: Controls GitHub preview comments for this Space. Set null to use the team setting.
    - `buildSettings` object, required: Resolved build settings. Builds persist this as an immutable `settingsSnapshot`.
      - `rootDirectory` string, nullable, required
      - `installDirectory` string, nullable, required
      - `installCommand` string, nullable, required
      - `buildCommand` string, nullable, required
      - `outputDirectory` string, nullable, required
      - `ignoredBuildCommand` string, nullable, required
      - `frameworkPreset` string, nullable, required
      - `platformPreset` string, nullable, required
      - `allowUnsupportedPlatformFeatures` boolean, required
      - `timeoutSeconds` integer, required
    - `syncStatus` 'idle' | 'syncing' | 'ready' | 'failed', required
    - `providerAccessStatus` 'active' | 'suspended' | 'revoked' | 'reauthorization_required', required
    - `providerAccessError` string, nullable, required
    - `lastSyncedAt` string, date-time, nullable, required
    - `lastSyncError` string, nullable, required
    - `syncRunId` string, nullable, required
    - `connectedUserId` string, nullable, required
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required

## Other responses

- `default`: Problem details (RFC 9457). Any 4xx/5xx response is one `application/problem+json` document.

---

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