Skip to content

Detect a repository's build settings

POST
/api/v1/projects/detect
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 . + _ -.

Repository to read

Media type application/json
object
branch

Branch to read. Omit to read the repository’s default branch.

string
<= 255 characters

Example

main
provider

Provider picks the default username the token is sent with (e.g. oauth2 for GitLab).

string
Allowed values: github gitlab bitbucket codeberg
repo_url
required

RepoURL is the repository’s https clone URL.

string
<= 2048 characters

Example

https://codeberg.org/acme/site
root_directory

RootDirectory is the folder to detect in. Omit to let detection find it.

string
<= 255 characters

Example

apps/site
token

Token for a private repository. Used for this request only, never stored or logged.

string
<= 500 characters
username

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.

string
<= 255 characters

Example

gitlab+deploy-token-123

OK

Media type application/json
object
data
meta
object
request_id
string
timestamp
string
trace_id
string
data
object
checks
Array<object>
object
code
string
fix
object
file
string
setting
string
snippet
string
value
string
message
string
severity
string
Allowed values: blocking warning
title

Title is the check’s own heading, when it has one; the setup page otherwise heads it by its severity.

string
duration_ms
integer
provider

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.

string
Allowed values: github gitlab bitbucket codeberg
repo
object
branches
Array<string>
branches_truncated
boolean
commit

Commit is the full id of the commit detection read, on the chosen branch.

string
default_branch
string
reachable
boolean
visibility
string
Allowed values: public private unknown
settings
object
branch

Branch is only set when detection knew the repository’s branches (the Git URL path).

object
candidates

Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.

Array<string>
kind

Kind is detected, default or requested.

string
Allowed values: detected default requested
label

Label is a human name for Value, e.g. “Astro 5”. Only on the framework.

string
source

Source says where Value came from, in words: “found astro.config.mjs”.

string
value

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.

string
build_command
object
candidates

Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.

Array<string>
kind

Kind is detected, default or requested.

string
Allowed values: detected default requested
label

Label is a human name for Value, e.g. “Astro 5”. Only on the framework.

string
source

Source says where Value came from, in words: “found astro.config.mjs”.

string
value

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.

string
framework
object
candidates

Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.

Array<string>
kind

Kind is detected, default or requested.

string
Allowed values: detected default requested
label

Label is a human name for Value, e.g. “Astro 5”. Only on the framework.

string
source

Source says where Value came from, in words: “found astro.config.mjs”.

string
value

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.

string
output_dir
object
candidates

Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.

Array<string>
kind

Kind is detected, default or requested.

string
Allowed values: detected default requested
label

Label is a human name for Value, e.g. “Astro 5”. Only on the framework.

string
source

Source says where Value came from, in words: “found astro.config.mjs”.

string
value

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.

string
package_manager
object
candidates

Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.

Array<string>
kind

Kind is detected, default or requested.

string
Allowed values: detected default requested
label

Label is a human name for Value, e.g. “Astro 5”. Only on the framework.

string
source

Source says where Value came from, in words: “found astro.config.mjs”.

string
value

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.

string
root_directory
object
candidates

Candidates lists the folders to choose from when a repository holds several apps. Only on root_directory.

Array<string>
kind

Kind is detected, default or requested.

string
Allowed values: detected default requested
label

Label is a human name for Value, e.g. “Astro 5”. Only on the framework.

string
source

Source says where Value came from, in words: “found astro.config.mjs”.

string
value

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.

string

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

Media type application/json
object
code
string
details
docs_url
string
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
next_actions
Array<object>
object
action
string
cli
string
description
string
http
string
tool
string
reason

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.

string
who_acts
string

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

Media type application/json
object
code
string
details
docs_url
string
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
next_actions
Array<object>
object
action
string
cli
string
description
string
http
string
tool
string
reason

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.

string
who_acts
string

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

Media type application/json
object
code
string
details
docs_url
string
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
next_actions
Array<object>
object
action
string
cli
string
description
string
http
string
tool
string
reason

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.

string
who_acts
string

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

Media type application/json
object
code
string
details
docs_url
string
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
next_actions
Array<object>
object
action
string
cli
string
description
string
http
string
tool
string
reason

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.

string
who_acts
string

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