> ## Documentation Index
> Fetch the complete documentation index at: https://agnt.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

> Give your agents the GitHub REST API — repositories, file contents, issues, pull requests, releases, and code search — through agntdata.

## Overview

The GitHub connection lets deployed agents work with GitHub: list and manage **repositories, branches, commits, and file contents**; create and triage **issues and comments**; open, review, and merge **pull requests**; publish and edit **releases**; **search** repositories, code, issues, users, and commits; and read **users, organizations, and gists**.

* **Base URL**: `https://api.agntdata.dev/v1/connections/github`
* **GitHub auth**: OAuth 2.0 — connect your GitHub account once from the dashboard. agntdata attaches a fresh access token (and the required `Accept` / `User-Agent` headers) to every call, so you never pass an `Authorization` header yourself.
* **MCP tools**: agents call `connection_github_*` tools, e.g. `connection_github_list_repo_issues`, `connection_github_create_issue`, `connection_github_create_pull_request`, `connection_github_merge_pull_request`.

<Note>
  **Paths take `{owner}`/`{repo}`** (owner is the user or org login). Reads paginate with `per_page` (max 100) and `page`. `search_*` tools return `{ total_count, items }`; most list tools return a bare array. **File contents are base64-encoded** — decode `content` on reads and base64-encode it on writes, passing the existing blob `sha` when updating. Issue endpoints also return pull requests (a `pull_request` field marks them). **Delete tools are irreversible.**
</Note>

## Setup

<Steps>
  <Step title="Connect GitHub">
    In the agntdata dashboard open **Integrations**, pick **GitHub**, and click **Connect**. You'll be redirected to GitHub to authorize and grant access to the repositories and organizations you want the agent to reach.
  </Step>

  <Step title="Pick GitHub tools">
    In an agent's Tools panel, add the GitHub tools the agent needs — for example `list_repo_issues`, `create_issue`, `create_pull_request`, and `create_release`. Destructive tools (`delete_repo`, `delete_file`, `delete_release`, `delete_gist`, `delete_issue_comment`) ship too; leave them off an agent you don't want deleting things.
  </Step>
</Steps>

## Examples

### Create an issue

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/github/repos/OWNER/REPO/issues" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Investigate flaky test","body":"Fails ~10% of runs on CI.","labels":["bug"]}'
```

### Open a pull request

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/github/repos/OWNER/REPO/pulls" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Fix retry backoff","head":"fix/backoff","base":"main","body":"Caps the backoff at 30s."}'
```

### Search code

```bash theme={null}
curl "https://api.agntdata.dev/v1/connections/github/search/code?q=addClass+in:file+repo:OWNER/REPO" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY"
```

### Create or update a file

```bash theme={null}
curl -X PUT "https://api.agntdata.dev/v1/connections/github/repos/OWNER/REPO/contents/docs/NOTES.md" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"Add notes","content":"'"$(printf 'hello' | base64)"'","branch":"main"}'
```
