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

# GitHub REST API

> Client-mode REST API connector for a curated GitHub REST subset: user, repos, issues, pulls, and Actions

Technical Preview

## Overview

A client-mode connector for a **curated eight-operation** slice of the [GitHub REST API](https://docs.github.com/en/rest): rate limit, the authenticated user, repositories, issues, pull requests, and Actions workflow runs. It is meant for edge or IT-ops demos, not the full GitHub surface. Prefer a fine-grained personal access token with least privilege.

> [!NOTE]
>
> `GET /rate_limit` can return HTTP 200 without a token. Authenticated connectors need a PAT. An invalid Bearer token returns HTTP 401. Unauthenticated calls to other public connectors may return HTTP 403 when the IP is rate limited. This template has not been verified with a real token.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — GitHub REST
# Generated from curated OpenAPI; credentials are placeholders only.
# Docs: https://docs.coreflux.org/latest/lot-language/routes/rest-api-routes
# Auth: Bearer PAT / fine-grained token via {value.json.api_token}. Prefer Hub secrets.
# Optional: ADD "X-GitHub-Api-Version" "2022-11-28" on events if you pin an API version.

DEFINE ROUTE GithubRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.github.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
        # Auth: GitHub PAT / fine-grained token as Bearer — pass {value.json.api_token}.
        # Prefer Hub secrets / GET SECRET upstream — never commit real tokens.
    ADD EVENT Getratelimit
        WITH SOURCE_TOPIC "integrations/github/request/Getratelimit"
        WITH DESTINATION_TOPIC "integrations/github/response/Getratelimit"
        WITH METHOD "GET"
        WITH ENDPOINT "/rate_limit"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Getauthenticateduser
        WITH SOURCE_TOPIC "integrations/github/request/Getauthenticateduser"
        WITH DESTINATION_TOPIC "integrations/github/response/Getauthenticateduser"
        WITH METHOD "GET"
        WITH ENDPOINT "/user"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Listuserrepos
        WITH SOURCE_TOPIC "integrations/github/request/Listuserrepos"
        WITH DESTINATION_TOPIC "integrations/github/response/Listuserrepos"
        WITH METHOD "GET"
        WITH ENDPOINT "/user/repos"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Getrepo
        WITH SOURCE_TOPIC "integrations/github/request/Getrepo"
        WITH DESTINATION_TOPIC "integrations/github/response/Getrepo"
        WITH METHOD "GET"
        WITH ENDPOINT "/repos/{value.json.owner}/{value.json.repo}"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Listissues
        WITH SOURCE_TOPIC "integrations/github/request/Listissues"
        WITH DESTINATION_TOPIC "integrations/github/response/Listissues"
        WITH METHOD "GET"
        WITH ENDPOINT "/repos/{value.json.owner}/{value.json.repo}/issues"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Createissue
        WITH SOURCE_TOPIC "integrations/github/request/Createissue"
        WITH DESTINATION_TOPIC "integrations/github/response/Createissue"
        WITH METHOD "POST"
        WITH ENDPOINT "/repos/{value.json.owner}/{value.json.repo}/issues"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Listpulls
        WITH SOURCE_TOPIC "integrations/github/request/Listpulls"
        WITH DESTINATION_TOPIC "integrations/github/response/Listpulls"
        WITH METHOD "GET"
        WITH ENDPOINT "/repos/{value.json.owner}/{value.json.repo}/pulls"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Listworkflowruns
        WITH SOURCE_TOPIC "integrations/github/request/Listworkflowruns"
        WITH DESTINATION_TOPIC "integrations/github/response/Listworkflowruns"
        WITH METHOD "GET"
        WITH ENDPOINT "/repos/{value.json.owner}/{value.json.repo}/actions/runs"
        WITH HEADERS
            ADD "Accept" "application/vnd.github+json"
            ADD "Authorization" "Bearer {value.json.api_token}"
```

## Events

| Event | Method | Endpoint | Request topic | Response topic |
| - | - | - | - | - |
| Getratelimit | GET | `/rate_limit` | `integrations/github/request/Getratelimit` | `integrations/github/response/Getratelimit` |
| Getauthenticateduser | GET | `/user` | `integrations/github/request/Getauthenticateduser` | `integrations/github/response/Getauthenticateduser` |
| Listuserrepos | GET | `/user/repos` | `integrations/github/request/Listuserrepos` | `integrations/github/response/Listuserrepos` |
| Getrepo | GET | `/repos/{value.json.owner}/{value.json.repo}` | `integrations/github/request/Getrepo` | `integrations/github/response/Getrepo` |
| Listissues | GET | `/repos/{value.json.owner}/{value.json.repo}/issues` | `integrations/github/request/Listissues` | `integrations/github/response/Listissues` |
| Createissue | POST | `/repos/{value.json.owner}/{value.json.repo}/issues` | `integrations/github/request/Createissue` | `integrations/github/response/Createissue` |
| Listpulls | GET | `/repos/{value.json.owner}/{value.json.repo}/pulls` | `integrations/github/request/Listpulls` | `integrations/github/response/Listpulls` |
| Listworkflowruns | GET | `/repos/{value.json.owner}/{value.json.repo}/actions/runs` | `integrations/github/request/Listworkflowruns` | `integrations/github/response/Listworkflowruns` |

## Auth

Bearer token plus the GitHub media type:

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
ADD "Accept" "application/vnd.github+json"
ADD "Authorization" "Bearer {value.json.api_token}"
```

**api\_token** `string` *required*

Classic or fine-grained PAT. Publish it as `api_token`. Prefer a Hub secret. Never commit the token.

**owner** `string`

Repository owner. Required on repo, issue, pull, and Actions events.

**repo** `string`

Repository name. Required with `owner`.

Optional header on each event: `X-GitHub-Api-Version` `2022-11-28`.

Rate limit or authenticated user:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_GITHUB_PAT"}
```

List issues:

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_GITHUB_PAT", "owner": "octocat", "repo": "Hello-World"}
```

Create issue (connector body is `{payload}`; include `title` and `body`):

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{"api_token": "YOUR_GITHUB_PAT", "owner": "OWNER", "repo": "REPO", "title": "From Coreflux", "body": "Opened via REST_API route"}
```

## Try it

1. Add the connector on a lab broker.
2. Publish the token JSON to `integrations/github/request/Getratelimit` or `integrations/github/request/Getauthenticateduser`.
3. Subscribe to the matching `integrations/github/response/...` topic.
4. Issues: publish `api_token`, `owner`, and `repo` to `integrations/github/request/Listissues`.

> [!NOTE]
>
> Recorded probes without a usable PAT: `GET /rate_limit` HTTP 200 (remaining 0), invalid Bearer HTTP 401, `GET /zen` and `GET /repos/octocat/Hello-World` HTTP 403 (rate limit). `lot_lint` reported no findings on `GithubRestApi`.

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.