Develop. Preview. Ship.
@vercel/sdk
The @vercel/sdk is a type-safe Typescript SDK that gives you full control over the entire Vercel platform through the Vercel REST API.
Table of Contents
* SDK Installation * Requirements * Access Tokens * Authentication * SDK Example Usage * Available Resources and Operations * Standalone functions * File uploads * Retries * Error Handling * Server Selection * Custom HTTP Client * Debugging * Maturity * Contributions
SDK Installation
The SDK can be installed with either npm, pnpm, bun or yarn package managers.
NPM
npm add @vercel/sdk
PNPM
pnpm add @vercel/sdk
Bun
bun add @vercel/sdk
Yarn
yarn add @vercel/sdk
[!NOTE]
This package is published as an ES Module (ESM) only. For applications using
CommonJS, use await import("@vercel/sdk") to import and use this package.
Requirements
For supported JavaScript runtimes, please consult RUNTIMES.md.
Access Tokens
You need to pass a valid access token to be able to use any resource or operation. Refer to Creating an Access Token to learn how to create one. Make sure that you create a token with the correct Vercel scope. If you face permission (403) errors when you are already sending a token, it can be one of the following problems:
- The token you are using has expired. Check the expiry date of the token in the Vercel dashboard.
- The token does not have access to the correct scope, either not the right team or it does not have account level access.
- The resource or operation you are trying to use is not available for that team. For example, AccessGroups is an Enterprise only feature and you are using a token for a team on the pro plan.
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
| ------------- | ---- | ----------- |
| bearerToken | http | HTTP Bearer |
To authenticate with the API the bearerToken parameter must be set when initializing the SDK client instance. For example:
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.replaceDomainsByDomainRecords({
domain: "example.com",
});
console.log(result);
}
run();
SDK Example Usage
Update an existing project
Update the fields of a project using either its name or id.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.projects.updateProject({
idOrName: "prj_12HKQaOmR5t5Uy6vdcQsNIiZgHGB",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
requestBody: {
name: "a-project-name",
sandbox: {
region: "iad1",
failoverRegions: [
"sfo1",
"cle1",
],
},
},
});
console.log(result);
}
run();
Available Resources and Operations
Available methods
Vercel SDK
- replaceDomainsByDomainRecords
- getDomainsRecordsByRecordId
- createApiKeys
- createObservabilityQuery
- getObservabilitySchema
- getObservabilitySchemaByMetricId
- createSpeedInsightsToggle
- createWebInsightsToggle
AccessGroups
- readAccessGroup - Reads an access group
- updateAccessGroup - Update an access group
- deleteAccessGroup - Deletes an access group
- listAccessGroupMembers - List members of an access group
- listAccessGroups - List access groups for a team, project or member
- createAccessGroup - Creates an access group
- listAccessGroupProjects - List projects of an access group
- createAccessGroupProject - Create an access group project
- readAccessGroupProject - Reads an access group project
- updateAccessGroupProject - Update an access group project
- deleteAccessGroupProject - Delete an access group project
AiGateway
- createAiGatewayVirtualModelConfig - Create virtual model config
- getAiGatewayVirtualModelConfig - Get virtual model config
- updateAiGatewayVirtualModelConfig - Update virtual model config
- deleteAiGatewayVirtualModelConfig - Delete virtual model config
- listAiGatewayVirtualModelConfigs - List virtual model configs
- getAiGatewayVirtualModelConfigBySlug - Get virtual model config
- updateAiGatewayVirtualModelConfigBySlug - Update virtual model config
- deleteAiGatewayVirtualModelConfigBySlug - Delete virtual model config
- listAiGatewayRouters - List AI Gateway routers
- createAiGatewayRule - Create rule
- listAiGatewayRules - List rules
- updateAiGatewayRule - Update rule
- deleteAiGatewayRule - Delete rule
- listAiGatewayBudgets - List AI Gateway budgets
- upsertAiGatewayBudget - Upsert AI Gateway budget
- archiveAiGatewayBudget - Archive AI Gateway budget
- listAiGatewayBudgetDefaults - List AI Gateway budget defaults
- upsertAiGatewayBudgetDefault - Upsert AI Gateway budget default
- archiveAiGatewayBudgetDefault - Archive AI Gateway budget default
Aliases
- listDeploymentAliases - List Deployment Aliases
- assignAlias - Assign an Alias
- listAliases - List aliases
- getAlias - Get an Alias
- deleteAlias - Delete an Alias
- patchUrlProtectionBypass - Update the protection bypass for a URL
Artifacts
- recordEvents - Record an artifacts cache usage event
- status - Get status of Remote Caching for this principal
- uploadArtifact - Upload a cache artifact
- downloadArtifact - Download a cache artifact
- artifactExists - Check if a cache artifact exists
- artifactQuery - Query information about an artifact
- deleteAllArtifacts - Delete all cache artifacts
Authentication
- exchangeSsoToken - SSO Token Exchange
- listAuthTokens - List Auth Tokens
- createAuthToken - Create an Auth Token
- getAuthToken - Get Auth Token Metadata
- deleteAuthToken - Delete an authentication token
Billing
- buyCredits - Purchase credits
BulkRedirects
- stageRedirects - Stages new redirects for a project.
- getRedirects - Gets project-level redirects.
- deleteRedirects - Delete project-level redirects.
- editRedirect - Edit a project-level redirect.
- restoreRedirects - Restore staged project-level redirects to their production version.
- getVersions - Get the version history for a project's redirects.
- updateVersion - Promote a staging version to production or restore a previous production version.
Certs
- getCertById - Get cert by id
- removeCert - Remove cert
- getCerts - Get certs
- issueCert - Issue a new cert
- uploadCert - Upload a cert
~~Checks~~
- ~~createCheck~~ - Creates a new Check :warning: Deprecated
- ~~getAllChecks~~ - Retrieve a list of all checks :warning: Deprecated
- ~~getCheck~~ - Get a single check :warning: Deprecated
- ~~updateCheck~~ - Update a check :warning: Deprecated
- ~~rerequestCheck~~ - Rerequest a check :warning: Deprecated
ChecksV2
- listProjectChecks - List all checks for a project
- createProjectCheck - Create a check
- getProjectCheck - Get a check
- updateProjectCheck - Update a check
- deleteProjectCheck - Delete a check
- listCheckRuns - List runs for a check
- listDeploymentCheckRuns - List check runs for a deployment
- createDeploymentCheckRun - Create a check run
- getDeploymentCheckRun - Get a check run
- updateDeploymentCheckRun - Update a check run
Connect
- listConnectors - List connectors
- getConnector - Get a connector
- deleteConnector - Delete a connector
- updateConnector - Update a connector
- replaceConnectorTriggerDestinations - Update connector trigger destinations
- ejectManagedConnector - Eject a managed connector
- listConnectorProjectConnections - List projects for a connector
- getConnectorProjectConnection - Get a connector project connection
- upsertConnectorProjectConnection - Create or update a connector project connection
- deleteConnectorProjectConnection - Disconnect a connector from a project
- listProjectConnectorConnections - List connectors for a project
Deployments
- getDeploymentEvents - Get deployment events
- updateIntegrationDeploymentAction - Update deployment integration action
- getDeployment - Get a deployment by ID or URL
- createDeployment - Create a new deployment
- cancelDeployment - Cancel a deployment
- uploadFile - Upload Deployment Files
- listDeploymentFiles - List Deployment Files
- getDeploymentFileContents - Get Deployment File Contents
- getDeployments - List deployments
- deleteDeployment - Delete a Deployment
Dns
- getRecords - List existing DNS records
- createRecord - Create a DNS record
- updateRecord - Update an existing DNS record
- removeRecord - Delete a DNS record
Domains
- getDomainConfig - Get a Domain's configuration
- getDomainVerificationRecord - Get Domain Verification Record
- claimDomainOwnership - Claim Domain Ownership
- getDomainProjectDomains - List Project Domains by Apex Domain
- getDomain - Get Information for a Single Domain
- getDomains - List all the domains
- createOrTransferDomain - Add an existing domain to the Vercel platform
- patchDomain - Update or move apex domain
- deleteDomain - Remove a domain by name
DomainsRegistrar
- searchDomains - Get Domain Availability and Pricing
- getSupportedTlds - Get supported TLDs
- getTld - Get TLD
- getTldPrice - Get TLD price data
- getDomainAvailability - Get availability for a domain
- getDomainPrice - Get price data for a domain
- getBulkPrice - Get price data for multiple domains
- getBulkAvailability - Get availability for multiple domains
- getContactInfoSchema - Get contact info schema
- getDomainAuthCode - Get the auth code for a domain
- buySingleDomain - Buy a domain
- buyDomains - Buy multiple domains
- transferInDomain - Transfer-in a domain
- getDomainTransferIn - Get a domain's transfer status
- renewDomain - Renew a domain
- updateDomainAutoRenew - Update auto-renew for a domain
- updateDomainNameservers - Update nameservers for a domain
- getDomainContactVerification - Get contact verification status for a domain
- getOrder - Get a domain order
Drains
- createDrain - Create a new Drain
- getDrains - Retrieve a list of all Drains
- deleteDrain - Delete a drain
- getDrain - Find a Drain by id
- updateDrain - Update an existing Drain
- testDrain - Validate Drain delivery configuration
EdgeCache
- invalidateByTags - Invalidate by tag
- dangerouslyDeleteByTags - Dangerously delete by tag
- invalidateBySrcImages - Invalidate by source image
- dangerouslyDeleteBySrcImages - Dangerously delete by source image
Environment
- createSharedEnvVariable - Create one or more shared environment variables
- listSharedEnvVariable - Lists all Shared Environment Variables for a team
- updateSharedEnvVariable - Updates one or more shared environment variables
- deleteSharedEnvVariable - Delete one or more Env Var
- getSharedEnvVar - Retrieve the decrypted value of a Shared Environment Variable by id.
- unlinkSharedEnvVariable - Disconnects a shared environment variable for a given project
- createCustomEnvironment - Create a custom environment for the current project.
- getProjectsByIdOrNameCustomEnvironments - Retrieve custom environments
- getCustomEnvironment - Retrieve a custom environment
- updateCustomEnvironment - Update a custom environment
- removeCustomEnvironment - Remove a custom environment
FeatureFlags
- listFlagsV2 - List flags
- listFlags - List flags
- createFlag - Create a flag
- getFlag - Get a flag
- updateFlag - Update a flag
- deleteFlag - Delete a flag
- listFlagVersions - List flag versions
- getFlagSettings - Get project flag settings
- updateFlagSettings - Update project flag settings
- listTeamFlagSettings - List team project flag settings
- listTeamFlagsV2 - List all flags for a team
- listTeamFlags - List all flags for a team
- createFlagSegment - Create a segment
- listFlagSegments - List segments
- getFlagSegment - Get a segment
- deleteFlagSegment - Delete a segment
- updateFlagSegment - Update a segment
- getDeploymentFeatureFlags - Retrieve the feature flags of a deployment
- getSDKKeys - Get all SDK keys
- createSDKKey - Create an SDK key
- deleteSDKKey - Delete an SDK key
GlobalConfig
- getEdgeConfigs - Get Global Configs
- createEdgeConfig - Create a Global Config
- getEdgeConfig - Get a Global Config
- updateEdgeConfig - Update a Global Config
- deleteEdgeConfig - Delete a Global Config
- getEdgeConfigItems - Get Global Config items
- patchEdgeConfigItems - Update Global Config items in batch
- getEdgeConfigSchema - Get Global Config schema
- patchEdgeConfigSchema - Update Global Config schema
- deleteEdgeConfigSchema - Delete a Global Config's schema
- getEdgeConfigItem - Get a Global Config item
- getEdgeConfigTokens - Get all tokens of a Global Config
- deleteEdgeConfigTokens - Delete one or more Global Config tokens
- getEdgeConfigToken - Get Global Config token meta data
- createEdgeConfigToken - Create a Global Config token
- getEdgeConfigBackup - Get Global Config backup
- restoreEdgeConfigBackup - Restore Global Config backup
- getEdgeConfigBackups - Get Global Config backups
Integrations
- updateIntegrationDeploymentAction - Update deployment integration action
- gitNamespaces - List git namespaces by provider
- searchRepo - List git repositories linked to namespace by provider
- getBillingPlans - List integration billing plans
- connectIntegrationResourceToProject - Connect integration resource to project
- getConfigurations - Get configurations for the authenticated user or team
- getConfiguration - Retrieve an integration configuration
- deleteConfiguration - Delete an integration configuration
- getConfigurationProducts - List products for integration configuration
- createIntegrationStoreDirect - Create integration store (free and paid plans)
Kms
- signKmsMessage - Sign a message
- signKmsToken - Sign a token
- listKmsIssuers - List issuers
- createKmsIssuer - Create an issuer
- createKmsSigningKey - Create a signing key
- activateKmsSigningKey - Activate a signing key
- revokeKmsSigningKey - Revoke a signing key
- getKmsIssuer - Get an issuer
- updateKmsIssuer - Update an issuer
- deleteKmsIssuer - Delete an issuer
- createKmsIssuerPolicy - Create an issuer policy
- updateKmsIssuerPolicy - Update an issuer policy
- deleteKmsIssuerPolicy - Delete an issuer policy
LogDrains
- getConfigurableLogDrain - Retrieves a Configurable Log Drain (deprecated)
- deleteConfigurableLogDrain - Deletes a Configurable Log Drain (deprecated)
- getAllLogDrains - Retrieves a list of all the Log Drains (deprecated)
- createConfigurableLogDrain - Creates a Configurable Log Drain (deprecated)
- getIntegrationLogDrains - Retrieves a list of Integration log drains (deprecated)
- createLogDrain - Creates a new Integration Log Drain (deprecated)
- deleteIntegrationLogDrain - Deletes the Integration log drain with the provided
id(deprecated)
Logs
- getRuntimeLogs - Get logs for a deployment
Marketplace
- updateInstallation - Update Installation
- getAccountInfo - Get Account Information
- getMember - Get Member Information
- rotateInstallationCredential - Rotate Installation Credential
- revokeInstallationCredential - Revoke Installation Credential
- createEvent - Create Event
- getIntegrationResources - Get Integration Resources
- getIntegrationResource - Get Integration Resource
- deleteIntegrationResource - Delete Integration Resource
- importResource - Import Resource
- updateResource - Update Resource
- submitBillingData - Submit Billing Data
- submitInvoice - Submit Invoice
- finalizeInstallation - Finalize Installation
- getInvoice - Get Invoice
- updateInvoice - Invoice Actions
- submitPrepaymentBalances - Submit Prepayment Balances
- ~~updateResourceSecrets~~ - Deprecated: true. Update Resource Secrets (Deprecated) :warning: Deprecated
- updateResourceSecretsById - Update Resource Secrets
- exchangeSsoToken - SSO Token Exchange
- createInstallationIntegrationConfiguration - Create one or multiple experimentation items
- updateInstallationIntegrationConfiguration - Patch an existing experimentation item
- deleteInstallationIntegrationConfiguration - Delete an existing experimentation item
- headInstallationsByIntegrationConfigurationIdResourcesByResourceIdExperimentationGlobalConfig - Get the data of a user-provided Global Config
- getInstallationsByIntegrationConfigurationIdResourcesByResourceIdExperimentationGlobalConfig - Get the data of a user-provided Global Config
- replaceInstallationsByIntegrationConfigurationIdResourcesByResourceIdExperimentationGlobalConfig - Push data into a user-provided Global Config
Microfrontends
- getMicrofrontendsGroups - List microfrontends groups
- getMicrofrontendsInGroup - List projects in a microfrontends group
- getMicrofrontendsConfig - Get microfrontends config for a deployment
- getMicrofrontendsConfigForProject - Get microfrontends config for a project
- createMicrofrontendsGroupWithApplications - Create a microfrontends group with applications
Networking
- listNetworks - List Secure Compute networks
- createNetwork - Create a Secure Compute network
- deleteNetwork - Delete a Secure Compute network
- updateNetwork - Update a Secure Compute network
- readNetwork - Read a Secure Compute network
- createPrivateLinkEndpoint - Create a PrivateLink endpoint
- listPrivateLinkEndpoints - List PrivateLink endpoints
- readPrivateLinkEndpoint - Read a PrivateLink endpoint
- deletePrivateLinkEndpoint - Delete a PrivateLink endpoint
- updatePrivateLinkEndpoint - Update a PrivateLink endpoint
- updateStaticIps - Configures Static IPs for a project
Observability
- getObservabilityConfigurationProjects - Lists disabled Observability Plus projects
- updateObservabilityConfigurationProject - Updates a disabled Observability Plus project setting
ProjectRoutes
- getRoutes - Get project routing rules
- stageRoutes - Stage routing rules
- addRoute - Add a routing rule
- deleteRoutes - Delete routing rules
- editRoute - Edit a routing rule
- generateRoute - Generate a routing rule from natural language
- getRouteVersions - Get routing rule version history
- updateRouteVersions - Promote, restore, or discard a routing rule version
ProjectMembers
- getProjectMembers - List project members
- addProjectMember - Adds a new member to a project.
- removeProjectMember - Remove a Project Member
Projects
- getProjects - Retrieve a list of projects
- getProjectTrace - Get a project trace by request ID
- createProject - Create a new project
- getProjectToken - Generate a project OIDC token
- createTraceSession - Create a trace session token for a deployment
- getProject - Find a project by id or name
- updateProject - Update an existing project
- deleteProject - Delete a Project
- uploadProjectAvatar - Upload a project avatar
- deleteProjectAvatar - Delete a project avatar
- getProjectDomains - Retrieve project domains by project by id or name
- getProjectDomain - Get a project domain
- updateProjectDomain - Update a project domain
- removeProjectDomain - Remove a domain from a project
- addProjectDomain - Add a domain to a project
- moveProjectDomain - Move a project domain
- verifyProjectDomain - Verify project domain
- filterProjectEnvs - Retrieve the environment variables of a project by id or name
- createProjectEnv - Create one or more environment variables
- getProjectEnv - Retrieve the decrypted value of an environment variable of a project by id
- removeProjectEnv - Remove an environment variable
- editProjectEnv - Edit an environment variable
- batchRemoveProjectEnv - Batch remove environment variables
- createProjectTransferRequest - Create project transfer request
- acceptProjectTransferRequest - Accept project transfer request
- updateProjectProtectionBypass - Update Protection Bypass for Automation
- requestRollback - Point production traffic to a previous production deployment by ID
- updateProjectsByProjectIdRollbackByDeploymentIdUpdateDescription - Updates the description for a rollback
- updateMicrofrontends - Update the microfrontends settings
- requestPromote - Point production traffic to a given deployment
- listPromoteAliases - Gets a list of aliases with status for the current promote
- pauseProject - Pause a project
- unpauseProject - Unpause a project
RollingRelease
- getRollingReleaseBillingStatus - Get rolling release billing status
- getRollingReleaseConfig - Get rolling release configuration
- deleteRollingReleaseConfig - Delete rolling release configuration
- updateRollingReleaseConfig - Update the rolling release settings for the project
- getRollingRelease - Get the active rolling release information for a project
- approveRollingReleaseStage - Update the active rolling release to the next stage for a project
- startRollingRelease - Start a rolling release for the project
- completeRollingRelease - Complete the rolling release for the project
Sandboxes
- listNamedSandboxes - List sandboxes
- listDrives - List drives
- getDrive - Get a drive
- getOrCreateDrive - Get or create a drive
- deleteDrive - Delete a drive
- forkDrive - Fork a drive
- listSessionSnapshots - List snapshots
- getSessionSnapshot - Get a snapshot
- deleteSessionSnapshot - Delete a snapshot
- listSessions - List sessions
- getSession - Get a session
- getNamedSandbox - Get a named sandbox
- deleteSandbox - Delete a sandbox
- listSessionCommands - List commands
- getSessionCommand - Get a command
- killSessionCommand - Kill a command
- writeSessionCommandStdin - Write to command stdin
- stopSession - Stop a session
- extendSessionTimeout - Extend session timeout
- updateSessionNetworkPolicy - Update network policy
- readSessionFile - Read a file
- createSessionDirectory - Create a directory
- writeSessionFiles - Write files
- createSandboxesSessionsBySessionIdSnapshotV2 - Create a snapshot
- createSandboxesSessionsBySessionIdSnapshotV3 - Create a snapshot
Security
- updateAttackChallengeMode - Update Attack Challenge mode
- getSecurityFirewallConfig - Returns activated WAF config
- putFirewallConfig - Put Firewall Configuration
- updateFirewallConfig - Update Firewall Configuration
- getFirewallConfig - Read Firewall Configuration
- deleteSecurityFirewallConfigByConfigVersion - Returns activated WAF config
- createSecurityFirewallConfigByConfigVersionActivate - Returns activated WAF config
- getActiveAttackStatus - Read active attack data
- getBypassIp - Read System Bypass
- addBypassIp - Create System Bypass Rule
- removeBypassIp - Remove System Bypass Rule
- getSecurityFirewallEvents - Read Firewall Actions by Project
- getSecurityFirewallEventsSummary - Read Firewall Actions Summary by Project
- generateFirewallRule - Generate a firewall rule from natural language
StaticIps
- updateStaticIps - Configures Static IPs for a project
Storage
- getStorageStoresById - Get a store
- createStorageStoresBlob - Create a Blob store
- deleteStorageStoresBlobById - Delete a Blob store
Teams
- getTeamMembers - List team members
- inviteUserToTeam - Invite a user
- requestAccessToTeam - Request access to a team
- getTeamAccessRequest - Get access request status
- joinTeam - Join a team
- updateTeamMember - Update a Team Member
- removeTeamMember - Remove a Team Member
- getTeam - Get a Team
- patchTeam - Update a Team
- getTeams - List all teams
- createTeam - Create a Team
- postTeamDsyncRoles - Update Team Directory Sync Role Mappings
- deleteTeam - Delete a Team
- deleteTeamInviteCode - Delete a Team invite code
- updateMicrofrontendsGroup - Update a microfrontends group
- deleteMicrofrontendsGroup - Delete a microfrontends group
User
- listUserEvents - List User Events
- listEventTypes - List Event Types
- getAuthUser - Get the User
- requestDelete - Delete User Account
Vcr
- createRepository - Create a repository
- listRepositories - List repositories
- getRepository - Get a repository
- deleteRepository - Delete a repository
- listRepositoryImages - List repository images
- addRepositoryPermission - Add a repository permission
- removeRepositoryPermission - Remove a repository permission
- listRepositoryPermissions - List repository permissions
- clearRepositoryPermissions - Clear all repository permissions
- listRepositoryTags - List repository tags
- getRepositoryTag - Get a repository tag
- getRepositoryImage - Get a repository image
- deleteRepositoryImage - Delete a repository image
- getRoot - Check registry API version support
- headByTeamSlugByProjectSlugByRepositoryNameBlobsByDigest - Check if a blob exists
- getByTeamSlugByProjectSlugByRepositoryNameBlobsByDigest - Download a blob
- deleteByTeamSlugByProjectSlugByRepositoryNameBlobsByDigest - Delete a blob
- getByTeamSlugByProjectSlugByRepositoryNameBlobsUploadsByUuid - Get blob upload status
- [deleteByTeamSlugByProjectSlugByRepository