Get file blame - Spacefast Docs
Get file blame
Returns per-line commit attribution for one file at a ref, with the author and committer identity and time behind each line. Limit the work with range, and set detectMoves to follow lines that moved between files.
GET /v1/spaces/{spaceId}/source/blame
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:read
Path parameters
spaceId string required
Query parameters
connectionType string required
default: "connected"
Allowed: connected, hosted
path string required
min length 1
ref string
min length 1
range string | string[]
detectMoves boolean
Responses
200 Response 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.
data object required
Show properties Hide properties
repositoryConnection object required
Show properties Hide properties
id string required
Source connection ID (rpc_ prefix).
spaceId string required
Space this connection feeds.
provider string required
Git host the repository lives on.
Allowed: github, gitlab, bitbucket, generic
connectionType string required
connected for a repository linked from a Git host, hosted for the mirror Spacefast hosts and the caller pushes to.
Allowed: connected, hosted
repositoryId string | any required
Identifier of the mirror that content reads and builds run against. Null when no mirror is bound yet.
Show properties Hide properties
Any of:
string
string
any
any
installationId string | any required
GitHub App installation the connection reads through. Null for a hosted mirror.
default: null
Show properties Hide properties
Any of:
string
string
any
any
cloneUrlConfigured boolean required
Whether a clone URL is stored. The URL itself is not returned.
default: false
upstreamUrlConfigured boolean required
Whether an upstream URL to pull from is stored. The URL itself is not returned.
default: false
repositoryName string required
Repository name without its owner.
repositoryFullName string required
Repository name as owner/name.
defaultBranch string required
Branch the Git host treats as the repository default.
productionBranch string required
Branch whose pushes produce production builds, and the ref content reads fall back to when none is given.
credentialConfigured boolean required
Whether a Git credential is stored. The credential itself is never returned.
autoDeployProduction boolean required
Whether a push to the production branch queues a build.
autoDeployPreviews boolean required
Whether a push to any other branch or a pull request queues a preview build.
buildSettings object required
Install, build, and output settings each build runs with.
Show properties Hide properties
rootDirectory string | any required
Directory the build runs in, relative to the source root. Null builds at the root.
default: null
Show properties Hide properties
Any of:
string
string
any
any
installDirectory string | any required
Directory dependencies install into, relative to the source root. Null installs in the build directory.
default: null
Show properties Hide properties
Any of:
string
string
any
any
installCommand string | any required
Command that installs dependencies. Null lets the build runner pick one.
default: null
Show properties Hide properties
Any of:
string
string
any
any
buildCommand string | any required
Command that produces the output. Null lets the build runner pick one.
default: null
Show properties Hide properties
Any of:
string
string
any
any
outputDirectory string | any required
Directory the built output is collected from, relative to the build directory. Null lets the build runner detect it.
default: null
Show properties Hide properties
Any of:
string
string
any
any
ignoredBuildCommand string | any required
Command run before the build to decide whether the build is needed. Exiting 0 ends the build as skipped; any other exit code continues. Null always builds.
default: null
Show properties Hide properties
Any of:
string
string
any
any
frameworkPreset string | any required
Framework the source builds with, for example next or vite. Null lets the build runner detect it.
default: null
Show properties Hide properties
Any of:
string
string
any
any
platformPreset string | any required
Platform build convention the source follows, for example vercel or netlify. Null lets the build runner detect it.
default: null
Show properties Hide properties
Any of:
string
string
any
any
allowUnsupportedPlatformFeatures boolean required
Runs the build even when the source declares platform features Spacefast does not support. Defaults to false, which refuses those sources.
default: false
timeoutSeconds integer required
Wall-clock budget for the run, in seconds. Between 60 and 7200; defaults to 900.
min 60 · max 7200 · default: 900
syncStatus string required
idle before the first sync, syncing while one runs, ready once content reads work, failed when the last one did not finish.
Allowed: idle, syncing, ready, failed
providerAccessStatus string required
Whether the Git host still grants access. Anything other than active blocks builds until the caller reinstalls or reauthorizes.
default: "active"
Allowed: active, suspended, revoked, reauthorization_required
providerAccessError string | any required
What the Git host reported when access stopped working. Null while access holds.
default: null
Show properties Hide properties
Any of:
string
string
any
any
lastSyncedAt string
ISO 8601 timestamp of the last sync that finished. Null before the first one.
Show properties Hide properties
Any of:
string
string<date-time>
any
any
lastSyncError string | any required
Why the last sync failed. Null after a sync that succeeded.
Show properties Hide properties
Any of:
string
string
any
any
syncRunId string | any required
Identifier of the sync in flight. Null when no sync is running.
Show properties Hide properties
Any of:
string
string
any
any
connectedUserId string | any required
User who last authorized or changed the connection. Null when no user did.
Show properties Hide properties
Any of:
string
string
any
any
createdAt string
ISO 8601 timestamp when the connection was created.
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))$
updatedAt string
ISO 8601 timestamp of the last change.
repositoryId string required
ref string required
path string required
commitSha string required
lines object[] required
Show properties Hide properties
Array of object
lineNumber integer required
min -9007199254740991 · max 9007199254740991
commitSha string required
originalLineNumber integer required
min -9007199254740991 · max 9007199254740991
originalPath string required
previousCommitSha string | any required
Show properties Hide properties
Any of:
string
string
any
any
authorName string required
authorEmail string required
authorTime string required
committerName string required
committerEmail string required
committerTime string required
summary string required
First line of the commit message.
default Error.
Every 4xx and 5xx response is one RFC 9457 problem document served as application/problem+json.
$schema string
Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.
type string required
URL of the documentation page for this error. Derived from code.
title string required
Human-readable name of the error type. Derived from code.
status integer required
HTTP status of the response, repeated in the body.
min -9007199254740991 · max 9007199254740991
detail string required
What went wrong in this request.
code string required
Stable snake_case error code. Match on this, not on detail.
pointer string
RFC 6901 JSON Pointer to the request field or batch entry that failed, for example /files/37/path. Present on validation failures.
details object
Machine-readable context keyed by the error code.
suggestions string[]
Recovery steps safe to show to a person.
next string[]
Commands or API requests to run next, usable as written.
requestId string required
ID of this request, from the X-Request-Id header or generated. Quote it when contacting support.
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
spaceId path * connectionType query * connected hosted path query * ref query range query detectMoves query
Send
Request
cURL
curl -X GET "https://api.spacefast.com/v1/spaces/string/source/blame?connectionType=connected&path=string" \
-H "Authorization: Bearer YOUR_TOKEN"
JavaScript
const response = await fetch("https://api.spacefast.com/v1/spaces/string/source/blame?connectionType=connected&path=string", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_TOKEN"
}
});
Python
import requests
response = requests.get(
"https://api.spacefast.com/v1/spaces/string/source/blame?connectionType=connected&path=string",
headers={
"Authorization": "Bearer YOUR_TOKEN"
},
)
Response
200 default
{
"$schema": "http://example.com",
"data": {
"repositoryConnection": {
"id": "string",
"spaceId": "string",
"provider": "github",
"connectionType": "connected",
"repositoryId": "string",
"installationId": null,
"cloneUrlConfigured": false,
"upstreamUrlConfigured": false,
"repositoryName": "string",
"repositoryFullName": "string",
"defaultBranch": "string",
"productionBranch": "string",
"credentialConfigured": true,
"autoDeployProduction": true,
"autoDeployPreviews": true,
"buildSettings": {
"rootDirectory": null,
"installDirectory": null,
"installCommand": null,
"buildCommand": null,
"outputDirectory": null,
"ignoredBuildCommand": null,
"frameworkPreset": null,
"platformPreset": null,
"allowUnsupportedPlatformFeatures": false,
"timeoutSeconds": 900
},
"syncStatus": "idle",
"providerAccessStatus": "active",
"providerAccessError": null,
"lastSyncedAt": "2019-08-24T14:15:22Z",
"lastSyncError": "string",
"syncRunId": "string",
"connectedUserId": "string",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
},
"repositoryId": "string",
"ref": "string",
"path": "string",
"commitSha": "string",
"lines": [
{
"lineNumber": -9007199254740991,
"commitSha": "string",
"originalLineNumber": -9007199254740991,
"originalPath": "string",
"previousCommitSha": "string",
"authorName": "string",
"authorEmail": "string",
"authorTime": "string",
"committerName": "string",
"committerEmail": "string",
"committerTime": "string",
"summary": "string"
}
]
}
}
Error response structure
{
"$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"
}