PATCH
/
v12
/
deployments
/
{id}
/
cancel
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.deployments.cancelDeployment({
    id: "dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  // Handle the result
  console.log(result);
}

run();
{
  "aliasAssignedAt": 123,
  "alwaysRefuseToBuild": true,
  "build": {
    "env": [
      "<string>"
    ]
  },
  "buildArtifactUrls": [
    "<string>"
  ],
  "builds": [
    {
      "use": "<string>",
      "src": "<string>",
      "config": {}
    }
  ],
  "env": [
    "<string>"
  ],
  "inspectorUrl": "<string>",
  "isInConcurrentBuildsQueue": true,
  "isInSystemBuildsQueue": true,
  "projectSettings": {
    "buildCommand": "<string>",
    "devCommand": "<string>",
    "framework": "blitzjs",
    "commandForIgnoringBuildStep": "<string>",
    "installCommand": "<string>",
    "outputDirectory": "<string>",
    "speedInsights": {
      "id": "<string>",
      "enabledAt": 123,
      "disabledAt": 123,
      "canceledAt": 123,
      "hasData": true,
      "paidAt": 123
    },
    "webAnalytics": {
      "id": "<string>",
      "disabledAt": 123,
      "canceledAt": 123,
      "enabledAt": 123,
      "hasData": true
    }
  },
  "readyStateReason": "<string>",
  "integrations": {
    "status": "error",
    "startedAt": 123,
    "completedAt": 123,
    "skippedAt": 123,
    "skippedBy": "<string>"
  },
  "images": {
    "sizes": [
      123
    ],
    "qualities": [
      123
    ],
    "domains": [
      "<string>"
    ],
    "remotePatterns": [
      {
        "protocol": "http",
        "hostname": "<string>",
        "port": "<string>",
        "pathname": "<string>",
        "search": "<string>"
      }
    ],
    "localPatterns": [
      {
        "pathname": "<string>",
        "search": "<string>"
      }
    ],
    "minimumCacheTTL": 123,
    "formats": [
      "image/avif"
    ],
    "dangerouslyAllowSVG": true,
    "contentSecurityPolicy": "<string>",
    "contentDispositionType": "inline"
  },
  "alias": [
    "<string>"
  ],
  "aliasAssigned": true,
  "bootedAt": 123,
  "buildingAt": 123,
  "buildSkipped": true,
  "creator": {
    "uid": "<string>",
    "username": "<string>",
    "avatar": "<string>"
  },
  "initReadyAt": 123,
  "isFirstBranchDeployment": true,
  "lambdas": [
    {
      "id": "<string>",
      "createdAt": 123,
      "entrypoint": "<string>",
      "readyState": "BUILDING",
      "readyStateAt": 123,
      "output": [
        {
          "path": "<string>",
          "functionName": "<string>"
        }
      ]
    }
  ],
  "public": true,
  "ready": 123,
  "status": "BUILDING",
  "team": {
    "id": "<string>",
    "name": "<string>",
    "avatar": "<string>",
    "slug": "<string>"
  },
  "userAliases": [
    "<string>"
  ],
  "previewCommentsEnabled": true,
  "ttyBuildLogs": true,
  "customEnvironment": {},
  "id": "<string>",
  "aliasError": {
    "code": "<string>",
    "message": "<string>"
  },
  "aliasFinal": "<string>",
  "aliasWarning": {
    "code": "<string>",
    "message": "<string>",
    "link": "<string>",
    "action": "<string>"
  },
  "autoAssignCustomDomains": true,
  "automaticAliases": [
    "<string>"
  ],
  "buildErrorAt": 123,
  "checksState": "registered",
  "checksConclusion": "skipped",
  "createdAt": 123,
  "deletedAt": 123,
  "defaultRoute": "<string>",
  "canceledAt": 123,
  "errorCode": "<string>",
  "errorLink": "<string>",
  "errorMessage": "<string>",
  "errorStep": "<string>",
  "passiveRegions": [
    "<string>"
  ],
  "gitSource": {
    "type": "github",
    "repoId": "<string>",
    "ref": "<string>",
    "sha": "<string>",
    "prId": 123
  },
  "name": "<string>",
  "meta": {},
  "originCacheRegion": "<string>",
  "project": {
    "id": "<string>",
    "name": "<string>",
    "framework": "<string>"
  },
  "readyState": "BUILDING",
  "readySubstate": "STAGED",
  "regions": [
    "<string>"
  ],
  "softDeletedByRetention": true,
  "source": "api-trigger-git-deploy",
  "target": "production",
  "type": "LAMBDAS",
  "undeletedAt": 123,
  "url": "<string>",
  "version": 2,
  "oidcTokenClaims": {
    "iss": "<string>",
    "sub": "<string>",
    "scope": "<string>",
    "aud": "<string>",
    "owner": "<string>",
    "owner_id": "<string>",
    "project": "<string>",
    "project_id": "<string>",
    "environment": "<string>"
  },
  "connectBuildsEnabled": true,
  "connectConfigurationId": "<string>",
  "createdIn": "<string>",
  "crons": [
    {
      "schedule": "<string>",
      "path": "<string>"
    }
  ],
  "functions": {},
  "monorepoManager": "<string>",
  "ownerId": "<string>",
  "passiveConnectConfigurationId": "<string>",
  "plan": "pro",
  "projectId": "<string>",
  "routes": [
    {
      "src": "<string>",
      "dest": "<string>",
      "headers": {},
      "methods": [
        "<string>"
      ],
      "continue": true,
      "override": true,
      "caseSensitive": true,
      "check": true,
      "important": true,
      "status": 123,
      "has": [
        {
          "type": "host",
          "value": "<string>"
        }
      ],
      "missing": [
        {
          "type": "host",
          "value": "<string>"
        }
      ],
      "locale": {
        "redirect": {},
        "cookie": "<string>"
      },
      "middlewarePath": "<string>",
      "middlewareRawSrc": [
        "<string>"
      ],
      "middleware": 123
    }
  ],
  "gitRepo": {
    "namespace": "<string>",
    "projectId": 123,
    "type": "gitlab",
    "url": "<string>",
    "path": "<string>",
    "defaultBranch": "<string>",
    "name": "<string>",
    "private": true,
    "ownerType": "team"
  },
  "flags": {
    "definitions": {}
  },
  "microfrontends": {
    "isDefaultApp": true,
    "defaultRoute": "<string>",
    "groupIds": [
      "<string>"
    ]
  },
  "config": {
    "version": 123,
    "functionType": "fluid",
    "functionMemoryType": "standard",
    "functionTimeout": 123,
    "secureComputePrimaryRegion": "<string>",
    "secureComputeFallbackRegion": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

id
string
required

The unique identifier of the deployment.

Example:

"dpl_5WJWYSyB7BpgTj3EuwF37WMRBXBtPQ2iTMJHJBJyRfd"

Query Parameters

teamId
string

The Team identifier to perform the request on behalf of.

Example:

"team_1a2b3c4d5e6f7g8h9i0j1k2l"

slug
string

The Team slug to perform the request on behalf of.

Example:

"my-team-url-slug"

Response

200
application/json

The private deployment representation of a Deployment.

build
object
required
env
string[]
required
inspectorUrl
string | null
required
isInConcurrentBuildsQueue
boolean
required
isInSystemBuildsQueue
boolean
required
projectSettings
object
required
aliasAssigned
boolean
required
bootedAt
number
required
buildingAt
number
required
buildSkipped
boolean
required
creator
object
required
public
boolean
required
status
enum<string>
required
Available options:
BUILDING,
ERROR,
INITIALIZING,
QUEUED,
READY,
CANCELED
id
string
required
createdAt
number
required
name
string
required
meta
object
required
readyState
enum<string>
required
Available options:
BUILDING,
ERROR,
INITIALIZING,
QUEUED,
READY,
CANCELED
regions
string[]
required
type
enum<string>
required
Available options:
LAMBDAS
url
string
required
version
enum<number>
required
Available options:
2
createdIn
string
required
ownerId
string
required
plan
enum<string>
required
Available options:
pro,
enterprise,
hobby
projectId
string
required
routes
object[] | null
required
aliasAssignedAt
alwaysRefuseToBuild
boolean
buildArtifactUrls
string[]
builds
object[]
readyStateReason
string
integrations
object
images
object
alias
string[]
initReadyAt
number
isFirstBranchDeployment
boolean
lambdas
object[]

A partial representation of a Build used by the deployment endpoint.

ready
number
team
object
userAliases
string[]
previewCommentsEnabled
boolean
ttyBuildLogs
boolean
customEnvironment
object
aliasError
object | null
aliasFinal
string | null
aliasWarning
object | null
autoAssignCustomDomains
boolean

applies to custom domains only, defaults to true

automaticAliases
string[]
buildErrorAt
number
checksState
enum<string>
Available options:
registered,
running,
completed
checksConclusion
enum<string>
Available options:
skipped,
succeeded,
failed,
canceled
deletedAt
number | null
defaultRoute
string

Computed field that is only available for deployments with a microfrontend configuration.

canceledAt
number
errorCode
string
errorMessage
string | null
errorStep
string
passiveRegions
string[]

Since November 2023 this field defines a set of regions that we will deploy the lambda to passively Lambdas will be deployed to these regions but only invoked if all of the primary regions are marked as out of service

gitSource
object
originCacheRegion
string
project
object
readySubstate
enum<string>

Substate of deployment when readyState is 'READY' Tracks whether or not deployment has seen production traffic: - STAGED: never seen production traffic - ROLLING: in the process of having production traffic gradually transitioned. - PROMOTED: has seen production traffic

Available options:
STAGED,
ROLLING,
PROMOTED
softDeletedByRetention
boolean
source
enum<string>
Available options:
api-trigger-git-deploy,
cli,
clone/repo,
git,
import,
import/repo,
redeploy,
v0-web
target
enum<string> | null
Available options:
production,
staging
undeletedAt
number
oidcTokenClaims
object
connectBuildsEnabled
boolean
connectConfigurationId
string
crons
object[]
functions
object | null
monorepoManager
string | null
passiveConnectConfigurationId
string

Since November 2023 this field defines a Secure Compute network that will only be used to deploy passive lambdas to (as in passiveRegions)

gitRepo
object
flags

Flags defined in the Build Output API, used by this deployment. Primarily used by the Toolbar to know about the used flags.

microfrontends
object
config
object

Since February 2025 the configuration must include snapshot data at the time of deployment creation to capture properties for the /deployments/:id/config endpoint utilized for displaying Deployment Configuration on the frontend This is optional because older deployments may not have this data captured