Dock Docs
API reference

GitHub

Register the GitHub App, link installations to workspaces, and read and promote Runs.

The GitHub App turns issues into pull requests: a mention in an issue comment starts a Run in a Dock. Installations link a GitHub App installation to a workspace. Shared rules are in Conventions.

The GitHub webhook receiver and the Run completion callback are called by GitHub and by Run Docks, not by you, and are not documented here. Starting more than 10 Runs per hour for one installation and repository is refused.

Installation routes return the Installation object.

App registration

These routes register the GitHub App from a manifest. They need an instance admin with a verified email (the email must be listed in INSTANCE_ADMIN_EMAILS) and a browser session (Session only). Otherwise they fail with instance_admin_required.

POST /v1/github/app-setup/start

Begin registering the App. Returns a form target and manifest to post to GitHub.

FieldTypeRequiredLimits / defaultDescription
organizationstringnoGitHub login, 1 to 39 charactersGitHub organization that will own the App; your own account when omitted.

Response: { "postUrl": "https://github.com/...", "manifest": "<JSON string>", "state": "..." }. The state is single-use and valid for one hour. Errors: validation_error, instance_admin_required.

POST /v1/github/app-setup/conversion

Finish registration with the values GitHub appends to the redirect.

FieldTypeRequiredLimits / defaultDescription
codestringyes1 to 128 of A-Za-z0-9_-The code GitHub returned. Single-use, expires after one hour.
statestringyes32 hex charactersThe state from start.

Response:

{
  "appId": 123,
  "slug": "dock-example",
  "name": "Dock example",
  "owner": "octocat",
  "htmlUrl": "https://github.com/apps/dock-example",
  "installUrl": "https://github.com/apps/dock-example/installations/new",
  "env": { "GITHUB_APP_ID": "123", "GITHUB_APP_SLUG": "...", "GITHUB_APP_PRIVATE_KEY": "...", "GITHUB_APP_WEBHOOK_SECRET": "...", "GITHUB_APP_CLIENT_ID": "...", "GITHUB_APP_CLIENT_SECRET": "..." },
  "envFile": "GITHUB_APP_ID=\"123\"\nGITHUB_APP_SLUG=\"...\"\n..."
}

owner is null when GitHub does not report one. env and envFile hold the App's secrets and are shown once; put them in the control plane's environment. Errors: validation_error, instance_admin_required, invalid_state, invalid_code, github_unavailable.

Installations

POST /v1/github/installations/start

Get a link to install or authorize the App for a workspace. Session only. Role: admin.

FieldTypeRequiredLimits / defaultDescription
workspaceIduuidyesWorkspace to link.
modestringnoinstall or authorize, default installinstall opens GitHub's install page; authorize skips it when the App is already installed on the account.

Response: { "url": "https://github.com/...", "state": "..." }. Errors: validation_error, session_required, installation_not_found (unknown workspace), organization_not_found, forbidden (not an admin), github_app_oauth_not_configured, unavailable.

POST /v1/github/installations/complete

Link an installation after GitHub redirects back (201). Session only. Role: admin.

FieldTypeRequiredLimits / defaultDescription
installationIdintegernoat least 1The installation GitHub reported.
codestringno1 to 128 of A-Za-z0-9_-The OAuth code GitHub appended. Absent on a follow-up that picks one candidate.
statestringwhen code is sent32 hex charactersThe state from start.

One of installationId or code is required. Response: the linked Installation object without createdBy, createdAt, and updatedAt. When several installations qualify, the response is { "candidates": [ { "installationId": 1, "account": "octocat" } ] }; call again with the chosen installationId. Errors: validation_error, session_required, invalid_state, installation_not_accessible, installation_not_found (the workspace was deleted), organization_not_found, forbidden (not an admin), github_unavailable, github_app_oauth_not_configured, unavailable.

GET /v1/github/installations

List a workspace's installations. Role: member.

FieldTypeRequiredLimits / defaultDescription
workspaceId (query)uuidyesWorkspace.

Response: an array of Installation objects. Errors: validation_error, installation_not_found (unknown workspace), organization_not_found.

PATCH /v1/github/installations/:id

Update an installation. Session only. Role: admin. Every field is optional.

FieldTypeRequiredLimits / defaultDescription
reposarray of stringsnoeach owner/name, max 100 characters; each must be a repository the installation coversRepositories the App may act on.
agentstringnoa supported agent name, max 64Coding agent name.
testCommandstringnomax 500Command Runs use to check their work.

Response: the Installation object. Errors: validation_error, session_required, installation_not_found, organization_not_found, forbidden (not an admin), github_unavailable.

DELETE /v1/github/installations/:id

Unlink an installation. Session only. Role: admin.

Response: { "deleted": true }. Errors: session_required, installation_not_found, organization_not_found, forbidden (not an admin).

Runs

GET /v1/github/runs

List a workspace's Runs, newest first. Role: member.

FieldTypeRequiredLimits / defaultDescription
workspaceId (query)uuidyesWorkspace.
state (query)stringnopending, provisioning, working, pr_opened, failed, stopped, doneOnly Runs in this state.

Response: an array of Run objects. Errors: validation_error, installation_not_found (unknown workspace), organization_not_found.

GET /v1/github/runs/:id

Read one Run. Role: member.

Response: the Run object. Errors: run_not_found.

POST /v1/github/runs/:id/promote

Move a Fast Run onto a full Dock so it can keep working. Session only. Role: member. A Run that is not a Fast Run is returned unchanged.

Response: the Run object, now in state provisioning. Errors: session_required, run_not_found, run_not_promotable (the Run finished, its envelope is incomplete, or credentials cannot be resolved), subscription_required, budget_exceeded.

On this page