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
spaceId: string (required)
Request body
Content-Type: application/json
Required fields:
connectionType: string (required)- Allowed values:
connected,hosted
- Allowed values:
branch: string (required)- Branch to delete. (min length 1)
Responses
200 Response for status 200
{
"$schema": "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}",
)