See the schema
SDK platic.tools.databases.schema()
Read the current database schema. Without table, it returns all tables; with table, it returns that table's columns. Items hidden from agents are included with hidden: true, so you can review what to hide.
Example
curl "https://api.platic.ai/v1/tools/databases/$DB_ID/schema?table=orders" \
-H "Authorization: Bearer $PLATIC_API_KEY" await platic.tools.databases.schema("db_123", { table: "orders" }); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
databaseId | string | The id of the connection | ✓ |
Query parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
table | string | One table, as table or schema.table, as it comes in the list. Without it, all the tables | — |
Response
200 OK. Without table, the list of tables:
{
"status": "success",
"data": {
"tables": [
{ "name": "customers", "type": "table", "approxRows": 1840, "schema": "public", "table": "customers", "hidden": false },
{ "name": "payments", "type": "table", "approxRows": 9100, "schema": "public", "table": "payments", "hidden": true },
{ "name": "orders", "type": "table", "approxRows": 12400, "schema": "public", "table": "orders", "hidden": false }
]
}
} With table=customers, its columns:
{
"status": "success",
"data": {
"table": "customers",
"schema": "public",
"columns": [
{ "name": "id", "type": "integer", "nullable": false, "primaryKey": true, "hidden": false },
{ "name": "name", "type": "text", "nullable": false, "hidden": false },
{ "name": "phone", "type": "text", "nullable": true, "hidden": true },
{ "name": "order_id", "type": "integer", "nullable": true, "references": "orders.id", "hidden": false }
]
}
} Response fields
| Field | Type | Description |
|---|---|---|
tables[].name | string | table, or schema.table outside the default schema. It is what goes in table |
tables[].type | string | For example table or view |
tables[].schema, tables[].table | string | The schema and the name of the table separately |
tables[].approxRows, tables[].comment | number, string | The row estimate and the comment, if the server has them |
tables[].hidden | boolean | Whether it is in hiddenTables |
truncated | boolean | true if only the first tables are included |
columns[].name, columns[].type | string | The name and the type, as the server names them |
columns[].nullable | boolean | Whether it allows empty values |
columns[].primaryKey | boolean | Only if it is part of the primary key |
columns[].references | string | The column it points to, as table.column |
columns[].default, columns[].comment | string | The default value and the comment, if it has them |
columns[].hidden | boolean | Whether it is in hiddenColumns |
Errors
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | table is empty or too long |
403 | FORBIDDEN or INSUFFICIENT_SCOPE | The person behind the token does not have access to Integrations, or the token does not have write permission |
404 | NOT_FOUND | There is no connection with that id in the workspace |
404 | TABLE_NOT_AVAILABLE | That table does not exist |
409 | DB_AUTH_FAILED, DB_UNREACHABLE, and the other DB_* | The database did not respond. See why it does not connect |
503 | TRANSPORT_UNAVAILABLE | Database queries are not available right now. Try again |