Last updated on 15th September 2026

Create a global build command via API

This method allows you to create a new global build command template at the account level.

Tip: You can explore and test this endpoint interactively using our OpenAPI documentation.

URL

/global_build_commands

HTTP Method

POST

Supported Parameters

  • description - A description of the build command (required)
  • command - The command to run during the build pipeline (required)
  • halt_on_error - Whether the deployment should stop if the command fails (optional, defaults to true)
  • template_name - The name of a predefined build command template to base this command on (optional)
  • watch_files - A comma-separated list of file patterns that should trigger this command (optional)

Example cURL Request

curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user your-email@example.com:your-api-key \
-X POST \
-d '{
  "build_command": {
    "description": "Install dependencies",
    "command": "npm ci",
    "halt_on_error": true
  }
}' \
https://test.deployhq.com/global_build_commands

Example Response

{
  "identifier": "df8966fe-e161-4517-98e2-24f79102dd62",
  "description": "Install dependencies",
  "command": "npm ci",
  "halt_on_error": true,
  "source": "global"
}

Error Responses

If the build command is invalid (for example a missing description or command), the endpoint responds with 422 Unprocessable Entity and a list of the validation errors:

{
  "errors": [
    "Description can't be blank",
    "Command can't be blank"
  ]
}

Other responses you may receive:

  • 401 Unauthorized - the email address or API key is missing or incorrect
  • 403 Forbidden - your user is not an account administrator