Skip to content
Esc
↑↓navigate↵open⌘Jpreview

Start a new version upload

Creates a version and returns upload instructions. The declared file manifest drives change-only uploads: unchanged files are retained from the previous version and only the remainder is requested.

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

Space key (sfc_…) for an unclaimed anonymous Space. Also the fragment of its claim URL and the token of its /__/<key> door. A publish without a credential returns it in claim with the claim link. With the key, getSpace extends the Space's expiry window, getSpaceVersion follows its publish, createSpaceOpenLink returns its reusable open link, and restoreSpace undoes a deleteSpace while the claim window remains open.

or
AuthorizationBearer token · headerrequired

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

Path parameters
spaceIdstringrequired
Request body
requiredapplication/json
sourceobject

Publish provenance recorded on the version; defaults to {kind: "direct_upload"}.

Show properties
kindstringrequired

How this version was produced.

Allowed:direct_uploadclidashboardapigitimportagentbuildvariable_updateconfig_update
clientstring

Publishing client attribution, for example spacefast-cli/1.2.3.

max length 255
branchstring

Git branch the publish came from.

max length 255
commitstring

Git commit SHA the publish came from.

max length 64
messagestring

Plain-language description of the publish (the version changelog entry, commit message, or release note). This is THE spelling for the publish description; the version files-diff API is the fallback when none is given.

max length 2000
dirtyboolean

Whether the working tree had uncommitted changes at publish time.

metadataobject

Additional provenance (repository, CI run URL, workflow, actor, ...).

gitobject
Show properties
repositorystring | null
repositoryFullNamestring | null
repositoryUrlstring | null
refstring | null
branchstring | null
branchAliasUrlstring | null
commitstring | null
commitShastring | null
pullRequestNumbernumber | null
publishModestring

How to interpret omitted paths in files: additive retains existing paths unless explicitly replaced; snapshot treats files as the complete desired manifest.

default: "additive"
Allowed:additivesnapshot
sourceMetadataobject

Additional control-plane-only provenance for build and deploy read models.

buildLogstring

Build transcript truncated to a bounded size for deploys that ran a local build before publishing.

max length 524288
finalizeobject

Finalize intent for a declared upload. The version finalizes itself once Spacefast confirms every declared file landed: at create when nothing needs uploading, otherwise on the uploads/refresh call that finds nothing pending. Call refresh after the last upload. The explicit finalize call remains available for recovery and replay.

Show properties
channelstring | null
Show properties
Any of:
string
string
null
null
filesobject[]required

The complete desired file manifest. sha256 is optional: omit it to upload by path and let the runtime hash the bytes, or include it to upload by content address, with the digest verified as the bytes land. A sourceUrl entry is fetched and hashed by the runtime.

Show properties
Array of object
pathstringrequired

Version-relative POSIX file path, percent-decoded once, stripped of leading slashes, and normalized to UTF-8 NFC. No traversal, backslashes, or control characters; at most 1,024 canonical UTF-8 bytes.

sizeintegerrequired

File size in bytes.

min 0 · max 9007199254740991
sha256string

Optional SHA-256 content digest, 64 lowercase hex characters without the sha256: prefix. Omit it to let the runtime hash uploaded bytes; include it to upload by content address, with the digest verified as the bytes land.

matches ^[0-9a-f]{64}$
contentTypestring

Optional content type for serving metadata.

sourceUrlstring<uri>

Optional HTTPS URL the runtime can fetch directly for this file instead of receiving bytes from the client.

configOnlyboolean

Recompile the configuration on top of the current ready artifact without replacing content: the file catalog carries forward, Functions/Zero declarations and runtime detection are preserved, and the version records a config_update source. files may name only sf.jsonc (the shipped configuration); every other path keeps the current version's bytes. Requires an existing ready version to carry forward. Runtime changes still need a normal content publish.

deletePathsstring[]

Explicit paths to remove when publishMode is additive. Omitted paths are retained. Only listed paths are deleted.

default: []
immutableAssetPrefixesstring[]

Publisher-owned directory prefixes whose declared files are immutable generation assets. Snapshot publishes retain the matching files from the current generation for exactly one subsequent generation.

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
ignoredPathsstring[]

Deprecated; current servers return an empty array.

versionIdstring | nullrequired

Created version id, or null when the manifest matched and nothing changed.

uploadobject | nullrequired

Runtime upload session; present only while bytes still need uploading. Upload first, then finalize.

