Redeploy Project
Deployments
Redeploy Project
POST
Redeploy Project
Redeploys an existing project by triggering a new deployment with the current configuration. This endpoint:
- Validates the project exists and is not deleted
- Updates project status to
building - Adds a redeployment job to the queue
Authentication
Requires JWT authentication viaverifyJWT middleware.
Path Parameters
MongoDB ObjectId of the project to redeploy. Must be a valid ObjectId format.
Request Body
No request body required. All deployment configuration is read from the existing project record.Validation
The endpoint validates:projectIdmust be a valid MongoDB ObjectId format- Project must exist in the database
- Project status must not be
deleted
Response
Confirmation message indicating redeployment was initiated.
Success Response
Error Responses
Error message describing what went wrong.
Detailed error message for specific failures.
Common Errors
- 400 Bad Request:
"Invalid projectId format"- ProjectId is not a valid MongoDB ObjectId - 404 Not Found:
"Invalid ProjectId"- Project not found or has been deleted - 500 Internal Server Error:
"Internal server Error"- Server processing error
Redeployment Queue
When redeployment is initiated:- Project status is updated to
building - Project is saved to database
- ProjectId is added to
reDeploymentQueue - Redeployment worker processes the job asynchronously
- Use existing project configuration (buildCommand, startCommand, env, etc.)
- Fetch latest code from the configured branch
- Create a new build record
- Execute the build process
- Update project status based on build result
Request Examples
Basic Redeploy
With Axios
With Fetch API
Response Example
Successful Redeployment
Invalid ProjectId Format
Project Not Found
Use Cases
Manual Redeploy
Trigger a manual redeployment to:- Deploy latest code changes from the repository
- Retry a failed deployment
- Apply new environment variables (must be updated separately via settings endpoint)
- Rebuild after infrastructure updates
CI/CD Integration
Integrate with CI/CD pipelines:Webhook Automation
While DeployHub supports GitHub webhooks for automatic deployments, this endpoint can be used for:- Manual deployments outside of git pushes
- Scheduled redeployments
- Deployments triggered by external systems
Important Notes
- Redeployment uses the existing project configuration
- To change build settings, update via the project settings endpoint first
- Project status changes to
buildingimmediately - Actual build is processed asynchronously by the redeployment worker
- No new subdomain is generated - existing subdomain is retained
- Build history is preserved - a new build record is created
- Environment variables from the project configuration are used
Related Endpoints
- Create Deployment - Create initial deployment
- List Projects - Get all user projects
- Update Project Settings - Modify project configuration before redeploying
- Get Project Builds - View build history and status