Skip to main content
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 via verifyJWT middleware.

Path Parameters

string
required
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:
  • projectId must be a valid MongoDB ObjectId format
  • Project must exist in the database
  • Project status must not be deleted

Response

string
Confirmation message indicating redeployment was initiated.

Success Response

Error Responses

string
Error message describing what went wrong.
string
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:
  1. Project status is updated to building
  2. Project is saved to database
  3. ProjectId is added to reDeploymentQueue
  4. Redeployment worker processes the job asynchronously
The redeployment worker will:
  • 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 building immediately
  • 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
  • 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