{
  "schemaVersion": 1,
  "operation": {
    "operationId": "cancelDeployment",
    "method": "POST",
    "path": "/api/v1/projects/{project}/deployments/{deployment}/cancel",
    "summary": "Cancel a deployment before cutover",
    "description": "",
    "tags": [
      "Deployments"
    ],
    "effect": "write",
    "confirmation": "conditional",
    "authorization": {
      "mode": "privilege",
      "privilege": "ACTIVATE_DEPLOYMENT"
    },
    "parameters": [
      {
        "name": "project",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "deployment",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 200,
          "minLength": 1,
          "type": "string"
        }
      }
    ],
    "responses": [
      {
        "status": "202",
        "description": "The request has been accepted for processing, but processing has not yet completed.",
        "content": [
          {
            "contentType": "application/json",
            "schema": {
              "$ref": "#/components/schemas/DeploymentResponse"
            }
          }
        ]
      },
      {
        "status": "400",
        "description": "The server could not understand the request due to invalid syntax.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "401",
        "description": "Access is unauthorized.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "403",
        "description": "Access is forbidden.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "404",
        "description": "The server cannot find the requested resource.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "409",
        "description": "The request conflicts with the current state of the server.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "412",
        "description": "Precondition failed.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "413",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "415",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "422",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "429",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "500",
        "description": "Server error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "502",
        "description": "Server error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "503",
        "description": "Service unavailable.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      }
    ]
  },
  "schemas": {
    "DeploymentConnectionResponse": {
      "example": {
        "connectionId": "example",
        "priorRevisionId": "example",
        "revisionId": "example"
      },
      "properties": {
        "connectionId": {
          "example": "example",
          "type": "string"
        },
        "priorRevisionId": {
          "example": "example",
          "type": "string"
        },
        "revisionId": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "connectionId",
        "revisionId"
      ],
      "type": "object"
    },
    "DeploymentProgress": {
      "example": {
        "current": 1,
        "total": 1,
        "unit": "example"
      },
      "properties": {
        "current": {
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "total": {
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "unit": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "current",
        "total",
        "unit"
      ],
      "type": "object"
    },
    "DeploymentResponse": {
      "example": {
        "connections": [
          {
            "connectionId": "example",
            "priorRevisionId": "example",
            "revisionId": "example"
          }
        ],
        "createdAt": "2026-01-02T15:04:05Z",
        "createdBy": "example",
        "environment": "example",
        "error": "example",
        "finishedAt": "2026-01-02T15:04:05Z",
        "id": "example",
        "progress": {
          "current": 1,
          "total": 1,
          "unit": "example"
        },
        "projectId": "example",
        "releaseId": "example",
        "startedAt": "2026-01-02T15:04:05Z",
        "status": "queued",
        "targets": [
          {
            "error": "example",
            "priorServingStateId": "example",
            "servingStateId": "example",
            "status": "example",
            "workspaceId": "example"
          }
        ]
      },
      "properties": {
        "connections": {
          "example": [
            {
              "connectionId": "example",
              "priorRevisionId": "example",
              "revisionId": "example"
            }
          ],
          "items": {
            "$ref": "#/components/schemas/DeploymentConnectionResponse"
          },
          "type": "array"
        },
        "createdAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        },
        "createdBy": {
          "example": "example",
          "type": "string"
        },
        "environment": {
          "example": "example",
          "type": "string"
        },
        "error": {
          "example": "example",
          "type": "string"
        },
        "finishedAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        },
        "id": {
          "example": "example",
          "type": "string"
        },
        "progress": {
          "$ref": "#/components/schemas/DeploymentProgress"
        },
        "projectId": {
          "example": "example",
          "type": "string"
        },
        "releaseId": {
          "example": "example",
          "type": "string"
        },
        "startedAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        },
        "status": {
          "$ref": "#/components/schemas/DeploymentStatus"
        },
        "targets": {
          "example": [
            {
              "error": "example",
              "priorServingStateId": "example",
              "servingStateId": "example",
              "status": "example",
              "workspaceId": "example"
            }
          ],
          "items": {
            "$ref": "#/components/schemas/DeploymentTargetResponse"
          },
          "type": "array"
        }
      },
      "required": [
        "id",
        "projectId",
        "releaseId",
        "environment",
        "status",
        "targets",
        "connections",
        "createdBy",
        "createdAt"
      ],
      "type": "object"
    },
    "DeploymentStatus": {
      "enum": [
        "queued",
        "running",
        "active",
        "failed",
        "cancelled",
        "superseded"
      ],
      "example": "queued",
      "type": "string"
    },
    "DeploymentTargetResponse": {
      "example": {
        "error": "example",
        "priorServingStateId": "example",
        "servingStateId": "example",
        "status": "example",
        "workspaceId": "example"
      },
      "properties": {
        "error": {
          "example": "example",
          "type": "string"
        },
        "priorServingStateId": {
          "example": "example",
          "type": "string"
        },
        "servingStateId": {
          "example": "example",
          "type": "string"
        },
        "status": {
          "example": "example",
          "type": "string"
        },
        "workspaceId": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "workspaceId",
        "status"
      ],
      "type": "object"
    },
    "ProblemDetails": {
      "example": {
        "code": "example",
        "detail": "example",
        "errors": [
          {
            "code": "example",
            "detail": "example",
            "field": "example"
          }
        ],
        "instance": "example",
        "requestId": "example",
        "status": 1,
        "title": "example",
        "type": "example"
      },
      "properties": {
        "code": {
          "example": "example",
          "type": "string"
        },
        "detail": {
          "example": "example",
          "type": "string"
        },
        "errors": {
          "example": [
            {
              "code": "example",
              "detail": "example",
              "field": "example"
            }
          ],
          "items": {
            "$ref": "#/components/schemas/ProblemFieldError"
          },
          "type": "array"
        },
        "instance": {
          "example": "example",
          "type": "string"
        },
        "requestId": {
          "example": "example",
          "type": "string"
        },
        "status": {
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "title": {
          "example": "example",
          "type": "string"
        },
        "type": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "type",
        "title",
        "status",
        "detail",
        "instance",
        "code",
        "requestId",
        "errors"
      ],
      "type": "object"
    },
    "ProblemFieldError": {
      "example": {
        "code": "example",
        "detail": "example",
        "field": "example"
      },
      "properties": {
        "code": {
          "example": "example",
          "type": "string"
        },
        "detail": {
          "example": "example",
          "type": "string"
        },
        "field": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "field",
        "code",
        "detail"
      ],
      "type": "object"
    }
  }
}
