Portabase Logo
Portabase DashboardAPIDatabases

Declare a database on an agent

Same as Add database on the agent page: the dashboard stores the configuration (secrets encrypted) and sends it to the agent at its next ping. Requires system admin rights for a global agent, or canManageAgents in the agent's organization. projectId also attaches the database to that project (canManageSettings in its organization).

POST
/databases

Same as Add database on the agent page: the dashboard stores the configuration (secrets encrypted) and sends it to the agent at its next ping. Requires system admin rights for a global agent, or canManageAgents in the agent's organization. projectId also attaches the database to that project (canManageSettings in its organization).

Authorization

apiKeyAuth
headerx-api-key<token>

API key generated from the Portabase dashboard. Pass as the x-api-key header.

Request Body

application/json
  1. body
agentId*string
Formatuuid
projectId?string
Formatuuid
name*string
Lengthlength <= 255
dbms*string
Value in"postgresql""postgresql-cluster""mysql""mariadb""mongodb""sqlite""redis""valkey""firebird""mssql""docker-volume""files"
config*

Connection settings for the engine, with the keys of the agent's databases.json entry (host, port, username, password, database, options...). options.method picks the backup method of files (archive, snapshot, sync, copy) and postgresql-cluster (archive, physical) sources; it cannot be changed later.

Response Body

Declared database

application/json
  1. response
data*
Example Request
curl -X POST 'https://portabase.example.com/api/v1/databases' \  -H 'Content-Type: application/json' \  -d '{  "agentId": "123e4567-e89b-12d3-a456-426614174000",  "name": "string",  "dbms": "postgresql",  "config": {    "host": "postgres",    "port": 5432,    "username": "postgres",    "password": "secret",    "database": "app"  }}'
Example Response
{  "data": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "agentDatabaseId": "78f4c143-eccc-413e-8e8a-868364d45b73",    "name": "string",    "dbms": "postgresql",    "description": "string",    "backupPolicy": "string",    "isWaitingForBackup": true,    "backupToRestore": "string",    "backupEngine": "archive",    "methodConflict": "string",    "fullBackupCron": "string",    "healthErrorCount": -2147483648,    "agentId": "bc309ecf-5f66-4057-93c5-6611cc9cb7b2",    "lastContact": "2019-08-24T14:15:22Z",    "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8",    "updatedAt": "2019-08-24T14:15:22Z",    "createdAt": "2019-08-24T14:15:22Z",    "deletedAt": "2019-08-24T14:15:22Z"  }}