Projects
Projects represent your applications that are deployed and managed through Depfloy. Each project is linked to a server and a git repository. On this page, we will dive into the different project endpoints you can use to manage projects programmatically.
The project model
The project model contains all the information about your projects, including deployment settings, environment variables, and domain configuration.
Properties
- Name
id- Type
- integer
- Description
Unique identifier for the project.
- Name
name- Type
- string
- Description
The display name for the project.
- Name
server_id- Type
- integer
- Description
The ID of the server where the project is deployed.
- Name
framework_id- Type
- integer
- Description
The ID of the framework used for the project. You can fetch the frameworks from the
/api/v1/frameworksendpoint.
- Name
auto_deploy_is_active- Type
- integer
- Description
Whether automatic deployments are enabled. 0 = Disabled, 1 = Enabled.
- Name
ssl_is_enabled- Type
- integer
- Description
Whether SSL is enabled for the project. 0 = Disabled, 1 = Enabled.
- Name
installation_status- Type
- integer
- Description
The installation status of the project. 0 = Not installed, 1 = Installed.
- Name
redirect_status_code- Type
- integer
- Description
The redirect status code for the project. 301 = Permanent Redirect, 302 = Temporary Redirect, 307 = Temporary Redirect, 308 = Permanent Redirect.
- Name
www_redirect- Type
- integer
- Description
The WWW redirect setting for the project. 0 = no redirect, 1 = www to non-www, 2 = non-www to www - Default is 0 (no redirect).
- Name
directory- Type
- string
- Description
This is the directory where the project is deployed.
- Name
port- Type
- integer
- Description
This is the port number for node.js based project. It is automatically set by Depfloy.
- Name
primary_domain- Type
- string
- Description
The primary domain of the project.
- Name
domains- Type
- array
- Description
An array of domain names configured for the project.
- Name
domains.*.domain_name- Type
- string
- Description
Domain name.
- Name
domains.*.is_primary- Type
- integer
- Description
Whether the domain is the primary domain. 0 = No, 1 = Yes.
- Name
domains.*.is_active- Type
- integer
- Description
Whether the domain is active. 0 = No, 1 = Yes.
- Name
repository_type- Type
- string
- Description
Git repository source type. "github", "bitbucket" or "gitlab".
- Name
repository- Type
- string
- Description
The URL of the repository to deploy.
- Name
repository_branch- Type
- string
- Description
The branch of the repository to deploy.
- Name
custom_commands.dev- Type
- string
- Description
The customcommand to run the project in development mode.
- Name
custom_commands.install- Type
- string
- Description
The custom command to run before the project is deployed.
- Name
custom_commands.build- Type
- string
- Description
The custom command to run when the project is deploying.
- Name
custom_commands.directory- Type
- string
- Description
The custom working directory of the project.
- Name
custom_commands.custom- Type
- string
- Description
The custom deployment script to run when the project is deploying. Example: "php artisan horizon:terminate\nphp artisan cache:clear"
- Name
maintenance_mode- Type
- integer
- Description
The maintenance mode status for the project. 0 = Disabled, 1 = Enabled.
- Name
notes- Type
- string
- Description
Any additional notes about the project.
- Name
created_at- Type
- timestamp
- Description
Timestamp of when the project was created.
- Name
updated_at- Type
- timestamp
- Description
Timestamp of when the project was last updated.
List all projects
This endpoint allows you to retrieve a paginated list of all your projects.
Optional attributes
- Name
per_page- Type
- integer
- Description
Limit the number of projects returned per page. Default is 15.
- Name
page- Type
- integer
- Description
The page number to retrieve.
Request
curl -G https://app.depfloy.com/api/v1/projects \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"
-H "Content-Type: application/json"
-d per_page=10 \
-d page=1
Response
{
"current_page": 1,
"data": [
{
"id": 35231,
"name": "PixelPulse",
"server_id": 183009,
"framework_id": 2,
"auto_deploy_is_active": 1,
"ssl_is_enabled": 1,
"installation_status": 1,
"redirect_status_code": 308,
"www_redirect": 0,
"repository_type": "github",
"repository_branch": "dev",
"repository": "MyRepo/PixelPulse",
"custom_commands": {
"dev": "",
"build": "",
"install": "",
"directory": ""
},
"directory": "/home/depfloy/35",
"port": "3510",
"notes": null,
"maintenance_mode": false,
"created_at": "2025-02-09T18:52:20.000000Z",
"updated_at": "2025-02-09T18:52:35.000000Z",
"primary_domain": "nebula-spark.org",
"domains": [
{
"domain_name": "nebula-spark.org",
"is_primary": 1,
"is_active": 1,
"created_at": "2025-02-09T18:52:20.000000Z",
},
// ... more domains
]
},
// ... more projects
],
"per_page": 10,
"total_items": 8,
"total_pages": 1
}
Create a project
This endpoint allows you to create a new project. The project will be linked to the specified server and git repository.
Required attributes
- Name
name- Type
- string
- required
- *
- Description
The display name for the project.
- Name
server_id- Type
- integer
- required
- *
- Description
The ID of the server where the project will be deployed.
- Name
domain- Type
- string
- required
- *
- Description
The primary domain for the project.
- Name
framework_id- Type
- integer
- required
- *
- Description
The framework type identifier. You can fetch the frameworks from the
/api/v1/frameworksendpoint.
- Name
git_repository.repo- Type
- string
- required
- *
- Description
The repository URL. Example: "username/repository.git".
- Name
git_repository.type- Type
- string
- required
- *
- Description
The repository type. "github", "bitbucket" or "gitlab". Example: "github".
- Name
git_repository.branch- Type
- string
- required
- *
- Description
The branch of the repository to deploy. Example: "main".
Optional attributes
- Name
environment_variables- Type
- text
- Description
Environment variables with key, value, and is_secret fields. Example: "API_KEY=your-api-key\nDB_PASSWORD=your-db-password".
- Name
www_redirect- Type
- integer
- Description
WWW redirect setting (1: www to non-www, 2: non-www to www). Default is 0 (no redirect).
- Name
auto_deploy_is_active- Type
- integer
- Description
Enable automatic deployments on git push. Default is 0 (disabled).
- Name
ssl_is_enabled- Type
- integer
- Description
Enable SSL for the project. Default is 0 (disabled).
- Name
custom_commands.dev- Type
- string
- Description
The customcommand to run the project in development mode.
- Name
custom_commands.install- Type
- string
- Description
The custom command to run before the project is deployed.
- Name
custom_commands.build- Type
- string
- Description
The custom command to run when the project is deploying.
- Name
custom_commands.directory- Type
- string
- Description
The custom working directory of the project.
- Name
custom_commands.custom- Type
- string
- Description
The custom deployment script to run when the project is deploying. Example: "php artisan horizon:terminate\nphp artisan cache:clear"
Request
curl https://app.depfloy.com/api/v1/projects \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"server_id": 1,
"name": "My Website",
"domain": "example.com",
"framework": 3,
"git_repository": {
"repo": "username/repository.git",
"type": "github",
"branch": "main"
},
"environment_variables": "API_KEY=your-api-key\nDB_PASSWORD=your-db-password",
"custom_commands": {
"build": "npm run build",
"install": "npm install",
"custom" : "php artisan horizon:terminate\nphp artisan cache:clear"
},
"www_redirect": 2,
"auto_deploy_is_active": 1,
"ssl_is_enabled": 1
}'
Response
{
"status": "success",
"message": "Installation started",
"project_id": "14532"
}
Retrieve a project
This endpoint allows you to retrieve a project by providing the project id.
Request
curl https://app.depfloy.com/api/v1/projects/14532 \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"
-H "Content-Type: application/json"
Response
{
"id": 14532,
"name": "PixelPulse",
"server_id": 2,
"framework_id": 2,
"auto_deploy_is_active": 1,
"ssl_is_enabled": 1,
"installation_status": 1,
"redirect_status_code": 308,
"www_redirect": 0,
"repository_type": "github",
"repository_branch": "dev",
"repository": "MyRepo/PixelPulse",
"custom_commands": {
"dev": "",
"build": "",
"install": "",
"directory": "",
"custom": ""
},
"directory": "/home/depfloy/14532",
"port": "3510",
"notes": null,
"maintenance_mode": false,
"created_at": "2025-02-09T18:52:20.000000Z",
"updated_at": "2025-02-09T18:52:35.000000Z",
"primary_domain": "nebula-spark.org",
"domains": [
{
"domain_name": "nebula-spark.org",
"is_active": 1,
"created_at": "2025-02-09T18:52:20.000000Z",
"is_primary": 1
},
// ... more domains
]
}
Update a project
This endpoint allows you to update an existing project.
Attributes for updating a project
- Name
name- Type
- string
- Description
The display name for the project.
- Name
domain- Type
- string
- Description
The primary domain for the project.
- Name
repository_type- Type
- string
- Description
Git repository source type. "github", "bitbucket" or "gitlab".
- Name
repository- Type
- string
- Description
The URL of the repository to deploy.
- Name
repository_branch- Type
- string
- Description
The branch of the repository to deploy.
- Name
custom_commands.dev- Type
- string
- Description
The customcommand to run the project in development mode.
- Name
custom_commands.install- Type
- string
- Description
The custom command to run before the project is deployed.
- Name
custom_commands.build- Type
- string
- Description
The custom command to run when the project is deploying.
- Name
custom_commands.directory- Type
- string
- Description
The custom working directory of the project.
- Name
custom_commands.custom- Type
- string
- Description
The custom deployment script to run when the project is deploying. Example: "php artisan horizon:terminate\nphp artisan cache:clear"
- Name
environment_variables- Type
- text
- Description
Environment variables with key, value, and is_secret fields. Example: "API_KEY=your-api-key\nDB_PASSWORD=your-db-password".
- Name
auto_deploy_is_active- Type
- integer
- Description
Enable automatic deployments on git push. Default is 0 (disabled).
Request
curl https://app.depfloy.com/api/v1/projects/14532 \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "My Website Updated",
"repository_type": "github",
"repository": "username/repository.git",
"repository_branch": "main",
"custom_commands": {
"build": "npm run build",
"install": "npm install",
"custom" : "php artisan horizon:terminate\nphp artisan cache:clear"
},
"environment_variables": "API_KEY=your-api-key\nDB_PASSWORD=your-db-password",
"auto_deploy_is_active": 1
}'
Response
{
"status": "success",
"message": "Project updated successfully",
"project_id": "14532"
}
Delete a project
This endpoint allows you to delete a project. This will remove the project from the server and delete all associated deployments.
Request
curl -X DELETE https://app.depfloy.com/api/v1/project/14532 \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"
-H "Content-Type: application/json"
Response
{
"status": "success",
"message": "Project deleted successfully",
"project_id": "14532"
}
Publish project on Nginx
This endpoint allows you to publish or republish the project's Nginx configuration. This is useful when you need to update the server configuration without triggering a full deployment.
Optional query parameters
- Name
force_ssl- Type
- boolean
- Description
Force SSL configuration. Set to 1 to enable. 0 = Disable, 1 = Enable. When force_ssl is set to 1, the project's SSL configuration will be updated. When force_ssl is set to 0, the project's SSL configuration will be removed.
Request
curl "https://app.depfloy.com/api/v1/projects/14532/publish?force_ssl=1" \
-H "Authorization: Bearer {API_KEY}" \
-H "Accept: application/json"
-H "Content-Type: application/json"
Response
{
"nginx_response": {
"ok": true,
"system_output": [
"[nginx] : nginx: the configuration file /etc/nginx/nginx.conf syntax is ok",
"[nginx] : nginx: configuration file /etc/nginx/nginx.conf test is successful"
]
}
}