Quickstart
1
Get your Database URL
Your Database URL can be found in the Dashboard under Edge Platform > Database > [Select Database] > Access.The HTTP endpoint follows this format:
Note the
/v2/pipeline path — this is the endpoint that accepts SQL requests.2
Get your Access Token
You’ll need an access token to authenticate requests. Generate one from the same Access page in the Dashboard, or see Database Access for details.
3
Execute a query
Send a POST request to the pipeline endpoint with your SQL statement:
Request format
Each request to/v2/pipeline contains an array of requests to execute. A typical request includes an execute statement followed by a close:
Response format
The response contains aresults array with the outcome of each request:
Parameter binding
Use parameter binding to safely pass values to your queries. This helps prevent SQL injection and handles proper escaping.Positional parameters
Use? placeholders and provide values in the args array:
Named parameters
Use:name, $name, or @name placeholders with named_args:
Value types
Each value is a JSON object with atype field. The shape of the object depends on the type:
The server rejects values that do not match these shapes:
- An
integervalue must be a JSON string, not a number. This avoids precision loss, since some JSON implementations treat all numbers as 64-bit floats. - A
floatvalue must be a JSON number. Sending it as a string returns a400error. - A
blobcarries its data in abase64field, not invalue. The server accepts base64 with or without padding.
Blobs in responses are encoded as base64 without padding. If your base64
decoder is strict, add the missing
= padding before decoding.Multiple statements
You can execute multiple statements in a single request:Interactive sessions
For most use cases, executing statements with aclose request in a single HTTP call is sufficient. The API also supports interactive sessions using a baton, a token returned in responses that allows you to maintain state across multiple HTTP requests. This is useful for advanced scenarios like long-running transactions that span multiple roundtrips.
If you have a use case that requires interactive sessions with batons,
contact us to discuss your requirements.