Cancel Build
Stop a queued or running build before it publishes.
Stop a build that is queued or still running. A cancelled build publishes nothing, and the site keeps serving whatever it served before.
Any workspace member (session JWT), or an API key bound to this project with the build scope or higher. Any plan.
A build can be cancelled while its status is queued, uploading, cloning, parsing or compiling. Once it reaches deploying, the upload to the CDN and the switch to the new version may already be under way, so the request returns 409 build_not_cancellable.
What happens next depends on where the build is:
failed.Either way the status changes to cancelled immediately, the log gets a Cancelled by <name> line, and the log stream ends with a complete event whose data is cancelled. The workspace audit log records build.cancelled.
Path Parameters
projectId3f2a9c1e-8b4d-4e7a-9c21-5d6e7f8a9b0c).buildIdbld_xyz789). It must belong to projectId.Request Body
None.
Response
Returns the updated build object, without logs and triggeredBy:
status is cancelled.completedAt is the time of the cancel.error is Cancelled by <name>, using your account name (or email), or Cancelled by API key "<key name>" for an API key.durationMs is set if the build had started.Error Responses
| Status | error.code | When |
|---|---|---|
| 401 | unauthorized | No credential, or an invalid, revoked or expired one |
| 403 | forbidden | You are not a member of the project's workspace, or the API key's scope is below build |
| 404 | not_found | The project or build does not exist, the build belongs to another project, or the API key belongs to another project |
| 409 | build_not_cancellable | The build is deploying, deployed, failed or already cancelled. details.status is its current status |
409 Conflict
Returned when the build is already publishing or has finished. The status check and the update happen in one step, so if the build moves on between your request and the update you also get this error.
For a finished build the message is This build has already finished (<status>).