リファレンスHTTP APIWorkspace settings

Change a repository's default branch (owner or admin)

PATCH
/v1/workspaces/{id}/github-repositories/{repositoryId}

Sets the branch sessions start from. version is the one last read; another is 409 REVISION_CONFLICT. A session already running on the repository is refused its next repository request (CATALOG_MISMATCH). Writes a set_repository_branch receipt with the branch before and after. API keys are refused.

Auth: cookie session only; no scope. Idempotency-Key: ignored.

Authorization

cookieSession
cookie__Host-werft_session<token>

For the web console: the browser session cookie set by POST /v1/auth/login. It holds the scopes of the user's workspace role (owner: all; admin and member: all but sessions:recover). Requests other than GET must also send X-Requested-With: werft-web.

Path Parameters

id*string

The workspace's id.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
repositoryId*string

The repository's id in the workspace's repository catalog.

Length1 <= length <= 200

Header Parameters

X-Requested-With?"werft-web"

Required with a cookie session: the literal werft-web.

Value in"werft-web"

Request Body

application/json
  1. body
branch*string
Match^(?![-/.])(?!.*\.\.)(?!.*@\{)(?!.*\/\/)(?!.*\/\.)(?!.*\/$)(?!.*\.lock$)[^\s\x00-\x1f\x7f~^:?*[\\]+$
Length1 <= length <= 255
version*integer
Range0 < value <= 9007199254740991

Response Body

Changed; the repository and the receipt.

application/json
  1. response
repository*
receipt_id*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
Example Request
curl -X PATCH 'https://example.com/v1/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/github-repositories/string' \  -H 'Content-Type: application/json' \  -d '{  "branch": "develop",  "version": 1}'
Example Response
{  "repository": {    "id": "app",    "github_repository_id": 123456789,    "full_name": "acme/app",    "url": "https://github.com/acme/app.git",    "branch": "develop",    "source": "selection",    "version": 2,    "installed": true,    "updated_at": "2026-11-01T09:05:00Z"  },  "receipt_id": "c4a1e9d2-7b3f-4e8a-a6c5-1d2e3f4a5b6c"}