Show properties
Any of:
object
idstringrequired

Upload session id (upl_…) minted by the runtime.

min length 1
expiresAtstring<date-time>required

Instant when the session token expires. This rotates only the token, never the version lifecycle boundary. Resume always mints a fresh token.

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))$
summaryobjectrequired

Counts for the whole manifest, independent of target paging.

Show properties
uploadintegerrequired

Files that still need uploading.

min 0 · max 9007199254740991
reusedintegerrequired

Files satisfied by hash reuse.

min 0 · max 9007199254740991
ignoredinteger

Deprecated; current servers return zero.

min 0 · max 9007199254740991
targetsobject[]required

Opaque upload targets, bounded by the instruction payload budget. Upload these, then call links.refresh for the remainder.

default: []
Show properties
Array of object
pathstringrequired

Caller-local path/key identifying the bytes this target accepts.

methodstringrequired

HTTP method to use for this target.

Allowed:PUTPOST
urlstring<uri> | stringrequired

Absolute or API-relative upload URL issued by the control plane.

Show properties
Any of:
string<uri>
string<uri>
string
string
headersobjectrequired

Exact headers to send with the upload request.

default: {}
bodyobject

Optional body recipe. Omitted means the client uploads the local bytes for path; url means POST the URL for server-side fetch.

Show properties
One of:
object
kindstringrequired
urlstring<uri>required
sizeinteger

Expected byte size when known.

min 0 · max 9007199254740991
maxBytesinteger

Maximum accepted byte size when the server can advertise it.

max 9007199254740991
sha256string
matches ^[0-9a-f]{64}$
contentTypestring
bulkobject

Optional direct runtime transport for this page's content-addressed targets. Clients that do not support it continue with targets.

Show properties
kindstringrequired
methodstringrequired
urlstring<uri> | stringrequired

Upload-auth runtime URL that accepts a ZIP of SHA-named CAS blobs.

Show properties
Any of:
string<uri>
string<uri>
string
string
headersobjectrequired

Exact headers to send with the bulk upload request.

default: {}
maxCompressedBytesintegerrequired
max 9007199254740991
maxExpandedBytesintegerrequired
max 9007199254740991
maxBlobsintegerrequired
max 9007199254740991
linksobjectrequired
Show properties
refreshstringrequired
resumestring
finalizestringrequired
detailsobject
Show properties
reusedobject[]
Show properties
Array of object
pathstringrequired
reasonstringrequired
diagnosticsobject[]
Show properties
Array of object
codestringrequired

Stable snake_case diagnostic code naming the public contract that produced it.

severitystringrequired

How actionable the diagnostic is.

Allowed:infowarningerror
messagestringrequired

Human-readable explanation with enough detail to act on.

pathstring | null

Artifact path the diagnostic points at, for example "_headers:12", when one exists.

providerstring | null

Upstream system the diagnostic originated from, when not Spacefast itself.

Show properties
Any of:
string
string
null
null
detailsobject | null

Machine-readable context for the diagnostic code.

Show properties
Any of:
object
object
null
null
fixstring | null

Concrete, agent-actionable remediation hint, when one can be derived.

retryableboolean | null

Whether retrying the same operation can resolve this diagnostic without the caller changing anything.

null
null
201

Response for status 201

$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
ignoredPathsstring[]

Deprecated; current servers return an empty array.

versionIdstring | nullrequired

Created version id, or null when the manifest matched and nothing changed.

uploadobject | nullrequired

Runtime upload session; present only while bytes still need uploading. Upload first, then finalize.

Show properties
Any of:
object
idstringrequired

Upload session id (upl_…) minted by the runtime.

min length 1
expiresAtstring<date-time>required

Instant when the session token expires. This rotates only the token, never the version lifecycle boundary. Resume always mints a fresh token.

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))$
summaryobjectrequired

Counts for the whole manifest, independent of target paging.

Show properties
uploadintegerrequired

Files that still need uploading.

min 0 · max 9007199254740991
reusedintegerrequired

Files satisfied by hash reuse.

min 0 · max 9007199254740991
ignoredinteger

Deprecated; current servers return zero.

min 0 · max 9007199254740991
targetsobject[]required

Opaque upload targets, bounded by the instruction payload budget. Upload these, then call links.refresh for the remainder.

default: []
Show properties
Array of object
pathstringrequired

Caller-local path/key identifying the bytes this target accepts.

methodstringrequired

HTTP method to use for this target.

Allowed:PUTPOST
urlstring<uri> | stringrequired

