EDGE DB
Banco de dados edge
Um SQLite isolado por cliente, criado sob demanda. Manda SQL de verdade por HTTP — sem schema fixo, sem servidor de banco pra provisionar.
Edge database
An isolated SQLite database per client, created on demand. Send real SQL over HTTP — no fixed schema, no database server to provision.
SYNC resposta na mesma chamada answers in the same call
Endpoints
Endpoints
/api/v1/edgedb/{name}/query
executa uma instrução SQL — o banco é criado na primeira chamada
runs one SQL statement — the database is created on first call
/api/v1/edgedb
lista os bancos do cliente
lists the client's databases
/api/v1/edgedb/{name}
remove um banco inteiro
removes an entire database
Não existe um POST /create separado — o nome no path é criado sozinho na primeira query. SELECT/PRAGMA/EXPLAIN/WITH devolvem linhas; qualquer outra instrução (INSERT/UPDATE/DELETE/CREATE/...) devolve rows_affected/last_insert_id.
There's no separate POST /create — the name in the path is created on its own on first query. SELECT/PRAGMA/EXPLAIN/WITH return rows; any other statement (INSERT/UPDATE/DELETE/CREATE/...) returns rows_affected/last_insert_id.
Bloqueio deliberado: ATTACH é rejeitado — é o único jeito do SQLite escapar pro filesystem do servidor. Fora isso, é o SQL do próprio cliente contra o próprio banco dele, sem sanitização além disso.
Deliberate block: ATTACH is rejected — it's the one way SQLite can escape onto the server's filesystem. Beyond that, it's the client's own SQL against their own database, no further sanitizing.
Parâmetros
Parameters
| Nome | Name | Onde | In | Descrição | Description |
|---|---|---|---|---|---|
name |
path | nome do banco, isolado por cliente — um arquivo SQLite próprio por (cliente, nome) | database name, isolated per client — its own SQLite file per (client, name) | ||
sql |
body | a instrução SQL a executar | the SQL statement to run | ||
args |
body | opcional — valores posicionais pros ? da instrução (evita concatenar valor no SQL) |
optional — positional values for the statement's ? placeholders (avoids concatenating values into the SQL) |
Exemplo
Example
curl -X POST "https://api.alicercelabs.com.br/api/v1/edgedb/meubanco/query" \
-H "Authorization: Bearer <token>" \
-d '{"sql":"CREATE TABLE pedidos (id INTEGER PRIMARY KEY, cliente TEXT)"}'
curl -X POST "https://api.alicercelabs.com.br/api/v1/edgedb/meubanco/query" \
-H "Authorization: Bearer <token>" \
-d '{"sql":"INSERT INTO pedidos (cliente) VALUES (?)","args":["Fulano"]}'
curl -X POST "https://api.alicercelabs.com.br/api/v1/edgedb/meubanco/query" \
-H "Authorization: Bearer <token>" \
-d '{"sql":"SELECT * FROM pedidos"}'
{
"success": true,
"data": { "columns": ["id", "cliente"], "rows": [[1, "Fulano"]] },
"meta": { "elapsed_ms": 1, "request_id": "..." }
}
Erros possíveis
Possible errors
| Status | Motivo | Reason |
|---|---|---|
| 400 | nome de banco inválido, sql vazio, ATTACH, erro de sintaxe/execução do próprio SQL, ou limite de bancos atingido | invalid database name, empty sql, ATTACH, the client's own SQL syntax/execution error, or the database limit reached |
| 401 | token ausente ou inválido | missing or invalid token |
| 429 | limite de taxa excedido | rate limit exceeded |
| 503 | Edge DB não configurado no servidor | Edge DB not configured on the server |
Limites
Limits
10.000/dia · 416/hora. Bancos por cliente: 10 por padrão. Tamanho máximo por banco: 50MB — travado no próprio SQLite (PRAGMA max_page_count), não checado manualmente. Timeout de query: 5s. Tudo tunável por cliente via admin.
10,000/day · 416/hour. Databases per client: 10 by default. Max size per database: 50MB — capped by SQLite itself (PRAGMA max_page_count), not checked manually. Query timeout: 5s. All tunable per client via admin.