Test a database
SDK platic.tools.databases.test()
Test the connection using its saved settings and list the tables available to the agent. The result is saved in lastTest.
Example
curl -X POST https://api.platic.ai/v1/tools/databases/$DB_ID/test \
-H "Authorization: Bearer $PLATIC_API_KEY" await platic.tools.databases.test("db_123"); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
databaseId | string | The id of the connection | ✓ |
It has no body.
Response
200 OK, whether it connects or not. If it connected, message is Connected:
{
"status": "success",
"message": "Connected",
"data": {
"connected": true,
"server": { "version": "PostgreSQL 16.4", "database": "store", "user": "readonly" },
"tables": [
{ "name": "customers", "type": "table", "approxRows": 1840 },
{ "name": "orders", "type": "table", "approxRows": 12400, "comment": "One row per order" },
{ "name": "sales.monthly_summary", "type": "view" }
],
"hiddenTables": 1,
"database": { "id": "Xb2mQe7LtR9sKd4fHw1N", "name": "store", "lastTest": { "ok": true, "at": "2026-11-14T16:01:12.000Z", "version": "PostgreSQL 16.4", "tableCount": 3 } }
}
} If it did not connect, message is The database did not answer: see error:
{
"status": "success",
"message": "The database did not answer: see error",
"data": {
"connected": false,
"error": { "code": "DB_AUTH_FAILED", "message": "La base de datos rechazó el usuario o la contraseña." },
"database": { "id": "Xb2mQe7LtR9sKd4fHw1N", "name": "store", "lastTest": { "ok": false, "at": "2026-11-14T16:01:12.000Z", "code": "DB_AUTH_FAILED" } }
}
} database is the full connection, with the fields in get a database; the examples trim it.
Response fields
| Field | Type | Description |
|---|---|---|
connected | boolean | Whether it could connect |
server | object | version, database, and user of the server. Only if it connected |
tables | array | The tables the agent will see: name (table, or schema.table outside the default schema), type, and, if the server has them, approxRows and comment |
hiddenTables | number | How many hidden tables do not appear in tables |
truncated | boolean | true if only the first tables are included |
error | object | code and message with what to check. Only if it did not connect |
database | object | The connection, with its new lastTest |
Why it does not connect
error.code | What to check |
|---|---|
DB_AUTH_FAILED | The user or the password |
DB_UNREACHABLE | The host, the port, and that the database accepts connections from the internet. Platica does not connect from a fixed IP yet. If the message says the host only has an IPv6 address, use your provider's pooler host: on Supabase, the Session pooler one |
DB_HOST_UNRESOLVED | That the host is spelled correctly: it could not be resolved |
DB_HOST_NOT_ALLOWED | The host points to a local or private address. Use the public host of your database |
DB_SSL_CERTIFICATE | The server's certificate could not be verified: use ssl: "require" or check the certificate |
DB_SSL_UNSUPPORTED | The server does not support SSL: use ssl: "disable" or enable it on the server |
DB_NOT_FOUND | The name of the database |
DB_PERMISSION_DENIED | That the user can read the database |
Errors
| Status | details.code | When it happens |
|---|---|---|
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 |
503 | TRANSPORT_UNAVAILABLE | Database queries are not available right now. Try again |
Notes
- The test can take up to a minute if the database does not respond.
- Testing again only replaces
lastTest: it is safe to repeat.