ReferenceHTTP APIWorkspace settings

Register or replace one of the workspace's GitHub Apps (owner or admin)

PUT
/v1/workspaces/{id}/github-apps/{role}

Takes the App's id and private key as PUT …/github-app does, checks the key with GitHub the same way, and stores it. role is a role or a connection id. A role registers the role's first connection, or replaces it while the role has exactly one; with several it is 409 GITHUB_APP_CONFLICT ambiguous_role (name one by id, or add with POST …/github-apps). Replacing it with another App drops the repository pins it held (pins_cleared). A connection id rotates that connection's key: the app_id must be its App (400 app_id_mismatch). Each connection has its own key: changing one never touches another. One App is one connection in a workspace, whatever the role (409 same_app), and a reviewer App needs an author App first (409 no_author_app); both are decided under the workspace's lock. A reviewer App needs pull_requests: write and contents, metadata read; wider permissions are kept and listed in warnings. Writes a set_github_app receipt naming the App id and role. The key is in no response, receipt, log or error. 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
role*|

A GitHub App role, or the id of one connection of a role.

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
app_id*integer
Range0 < value <= 2147483647
private_key*string
Length1 <= length <= 16384

Response Body

Stored; the App as GET now answers it, and the receipt.

application/json
  1. response
github_app*
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
pins_cleared?integer
Range0 <= value <= 9007199254740991
pins_restored?integer
Range0 <= value <= 9007199254740991
Example Request
curl -X PUT 'https://example.com/v1/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/github-apps/author' \  -H 'Content-Type: application/json' \  -d '{  "app_id": 234567,  "private_key": "[REDACTED]"}'
Example Response
{  "github_app": {    "role": "reviewer",    "app_id": 234567,    "slug": "acme-reviewer",    "name": "Acme reviewer",    "html_url": "https://github.com/apps/acme-reviewer",    "private_key": {      "updated_at": "2026-10-30T09:00:00Z",      "updated_by": {        "user_id": "3e7f1a90-5c2d-4b8e-8f61-2a9d0c4b7e35",        "display_name": "Jae"      }    },    "created_at": "2026-10-30T09:00:00Z",    "updated_at": "2026-10-30T09:00:00Z",    "permissions": {      "contents": "read",      "metadata": "read",      "pull_requests": "write"    },    "permissions_checked_at": "2026-10-30T09:00:00Z",    "warnings": []  },  "receipt_id": "c4a1e9d2-7b3f-4e8a-a6c5-1d2e3f4a5b6c"}