Skip to content
Esc
↑↓navigate↵open⌘Jpreview

Sync the space's source

Refreshes the source repository before a build.

POST/v1/spaces/{spaceId}/source/sync
Authorization
AuthorizationBearer token · headerrequired

Better Auth session, OAuth access token, OAuth client-credentials token, or sfm_ Space machine credential.

or
AuthorizationOAuth2 access token · headerrequired

OAuth 2.0 with explicit Spacefast capability scopes. Use the authorization-code flow for people and client credentials for machines.

Scopes:publish:write
Path parameters
spaceIdstringrequired
Request body
requiredapplication/json
refstring
min length 1
ttlSecondsinteger
max 86400
readOnlyRefsstring[]
max items 25
Responses
200

Response for status 200

$schemastring<uri>

Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.

dataobjectrequired
Show properties
repositoryConnectionobjectrequired
Show properties
idstringrequired

Repository connection id (rpc_).

spaceIdstringrequired
providerstringrequired

Git host family for the repository connection.

Allowed:githubgitlabbitbucketgeneric
connectionTypestringrequired
Allowed:connectedhosted
repositoryIdstring | nullrequired
installationIdstring | nullrequired

Repository app installation id, when configured.

default: null
cloneUrlConfiguredbooleanrequired

Whether a repository clone URL is configured.

default: false
upstreamUrlConfiguredbooleanrequired

Whether an upstream repository URL is configured.

default: false
forkStateobject | null

Initial main-branch remix progress, backed by its durable operation.

Show properties
Any of:
object
copiedbooleanrequired
statusstringrequired
Allowed:queuedrunningsucceededfailedcanceled
null
null
repositoryNamestringrequired
repositoryFullNamestringrequired
defaultBranchstringrequired
productionBranchstringrequired
credentialConfiguredbooleanrequired
autoDeployProductionbooleanrequired
autoDeployPreviewsbooleanrequired
githubPreviewCommentsEnabledboolean | null

Controls GitHub preview comments for this Space. Set null to use the team setting.

buildForkPullRequestsboolean

Whether pull requests opened from forks run isolated output checks without Space variables or data sources. A maintainer must review and push the branch to the connected repository before publishing its preview.

buildSettingsobjectrequired

Resolved build settings. Builds persist this as an immutable settingsSnapshot.

Show properties
rootDirectorystring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
installDirectorystring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
installCommandstring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
buildCommandstring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
outputDirectorystring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
ignoredBuildCommandstring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
frameworkPresetstring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
platformPresetstring | nullrequired
default: null
Show properties
Any of:
string
string
null
null
allowUnsupportedPlatformFeaturesbooleanrequired
default: false
timeoutSecondsintegerrequired
min 60 · max 7200 · default: 900
syncStatusstringrequired
Allowed:idlesyncingreadyfailed
providerAccessStatusstringrequired
default: "active"
Allowed:activesuspendedrevokedreauthorization_required
providerAccessErrorstring | nullrequired
default: null
lastSyncedAtstring<date-time> | nullrequired
Show properties
Any of:
string<date-time>
string<date-time>
null
null
lastSyncErrorstring | nullrequired
syncRunIdstring | nullrequired
connectedUserIdstring | nullrequired
createdAtstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
updatedAtstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
statusstringrequired
Allowed:idlesyncingreadyfailed
refstring | nullrequired
default

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

$schemastring<uri>

Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.

typestringrequired

Problem type URI resolving to the error docs page. The server derives it mechanically from code against the docs origin.

titlestringrequired

Short human-readable summary of the problem type. The server derives it mechanically from code.

statusintegerrequired

HTTP status code of this response, repeated in the body.

min -9007199254740991 · max 9007199254740991
detailstringrequired

Human-readable failure explanation for this occurrence.

codestringrequired

Stable snake_case error code naming the failed public contract.

pointerstring

RFC 6901 JSON Pointer into the failing request field, for example "/files/37/path", on validation failures.

detailsobject

Machine-readable context for the error code.

fixstring

One sentence on what to do about this error code, the same text as the type page. Read it before retrying.

suggestionsstring[]

Actionable recovery steps safe to show in dashboards, SDKs, and CLI output.

nextstring[]

Copy-pasteable commands or API requests an agent can run next.

requestIdstringrequired

The request id to quote when contacting support.

Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'https://api.spacefast.com/v1/spaces/string/source/sync' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "ref": "string",
  "ttlSeconds": 1,
  "readOnlyRefs": [
    "string"
  ]
}'
Response
{
  "$schema": "http://example.com",
  "data": {
    "repositoryConnection": {
      "id": "string",
      "spaceId": "string",
      "provider": "github",
      "connectionType": "connected",
      "repositoryId": "string",
      "installationId": null,
      "cloneUrlConfigured": false,
      "upstreamUrlConfigured": false,
      "forkState": {
        "copied": true,
        "status": "queued"
      },
      "repositoryName": "string",
      "repositoryFullName": "string",
      "defaultBranch": "string",
      "productionBranch": "string",
      "credentialConfigured": true,
      "autoDeployProduction": true,
      "autoDeployPreviews": true,
      "githubPreviewCommentsEnabled": true,
      "buildForkPullRequests": true,
      "buildSettings": {
        "rootDirectory": null,
        "installDirectory": null,
        "installCommand": null,
        "buildCommand": null,
        "outputDirectory": null,
        "ignoredBuildCommand": null,
        "frameworkPreset": null,
        "platformPreset": null,
        "allowUnsupportedPlatformFeatures": false,
        "timeoutSeconds": 900
      },
      "syncStatus": "idle",
      "providerAccessStatus": "active",
      "providerAccessError": null,
      "lastSyncedAt": "2019-08-24T14:15:22Z",
      "lastSyncError": "string",
      "syncRunId": "string",
      "connectedUserId": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z"
    },
    "status": "idle",
    "ref": "string"
  }
}

Was this page helpful?