Delete an ephemeral repository branch - Spacefast Docs
Delete an ephemeral repository branch
Delete a short-lived repository branch after a preview or experiment.
Endpoint
DELETE /v1/spaces/{spaceId}/source/ephemeral-branch
Authorization
Authorization Bearer Token
Authorization: Bearer <token> with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).
Authorization OAuth2 Access Token
OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.
Scopes: spaces:write
Path Parameters
spaceIdstring required
Query Parameters
connectionTypestring required
default: "connected"
Allowed:connected,hosted
Request Body
Content-Type: application/json
branchstring required
Name for the short-lived branch.ttlSecondsinteger
How long the signed access lasts, in seconds. At most 86400.readOnlyRefsstring[]
Refs the access may read but never write. At most 25.
Responses
200 Response for Status 200
$schemastringdataobject requiredrepositoryConnectionobject requiredidstring required
Source connection ID (rpc_prefix).spaceIdstring required
Space this connection feeds.providerstring required
Git host the repository lives on.
Allowed:github,gitlab,bitbucket,genericconnectionTypestring requiredconnectedfor a repository linked from a Git host,hostedfor the mirror Spacefast hosts and the caller pushes to. Allowed:connected,hostedrepositoryIdstring | any required
Identifier of the mirror that content reads and builds run against. Null when no mirror is bound yet.installationIdstring | any required
GitHub App installation the connection reads through. Null for a hosted mirror.cloneUrlConfiguredboolean required
Whether a clone URL is stored. The URL itself is not returned.upstreamUrlConfiguredboolean required
Whether an upstream URL to pull from is stored. The URL itself is not returned.repositoryNamestring required
Repository name without its owner.repositoryFullNamestring required
Repository name asowner/name.defaultBranchstring required
Branch the Git host treats as the repository default.productionBranchstring required
Branch whose pushes produce production builds, and the ref content reads fall back to when none is given.credentialConfiguredboolean required
Whether a Git credential is stored. The credential itself is never returned.autoDeployProductionboolean required
Whether a push to the production branch queues a build.autoDeployPreviewsboolean required
Whether a push to any other branch or a pull request queues a preview build.buildSettingsobject requiredrootDirectorystring | any required
Directory the build runs in, relative to the source root. Null builds at the root.installDirectorystring | any required
Directory dependencies install into, relative to the source root. Null installs in the build directory.installCommandstring | any required
Command that installs dependencies. Null lets the build runner pick one.buildCommandstring | any required
Command that produces the output. Null lets the build runner pick one.outputDirectorystring | any required
Directory the built output is collected from, relative to the build directory. Null lets the build runner detect it.ignoredBuildCommandstring | any required
Command run before the build to decide whether the build is needed. Exiting 0 ends the build asskipped; any other exit code continues. Null always builds.frameworkPresetstring | any requiredplatformPresetstring | any requiredallowUnsupportedPlatformFeaturesboolean required
Runs the build even when the source declares platform features Spacefast does not support. Defaults tofalse, which refuses those sources.timeoutSecondsinteger required
Wall-clock budget for the run, in seconds. Between 60 and 7200; defaults to 900.
syncStatusstring requiredidlebefore the first sync,syncingwhile one runs,readyonce content reads work,failedwhen the last one did not finish. Allowed:idle,syncing,ready,failedproviderAccessStatusstring required
Whether the Git host still grants access. Anything other thanactiveblocks builds until the caller reinstalls or reauthorizes. default: "active"providerAccessErrorstring | any required
What the Git host reported when access stopped working. Null while access holds.lastSyncedAtstring| any required
ISO 8601 timestamp of the last sync that finished. Null before the first one.lastSyncErrorstring | any required
Why the last sync failed. Null after a sync that succeeded.syncRunIdstring | any required
Identifier of the sync in flight. Null when no sync is running.connectedUserIdstring | any required
User who last authorized or changed the connection. Null when no user did.createdAtstringrequired
ISO 8601 timestamp when the connection was created.updatedAtstringrequired
ISO 8601 timestamp of the last change.
branchobject requiredrepositoryIdstring requiredbranchstring requiredbaseRefstring | any requiredbaseBranchstring | any requiredephemeralboolean required
Example Request
curl -X DELETE "https://api.spacefast.com/v1/spaces/string/source/ephemeral-branch?connectionType=connected" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"branch": "string", "ttlSeconds": 86400, "readOnlyRefs": ["string"]}'
Example Response
{
"$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"
},
"branch": {
"repositoryId": "string",
"branch": "string",
"baseRef": "string",
"baseBranch": "string",
"ephemeral": true
}
}
}