multi-router.aidocs

Prompts

GitHub Prompt

Prompts kept as files in a GitHub repository and synced to Multi-Router on every push.

A GitHub prompt is a .md or .json file in a GitHub repository that Multi-Router tracks. The repository stays the source of truth: prompt changes go through the team's usual review in pull requests, and when a commit that changes a tracked file lands on the tracked branch, Multi-Router picks up the new content. GitHub prompts are read-only in Multi-Router, their revisions are commits, and a router can be pinned to any commit of the file.

A repository is connected to Multi-Router through a GitHub connection and a prompt repo:

ObjectIdDescription
GitHub connectionThe GitHub loginA GitHub organization or personal account where the Multi-Router GitHub App is installed and claimed by the Multi-Router organization.
Prompt repopr_One repository and branch tracked as a prompt source, such as example-co/prompts on main.
GitHub promptpf_One tracked file in a prompt repo, such as prompts/support-triage.md.

Connecting a GitHub organization

A GitHub connection gives Multi-Router read access to the repositories the Multi-Router GitHub App is installed on. Connecting and disconnecting a GitHub organization requires an organization admin, and is done in the dashboard:

  1. On the Prompts page, select New Prompt and choose Connect new GitHub org.
  2. On GitHub, choose the organization or personal account, choose which repositories the App can read, and approve the install.
  3. GitHub returns to the Prompts page, which claims the installation for the organization and opens the form to connect a repository.

Manage GitHub orgs on the same menu lists the connected organizations, with Connect, Disconnect, Authorize GitHub and Re-authorize. The panel shows which GitHub user it is listing installations for, and an installation is claimed by an admin who has used Authorize GitHub and can see the installation on GitHub. A GitHub installation can be claimed by more than one Multi-Router organization. Disconnecting a GitHub organization stops its prompt repos from syncing: routers that track latest keep the content last synced, and routers pinned to an earlier commit return an error until the organization is connected again.

Connecting a repository

A prompt repo tracks one branch of one repository. In the dashboard:

  1. Select New Prompt and choose Connect repo from the connected GitHub organization.
  2. Search for and choose the repository, then choose the branch.
  3. Choose the .md and .json files to track, and connect.

Multi-Router fetches each chosen file at once, and each file appears on the Prompts page as a GitHub prompt. A repository and branch are connected once per organization; to track another branch of the same repository, connect it as a second prompt repo. Through the API, a prompt repo is connected with POST /v1/prompt-repos. Connect the repository's GitHub organization in the dashboard first; until it is connected, each file of the prompt repo shows the status error with the message github account not connected.

Connect a prompt repobash
curl -X POST https://api.multi-router.ai/v1/prompt-repos \
  -H "Authorization: Bearer $MR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support prompts",
    "repository": "example-co/prompts",
    "branch": "main",
    "file_paths": ["prompts/support-triage.md", "prompts/refund-examples.json"]
  }'
Response 201json
{
  "organization_id": "org_7Tq2Wd9KxP",
  "data": {
    "id": "pr_Xb5Nq2Lw8T",
    "object": "prompt_repo",
    "etag": "\"1\"",
    "name": "Support prompts",
    "repository": "example-co/prompts",
    "branch": "main",
    "sync": { "status": "synced", "last_synced_at": "2026-09-14T17:20:04Z" },
    "tags": [],
    "created_at": "2026-09-14T17:20:03Z",
    "updated_at": "2026-09-14T17:20:04Z"
  }
}

Tracked files

A tracked file is a path in the prompt repo that Multi-Router keeps in sync. A file path is relative to the repository root, up to 512 characters, ends in .md or .json in any letter case, and starts with a file or folder name, with every segment other than . or ... A .md file is a text prompt whose content is the file's text, and a .json file is a chat prompt whose content is a JSON array of messages. See Prompt Type.

On the prompt's page, Add files opens a list of the branch's files with the tracked files checked and locked, and Stop tracking removes the file from Multi-Router while leaving it in the repository. Through the API, POST /v1/prompt-repos/{id}/files with a path tracks one file, and DELETE /v1/prompt-repos/{id}/files?path= stops tracking it. GET /v1/prompt-repos/{id}/files lists the tracked files with their prompt ids and sync status. A file that routers are bound to stays tracked until those routers are unbound, and the request is refused with prompt_in_use.

Syncing

Syncing is how a commit on GitHub reaches Multi-Router. When a push lands on a tracked branch, GitHub notifies Multi-Router, which fetches each tracked file the push added, changed or removed, in every organization and prompt repo that tracks that branch. Files the push did not touch keep their current content. A router that tracks latest uses the new content from its next request, usually within seconds of the push.

A file is fetched when it is first tracked, when it is added again, and on each push that changes it. Each tracked file has a status:

StatusMeaning
pendingThe file is tracked and its first fetch has not finished.
syncedThe file was fetched and its content is current with the branch.
errorThe last fetch failed. The error message says why.

