Close a source workspace - Spacefast Docs
Close a source workspace
Remove managed workspace refs. Require explicit discard for pending changes. Keep saved project history unchanged.
POST /v1/spaces/{spaceId}/source/workspaces/{workspaceId}/close
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
spaceIdstring requiredworkspaceIdstring required
Request body
required application/json
expectedRevisioninteger required
Revision from the last workspace response. Read the workspace again after a revision conflict.
min 0 · max 9007199254740991
operationIdstring required
Unique ID for this operation. Reuse this ID and the same input after an uncertain response.
min length 1 · max length 128
discardPendingboolean
Set true only when the user requests discarding pending changes.
default: false
Responses
200 Response for status 200
$schemastring
Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.
dataobject requiredworkspaceobject requiredidstring requiredspaceIdstring requiredrepositoryIdstring requiredtargetBranchstring requirednamestring requiredrevisioninteger required
min 0 · max 9007199254740991
- state string required
Allowed: initializing active conflicted closed
- baseCommitSha string | any required
- indexCommitSha string | any required
- workingCommitSha string | any required
- headCommitSha string | any required
- originalUploadVersionId string | any required
- hasStagedChanges boolean required
- hasUnstagedChanges boolean required
- hasPendingChanges boolean required
- needsSync boolean required
- pendingOperationId string | any required
- autoDeploy boolean required
- createdAt string required
- updatedAt string required
- commit object
sourceCommitShastring required
matches ^[a-f0-9]{40}$
- parentSourceCommitSha string required
matches ^[a-f0-9]{40}$
- message string required
- autoDeploy boolean required
- conflicts object
phasestring required
Allowed: staged working undo
- labels object required
oursstring required -theirsstring required -filesobject[] required
Array of object
pathstring required -resultstring required -baseobject requiredsourceCommitShastring required
matches ^[a-f0-9]{40}$
- content string | any required
- exists boolean required
- binary boolean required
- truncated boolean required
- ours object required
sourceCommitShastring required
matches ^[a-f0-9]{40}$
- content string | any required
- exists boolean required
- binary boolean required
- truncated boolean required
- theirs object required
sourceCommitShastring required
matches ^[a-f0-9]{40}$
- content string | any required
- exists boolean required
- binary boolean required
- truncated boolean required
Error Response
Default Problem details (RFC 9457). Any 4xx/5xx response is one application/problem+json document.
$schemastring
Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.
typestring required
URL of the documentation page for this error. Derived from code.
titlestring required
Human-readable name of the error type. Derived from code.
statusinteger required
HTTP status of the response, repeated in the body.
min -9007199254740991 · max 9007199254740991
detailstring required
What went wrong in this request.
codestring required
Stable snake_case error code. Match on this, not on detail.
pointerstring
RFC 6901 JSON Pointer to the request field or batch entry that failed, for example /files/37/path. Present on validation failures.
detailsobject
Machine-readable context keyed by the error code.
suggestionsstring[]
Recovery steps safe to show to a person.
nextstring[]
Commands or API requests to run next, usable as written.
requestIdstring required
ID of this request, from the X-Request-Id header or generated. Quote it when contacting support.