10. REST API reference
Parameters with type and default, response fields, errors and examples for every endpoint: see the detailed REST API reference.
The REST API is served by SmartFBX on http://<listen address>:<API port> (default http://127.0.0.1:6615). Start it with the API switch or Tools > Start/stop API and MCP.
10.1 Conventions
| Topic | Rule |
|---|---|
| Parameters | GET and DELETE: query string (?ConnectionName=prova%20locale&Filter=ORD). POST and PUT: JSON body ({"ConnectionName":"...","SQL":"..."}). Parameter names are in PascalCase as listed below |
| Connection | ConnectionName is the name of a connection in the tree. Omitted = the connection selected in SmartFBX |
| Authentication | When an access token is set in Settings, send Authorization: Bearer <token> (or X-Access-Token: <token>); otherwise the server answers 403 |
| Response | JSON. Success: {"ok": true, "data": ...}. Error: {"ok": false, "error": "message"} with HTTP status 400 (bad request), 403 (token), 404 (not found) or 500 (database error) |
| CORS | Access-Control-Allow-Origin: *, methods GET, POST, PUT, DELETE, OPTIONS |
| Logging | Every call appears in Tools > API log |
Example:
curl "http://127.0.0.1:6615/api/fb/meta/tables?ConnectionName=prova%20locale&Filter=ORD"
curl -X POST http://127.0.0.1:6615/api/fb/sql/execute \
-H "Content-Type: application/json" \
-d "{\"ConnectionName\":\"prova locale\",\"SQL\":\"select * from CUSTOMERS\",\"MaxRows\":50}"
10.2 Database
| Method | Path | Parameters | Returns |
|---|---|---|---|
| GET | /api/fb/db/connections |
— | Names of the configured connections |
| GET | /api/fb/db/info |
ConnectionName |
Engine version, database path, server, driver, character set, page size, dialect |
10.3 Metadata
| Method | Path | Parameters | Returns |
|---|---|---|---|
| GET | /api/fb/meta/schema/summary |
ConnectionName |
Counts of tables, views, procedures, functions, triggers, generators, domains, foreign keys |
| GET | /api/fb/meta/tables |
ConnectionName, Filter (substring), SystemTables (bool) |
Tables with description |
| GET | /api/fb/meta/table |
ConnectionName, TableName, WithFields, WithIndexes, WithFK, WithTriggers |
Full structure of a table |
| GET | /api/fb/meta/views |
ConnectionName |
Views |
| GET | /api/fb/meta/procedures |
ConnectionName, Filter, WithParams |
Stored procedures, optionally with parameters |
| GET | /api/fb/meta/functions |
ConnectionName, Filter, WithParams, ExcludeUDF |
PSQL functions and legacy UDFs |
| GET | /api/fb/meta/generators |
ConnectionName, Filter, WithValue |
Generators (sequences), optionally with current value |
| GET | /api/fb/meta/domains |
ConnectionName, Filter, UserDefinedOnly (default true) |
Domains with type, size, default, check, character set |
| GET | /api/fb/meta/ddl |
ConnectionName, ObjectName, ObjectType (table, procedure, function, view, trigger) |
DDL of the object |
| GET | /api/fb/meta/dependencies |
ConnectionName, ObjectName, Direction (uses, used_by, both) |
Dependencies |
| GET | /api/fb/meta/fk-graph |
ConnectionName, TableName (optional pivot), Direction (from, to, empty) |
Foreign-key graph: nodes (tables) and edges (keys, update/delete rules) |
10.4 SQL and DDL
| Method | Path | Body | Returns |
|---|---|---|---|
| POST | /api/fb/sql/execute |
ConnectionName, SQL, MaxRows (default 200), ReadOnly (default true; false allows DML) |
Rows of a SELECT, or affected rows |
| POST | /api/fb/sql/explain |
ConnectionName, SQL |
Execution plan |
| POST | /api/fb/ddl/execute |
ConnectionName, SQL (one DDL statement), DryRun (true = execute and roll back) |
Result of the statement |
| POST | /api/fb/sp/execute |
ConnectionName, ProcName, Params (JSON object as text: keys are the input parameter names, missing ones are NULL; if no key matches a parameter name the values are taken in order), MaxRows |
Output rows or values of the procedure |
10.5 Table rows (CRUD)
| Method | Path | Parameters | Effect |
|---|---|---|---|
| GET | /api/fb/crud/list |
ConnectionName, TableName, Where, OrderBy, MaxRows (default 200) |
Rows of the table |
| POST | /api/fb/crud/insert |
ConnectionName, TableName, Row (JSON object as text: {"FIELD":"value"}) |
Inserts a row |
| PUT | /api/fb/crud/update |
ConnectionName, TableName, Row, Key (JSON object as text: {"ID":12}) or Where |
Updates the rows matching Key or Where |
| DELETE | /api/fb/crud/delete |
ConnectionName, TableName, Key or Where |
Deletes the rows matching Key or Where |
Values in Row and Key are sent to the server as parameters with their JSON type: null, numbers, true/false and strings (dates as ISO strings, e.g. "2026-11-15"). Table, field and procedure names are checked against the database catalog (unknown names return 400). Where and OrderBy are passed as written, so they cannot contain ; or comments. With an empty access token, insert, update, delete and sp/execute are accepted only from this computer (127.0.0.1); set a token in the Settings before allowing write calls from other computers.
For controlled single-row changes with optimistic locking use the agent endpoints row/get, row/update, row/delete (chapter 12).
10.6 Scripts (review before execution)
Scripts are SQL files stored in the SmartFBX data folder (scripts) with a status: pending, executed, failed. The intended workflow is upload → human review → execute.
| Method | Path | Parameters | Effect |
|---|---|---|---|
| POST | /api/fb/script/upload |
ConnectionName, Title, Author; the SQL in the request body (or SQL parameter) |
Stores the script, returns script_id |
| GET | /api/fb/script/list |
Status (empty = all) |
Scripts with title, author, connection, dates, status |
| GET | /api/fb/script/get |
ScriptId |
SQL text and metadata |
| POST | /api/fb/script/execute |
ScriptId, ConnectionName |
Runs the script and records the result |
| DELETE | /api/fb/script/delete |
ScriptId |
Deletes the script |
10.7 Xtumble named queries
These endpoints work only on databases with the Xtumble schema (table CUSTOM_FR_DYN_DATASET).
| Method | Path | Parameters |
|---|---|---|
| GET | /api/fb/nq/groups |
ConnectionName |
| GET | /api/fb/nq/list |
ConnectionName, EntityGroups (e.g. 1,2,5; empty = global only), Filter, WithSQL |
| GET | /api/fb/nq/detail |
ConnectionName, EntityGroups, Name |
| POST | /api/fb/nq/execute |
ConnectionName, EntityGroups, Name, Params (JSON object as text), MaxRows |
| POST | /api/fb/nq/validate |
ConnectionName, Name (optional), SQL, SQLCount |
| POST | /api/fb/nq/register |
ConnectionName, Name, GroupId, SQL, SQLCount, Description, ReadOnly (S/N), GeneratorName |
| POST | /api/fb/nq/update |
as register, plus SetSQLCount, SetDescription (true = write the value, also empty) |
10.8 Agent endpoints
POST /api/fb/agent/... exposes the controlled editing tools described in chapter 12 (source/get, source/patch, source/search, change/validate, change/apply, change/discard, sql/query, procedure/execute, row/get, row/update, row/delete). The JSON body takes the same arguments as the MCP tool with the same name.
10.9 Web pages
When the web folder is installed, the API also serves:
| Path | Page |
|---|---|
/ui |
Web client: connections, tables, procedures, views, DDL, SQL execution (opened by Database > Open Web Client) |
/scripts |
Review page for uploaded scripts (list, view, execute, delete) |
/ep |
Test page with ready-made calls to every endpoint |