The Server API allows you to manage remote servers, configure monitoring, and perform infrastructure operations.
Create Server
curl -X POST "https://your-dokploy-instance.com/api/server.create" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Server",
"description": "Main production deployment server",
"ipAddress": "192.168.1.100",
"port": 22,
"username": "deploy",
"sshKeyId": "ssh_key_123",
"serverType": "deploy"
}'
Register a new remote server for deployments or builds.
Body Parameters
Display name for the server.
Optional description of the server’s purpose.
IP address or hostname of the server.
SSH port number (typically 22).
SSH username for connecting to the server.
ID of the SSH key to use for authentication.
Type of server.
deploy - Server for deploying applications
build - Server for building application images
Get Server
curl -X GET "https://your-dokploy-instance.com/api/server.one?serverId=server_123" \
-H "Authorization: Bearer YOUR_API_KEY"
Retrieve details of a specific server.
Query Parameters
The ID of the server to retrieve.
List All Servers
curl -X GET "https://your-dokploy-instance.com/api/server.all" \
-H "Authorization: Bearer YOUR_API_KEY"
Get all servers in your organization with service counts.
Response
Returns an array of servers with the total count of services (applications, databases, compose files) deployed on each server.
Setup Server
curl -X POST "https://your-dokploy-instance.com/api/server.setup" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"serverId": "server_123"
}'
Install required dependencies on a server (Docker, buildpacks, etc.).
Body Parameters
The ID of the server to set up.
Validate Server
curl -X GET "https://your-dokploy-instance.com/api/server.validate?serverId=server_123" \
-H "Authorization: Bearer YOUR_API_KEY"
Check if a server has all required dependencies installed.
Query Parameters
The ID of the server to validate.
Response
Docker installation status.
Whether Docker is installed and accessible.
Rclone installation status.
Nixpacks installation status.
Cloud Native Buildpacks installation status.
Railpack installation status.
isDokployNetworkInstalled
Whether the Dokploy Docker network is configured.
Whether Docker Swarm mode is initialized.
Whether the main Dokploy directory structure exists.
Security Audit
curl -X GET "https://your-dokploy-instance.com/api/server.security?serverId=server_123" \
-H "Authorization: Bearer YOUR_API_KEY"
Perform a security audit on a server.
Query Parameters
The ID of the server to audit.
Response
UFW (Uncomplicated Firewall) status.
Default incoming traffic policy (deny/allow).
SSH configuration.
Whether key-based authentication is enabled.
Whether a non-root sudo user exists.
Automatic security updates configuration.
Fail2ban intrusion prevention status.
Setup Monitoring
curl -X POST "https://your-dokploy-instance.com/api/server.setupMonitoring" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"serverId": "server_123",
"metricsConfig": {
"server": {
"refreshRate": 5,
"port": 9090,
"token": "monitoring_token",
"urlCallback": "https://your-instance.com/api/metrics",
"retentionDays": 7,
"cronJob": "0 0 * * *",
"thresholds": {
"cpu": 80,
"memory": 85
}
},
"containers": {
"refreshRate": 10,
"services": {
"include": ["app-*"],
"exclude": ["test-*"]
}
}
}
}'
Configure monitoring and metrics collection for a server.
Body Parameters
The ID of the server to configure.
Metrics collection configuration.
Server-level metrics configuration.
Metrics refresh rate in seconds (minimum: 2).
Port for metrics endpoint (minimum: 1).
Authentication token for metrics endpoint.
Callback URL for metrics delivery.
Number of days to retain metrics (minimum: 1).
Cron expression for cleanup schedule.
Alert thresholds.
CPU usage threshold percentage (0-100).
Memory usage threshold percentage (0-100).
Container-level metrics configuration.
Container metrics refresh rate in seconds (minimum: 2).
Service filtering configuration.
Array of service name patterns to include.
Array of service name patterns to exclude.
Update Server
curl -X POST "https://your-dokploy-instance.com/api/server.update" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"serverId": "server_123",
"name": "Updated Server Name",
"description": "Updated description",
"ipAddress": "192.168.1.100",
"port": 22,
"username": "deploy",
"sshKeyId": "ssh_key_123",
"serverType": "deploy"
}'
Update server configuration.
Body Parameters
The ID of the server to update.
Updated IP address or hostname.
Server type (deploy or build).
Remove Server
curl -X POST "https://your-dokploy-instance.com/api/server.remove" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"serverId": "server_123"
}'
Delete a server from your infrastructure. The server must have no active services.
Body Parameters
The ID of the server to remove.
Get Server Metrics
curl -X GET "https://your-dokploy-instance.com/api/server.getServerMetrics?url=https://metrics.example.com&token=metrics_token&dataPoints=100" \
-H "Authorization: Bearer YOUR_API_KEY"
Retrieve server metrics data from the monitoring endpoint.
Query Parameters
The metrics endpoint URL.
Authentication token for the metrics endpoint.
Number of data points to retrieve.
Response
Returns an array of metric data points with CPU, memory, disk, and network statistics.