Skip to content

Test a Bunny Database connection

POST
/api/v1/projects/{id}/database/test
curl --request POST \
--url https://api.deploybase.eu/api/v1/api/v1/projects/example/database/test \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "environment": "production", "token": "example", "url": "example" }'

Runs SELECT 1 against a Bunny Database. With url and token, tests those candidates (nothing is stored). With neither, tests BUNNY_DATABASE_URL and BUNNY_DATABASE_AUTH_TOKEN as stored for the environment (an environment-specific value beats an “all” one, whatever its targets). Every outcome of the test itself is a 200 with a status; the URL, its host and the token are never returned. latency_ms and token_kind are present only when status is ok.

id
required
string

Project ID

Environment, and optionally a candidate url and token

Media type application/json
object
environment
required
string
Allowed values: production preview
token

Token is a candidate database token. Never stored here.

string
<= 16384 characters
url

URL is a candidate Bunny Database URL (libsql://.lite.bunnydb.net). Never stored here.

string
<= 2048 characters

OK

Media type application/json
object
data
meta
object
request_id
string
timestamp
string
trace_id
string
data
object
latency_ms

LatencyMS is the round trip to Bunny in milliseconds. Only when status is ok.

integer
status

Status is ok, rejected (Bunny refused the token), not_found (no such database), unreachable (timeout, network, redirect, 5xx or an unreadable answer), not_configured (stored mode: a variable is missing) or invalid_url (stored mode: the stored URL is not a Bunny Database URL).

string
Allowed values: ok rejected not_found unreachable not_configured invalid_url
token_kind

TokenKind is what the token’s own claims allow, read without verifying it (Bunny does). Only when status is ok.

string
Allowed values: full_access read_only unknown

Example

{
"data": {
"status": "ok",
"token_kind": "full_access"
}
}

INVALID_INPUT for a bad body, an unknown environment, or only one of url and token; INVALID_DATABASE_URL for a candidate url that is not a Bunny Database URL

Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string

Example generated

{
"code": "example",
"details": "example",
"error": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
}
}

Unauthorized

Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string

Example generated

{
"code": "example",
"details": "example",
"error": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
}
}

FORBIDDEN below the member role

Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string

Example generated

{
"code": "example",
"details": "example",
"error": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
}
}

PROJECT_NOT_FOUND

Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string

Example generated

{
"code": "example",
"details": "example",
"error": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
}
}

Internal Server Error

Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string

Example generated

{
"code": "example",
"details": "example",
"error": "example",
"meta": {
"request_id": "example",
"timestamp": "example",
"trace_id": "example"
}
}

Live 022265e7 built