Import a GitHub repository
POST/api/github/imports
createGithubImport
Creates a new neosource repository in the caller's personal workspace and enqueues a background import that clones the GitHub repo into it. Watch progress via the repo's `import-progress` SSE / `import-status` endpoints. `relationship` says what tie to keep with the GitHub repository (ADR 0115). In this build only `neosource_readonly_mirror` can be established — issues, comments and labels are imported and kept in sync, and GitHub stays authoritative. `github_managed` and `move_now` answer `409 relationship_unavailable`, refused **before the repository is created** so a refusal never leaves an orphan behind. The deprecated `sync_metadata: true` means exactly `relationship: "neosource_readonly_mirror"`; sending both is `400`. Two further refusals land at that same early point, so neither can orphan a repository either: asking for `neosource_readonly_mirror` without a linked GitHub identity carrying a stored access token answers `400` (connect GitHub in account settings first — it is the credential the metadata backfill and the recurring polls run on), and a token locked to specific repositories or workspaces answers `403`, because every import spends the owner's stored GitHub credential on a repository the token was never scoped to. Sessions and unrestricted tokens are unaffected.
Requires authentication using a session cookie or a bearer token — see tokens and scopes.
curl
curl -X POST 'https://neosource.dev/api/github/imports' \
-H 'Authorization: Bearer $NEOSOURCE_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"source_full_name":"string"}'fetch
fetch("https://neosource.dev/api/github/imports", {
method: "POST",
headers: {
Authorization: "Bearer $NEOSOURCE_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({"source_full_name":"string"}),
});Request bodyrequired
application/json
Responses
202Repo created and import enqueued
application/json
Standard errors
Bodies documented once for the whole API — see standard errors.
- 400Bad Request — one of: invalid_input
- 401Authentication required
- 403Forbidden — one of: forbidden
- 404Not Found — one of: not_found
- 409Conflict — one of: already_exists, conflict, relationship_unavailable
- 429Rate limited — retry after the `Retry-After` header
- 500Internal server error
- 503Service temporarily unavailable / at capacity — retry after the `Retry-After` header
- 504Gateway timeout — the request exceeded the server's handling budget