OriginChainDB
Database endpoints

Execute SQL

Run SQL and receive rows for a query or a summary for a write or schema change.

POST /v1/tenants/{tenant}/sql

Run SQL and inspect its result kindMissing write counts are unknown; inspect all outcomes before retrying a batch.
  1. Prepare SQL and parametersBind values rather than inserting them into SQL text.
  2. Execute the statement or batchSend the required session ID when using a session.
  3. Read rows or write resultsCheck kind and any nested or failed outcomes.

Before you start

Use your database bearer token.

Connection setup

For this example, register demo.people and insert the quickstart rows. params binds $1 to the first array value.

Path parameters

FieldTypeRequired
tenantstringRequired

Headers

FieldTypeRequiredDescription
x-oc-db-userstringOptionalActing database user (role, grant and row-policy checks). Send with x-oc-db-key.
x-oc-db-keystringOptionalAPI key of the x-oc-db-user user.

Request body

application/json

Limits and accepted values
  • params binds $1, $2 and later placeholders in array order. It cannot be combined with a multi-statement batch.
  • A batch holds at most 256 statements. DDL and explicit transaction boundaries affect its atomicity; do not assume every statement rolls back together. See SQL compatibility.
  • session_id pins the statement to the transaction a BEGIN opened, equivalent to the X-OC-Session-Id header.
  • Optional headers: X-OC-Session-Id, X-OC-Statement-Timeout-Ms (408 on expiry), X-OC-Query-Id (client-chosen ULID, usable for cancellation; 409 if already running), X-OC-DB-User for database-user identity.
FieldTypeRequired
paramsany JSON[]Optional
Fields in params
FieldTypeRequired
paramsany JSONOptional
FieldTypeRequired
session_idstringOptional
sqlstringRequired

Read the result

Check kind first. A select returns rows and column metadata; writes report the counts the engine confirms. Batches can contain nested outcomes or stop after a failed statement, so inspect the whole result before retrying. Missing write counts mean unknown.

Response statuses

HTTP status reference
StatusWhat to do
200OK
202Accepted
400Correct the request before retrying.
401Check the credential and Authorization header.
402Check feature access or available credits.
403Check tenant access, roles and permissions.
404Check the resource ID and API route.
408Reduce query work or adjust the timeout.
409Resolve the conflict before retrying.
413Split or reduce the request body.
415Send the required Content-Type.
422Correct the values or unsupported combination.
429Honor Retry-After when present; back off.
499The client cancelled the request.
500Check the outcome before retrying a write.
501Check deployment support for this operation.
502Check service availability and the write outcome.
503Honor Retry-After when present; check write outcomes.
© 2026 Silicoyn Technologies Pvt Ltd