Database

Execute a raw SQL query

Execute a raw SQL query against the project's SQLite database. Use positional parameters (params or args) to avoid injection. Accepts params, args, or named_args interchangeably. Use ? placeholders in the query when using params/args. The statement is executed verbatim against the underlying database, with no keyword filtering. Requires a service credential (secret key).

post/api/db/{project_id}/sql

Request

  • Base URL
    https://core.blink.new
  • URL
    https://core.blink.new/api/db/{project_id}/sql
  • Auth
    HTTP bearer

Path parameters

project_idstring required
Example:my-project-123

Unique identifier for the project

Request body

querystring required

SQL query to execute (use $1, $2, etc. for parameters)

Example request

{
  "query": "SELECT * FROM users WHERE status = $1 AND age > $2",
  "params": [
    "active",
    18
  ]
}

Response

Query executed successfully

rowsobject[]

Query result rows

columnsstring[]

Column names

rowCountinteger

Number of rows returned/affected

executionTimenumber

Query execution time in milliseconds

Changes

No recorded changes to this operation across all 1 revision of this API.