Docs
Account, keys and webhooks ›

Connect git hub installation

POST/v1/github/installations

Connect git hub installation.

Requestcurl
  1. curl -X POST https://agental.io/v1/github/installations \
  2. -H "Authorization: Bearer $AGENTAL_API_KEY" \
  3. -H "Content-Type: application/json" \
  4. -d '{"installationId":1,"code":"…","state":"…"}'
Answer200 OK · GitHubInstallation
  1. {
  2. "installationId": integer,
  3. "account": string,
  4. "accountType": string,
  5. "connectedAt": string,
  6. "repositorySelection": "all" | "selected" | "null" | null,
  7. "repositories": string[] | null,
  8. "manageUrl": string,
  9. }

The installation is the organization's.

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Body

installationIdrequired
integer
installation_id, as GitHub sent the browser back with it.
coderequired
string
code, the person's GitHub sign-in, as GitHub sent the browser back with it.
staterequired
string
state, as POST /v1/github/connect gave it and GitHub sent it back.

Returns

200 The installation is the organization's.

GitHubInstallation7 fields
installationId
integer
account
string
The GitHub user or organization the App is installed on.
accountType
string
User or Organization.
connectedAt
string
repositorySelection
allselectednullnull
Whether the App may use all the account's repositories or those chosen.
More Null where GitHub did not say.
repositories
string[]null
The repositories the App may use, by full name.
More Null where GitHub did not say.
manageUrl
string
Where on GitHub the repositories it may use are changed, or the App uninstalled.

Errors and other answers

400github_state_invalid the state is not one given to this person, it ran out, or it was used.
400github_code_invalid GitHub did not take the sign-in.
403 session_required, or
403forbidden only an owner or an admin.
403github_installation_unreachable GitHub says the person who signed in does not reach that installation.
403github_not_admin they reach it, but are not the account it is on, or an admin of that GitHub organization.
409 github_not_available, or
409installation_taken it is connected to another organization.
503github_unavailable GitHub did not answer. Connect again in a minute.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.