Test a Bunny Database connection
const url = 'https://api.deploybase.eu/api/v1/api/v1/projects/example/database/test';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"environment":"production","token":"example","url":"example"}'};
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/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.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Project ID
Request Body
Section titled “ Request Body ”Environment, and optionally a candidate url and token
object
Token is a candidate database token. Never stored here.
URL is a candidate Bunny Database URL (libsql://
Responses
Section titled “ Responses ”OK
object
object
object
LatencyMS is the round trip to Bunny in milliseconds. Only when status is ok.
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).
TokenKind is what the token’s own claims allow, read without verifying it (Bunny does). Only when status is ok.
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
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Unauthorized
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}FORBIDDEN below the member role
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}PROJECT_NOT_FOUND
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Internal Server Error
object
object
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Live 022265e7 built