Detect a repository's build settings
const url = 'https://api.deploybase.eu/api/v1/api/v1/projects/detect';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"branch":"main","provider":"github","repo_url":"https://codeberg.org/acme/site","root_directory":"apps/site","token":"example","username":"gitlab+deploy-token-123"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.deploybase.eu/api/v1/api/v1/projects/detect \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "branch": "main", "provider": "github", "repo_url": "https://codeberg.org/acme/site", "root_directory": "apps/site", "token": "example", "username": "gitlab+deploy-token-123" }'Reads a repository from its https URL and proposes the branch, root directory, framework, package manager, build command and output folder, each with the evidence behind it (source) and whether it was read from the repository or is our default (kind). checks lists what will stop the site from building or running as a static site. Only what detection needs is read: the refs, one shallow blobless fetch of the trees, and a few small files. The host must be public (private, link-local, metadata and reserved addresses are refused at connect time), redirects must stay on the same host, and the whole read is limited in size and time. Limited per team. 422 GIT_VALIDATION_FAILED carries details.git_error_code: auth_required (private or missing, no token sent), auth_failed (the token was refused), repo_not_found, host_not_found, host_not_allowed, timeout, too_large, connection_failed, unknown, and deploy_token_username_required (a GitLab deploy token sent without its username, refused before the host is contacted). With auth_failed, details.git_error_reason says why: token_not_accepted (the host answered 401: the token is wrong, expired or revoked, or a GitLab deploy token went with the wrong username), token_cannot_read (403: the token was accepted but may not read code, e.g. a scope without read_repository), token_needs_fine_grained (403: the GitLab group accepts only fine-grained tokens, so the token needs Code: Download on the project) or token_role_cannot_read (403: GitLab took the token and its scope, but its role may not download this project’s code: a project or group token left on the default Guest role, or a person who is Guest or no member; it needs Reporter or higher). When the request named no provider and the host identified itself as GitLab (its Basic realm, or a GitLab token), details.git_provider is gitlab, and a successful answer carries provider. 422 INVALID_INPUT with details.field username: a username without a token, or one that is not 1-255 letters, digits and . + _ -.
Authorizations
Section titled “ Authorizations ”Request Body
Section titled “ Request Body ”Repository to read
object
Branch to read. Omit to read the repository’s default branch.
Example
mainProvider picks the default username the token is sent with (e.g. oauth2 for GitLab).
RepoURL is the repository’s https clone URL.
Example
https://codeberg.org/acme/siteRootDirectory is the folder to detect in. Omit to let detection find it.
Example
apps/siteToken for a private repository. Used for this request only, never stored or logged.
Username is sent with the token instead of the provider default. Only needed for a GitLab deploy token (gldt-), which works only with its own username. Requires token.
Example
gitlab+deploy-token-123Responses
Section titled “ Responses ”OK
object
object
object
object
object
Title is the check’s own heading, when it has one; the setup page otherwise heads it by its severity.
Provider is the provider the request named, else the one detected (gitlab from GitLab’s Basic realm or a GitLab token). Omitted when neither is known.
object
Commit is the full id of the commit detection read, on the chosen branch.
object
Branch is only set when detection knew the repository’s branches (the Git URL path).
object
Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.
Kind is detected, default or requested.
Label is a human name for Value, e.g. “Astro 5”. Only on the framework.
Source says where Value came from, in words: “found astro.config.mjs”.
Value is the setting. null means there is nothing to set (no framework we know, no package manager because there is no package.json). An empty string is a real value: no build command, or the top of the repository.
object
Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.
Kind is detected, default or requested.
Label is a human name for Value, e.g. “Astro 5”. Only on the framework.
Source says where Value came from, in words: “found astro.config.mjs”.
Value is the setting. null means there is nothing to set (no framework we know, no package manager because there is no package.json). An empty string is a real value: no build command, or the top of the repository.
object
Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.
Kind is detected, default or requested.
Label is a human name for Value, e.g. “Astro 5”. Only on the framework.
Source says where Value came from, in words: “found astro.config.mjs”.
Value is the setting. null means there is nothing to set (no framework we know, no package manager because there is no package.json). An empty string is a real value: no build command, or the top of the repository.
object
Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.
Kind is detected, default or requested.
Label is a human name for Value, e.g. “Astro 5”. Only on the framework.
Source says where Value came from, in words: “found astro.config.mjs”.
Value is the setting. null means there is nothing to set (no framework we know, no package manager because there is no package.json). An empty string is a real value: no build command, or the top of the repository.
object
Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.
Kind is detected, default or requested.
Label is a human name for Value, e.g. “Astro 5”. Only on the framework.
Source says where Value came from, in words: “found astro.config.mjs”.
Value is the setting. null means there is nothing to set (no framework we know, no package manager because there is no package.json). An empty string is a real value: no build command, or the top of the repository.
object
Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.
Kind is detected, default or requested.
Label is a human name for Value, e.g. “Astro 5”. Only on the framework.
Source says where Value came from, in words: “found astro.config.mjs”.
Value is the setting. null means there is nothing to set (no framework we know, no package manager because there is no package.json). An empty string is a real value: no build command, or the top of the repository.
Example
{ "data": { "checks": [ { "severity": "blocking" } ], "provider": "github", "repo": { "visibility": "public" }, "settings": { "branch": { "kind": "detected" }, "build_command": { "kind": "detected" }, "framework": { "kind": "detected" }, "output_dir": { "kind": "detected" }, "package_manager": { "kind": "detected" }, "root_directory": { "kind": "detected" } } }}Invalid input; details.field names the field
object
object
object
The structured outcome (ADR-030, DEP-965). Optional and additive: only the operations endpoints fill them so far, and a client that does not know them reads the rest as before.
Example generated
{ "code": "example", "details": "example", "docs_url": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }, "next_actions": [ { "action": "example", "cli": "example", "description": "example", "http": "example", "tool": "example" } ], "reason": "example", "who_acts": "example"}Forbidden
object
object
object
The structured outcome (ADR-030, DEP-965). Optional and additive: only the operations endpoints fill them so far, and a client that does not know them reads the rest as before.
Example generated
{ "code": "example", "details": "example", "docs_url": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }, "next_actions": [ { "action": "example", "cli": "example", "description": "example", "http": "example", "tool": "example" } ], "reason": "example", "who_acts": "example"}GIT_VALIDATION_FAILED with details.git_error_code, or INVALID_INPUT for username
object
object
object
The structured outcome (ADR-030, DEP-965). Optional and additive: only the operations endpoints fill them so far, and a client that does not know them reads the rest as before.
Example generated
{ "code": "example", "details": "example", "docs_url": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }, "next_actions": [ { "action": "example", "cli": "example", "description": "example", "http": "example", "tool": "example" } ], "reason": "example", "who_acts": "example"}RATE_LIMIT_EXCEEDED: too many detections for this team
object
object
object
The structured outcome (ADR-030, DEP-965). Optional and additive: only the operations endpoints fill them so far, and a client that does not know them reads the rest as before.
Example generated
{ "code": "example", "details": "example", "docs_url": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }, "next_actions": [ { "action": "example", "cli": "example", "description": "example", "http": "example", "tool": "example" } ], "reason": "example", "who_acts": "example"}Live 582ac705 built