neosourceDocs
Search docs

Import a repository from a public git URL

POST/api/imports/url

createUrlImport

Creates a new neosource repository in 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.

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

CreateUrlImportRequest

object

Request to import a repository from a public git URL into a new neosource repo (`POST /api/imports/url`). Provider-agnostic and OAuth-free — any public HTTPS git host (GitHub, GitLab, Codeberg, a self-hosted Gitea, …) works, because a public repo clones for anyone. The URL is validated server-side (https-only, no embedded credentials, host must resolve to a public address) before the import is enqueued.

clone_urlrequired

string

Public HTTPS git clone URL, e.g. `https://github.com/owner/repo.git`.

target_name

string | null

Optional name for the created neosource repo; defaults to the last path segment of the clone URL (with any `.git` suffix stripped).

visibility
one of
  • null

  • RepoVisibilityInput

    string

    "public""internal""private"

additional propertiesnot allowed

Responses

202Repo created and import enqueued

application/json

ImportEnqueuedResponse

object

Returned by `POST /api/github/imports` once the target repo is created and the import job is enqueued. The SPA navigates to `/{owner}/{repo}` and watches the existing import-progress SSE.

job_idrequired

string

Import job id (for debugging / correlation).

ownerrequired

string

reporequired

string

403Forbidden — one of: forbidden, needs_scope

application/json

one of
  • ErrorForbidden
  • NeedsScopeError

    object

    `403` body returned when listing private repos but the linked identity lacks the required provider scope. The SPA turns this into an incremental-authorization prompt (Tier 2) that calls the `/elevate` OAuth endpoint with this `scope`.

    errorrequired

    string

    Always `needs_scope` — this body exists to carry the extra fields that kind needs.

    "needs_scope"

    scoperequired

    string

    The provider scope to request via elevation (e.g. `"repo"`).

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