Dokploy Infrastructure Management
Dokploy is a self-hosted PaaS. All management happens through its REST API using curl. No CLI tools or bash scripts — construct curl commands directly.
Authentication & Request Pattern
Environment variables (must be set):
- — base URL of the Dokploy instance (e.g.,
https://dokploy.example.com
)
- — API token generated from Dokploy UI: Settings → Profile → API/CLI Section
All endpoints follow the pattern:
$DOKPLOY_API_URL/api/{router}.{procedure}
GET request (reads)
bash
curl -s -H "x-api-key: $DOKPLOY_API_KEY" \
"$DOKPLOY_API_URL/api/{endpoint}?{param}={value}"
Parameters are flat query params. Do NOT use tRPC
encoding — it doesn't work on the OpenAPI surface.
POST request (all mutations)
bash
curl -s -X POST \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H "Content-Type: application/json" \
"$DOKPLOY_API_URL/api/{endpoint}" \
-d '{"param": "value"}'
Every mutation (create, update, remove, deploy, start, stop, reload) uses POST. Never use PUT, PATCH, or DELETE.
Always pipe output through
for readability:
Response Formats
Not all endpoints return JSON objects. Be aware of these patterns:
- ,
application.saveEnvironment
, and other mutation endpoints may return a bare instead of the updated object. Do not pipe these through with object filters — use or skip entirely.
- returns empty output on success.
- GET endpoints (, ) return full JSON objects.
- When in doubt, don't assume the response shape — capture raw output first.
Critical: The Resource Hierarchy
Project
└── Environment (default: "production")
├── Applications
├── Databases (postgres, mysql, mariadb, mongo, redis)
└── Compose services
- Every project has at least one environment. The default is named "production" with .
- Creating any resource requires , NOT .
- To get : fetch the project with , then read
.environments[0].environmentId
(or find the environment by name).
This is the most common source of errors. Always fetch the environment first.
Quick Reference
Projects & Environments
| Task | Endpoint | Method | Key Params |
|---|
| List all projects | | GET | — |
| Get project details | | GET | |
| Create project | | POST | , |
| Update project | | POST | , , |
| Delete project | | POST | |
Applications
| Task | Endpoint | Method | Key Params |
|---|
| Get app details | | GET | |
| Create app | | POST | , |
| Update app | | POST | , ... |
| Delete app | | POST | |
| Deploy app | | POST | |
| Start app | | POST | |
| Stop app | | POST | |
| Redeploy app | | POST | |
| Save env vars | application.saveEnvironment
| POST | , , , , |
| Set build type | application.saveBuildType
| POST | , , ... |
Databases
All database types share the same operation pattern. Replace
with:
,
,
,
,
.
| Task | Endpoint | Method | Key Params |
|---|
| Get DB details | | GET | |
| Create DB | | POST | , , , ... |
| Delete DB | | POST | |
| Deploy DB | | POST | |
| Start DB | | POST | |
| Stop DB | | POST | |
Note: Each type uses its own ID field name:
,
,
,
,
.
Domains
| Task | Endpoint | Method | Key Params |
|---|
| Get domain | | GET | |
| Domains for app | | GET | |
| Create domain | | POST | , , |
| Update domain | | POST | , , ... |
| Delete domain | | POST | |
Compose
| Task | Endpoint | Method | Key Params |
|---|
| Get compose | | GET | |
| Create compose | | POST | , |
| Update compose | | POST | , ... |
| Delete compose | | POST | , |
| Deploy compose | | POST | |
| Start compose | | POST | |
| Stop compose | | POST | |
| List services | | GET | |
Deployments
| Task | Endpoint | Method | Key Params |
|---|
| List deployments | | GET | |
| By type | | GET | , |
Servers
| Task | Endpoint | Method | Key Params |
|---|
| List servers | | GET | — |
| Get server | | GET | |
| Create server | | POST | , , , , |
| Delete server | | POST | |
Common Workflows
List all projects with their resources
bash
curl -s -H "x-api-key: $DOKPLOY_API_KEY" \
"$DOKPLOY_API_URL/api/project.all" | jq .
The response includes nested environments with all applications, databases, and compose services summarized.
Deploy an existing application
bash
curl -s -X POST \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H "Content-Type: application/json" \
"$DOKPLOY_API_URL/api/application.deploy" \
-d '{"applicationId": "THE_APP_ID"}' | jq .
Create a new app in an existing project
Step 1 — Get the project's environmentId:
bash
curl -s -H "x-api-key: $DOKPLOY_API_KEY" \
"$DOKPLOY_API_URL/api/project.one?projectId=PROJECT_ID" \
| jq '.environments[] | select(.isDefault) | .environmentId'
Step 2 — Create the application:
bash
curl -s -X POST \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H "Content-Type: application/json" \
"$DOKPLOY_API_URL/api/application.create" \
-d '{"name": "my-app", "environmentId": "ENV_ID"}' | jq .
Create a full project from scratch
Step 1 — Create the project:
bash
curl -s -X POST \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H "Content-Type: application/json" \
"$DOKPLOY_API_URL/api/project.create" \
-d '{"name": "My Project", "description": "Project description"}' | jq .
Step 2 — Get the new project's environmentId from the response, or fetch it:
bash
curl -s -H "x-api-key: $DOKPLOY_API_KEY" \
"$DOKPLOY_API_URL/api/project.all" \
| jq '.[] | select(.name == "My Project") | .environments[0].environmentId'
Step 3 — Create resources using that environmentId (apps, databases, compose).
Check deployment status
For applications:
bash
curl -s -H "x-api-key: $DOKPLOY_API_KEY" \
"$DOKPLOY_API_URL/api/deployment.all?applicationId=APP_ID" | jq '.[0]'
For compose services:
bash
curl -s -H "x-api-key: $DOKPLOY_API_KEY" \
"$DOKPLOY_API_URL/api/deployment.allByType?id=COMPOSE_ID&type=compose" | jq '.[0]'
Set environment variables on an app
Env vars are set as a single newline-separated string block, not key-value pairs.
Required fields:
,
, and
are mandatory (use empty strings and
as defaults):
bash
curl -s -X POST \
-H "x-api-key: $DOKPLOY_API_KEY" \
-H "Content-Type: application/json" \
"$DOKPLOY_API_URL/api/application.saveEnvironment" \
-d '{
"applicationId": "APP_ID",
"env": "DATABASE_URL=postgres://...\nREDIS_URL=redis://...\nNODE_ENV=production",
"buildArgs": "",
"buildSecrets": "",
"createEnvFile": false
}'
Important Notes
- returns a comprehensive overview — use it to discover IDs before drilling down.
- Deployment is asynchronous. After triggering deploy, poll or to check status.
- Destructive operations (, ) cannot be undone. Always confirm with the user first.
- The Swagger UI is available at for interactive API exploration (admin only).
Reference Files
For full endpoint details with all parameters:
| Need details about... | Read |
|---|
| Projects & environments | references/api-projects.md
|
| Applications (CRUD, deploy, build types, git providers) | references/api-applications.md
|
| Databases (PostgreSQL, MySQL, MariaDB, MongoDB, Redis) | references/api-databases.md
|
| Domains (create, update, certificates) | references/api-domains.md
|
| Docker Compose services | references/api-compose.md
|
| Deployment history & logs | references/api-deployments.md
|
| Server management | references/api-servers.md
|