Absolute or API-relative upload URL issued by the control plane.

Show properties
Any of:
string<uri>
string<uri>
string
string
headersobjectrequired

Exact headers to send with the upload request.

default: {}
bodyobject

Optional body recipe. Omitted means the client uploads the local bytes for path; url means POST the URL for server-side fetch.

Show properties
One of:
object
kindstringrequired
urlstring<uri>required
sizeinteger

Expected byte size when known.

min 0 · max 9007199254740991
maxBytesinteger

Maximum accepted byte size when the server can advertise it.

max 9007199254740991
sha256string
matches ^[0-9a-f]{64}$
contentTypestring
bulkobject

Optional direct runtime transport for this page's content-addressed targets. Clients that do not support it continue with targets.

Show properties
kindstringrequired
methodstringrequired
urlstring<uri> | stringrequired

Upload-auth runtime URL that accepts a ZIP of SHA-named CAS blobs.

Show properties
Any of:
string<uri>
string<uri>
string
string
headersobjectrequired

Exact headers to send with the bulk upload request.

default: {}
maxCompressedBytesintegerrequired
max 9007199254740991
maxExpandedBytesintegerrequired
max 9007199254740991
maxBlobsintegerrequired
max 9007199254740991
linksobjectrequired
Show properties
refreshstringrequired
resumestring
finalizestringrequired
detailsobject
Show properties
reusedobject[]
Show properties
Array of object
pathstringrequired
reasonstringrequired
diagnosticsobject[]
Show properties
Array of object
codestringrequired

Stable snake_case diagnostic code naming the public contract that produced it.

severitystringrequired

How actionable the diagnostic is.

Allowed:infowarningerror
messagestringrequired

Human-readable explanation with enough detail to act on.

pathstring | null

Artifact path the diagnostic points at, for example "_headers:12", when one exists.

providerstring | null

Upstream system the diagnostic originated from, when not Spacefast itself.

Show properties
Any of:
string
string
null
null
detailsobject | null

Machine-readable context for the diagnostic code.

Show properties
Any of:
object
object
null
null
fixstring | null

Concrete, agent-actionable remediation hint, when one can be derived.

retryableboolean | null

Whether retrying the same operation can resolve this diagnostic without the caller changing anything.

null
null
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/versions' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "source": {
    "kind": "direct_upload",
    "client": "string",
    "branch": "string",
    "commit": "string",
    "message": "string",
    "dirty": true,
    "metadata": {
      "property1": "string",
      "property2": "string"
    },
    "git": {
      "repository": "string",
      "repositoryFullName": "string",
      "repositoryUrl": "string",
      "ref": "string",
      "branch": "string",
      "branchAliasUrl": "string",
      "commit": "string",
      "commitSha": "string",
      "pullRequestNumber": 0,
      "property1": null,
      "property2": null
    }
  },
  "publishMode": "additive",
  "sourceMetadata": {
    "property1": null,
    "property2": null
  },
  "buildLog": "string",
  "finalize": {
    "channel": "live"
  },
  "files": [
    {
      "path": "string",
      "size": 0,
      "sha256": "string",
      "contentType": "string",
      "sourceUrl": "http://example.com"
    }
  ],
  "configOnly": true,
  "deletePaths": [],
  "immutableAssetPrefixes": [
    "string"
  ]
}'
Response
{
  "$schema": "http://example.com",
  "data": {
    "ignoredPaths": [
      "string"
    ],
    "versionId": "string",
    "upload": {
      "id": "string",
      "expiresAt": "2019-08-24T14:15:22Z",
      "summary": {
        "upload": 0,
        "reused": 0,
        "ignored": 0
      },
      "targets": [],
      "bulk": {
        "kind": "zip-cas-v1",
        "method": "PUT",
        "url": "http://example.com",
        "headers": {},
        "maxCompressedBytes": 1,
        "maxExpandedBytes": 1,
        "maxBlobs": 1
      },
      "links": {
        "refresh": "string",
        "resume": "string",
        "finalize": "string"
      },
      "details": {
        "reused": [
          {
            "path": "string",
            "reason": "string"
          }
        ],
        "diagnostics": [
          {
            "code": "string",
            "severity": "info",
            "message": "string",
            "path": "string",
            "provider": "infra",
            "details": {
              "property1": null,
              "property2": null
            },
            "fix": "string",
            "retryable": true
          }
        ]
      }
    }
  }
}

Was this page helpful?