HTTP API Reference
APIBASE exposes data through a deterministic HTTP interface using coordinate addressing and scoped security.
Stateless Auth
Requests are validated independently via bearer tokens. No sessions required.
Coordinate Logic
Data is accessed by explicit addresses: Table → Record → Column.
Predictable Output
The same coordinate request always yields the same result structure. Responses are JSON with a status field (see section 7). Only format=raw returns plain text.
1. Authentication & API Modes
All requests require a bearer token in the header: Authorization: Bearer YOUR_TOKEN. Each request accepted by the token check consumes 1 RQT from the token's balance, even if it then fails (ACL denied, record not found, invalid body). Requests rejected at the token check consume nothing, and /hive/whoami is free.
Personal API (/api/)
Requires a full token. Full Read/Write access to your own BASE. The token automatically identifies your storage.
HIVE Gateway (/hive/)
Requires a hive token. Collaboration access to shared department BASEs: the basekey in the path selects the target BASE, and every call is checked against the token's ACL (read / add / edit / delete / request) for that table.
2. Addressing Model
APIBASE translates logical requests into physical TLC coordinates internally.
- T (Table): Numeric ID of the table (e.g.,
T2). - L (Line/Record): Targets a record by its Primary Identifier — the value stored in column 1 (e.g.,
L95), not its physical position. - C (Column): Numeric ID of the column (e.g.,
C2).
L targets the logical identity.
Note that using L alone without an ID (e.g., /T2/L/C5...) instructs the engine to scan the entire table rather than a single record.
3. Endpoints
Personal API
| Method | Path | Action |
|---|---|---|
| GET | /api/get | List the tables of your BASE |
| GET | /api/get/T2 | Read a whole table |
| GET | /api/get/T2/L1 | Read one record |
| GET | /api/get/T2/L1/C2 | Read one cell |
| GET | /api/get/T2/L/C2/O28?V=Dune | Filter a table (section 4) |
| GET | /api/schema | List tables (same as /api/get) |
| GET | /api/schema/books | Columns of a table, by table name |
| POST | /api/post/T2 | Create a record |
| PUT | /api/put/T2/L1/C2 | Update one cell |
| PUT | /api/put/T2/L1 | Update the fields sent; others are kept |
| DELETE | /api/delete/T2/L1 | Delete a record (child rows cascade via rules) |
HIVE Gateway
Same addressing, with the basekey inserted after the action. The table must be granted to your token in the target BASE's ACL.
| Method | Path | ACL | Action |
|---|---|---|---|
| GET | /hive/whoami/<basekey> | — | Username behind the hive token |
| GET | /hive/get/<basekey> | read | List the tables you can read |
| GET | /hive/get/<basekey>/T2[/L1[/C2]] | read | Read a table, record or cell (filters allowed) |
| GET | /hive/schema/<basekey>/books | read | Columns of a table |
| POST | /hive/post/<basekey>/T2 | add | Create a record |
| PUT | /hive/put/<basekey>/T2/L1/C2 | edit | Update one cell |
| PUT | /hive/put/<basekey>/T2/L1 | edit | Update the fields sent; others are kept |
| DELETE | /hive/delete/<basekey>/T2/L1 | delete | Delete a record |
| DELETE | /hive/delete/<basekey>/T2/C5/O6?V=50 | delete | Delete every record matching a filter |
| POST | /hive/request/<basekey> | request | Request a copy of a table. Body: { "table_id": 2, "comment": "..." } |
| POST | /hive/approve/<basekey> | edit | Approve a pending request. Body: { "id_hive": 1 } |
| POST | /hive/publish/<basekey> | edit | Write a snapshot of the table to the requester's directory. Body: { "id_hive": 1 } |
A request moves through pending → approved → published. publish writes a separate <table>.php file next to the requester's BASE file.
Archived chunks are readable with ?archive=aaa on GET requests, schema included. Writes always target the live BASE. An archive is a full copy of the BASE in which only one table was cut down to its archived records: table lists and schemas of an archive return it as "rotated_table" (null for archives older than the rotation log). Rows of the other tables in that archive are plain copies.
4. Filtering with Operators
To perform searches across a table, extend the TLC path with O (Operator) and V (Value). As noted above, use a naked L to search all records.
GET /api/get/T[id]/L/C[id]/O[op]?V=[value]
| OP | Symbol | Meaning | Example (Global Search) |
|---|---|---|---|
| 1 | == | Equal | .../L/C2/O1?V=100 |
| 3 | != | Not equal | .../L/C2/O3?V=100 |
| 6 | < | Less than | .../L/C5/O6?V=50 |
| 7 | > | Greater than | .../L/C5/O7?V=50 |
| 8 | <= | Less or equal | .../L/C5/O8?V=50 |
| 9 | >= | Greater or equal | .../L/C5/O9?V=50 |
| 28 | LIKE | Partial match | .../L/C2/O28?V=Dune |
| 32 | BETWEEN | Range (use _) | .../L/C5/O32?V=10_20 |
| 33 | LIST | In List (use _) | .../L/C1/O33?V=1_2_3 |
5. Output Formats
Control the response structure using the format query parameter (GET only). Examples below read table T2 (books).
- default: Rows keyed by column ID.
- assoc: Returns named fields (associative array).
- meta: Adds headers, coordinates and row count.
- raw: Returns the plain text value of a single cell.
default — GET /api/get/T2
{
"status": "success",
"data": [
{ "1": "1", "2": "Dune", "3": "1" },
{ "1": "2", "2": "Foundation", "3": "2" }
],
"rows": 2
}
assoc — GET /api/get/T2?format=assoc
{
"status": "success",
"data": [
{ "id_book": "1", "title": "Dune", "author_id": "1" },
{ "id_book": "2", "title": "Foundation", "author_id": "2" }
],
"rows": 2
}
meta — GET /api/get/T2/L1?format=meta
{
"status": "success",
"header": { "1": "id_book", "2": "title", "3": "author_id" },
"data": { "1": "1", "2": "Dune", "3": "1" },
"tlc": { "table": 2, "line": "1" },
"rows": 2
}
raw — GET /api/get/T2/L1/C2?format=raw
Dune
Content-Type text/plain. Only valid on a single cell.
Table list — GET /api/get
{
"status": "success",
"tables": [
{ "id": 1, "name": "authors", "rows": 2, "min_id": 1, "version": "8c1f…" },
{ "id": 2, "name": "books", "rows": 2, "min_id": 1, "version": "e40a…" }
]
}
Schema — GET /api/schema/books
{
"status": "success",
"table": "books",
"T": 2,
"columns": { "1": "id_book", "2": "title", "3": "author_id" }
}
HIVE responses have the same structure, plus a hive_base field.
Table version. The table list, the schema of a table and every read of a table (/api/get, /hive/get) carry a version field; reads also send it in the X-Apibase-Version header. It is a hash of the table's content: the same version always means the same data, whatever wrote it. Compare it by equality only (it has no order). To cache a table on your side: keep the version returned with the data, then reload only the tables whose version in the list has changed. A version never carries access rights: check them on every call.
6. Write Operations
Request bodies are JSON (Content-Type: application/json). The format and archive parameters are rejected on writes.
Create (POST)
Adds a new record. The primary identifier is assigned automatically and returned. To restore a record under its original identifier (e.g. from an archive), send the primary key field in record: it is kept if free, refused with 409 PRIMARY_KEY_ALREADY_EXISTS if taken.
POST /api/post/T2
{ "record": { "title": "Dune", "author_id": "1" } }
→ { "status": "success", "message": "Record added.",
"line": 3, "id_book": "3" }
Update Cell (PUT)
Updates a specific coordinate (TLC).
PUT /api/put/T2/L1/C2
{ "value": "New Title" }
→ { "status": "success", "mode": "cell",
"message": "Cell updated." }
Update Record (PUT)
Without C, updates only the fields sent. Omitted fields keep their value, and the primary identifier never changes.
PUT /api/put/T2/L1
{ "record": { "title": "Dune Messiah" } }
→ { "status": "success", "mode": "line",
"message": "Line replaced." }
Delete (DELETE)
Deletes a record. Child records linked through rules are deleted with it.
DELETE /api/delete/T2/L1
→ { "status": "success", "message": "Line deleted." }
7. Errors
Errors return the matching HTTP status code and a JSON body with a stable, machine-readable message:
HTTP/1.1 404 Not Found
{ "status": "error", "code": 404, "message": "PRIMARY_NOT_FOUND" }
| HTTP | Messages |
|---|---|
| 400 | TABLE_REQUIRED, TABLE_AND_PRIMARY_REQUIRED, RECORD_REQUIRED, VALUE_REQUIRED, INVALID_JSON, INVALID_BODY, COLUMN_NOT_ALLOWED_ON_DELETE, FORMAT_NOT_ALLOWED_ON_WRITE, ARCHIVE_NOT_ALLOWED_ON_WRITE, INVALID_ARCHIVE, BASEKEY_REQUIRED, TABLE_ID_REQUIRED, ID_HIVE_REQUIRED |
| 401 | TOKEN_REQUIRED, INVALID_TOKEN, TOKEN_REVOKED |
| 402 | NO_REQUESTS_LEFT — the token has no RQT left |
| 403 | FULL_TOKEN_REQUIRED (hive token on /api/), HIVE_TOKEN_REQUIRED (full token on /hive/), ARCHIVE_NOT_ALLOWED_FOR_HIVEBASE, HIVEBASE_MISMATCH, ACL denial on a HIVE table |
| 404 | TABLE_NOT_FOUND, PRIMARY_NOT_FOUND, LINE_NOT_FOUND, COLUMN_NOT_FOUND, ARCHIVE_NOT_FOUND, HIVEBASE_NOT_FOUND, TARGET_DB_NOT_FOUND, HIVE_NOT_FOUND |
| 409 | PRIMARY_KEY_ALREADY_EXISTS, HIVE_REQUEST_ALREADY_EXISTS, INVALID_STATUS_TRANSITION |
| 500 | Unexpected engine error (the message describes the cause) |