POST
/
v13
/
deployments
import { Vercel } from "@vercel/sdk";

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

async function run() {
  const result = await vercel.deployments.createDeployment({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      deploymentId: "dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6",
      files: [
        {
          file: "folder/file.js",
        },
        {
          file: "folder/file.js",
        },
      ],
      gitMetadata: {
        remoteUrl: "https://github.com/vercel/next.js",
        commitAuthorName: "kyliau",
        commitMessage: "add method to measure Interaction to Next Paint (INP) (#36490)",
        commitRef: "main",
        commitSha: "dc36199b2234c6586ebe05ec94078a895c707e29",
        dirty: true,
      },
      gitSource: {
        ref: "main",
        repoId: 123456789,
        sha: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
        type: "github",
      },
      meta: {
        "foo": "bar",
      },
      name: "my-instant-deployment",
      project: "my-deployment-project",
      projectSettings: {
        buildCommand: "next build",
        installCommand: "pnpm install",
      },
      target: "production",
    },
  });

  // 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>",
    "commandForIgnoringBuildStep": "<string>",
    "devCommand": "<string>",
    "framework": "blitzjs",
    "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": "CANCELED",
  "team": {
    "name": "<string>",
    "id": "<string>",
    "slug": "<string>",
    "avatar": "<string>"
  },
  "userAliases": [
    "<string>"
  ],
  "previewCommentsEnabled": true,
  "ttyBuildLogs": true,
  "customEnvironment": {},
  "type": "LAMBDAS",
  "name": "<string>",
  "createdAt": 123,
  "deletedAt": 123,
  "id": "<string>",
  "version": 2,
  "autoAssignCustomDomains": true,
  "gitSource": {
    "type": "github",
    "repoId": "<string>",
    "ref": "<string>",
    "sha": "<string>",
    "prId": 123
  },
  "meta": {},
  "project": {
    "id": "<string>",
    "name": "<string>",
    "framework": "<string>"
  },
  "readyState": "CANCELED",
  "source": "cli",
  "target": "production",
  "passiveRegions": [
    "<string>"
  ],
  "regions": [
    "<string>"
  ],
  "errorMessage": "<string>",
  "aliasWarning": {
    "code": "<string>",
    "message": "<string>",
    "link": "<string>",
    "action": "<string>"
  },
  "aliasError": {
    "code": "<string>",
    "message": "<string>"
  },
  "aliasFinal": "<string>",
  "automaticAliases": [
    "<string>"
  ],
  "buildErrorAt": 123,
  "checksState": "registered",
  "checksConclusion": "succeeded",
  "defaultRoute": "<string>",
  "canceledAt": 123,
  "errorCode": "<string>",
  "errorLink": "<string>",
  "errorStep": "<string>",
  "originCacheRegion": "<string>",
  "readySubstate": "STAGED",
  "softDeletedByRetention": true,
  "undeletedAt": 123,
  "url": "<string>",
  "oidcTokenClaims": {
    "iss": "<string>",
    "sub": "<string>",
    "scope": "<string>",
    "aud": "<string>",
    "owner": "<string>",
    "owner_id": "<string>",
    "project": "<string>",
    "project_id": "<string>",
    "environment": "<string>"
  },
  "plan": "pro",
  "projectId": "<string>",
  "ownerId": "<string>",
  "microfrontends": {
    "isDefaultApp": true,
    "defaultRoute": "<string>",
    "groupIds": [
      "<string>"
    ]
  },
  "monorepoManager": "<string>",
  "config": {
    "version": 123,
    "functionType": "fluid",
    "functionMemoryType": "standard",
    "functionTimeout": 123,
    "secureComputePrimaryRegion": "<string>",
    "secureComputeFallbackRegion": "<string>"
  },
  "functions": {},
  "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
    }
  ],
  "crons": [
    {
      "schedule": "<string>",
      "path": "<string>"
    }
  ],
  "connectBuildsEnabled": true,
  "connectConfigurationId": "<string>",
  "createdIn": "<string>",
  "passiveConnectConfigurationId": "<string>",
  "gitRepo": {
    "namespace": "<string>",
    "projectId": 123,
    "type": "gitlab",
    "url": "<string>",
    "path": "<string>",
    "defaultBranch": "<string>",
    "name": "<string>",
    "private": true,
    "ownerType": "team"
  },
  "flags": {
    "definitions": {}
  }
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Query Parameters

forceNew
enum<string>

Forces a new deployment even if there is a previous similar deployment

Available options:
0,
1
skipAutoDetectionConfirmation
enum<string>

Allows to skip framework detection so the API would not fail to ask for confirmation

Available options:
0,
1
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"

Body

application/json
name
string
required

A string with the project name used in the deployment URL

Example:

"my-instant-deployment"

customEnvironmentSlugOrId
string

Deploy to a custom environment, which will override the default environment

deploymentId
string

An deployment id for an existing deployment to redeploy

Example:

"dpl_2qn7PZrx89yxY34vEZPD31Y9XVj6"

files
object[]

A list of objects with the files to be deployed

Used in the case you want to inline a file inside the request

gitMetadata
object

Populates initial git metadata for different git providers.

gitSource
object

Defines the Git Repository source to be deployed. This property can not be used in combination with files.

meta
object

An object containing the deployment's metadata. Multiple key-value pairs can be attached to a deployment

Example:
{ "foo": "bar" }
monorepoManager
string | null

The monorepo manager that is being used for this deployment. When null is used no monorepo manager is selected

project
string

The target project identifier in which the deployment will be created. When defined, this parameter overrides name

Example:

"my-deployment-project"

projectSettings
object

Project settings that will be applied to the deployment. It is required for the first deployment of a project and will be saved for any following deployments

target
string

Either not defined, staging, production, or a custom environment identifier. If staging, a staging alias in the format <project>-<team>.vercel.app will be assigned. If production, any aliases defined in alias will be assigned. If omitted, the target will be preview.

Example:

"production"

withLatestCommit
boolean

When true and deploymentId is passed in, the sha from the previous deployment's gitSource is removed forcing the latest commit to be used.

Response

200
application/json

The successfully created 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:
CANCELED,
ERROR,
QUEUED,
BUILDING,
INITIALIZING,
READY
type
enum<string>
required
Available options:
LAMBDAS
name
string
required
createdAt
number
required
id
string
required
version
enum<number>
required
Available options:
2
meta
object
required
readyState
enum<string>
required
Available options:
CANCELED,
ERROR,
QUEUED,
BUILDING,
INITIALIZING,
READY
regions
string[]
required
url
string
required
plan
enum<string>
required
Available options:
pro,
enterprise,
hobby
projectId
string
required
ownerId
string
required
routes
object[] | null
required
createdIn
string
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
deletedAt
number | null
autoAssignCustomDomains
boolean

applies to custom domains only, defaults to true

gitSource
object
project
object
source
enum<string>
Available options:
cli,
git,
import,
import/repo,
clone/repo,
api-trigger-git-deploy,
redeploy,
v0-web
target
enum<string> | null
Available options:
production,
staging
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

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

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

canceledAt
number
errorCode
string
errorStep
string
originCacheRegion
string
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
undeletedAt
number
oidcTokenClaims
object
microfrontends
object
monorepoManager
string | null
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

functions
object | null
crons
object[]
connectBuildsEnabled
boolean
connectConfigurationId
string
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.