Delete a repository branch - Spacefast Docs

Delete a repository branch

Deletes an ordinary branch from the repository. Short-lived branches are deleted through the ephemeral-branch operation instead.

HTTP Method: DELETE /v1/spaces/{spaceId}/source/branches

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).

OAuth2 Access Token

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

Scopes:

spaces:write

Path parameters

Request body

Content-Type: application/json

Required fields:

Responses

200 Response for status 200

{ "$schema": "string", "data": { "repositoryConnection": { "id": "string", "spaceId": "string", "provider": "string", "connectionType": "string", "repositoryId": "string | any", "installationId": "string | any", "cloneUrlConfigured": boolean, "upstreamUrlConfigured": boolean, "repositoryName": "string", "repositoryFullName": "string", "defaultBranch": "string", "productionBranch": "string", "credentialConfigured": boolean, "autoDeployProduction": boolean, "autoDeployPreviews": boolean, "buildSettings": { "rootDirectory": "string | any", "installDirectory": "string | any", "installCommand": "string | any", "buildCommand": "string | any", "outputDirectory": "string | any", "ignoredBuildCommand": "string | any", "frameworkPreset": "string | any", "platformPreset": "string | any", "allowUnsupportedPlatformFeatures": boolean, "timeoutSeconds": integer, }, "syncStatus": "string", "providerAccessStatus": "string", "providerAccessError": "string | any", "lastSyncedAt": "string | any", "lastSyncError": "string | any", "syncRunId": "string | any", "connectedUserId": "string | any", "createdAt": "string", "updatedAt": "string", }, "repositoryId": "string", "branch": { "name": "string", "message": "string" } } }

Errors

Error Schema:

{
  "$schema": "string<uri>",
  "type": "string",
  "title": "string",
  "status": integer,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": ["string"],
  "next": ["string"],
  "requestId": "string"
}

Example Request

cURL

curl -X DELETE "https://api.spacefast.com/v1/spaces/string/source/branches" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "connectionType": "connected",
  "branch": "string"
}'

JavaScript

const response = await fetch("https://api.spacefast.com/v1/spaces/string/source/branches", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\n  \"connectionType\": \"connected\",\n  \"branch\": \"string\"\n}"
});

Python

import requests

response = requests.delete(
    "https://api.spacefast.com/v1/spaces/string/source/branches",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\n  \"connectionType\": \"connected\",\n  \"branch\": \"string\"\n}",
)