Database
Projects with Frontend Cloud enabled get their own SQL (SQLite) database. These endpoints run SQL and inspect the schema over HTTP. If Frontend Cloud is not enabled for the project, both return 409 database_not_connected.
Run a query
Section titled “Run a query”POST /api/v1/projects/{id}/database/queryBody: sql (required), optional params (array, for parameterized statements). Returns { result } with the query’s result set.
curl -X POST "https://www.frontend.co/api/v1/projects/$ID/database/query" \ -H "Authorization: Bearer $FRONTEND_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "sql": "select * from posts limit 5" }'const rows = await client.database.query(projectId, 'select * from posts limit 5')await client.database.query(projectId, 'insert into posts (title) values (?)', ['Hello'])Get the schema
Section titled “Get the schema”GET /api/v1/projects/{id}/database/schemaReturns { schema } — a map of table name to its columns (name, type, nullability, default, primary key).
const schema = await client.database.schema(projectId)