# Start connecting an agent to GitHub through its own GitHub App. Returns `install` with a URL to open in a browser when the App exists, or `create_app` when GitHub must first create it, which needs the web UI (Agent > Integrations > Connect GitHub).

Source: <https://everruns.com/docs/api/operations/connect_agent_github/>

POST

/v1/agents/{agent\_id}/github/connect

Select code samplecURL (shell:curl)

```js
const url = 'https://app.everruns.com/api/v1/agents/example/github/connect';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"owner_org":"example","return_to":"example"}'
};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```sh
curl --request POST \
  --url https://app.everruns.com/api/v1/agents/example/github/connect \
  --header 'Content-Type: application/json' \
  --data '{ "owner_org": "example", "return_to": "example" }'
```

* Production APIapp.everruns.com/api/v1/agents/{agent\_id}/github/connect

## Parameters

### Path Parameters

**agent\_id**

required

string

Prefixed public identifier

## Request Bodyrequired

Media typeapplication/json

Where a new App is created and where the browser lands afterwards.

object

**owner\_org**

GitHub organization that should own a new App. Omit for the personal account of whoever confirms it on GitHub. A private App can only be installed on the account that owns it.

string | null

**return\_to**

UI path to return to when the flow ends.

string | null

##### Examplegenerated

```json
{
  "owner_org": "example",
  "return_to": "example"
}
```

## Responses

### 200

Success

Media typeapplication/json

One of:

* object

  GitHub must create the App first. A browser posts `manifest` as the `manifest` form field to `action` (a top-level navigation, so GitHub’s confirmation page is shown). Outside a browser, follow `next_step`.

  object

  **action**

  required

  string

  **kind**

  required

  string

  Allowed values: create\_app

  **manifest**

  required

  string

  **next\_step**

  required

  string

* object

  The App exists; open `url` in a browser to install it or change which repositories it can reach.

  object

  **app\_slug**

  required

  string

  **kind**

  required

  string

  Allowed values: install

  **url**

  required

  string

##### Example

```json
{
  "kind": "create_app"
}
```

### 404

Agent not found