Database Services

Working with Your Database

WoWSQL automatically generates REST APIs for every table in your database. Query, insert, update, and delete data with simple HTTP requests.

Querying Data

Query your tables with powerful filtering, sorting, and pagination:

POST /api/v1/db/tables/{table_name}/query

Headers:
  Authorization: Bearer YOUR_ACCESS_TOKEN
  X-Project-Slug: your-project-slug
  Content-Type: application/json

Body:
{
  "select": ["id", "name", "email"],
  "filters": [
    {"column": "status", "operator": "eq", "value": "active"},
    {"column": "created_at", "operator": "gte", "value": "2024-01-01"}
  ],
  "order_by": [{"column": "created_at", "direction": "desc"}],
  "limit": 20,
  "offset": 0
}

Authentication: this is a control-plane endpoint on https://api.wowsql.com. Send a WoWSQL account access token (the JWT issued when you sign in to your WoWSQL account) as Authorization: Bearer .... Project API keys (wowsql_anon_... / wowsql_service_...) are rejected with 401 here; use them with the REST API on your project host instead.

Filter Operators

Use these operators in your filters:

  • eq - Equal to
  • neq - Not equal to (ne is not accepted)
  • gt - Greater than
  • gte - Greater than or equal
  • lt - Less than
  • lte - Less than or equal
  • like - Contains (the value is wrapped as %value%)
  • in / not_in - Value in / not in an array
  • between / not_between - Value in / outside a two-element range
  • is with value null - Is NULL
  • is_not with value null - Is not NULL

Any other operator returns an "Unsupported operator" error. group_by / having accept eq, neq, gt, gte, lt and lte.

Inserting Data

POST /api/v1/db/tables/{table_name}/query is a read (SELECT) endpoint. To write rows, use the auto-generated REST API (PostgREST) on your project host with your API key, exactly as the SDKs do:

POST https://your-project-slug.wowsqlconnect.com/rest/v1/{table_name}

Headers:
  apikey: YOUR_API_KEY
  Content-Type: application/json
  Prefer: return=representation

Body:
{
  "name": "John Doe",
  "email": "john@example.com",
  "status": "active"
}

Updating Data

PATCH https://your-project-slug.wowsqlconnect.com/rest/v1/{table_name}?id=eq.1

Headers:
  apikey: YOUR_API_KEY
  Content-Type: application/json
  Prefer: return=representation

Body:
{
  "name": "Jane Doe",
  "status": "inactive"
}

Deleting Data

DELETE https://your-project-slug.wowsqlconnect.com/rest/v1/{table_name}?id=eq.1

Headers:
  apikey: YOUR_API_KEY

Warning: DELETE /api/v1/db/tables/{table_name} (without /query) drops the whole table. Use the REST call above to delete rows.

Running Custom SQL

Execute custom SQL queries when needed:

Send one statement as query, or several as a queries array; semicolon-separated scripts are split and run statement by statement.

POST /api/v1/db/execute

Headers:
  Authorization: Bearer YOUR_ACCESS_TOKEN
  X-Project-Slug: your-project-slug
  Content-Type: application/json

Body:
{
  "query": "SELECT COUNT(*) AS total FROM users WHERE status = 'active'"
}