Database API 🟡 BETA

Generic CRUD API for direct database table operations


Base URL

/api/db

Authentication

All endpoints require a valid session token via Authorization: Bearer <token> header.


Endpoints

List / Create Records

GET /api/db/:table

Retrieves all records from the specified table.

ParameterTypeRequiredDescription
tablestringYesTable name (path param)
limitintegerNoMax records to return (default: 100)
offsetintegerNoPagination offset (default: 0)
order_bystringNoColumn to sort by
order_dirstringNoSort direction: asc or desc

Response:

{
  "success": true,
  "data": [
    { "id": "a1b2c3", "name": "Example", "created_at": "2026-01-15T10:30:00Z" }
  ],
  "count": 1
}

POST /api/db/:table

Inserts a new record into the specified table.

ParameterTypeRequiredDescription
tablestringYesTable name (path param)
*anyYesJSON body with column-value pairs

Request Body:

{
  "name": "New Record",
  "value": 42
}

Response:

{
  "success": true,
  "data": {
    "id": "d4e5f6",
    "name": "New Record",
    "value": 42,
    "created_at": "2026-01-15T10:30:00Z"
  }
}

Get / Update / Delete Single Record

GET /api/db/:table/:id

Retrieves a single record by its primary key.

ParameterTypeRequiredDescription
tablestringYesTable name (path param)
idstringYesRecord ID (path param)

Response:

{
  "success": true,
  "data": {
    "id": "a1b2c3",
    "name": "Example",
    "value": 100,
    "created_at": "2026-01-15T10:30:00Z"
  }
}

PUT /api/db/:table/:id

Updates an existing record by its primary key.

ParameterTypeRequiredDescription
tablestringYesTable name (path param)
idstringYesRecord ID (path param)
*anyYesJSON body with column-value pairs to update

Request Body:

{
  "name": "Updated Record",
  "value": 99
}

Response:

{
  "success": true,
  "data": {
    "id": "a1b2c3",
    "name": "Updated Record",
    "value": 99,
    "updated_at": "2026-01-15T11:00:00Z"
  }
}

DELETE /api/db/:table/:id

Deletes a record by its primary key.

ParameterTypeRequiredDescription
tablestringYesTable name (path param)
idstringYesRecord ID (path param)

Response:

{
  "success": true,
  "message": "Record deleted"
}

Record Count

GET /api/db/:table/count

Returns the total number of records in the specified table.

ParameterTypeRequiredDescription
tablestringYesTable name (path param)

Response:

{
  "success": true,
  "count": 142
}

Search Records

POST /api/db/:table/search

Searches records using filtering criteria.

ParameterTypeRequiredDescription
tablestringYesTable name (path param)
filtersobjectNoKey-value pairs for equality filters
likeobjectNoKey-value pairs for LIKE (partial match) filters
limitintegerNoMax results (default: 100)
offsetintegerNoPagination offset

Request Body:

{
  "filters": {
    "status": "active"
  },
  "like": {
    "name": "john"
  },
  "limit": 10,
  "offset": 0
}

Response:

{
  "success": true,
  "data": [
    { "id": "a1b2c3", "name": "John Smith", "status": "active" }
  ],
  "count": 1
}

See Also