Create PostgreSQL Database
curl -X POST "https://your-dokploy-instance.com/api/postgres.create" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Database",
"appName": "prod-postgres",
"databaseName": "myapp",
"databaseUser": "admin",
"databasePassword": "SecurePass123!",
"dockerImage": "postgres:18",
"environmentId": "env_123456",
"description": "Main production PostgreSQL database"
}'
Display name for the PostgreSQL database
Unique application name used for Docker container identification
Name of the database to create
Username for database access
Password for database user. Must match pattern: ^[a-zA-Z0-9@#%^&*()_+\-=[\]{}|;:,.<>?~]*$`
ID of the environment where this database will be deployed
dockerImage
string
default:"postgres:18"
Docker image to use for PostgreSQL
Optional description of the database instance
Optional server ID for deployment on specific server
Unique identifier for the created PostgreSQL instance
Application name of the database
Display name of the database
Get PostgreSQL Database
curl -X GET "https://your-dokploy-instance.com/api/postgres.one?postgresId=pg_123456" \
-H "Authorization: Bearer YOUR_API_TOKEN"
ID of the PostgreSQL database to retrieve
Current status: idle, running, done, or error
External port for database access (if configured)
Deploy PostgreSQL
curl -X POST "https://your-dokploy-instance.com/api/postgres.deploy" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456"
}'
ID of the PostgreSQL database to deploy
Start PostgreSQL
curl -X POST "https://your-dokploy-instance.com/api/postgres.start" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456"
}'
ID of the PostgreSQL database to start
Stop PostgreSQL
curl -X POST "https://your-dokploy-instance.com/api/postgres.stop" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456"
}'
ID of the PostgreSQL database to stop
Update PostgreSQL
curl -X POST "https://your-dokploy-instance.com/api/postgres.update" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456",
"name": "Updated Database Name",
"description": "Updated description",
"memoryLimit": "2g",
"memoryReservation": "1g",
"cpuLimit": "1",
"cpuReservation": "0.5"
}'
ID of the PostgreSQL database to update
Maximum memory (e.g., “2g”, “512m”)
Guaranteed memory allocation
Guaranteed CPU allocation
Save External Port
curl -X POST "https://your-dokploy-instance.com/api/postgres.saveExternalPort" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456",
"externalPort": 5432
}'
ID of the PostgreSQL database
Port number for external access. Set to null to remove external port.
Save Environment Variables
curl -X POST "https://your-dokploy-instance.com/api/postgres.saveEnvironment" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456",
"env": "POSTGRES_MAX_CONNECTIONS=200\nPOSTGRES_SHARED_BUFFERS=256MB"
}'
ID of the PostgreSQL database
Environment variables in KEY=VALUE format, separated by newlines
Reload PostgreSQL
curl -X POST "https://your-dokploy-instance.com/api/postgres.reload" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456",
"appName": "prod-postgres"
}'
ID of the PostgreSQL database
Application name of the database
Rebuild PostgreSQL
curl -X POST "https://your-dokploy-instance.com/api/postgres.rebuild" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456"
}'
ID of the PostgreSQL database to rebuild
Remove PostgreSQL
curl -X POST "https://your-dokploy-instance.com/api/postgres.remove" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"postgresId": "pg_123456"
}'
ID of the PostgreSQL database to remove
postgresql://[databaseUser]:[databasePassword]@[appName]:5432/[databaseName]
Example:
postgresql://admin:SecurePass123!@prod-postgres:5432/myapp
For external connections: