---
raw: true
search:
  tags:
    - Git
    - POST
seo:
  description: >-
    Refreshes the source repository before a build. Reference for the POST
    /v1/spaces/{spaceId}/source/sync endpoint in the Spacefast Partner API.
sidebar:
  label: Sync the space's source
  badge: POST
title: Sync the space's source
type: openapi-operation
---
Refreshes the source repository before a build.

`POST /v1/spaces/{spaceId}/source/sync`

**Request body** (`application/json`, required)

- `ref` (string)
- `ttlSeconds` (integer)
- `readOnlyRefs` (string[])

Request body example:

```json
{
  "ref": "string",
  "ttlSeconds": 1,
  "readOnlyRefs": [
    "string"
  ]
}
```

**Responses**

- `200` — Response for status 200
- `default` — Problem details (RFC 9457). Any 4xx/5xx response is one \`application/problem+json\` document.

Response example, 200:

```json
{
  "$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"
  }
}
```
