Analyze a source connection - Spacefast Docs

Analyze a source connection

Reads the repository at a ref and returns the build settings to run with, the files that drove detection, other directories that could be the project root, and configuration for other hosts that a Spacefast build cannot honor. Requires the connection’s sync to have reached ready.

POST /v1/spaces/{spaceId}/source/connection/analyze

Authorization

Authorization Bearer token · header required

`Authorization: Bearer ` with an API key (`sfa_` prefix), an OAuth access token, a session token, or a Space machine credential (`sfm_` prefix).

or

Authorization OAuth2 access token · header required

OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.

Scopes: spaces:read

Path parameters

Query parameters

Request body

required application/json

Responses

200 Response for status 200

Build settings to run with: what the repository suggests, with settings already saved on the connection taking precedence.

Example cURL Request

curl -X POST "https://api.spacefast.com/v1/spaces/string/source/connection/analyze?connectionType=connected" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{\n  "ref": "string",\n  "rootDirectory": "string"\n}'

Example JavaScript Fetch

const response = await fetch("https://api.spacefast.com/v1/spaces/string/source/connection/analyze?connectionType=connected", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\n  \"ref\": \"string\",\n  \"rootDirectory\": \"string\"\n}"
});

Example Python Request

import requests

response = requests.post(
    "https://api.spacefast.com/v1/spaces/string/source/connection/analyze?connectionType=connected",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\n  \"ref\": \"string\",\n  \"rootDirectory\": \"string\"\n}",
)

Response Example

{
  "$schema": "http://example.com",
  "data": {
    "detected": {
      "rootDirectory": null,
      "installDirectory": null,
      "installCommand": null,
      "buildCommand": null,
      "outputDirectory": null,
      "ignoredBuildCommand": null,
      "frameworkPreset": null,
      "platformPreset": null,
      "allowUnsupportedPlatformFeatures": false,
      "timeoutSeconds": 900
    },
    "detectedFiles": [
      "string"
    ],
    "candidates": [],
    "platformConfigs": [
      {
        "platform": "vercel",
        "rootDirectory": "string",
        "installDirectory": "string",
        "installCommand": "string",
        "buildCommand": "string",
        "outputDirectory": "string",
        "unsupportedFeatures": [
          "string"
        ]
      }
    ],
    "unsupportedFeatures": [
      "string"
    ],
    "blocked": true,
    "message": "string"
  }
}

Error Response Example

{
  "$schema": "http://example.com",
  "type": "string",
  "title": "string",
  "status": -9007199254740991,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": [
    "string"
  ],
  "next": [
    "string"
  ],
  "requestId": "string"
}