Save staged source as one commit - Spacefast Docs

Save staged source as one commit

Commit only the staged tree. Keep other pending changes. Reject a moved project branch. Configured automatic deployment may start a build.

POST /v1/spaces/{spaceId}/source/workspaces/{workspaceId}/commit

Authorization

Authorization Bearer token · header required

Authorization: Bearer <token> 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:write spaces:read

Path parameters

Request body

required application/json

Responses

200 Response for status 200

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

Try it

Server

Base URL https://api.spacefast.com

Custom base URL Overrides the selected server when set.

Authorization

Bearer token Remember on this device

Include my values in samples

Parameters

Body application/json

Request body

Send Request

cURL

curl -X POST "https://api.spacefast.com/v1/spaces/string/source/workspaces/string/commit" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \ 
  -d '{\
  "expectedRevision": 9007199254740991,\
  "operationId": "string",\
  "message": "string",\
  "author": {\
    "name": "string",\
    "email": "user@example.com"\
  }\
}'

JavaScript

const response = await fetch("https://api.spacefast.com/v1/spaces/string/source/workspaces/string/commit", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\
  \"expectedRevision\": 9007199254740991,\
  \"operationId\": \"string\",\
  \"message\": \"string\",\
  \"author\": {\
    \"name\": \"string\",\
    \"email\": \"user@example.com\"\
  }\
}"
});

Python

import requests

response = requests.post(
    "https://api.spacefast.com/v1/spaces/string/source/workspaces/string/commit",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\
  \"expectedRevision\": 9007199254740991,\
  \"operationId\": \"string\",\
  \"message\": \"string\",\
  \"author\": {\
    \"name\": \"string\",\
    \"email\": \"user@example.com\"\
  }\
}",
)

Response 200 default

{
  "$schema": "http://example.com",
  "data": {
    "workspace": {
      "id": "string",
      "spaceId": "string",
      "repositoryId": "string",
      "targetBranch": "string",
      "name": "string",
      "revision": 9007199254740991,
      "state": "initializing",
      "baseCommitSha": "string",
      "indexCommitSha": "string",
      "workingCommitSha": "string",
      "headCommitSha": "string",
      "originalUploadVersionId": "string",
      "hasStagedChanges": true,
      "hasUnstagedChanges": true,
      "hasPendingChanges": true,
      "needsSync": true,
      "pendingOperationId": "string",
      "autoDeploy": true,
      "createdAt": "string",
      "updatedAt": "string"
    },
    "commit": {
      "sourceCommitSha": "string",
      "parentSourceCommitSha": "string",
      "message": "string",
      "autoDeploy": true
    },
    "conflicts": {
      "phase": "staged",
      "labels": {
        "ours": "string",
        "theirs": "string"
      },
      "files": [
        {
          "path": "string",
          "result": "string",
          "base": {
            "sourceCommitSha": "string",
            "content": "string",
            "exists": true,
            "binary": true,
            "truncated": true
          },
          "ours": {
            "sourceCommitSha": "string",
            "content": "string",
            "exists": true,
            "binary": true,
            "truncated": true
          },
          "theirs": {
            "sourceCommitSha": "string",
            "content": "string",
            "exists": true,
            "binary": true,
            "truncated": true
          }
        }
      ]
    }
  }
}

Error Response

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