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

# GitHub

> Repository and code collaboration API for reading repos, issues, pull requests, and commits.

Repository and code collaboration API for reading repos, issues, pull requests, and commits. Use when a workflow needs to gather development context, check PR status, or read code. Requires a personal access token — most endpoints use the authenticated user's permissions.

7 example endpoints available through Lava's AI Gateway. See the [GitHub API docs](https://docs.github.com/en/rest) for full documentation.

<Warning>This provider requires your own credentials — connect your API key or OAuth account before use.</Warning>

<Info>This is a **catch-all provider** — any valid URL under `https://api.github.com` is supported. Any GitHub REST API endpoint. Construct URL as [https://api.github.com/\&#123;path\&#125](https://api.github.com/\&#123;path\&#125);. See [https://docs.github.com/en/rest](https://docs.github.com/en/rest) for full reference. The endpoints below are curated examples.</Info>

## Endpoints

### Get authenticated user

**GET** `https://api.github.com/user` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.github.com/user', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.github.com%2Fuser" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### List user repositories

**GET** `https://api.github.com/user/repos` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.github.com/user/repos', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.github.com%2Fuser%2Frepos" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### List pull requests for a repository

**GET** `https://api.github.com/repos/{owner}/{repo}/pulls` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.github.com/repos/{owner}/{repo}/pulls', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.github.com%2Frepos%2F%7Bowner%7D%2F%7Brepo%7D%2Fpulls" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Create an issue

**POST** `https://api.github.com/repos/{owner}/{repo}/issues` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.github.com/repos/{owner}/{repo}/issues', { body: {"title":"Bug report","body":"Description of the issue"} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.github.com%2Frepos%2F%7Bowner%7D%2F%7Brepo%7D%2Fissues" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"title":"Bug report","body":"Description of the issue"}'
    ```
  </Tab>
</Tabs>

### Update an issue

**PATCH** `https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}', { method: 'PATCH', body: {"state":"closed"} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X PATCH "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.github.com%2Frepos%2F%7Bowner%7D%2F%7Brepo%7D%2Fissues%2F%7Bissue_number%7D" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"state":"closed"}'
    ```
  </Tab>
</Tabs>

### Merge a pull request

**PUT** `https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/merge` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/merge', { method: 'PUT', body: {"merge_method":"squash"} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X PUT "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.github.com%2Frepos%2F%7Bowner%7D%2F%7Brepo%7D%2Fpulls%2F%7Bpull_number%7D%2Fmerge" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"merge_method":"squash"}'
    ```
  </Tab>
</Tabs>

### Delete a repository

**DELETE** `https://api.github.com/repos/{owner}/{repo}` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.github.com/repos/{owner}/{repo}', { method: 'DELETE' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X DELETE "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.github.com%2Frepos%2F%7Bowner%7D%2F%7Brepo%7D" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json"
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="All Providers" icon="grid" href="/gateway/supported-providers">
    Browse all supported AI providers
  </Card>

  <Card title="Forward Proxy" icon="route" href="/gateway/forward-proxy">
    Learn how to construct proxy URLs and authenticate requests
  </Card>
</CardGroup>
