Skip to main content
Before connecting a repository to a project, your frontend needs to let the user browse their GitHub account. These two endpoints power that flow: one fetches the list of organizations (plus the user’s personal account), and the other lists repositories for a chosen organization or account. Both endpoints call the GitHub API on behalf of the authenticated user using their stored GitHub access token — no extra GitHub credentials are needed in the request.

GET /api/repo/orgs

Returns all GitHub organizations the authenticated user belongs to, with the user’s personal account prepended to the list. Requires JWT. The server fetches GET /user/orgs and GET /user from the GitHub API in parallel and merges the results. The personal account always appears first so it can be used as the default selection in a repo picker.

Curl example

curl https://your-server/api/repo/orgs \
  -H "Authorization: Bearer <your-jwt>"

Response

{
  "organizations": [
    {
      "login": "your-github-username",
      "avatar_url": "https://avatars.githubusercontent.com/u/12345678"
    },
    {
      "login": "acme-corp",
      "avatar_url": "https://avatars.githubusercontent.com/u/87654321"
    }
  ]
}

Response fields

organizations
array
required
Ordered list of accounts. The first entry is always the authenticated user’s personal account; subsequent entries are their GitHub organizations.
organizations[].login
string
The GitHub login (username or organization slug). Pass this value as the org query parameter to GET /api/repo/repos.
organizations[].avatar_url
string
URL of the account’s GitHub avatar image.

GET /api/repo/repos

Returns repositories for a given organization or personal account. If the org parameter matches the authenticated user’s own login, the server fetches personal repos owned by that user (sorted by creation date, descending). For any other value, it fetches repos belonging to that organization. Requires JWT.

Query parameters

org
string
GitHub login of the organization or personal account whose repositories you want to list. Defaults to the authenticated user’s own login if omitted.
page
number
Page number for pagination. Defaults to 1. Each page returns up to 100 repositories.

Curl example

# List personal repos
curl "https://your-server/api/repo/repos?org=your-github-username" \
  -H "Authorization: Bearer <your-jwt>"

# List repos for an organization
curl "https://your-server/api/repo/repos?org=acme-corp&page=2" \
  -H "Authorization: Bearer <your-jwt>"

Response

{
  "repos": [
    {
      "name": "my-app",
      "branch": "main",
      "repoUrl": "https://github.com/your-github-username/my-app",
      "owner": "your-github-username",
      "updatedAt": "2026-03-15T10:24:00Z"
    },
    {
      "name": "api-service",
      "branch": "master",
      "repoUrl": "https://github.com/your-github-username/api-service",
      "owner": "your-github-username",
      "updatedAt": "2026-02-01T08:00:00Z"
    }
  ]
}

Response fields

repos
array
required
List of repositories for the requested account or organization.
repos[].name
string
Repository name (without the owner prefix).
repos[].branch
string
The repository’s default branch (e.g., main or master). Use this as the default value for the branch field when creating a project.
repos[].repoUrl
string
The HTTPS URL of the repository on GitHub (e.g., https://github.com/owner/repo). Pass this as repoUrl when creating a project.
repos[].owner
string
GitHub login of the repository owner.
repos[].updatedAt
string
ISO 8601 timestamp of the last push to the repository, as reported by GitHub.

Error responses

StatusCondition
400The authenticated user record was not found in the database
401JWT is missing or invalid

Build docs developers (and LLMs) love