Import a repository from a public git URL
POST/api/imports/url
createUrlImport
Creates a new neosource repository in the workspace named by `owner` (omitted = the caller's personal workspace) and enqueues a background import that clones a PUBLIC git URL into it — no OAuth, provider-agnostic (GitHub, GitLab, Codeberg, self-hosted, …). The URL is validated (https-only, no credentials, host must resolve to a public address) before enqueue. Watch progress via the repo's `import-progress` SSE / `import-status` endpoints. Every target, the caller's personal workspace included, needs `workspace:repo:create` there, decided **before the repository is created**: `404` for an unknown owner, `403` without the permission. A session or an unrestricted token holds it in the caller's personal workspace; a token whose scopes do not cover it, or one locked to other workspaces or to repositories, is refused `403` there too. The import queue is bounded: `429` when the caller already has the per-user maximum of imports queued or running, `503` when the platform-wide queue is full. Both are retryable and carry `Retry-After`, and both land **before the repository is created**.
Requires authentication using a session cookie or a bearer token — see tokens and scopes.
curl
curl -X POST 'https://neosource.dev/api/imports/url' \
-H 'Authorization: Bearer $NEOSOURCE_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"clone_url":"string"}'fetch
fetch("https://neosource.dev/api/imports/url", {
method: "POST",
headers: {
Authorization: "Bearer $NEOSOURCE_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({"clone_url":"string"}),
});Request bodyrequired
application/json
Responses
202Repo created and import enqueued
application/json
403Forbidden — one of: forbidden, needs_scope
application/json
Standard errors
Bodies documented once for the whole API — see standard errors.
- 400Bad Request — one of: invalid_input
- 401Authentication required
- 404Not Found — one of: not_found
- 409Conflict — one of: already_exists, conflict
- 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