Telebase Docs

SQL Queries

Execute familiar SQL syntax natively via the Telebase REST API.

Currently Supported SQL Syntax

Telebase's custom query parser fully supports the following keywords and operations:

SELECT ... FROM
INNER JOIN ... ON
WHERE (AND, =, !=, >, <, LIKE)
GROUP BY / HAVING
ORDER BY (ASC / DESC)
LIMIT / COUNT(*)
INSERT INTO ... VALUES
UPDATE ... SET
DELETE FROM
CREATE / DROP TABLE
ALTER TABLE (ADD / DROP)
CREATE / DROP INDEX

* Note: Future updates will bring compatibility for 100% of standard SQL query structures and procedures.

SELECT

Retrieve records from your table. Supports filtering, joins, sorting, and pagination.

await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({
    tableName: 'users',
    sqlQuery: "SELECT id, name, age FROM users WHERE status = 'active' ORDER BY age DESC LIMIT 10"
  })
});

INSERT

Add new rows to your database table.

await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({
    tableName: 'users',
    sqlQuery: "INSERT INTO users (name, age, status) VALUES ('Emma', 28, 'active')"
  })
});

UPDATE

Modify existing fields matching the WHERE condition.

await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({
    tableName: 'users',
    sqlQuery: "UPDATE users SET status = 'inactive' WHERE age > 60"
  })
});

DELETE

Remove rows matching the WHERE filter from the table.

await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({
    tableName: 'users',
    sqlQuery: "DELETE FROM users WHERE id = 'some-uuid'"
  })
});

DDL Operations (Tables & Columns)

Manage tables, schemas, and fields programmatically.

// Create a new table
await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({
    sqlQuery: "CREATE TABLE customers (id TEXT, name TEXT, age INT, is_active BOOL)"
  })
});

// Alter Table: Add/Drop columns
await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({
    sqlQuery: "ALTER TABLE customers ADD COLUMN email TEXT"
  })
});

// Drop table
await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({
    sqlQuery: "DROP TABLE IF EXISTS customers"
  })
});

Metadata & Indexes

Interact with schema meta info or manage database indexes.

// Show all tables
const resShow = await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({ sqlQuery: "SHOW TABLES" })
});

// Describe table structure
const resDesc = await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({ sqlQuery: "DESCRIBE users" })
});

// Create/Drop index
await fetch('https://telebase.pages.dev/api/db', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_KEY' },
  body: JSON.stringify({ sqlQuery: "CREATE INDEX age_idx ON users (age)" })
});

Roadmap: Expanded SQL Support

Telebase is undergoing active development to extend its SQL query parser. Future releases will support all query types, operations, and aggregation techniques including:

  • Advanced JOIN structures (LEFT/RIGHT OUTER JOIN, FULL OUTER JOIN)
  • Subqueries, nested query expressions, and complex set operations (UNION, INTERSECT)
  • Expanded Aggregations (SUM, AVG, MIN, MAX with GROUP BY/HAVING)
  • Common Table Expressions (CTEs), Transaction queries, and custom query procedures