Skip to content
Connect an agent

Organisations

Link a GitHub App installation

Links one installation to the organisation, proved by the grant from POST /github/authorize, and reads the first page of its repositories.

POST/orgs/{org}/github/installations

TL;DR

QuestionAnswer
What does it do?Link a GitHub App installation.
What does it take?A JSON body of type GithubLinkBody.
What does it return?Status 200 with a body of type GithubLink.
What can go wrong?400 the body is not valid; 401 not signed in; 403 a member may not (orgs.forbidden), the plan has no GitHub App (plan.github_app_not_included), or the request came from an origin that may not make changes. Or the grant is not valid (github.grant_invalid), or does not name the installation (github.installation_not_yours); 404 no such organisation, or GitHub has no such installation of the App (github.installation_not_found); 409 another organisation has linked it (github.installation_linked); 429 too many requests, or GitHub asked to wait (github.rate_limited); 502 GitHub could not be reached (github.unavailable); 503 the GitHub App is not set up on this server (github.not_configured), or organisations are not. Every failure uses the one error envelope.

What it does

Links one installation to the organisation, proved by the grant from POST /github/authorize, and reads the first page of its repositories. One installation belongs to one organisation. The owner and an admin, on Pro and Enterprise.

Path parameters

FieldTypeRequiredDescription
orgstringyesThe organisation's id or its slug.

Request body

The body has the type GithubLinkBody.

FieldTypeRequiredDescription
grantstringyesat least 1 character; at most 8192 characters.
installationIdstringyesat most 20 characters; pattern ^[1-9][0-9]{0,19}$.

Responses

StatusMeaningBody
200Linked already to this organisation; its repositories were read again.GithubLink
201Linked.GithubLink
400The body is not valid.ErrorResponse
401Not signed in.ErrorResponse
403A member may not (orgs.forbidden), the plan has no GitHub App (plan.github_app_not_included), or the request came from an origin that may not make changes. Or the grant is not valid (github.grant_invalid), or does not name the installation (github.installation_not_yours).ErrorResponse
404No such organisation, or GitHub has no such installation of the App (github.installation_not_found).ErrorResponse
409Another organisation has linked it (github.installation_linked).ErrorResponse
429Too many requests, or GitHub asked to wait (github.rate_limited).ErrorResponse
502GitHub could not be reached (github.unavailable).ErrorResponse
503The GitHub App is not set up on this server (github.not_configured), or organisations are not.ErrorResponse

Response body

A 200 answer has the type GithubLink.

FieldTypeRequiredDescription
installationGithubInstallationyes
installation.idstringyesGitHub's installation id.
installation.accountobjectyes
installation.account.loginstringyes
installation.account.idstringyes
installation.account.type"User" | "Organization"yes
installation.repositorySelection"all" | "selected"yesWhether the App reaches every repository of the account or the ones chosen on GitHub.
installation.suspendedbooleanyes
installation.linkedAtintegeryesMilliseconds since the epoch.
installation.linkedByobject | nullyes
installation.linkedBy.idstringyes
installation.linkedBy.emailstringyes
installation.settingsUrlstringyesThe installation's settings page on GitHub, where it is narrowed, suspended or uninstalled.
syncedintegeryes
nextPageinteger | nullyesThe next page of repositories to read with sync, or null when every one was read.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools