Rename or rebind an artifact - Spacefast Docs

Rename or rebind an artifact

Rewrites the file’s front-matter (title, description, bindings) or moves it (slug) as a source commit.

PATCH/v1/artifacts/{ref}

Authorization

AuthorizationBearer token · headerrequired

`Authorization: Bearer ` with the Space key (`sfc_` prefix) of an unclaimed Space. The same key is the fragment of the claim URL and the token in the Space's `/__/` sign-in URL.

or

AuthorizationBearer token · headerrequired

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

or

AuthorizationOAuth2 access token · headerrequired

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

Scopes:connectors:execute

Path parameters

refstringrequired

Query parameters

teamstring

min length 1

Request body

requiredapplication/json

Every field here lands as a source commit, so history, blame, and revert come from git.

titlestring

Replacement title. Rewrites the file's front-matter.

min length 1 · max length 255

descriptionstring | any

Replacement description.

slugstring

Rename. Moves the file, so `ref` changes.

min length 1 · max length 128 · matches ^[a-z0-9][a-z0-9-]*$

bindingsobject

Replacement role to connection map. Rebinding is how an artifact moves between accounts.

Responses

200Response for status 200

`$schema`string

Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.

dataobjectrequired

One artifact, with its source at a commit.

refstringrequired

Artifact address: `:`. The only way to name an artifact.

min length 3 · max length 1024 · matches ^[^:]+:[^:].*$

spaceIdstringrequired

Space holding the source file. Read-only projection of `ref`.

pathstringrequired

Path within the space's source, e.g. `artifacts/burndown.tsx`. Read-only projection of `ref`.

slugstringrequired

Short name derived from the file name. Unique within its space.

titlestringrequired

Title declared in the file's front-matter.

descriptionstring | anyrequired

Description declared in the file's front-matter.

ownerstringrequired

`personal` when the file lives under `artifacts/personal//`. A visibility convention, not a storage boundary.

Allowed: team``personal

bindingsobjectrequired

Role name to connection id. Code writes roles, never accounts — sharing an artifact is a rebind, not a rewrite.

commitShastringrequired

Commit the projection was read at. Everything here is true as of this commit.

previewUrlstring | anyrequired

Rendered snapshot for this commit; null until one has been captured.

updatedAtstringrequired

When the commit landed.

sourcestringrequired

The file: one component named `App`, zero imports, everything else pre-bound in scope.

parsedScopeNamesstring[]required

Provided-scope names the source actually references. An unknown name here is why a render fails.

Example cURL Request

curl -X PATCH "https://api.spacefast.com/v1/artifacts/string" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{\n  "title": "string",\n  "description": "string",\n  "slug": "string",\n  "bindings": {\n    "property1": "string",\n    "property2": "string"\n  }\n}'

Example JavaScript Request

const response = await fetch("https://api.spacefast.com/v1/artifacts/string", {
  method: "PATCH",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\n  \"title\": \"string\",\n  \"description\": \"string\",\n  \"slug\": \"string\",\n  \"bindings\": {\n    \"property1\": \"string\",\n    \"property2\": \"string\"\n  }\n}"
});

Example Python Request

import requests

response = requests.patch(
    "https://api.spacefast.com/v1/artifacts/string",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\n  \"title\": \"string\",\n  \"description\": \"string\",\n  \"slug\": \"string\",\n  \"bindings\": {\n    \"property1\": \"string\",\n    \"property2\": \"string\"\n  }\n}",
)

Responses

200 default

{
  "$schema": "http://example.com",
  "data": {
    "ref": "string",
    "spaceId": "string",
    "path": "string",
    "slug": "string",
    "title": "string",
    "description": "string",
    "owner": "team",
    "bindings": {
      "property1": "string",
      "property2": "string"
    },
    "commitSha": "string",
    "previewUrl": "string",
    "updatedAt": "2019-08-24T14:15:22Z",
    "source": "string",
    "parsedScopeNames": [
      "string"
    ]
  }
}

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