# Complete GitHub connection in project

`POST /v1/projects/{project}/connections/github/complete`, operation `connections.CompleteGitHubConnectionInProject`

Connects an installation of kosem's GitHub App that the caller installed, once GitHub sent them back with a code.

The code shows which installations the person who authorized the app reaches, and only those connect: an installationId that names another is refused. An installation is one organization's or project's; completing again for the one that connected it returns its connection.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `project` | path | Yes | `string` | The project's ID. |

## Request body

Content-Type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | `string` | Yes | The code GitHub gave as the person authorized kosem's GitHub App, which shows which installations they may reach. It works once, for ten minutes. |
| `displayName` | `string` | No | Name shown in user interfaces. Defaults to GitHub and the account's name. |
| `installationId` | `integer (int64)` | No | The installation GitHub named, as installation_id. Unset, the person's only installation of the app that no organization connected. |
| `state` | `string` | Yes | The state that StartGitHubConnection gave, for this organization and this person. |

## Responses

### 201

Created

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availability` | `Availability` | Yes | For an organization's connection: the projects it is shared with. Choosing it for an access profile still takes connections.connections.use. A project's own connection serves that project alone, and is shared with none. |
| `availability.allProjects` | `boolean` | Yes | Every project, including those created later. |
| `availability.projects` | `string[]` | Yes | Projects, projects/{project_id}, when not all of them; at most 500. Past that, make the resource available to every project. |
| `config` | `map<string, string>` | Yes | Settings, as the type's configFields describe them. |
| `createTime` | `string (date-time)` | No | When the connection was created; unset on one that was only validated. |
| `displayName` | `string` | Yes | Name shown in user interfaces. Defaults to the type's name. |
| `name` | `string` | Yes | Resource name, organizations/{organization_id}/connections/{connection_id}, or projects/{project_id}/connections/{connection_id} for a project's own. |
| `roles` | `ConnectionRole[]` | No | For AWS, once set up: the IAM roles the connection assumes, its default one first. Each trusts the connection's identity subject. |
| `serviceAccounts` | `ConnectionServiceAccount[]` | No | For Google Cloud, once set up: the service accounts the connection acts as, its default one first. Each trusts the connection's identity, and its roles bound what its tokens can do. |
| `state` | `string` | Yes | Whether the service lets kosem act in the account: ACTIVE, it did when it was last verified; NEEDS_ATTENTION, it refused, or the connection isn't set up yet, and stateReason says why. Values: `ACTIVE`, `NEEDS_ATTENTION`. |
| `stateReason` | `string` | Yes | Why the connection needs attention. |
| `trust` | `ConnectionTrust` | No | What the service trusts of kosem for this connection, for a type connected by WORKLOAD_IDENTITY. |
| `trust.attributeCondition` | `string` | No | For Google Cloud: the attribute condition that the workload identity provider must have, which takes the identity tokens of this organization's connections, its projects' own among them, and of no environment. kosem's issuer is every customer's, so a provider without it trusts them all; each service account then lets one connection's subject act as it. |
| `trust.audience` | `string` | No | For AWS: the audience of kosem's identity tokens, sts.amazonaws.com, the client ID of the account's IAM OpenID Connect provider. |
| `trust.issuer` | `string` | Yes | kosem's issuer of identity tokens, whose keys it publishes at /.well-known/jwks.json. For AWS, the URL of the account's IAM OpenID Connect provider. |
| `trust.subject` | `string` | Yes | The subject of kosem's identity tokens for the connection: connection:{name}. Only kosem mints it, so trusting it trusts no other organization's connection and no environment. |
| `type` | `string` | Yes | The connection's type, such as connectionTypes/github. It never changes. |
| `updateTime` | `string (date-time)` | No | When the connection was last updated; unset on one that was only validated. |
| `verifyTime` | `string (date-time)` | Yes | When the service last let kosem act in the account, or refused. |

### default

Error

Base URL: `https://api.kosem.ai`. See [API conventions](https://docs.kosem.ai/reference/api-conventions.md) for authentication, pagination and errors, and [https://docs.kosem.ai/openapi.yaml](https://docs.kosem.ai/openapi.yaml) for the full OpenAPI document.