When a fetch fails for a temporary reason, such as a GitHub outage or rate limit, the file keeps serving the content from its last successful fetch until the next push syncs it. When the file has been removed from the branch, or its content is not a valid prompt, routers bound to it return an error until the file is fixed and pushed again. The error message is one of:

Error messageCause
removed upstreamA push deleted the file from the tracked branch.
invalid chat body: …A .json file is not a valid chat prompt. The message describes the problem.
github account not connectedThe repository's GitHub organization is no longer connected.
github: unauthorizedThe GitHub App no longer has access to the repository.
github: not foundThe repository, branch or file was not found.
github: rate limitedGitHub limited the number of requests.
github: server errorGitHub returned a server error.
github: timed outGitHub did not respond in time.
github: response too largeThe file is larger than the prompt size limit.
github: network errorGitHub could not be reached.
github: api errorGitHub returned an unexpected error.
github: malformed responseGitHub returned a response Multi-Router could not read.
github: credentials misconfiguredThe GitHub integration for this Multi-Router installation is set up incorrectly.

Revisions

The revisions of a GitHub prompt are the commits on the tracked branch that changed the file, newest first, each with its commit SHA, commit message and date. The prompt's History tab lists them, and a router can be pinned to any of them by its SHA, written in full or shortened to at least 7 characters. The API reads them with GET /v1/prompts/{id}/versions and GET /v1/prompts/{id}/versions/{sha}, which read the history from GitHub when called, and return up to the 100 most recent revisions. Reading a single commit returns its version and body. The commits of the whole repository, or of one tracked file, are listed with GET /v1/prompt-repos/{id}/commits. When GitHub cannot be read, the revision endpoints return 502 with github_unavailable, when the GitHub organization is not connected, or github_error, when the fetch fails.

The GitHub prompt page

Back to Prompts

example-co/prompts

syncedmain
3 files tracked · last sync 3 days ago
Disconnect
supportproductionAdd tag
prompts/support-triage.md
synced3f9c2a7
Add filesStop tracking
ContentHistory
You are a support agent for {{product}}.

Classify the customer's message as billing, technical or account, then answer in {{language}}.
Keep answers under 120 words and link to the help center when an article covers the question.

Read-only — push to GitHub to update.

Variables
Auto-detected from body. Provide values via prompt_variables at request time.
{{product}}
{{language}}
A tracked GitHub file: its repository and branch, the file switcher, sync status and commit, and its read-only content. Select to enlarge.

A GitHub prompt's page shows the file's content with a note that it is read-only and changes by pushing to GitHub, and a History tab with its commits. A file switcher moves between the files of the same prompt repo. The page offers Add files, Stop tracking and Disconnect, which disconnects the whole prompt repo.

Disconnecting a repository

Disconnecting a prompt repo stops tracking all of its files, and their GitHub prompts are removed from Multi-Router. The repository on GitHub is unchanged. A prompt repo with files that routers are bound to stays connected until those routers are unbound, and the request is refused with prompt_in_use. Through the API, a prompt repo is disconnected with DELETE /v1/prompt-repos/{id}, which returns the number of files removed:

Delete response 200json
{ "organization_id": "org_7Tq2Wd9KxP", "id": "pr_Xb5Nq2Lw8T", "object": "prompt_repo", "deleted": true, "files_deleted": 2 }

GitHub connections in the API

GitHub connections are read and removed through the API, and created in the dashboard because installing the GitHub App takes place on GitHub.

EndpointDescription
GET /v1/github/connectionsLists the connected GitHub organizations, each with its login, installation_id and connected_at.
GET /v1/github/connections/{login}Reads one connection.
DELETE /v1/github/connections/{login}Disconnects a GitHub organization. Its prompt repos stay and stop syncing. Accepts dry_run.

Errors

Connecting repositories and tracking files return the following errors:

ErrorStatusCause
prompt_repo_exists409The organization already tracks this repository and branch.
invalid_field400A file path, repository name or branch is not valid.
prompt_repo_not_found404No prompt repo with that id exists in the organization.
file_not_found404The prompt repo does not track that file.
github_not_connected424The repository's GitHub organization is not connected.
github_repo_not_found404The connected organization cannot find the repository or branch.
connection_not_found404No connected GitHub organization has that login.
prompt_in_use409Routers are bound to a file being untracked or disconnected. The message lists the routers.
source_read_only409An edit or delete names a GitHub prompt through the prompt endpoints.
rate_limited429The organization made more than 60 requests in a minute that check GitHub.
invalid_body400A required field is missing, or the body has the wrong shape.
invalid_json400The request body is not valid JSON.
version_conflict412The If-Match ETag is stale. The response carries the current prompt repo.
use_sub_collection400A PATCH sends files or tags, which change through their own endpoints. The valid field of the error lists the endpoint path template, such as /v1/prompt-repos/{id}/files; {id} is not replaced with the object id.
github_not_configured503The GitHub integration is not set up for this Multi-Router installation.
Inline PromptPrompt Type
Was this helpful?