vercel api
The vercel api command is currently in beta. Features and behavior may change.
The vercel api command lets you make authenticated HTTP requests to the Vercel API directly from your terminal. It handles authentication automatically using your CLI session, supports interactive endpoint discovery, and provides features like automatic pagination and request body construction.
This command is useful for scripting, debugging, and exploring the Vercel API without needing to manage tokens or construct requests manually.
vercel api [endpoint]Using the vercel api command to make a request to the Vercel API.
If you run vercel api without an endpoint, the command enters interactive mode where you can search and select from all available API endpoints.
Retrieve information about the authenticated user:
vercel api /v2/userMaking a GET request to the /v2/user endpoint.
List projects for a specific team:
vercel api /v9/projects --scope my-teamUsing the --scope option to target a specific team.
Create a project using a POST request with field data:
vercel api /v10/projects -X POST -F name=my-projectUsing -X POST to set the method and -F to add a typed field.
Delete a specific deployment:
vercel api /v13/deployments/dpl_abc123 -X DELETEMaking a DELETE request to remove a deployment.
Fetch all pages of deployments automatically:
vercel api /v6/deployments --paginateUsing --paginate to fetch all pages of results.
Send a request body from a JSON file:
vercel api /v10/projects -X POST --input config.jsonUsing --input to read the request body from a file.
Include custom headers in your request:
vercel api /v2/user -H "X-Custom-Header: value"Using -H to add a custom HTTP header.
Launch interactive endpoint selection:
vercel apiRunning without an endpoint to enter interactive mode.
Output a curl command instead of executing the request:
vercel api /v2/user --generate=curlUsing --generate=curl to output a curl command with authentication placeholder.
When you run vercel api:
- The CLI authenticates using your current session (the same credentials used by other CLI commands)
- It constructs the request with your specified method, headers, and body
- It sends the request to
https://api.vercel.comwith the appropriate authorization - It formats and displays the JSON response
For interactive mode, the CLI fetches the OpenAPI specification to provide endpoint discovery and parameter prompts.
These options only apply to the vercel api command.
The --method option, shorthand -X, sets the HTTP method for the request. Defaults to GET, or POST if a body is provided.
vercel api /v10/projects -X POST -F name=my-projectUsing -X POST to make a POST request.
The --field option, shorthand -F, adds a typed parameter to the request body. Values are automatically parsed as numbers, booleans, or strings. Use @file syntax to read field content from a file.
vercel api /v10/projects -X POST -F name=my-project -F framework=nextjsAdding multiple fields to the request body.
The --raw-field option, shorthand -f, adds a string parameter without type parsing.
vercel api /v10/projects -X POST -f name=my-projectAdding a field as a raw string value.
The --header option, shorthand -H, adds a custom HTTP header to the request.
vercel api /v2/user -H "Accept: application/json"Adding a custom header to the request.
The --input option reads the request body from a file. Use - to read from stdin.
vercel api /v10/projects -X POST --input project.jsonReading the request body from a JSON file.
The --paginate flag fetches all pages of results and combines them into a single output.
vercel api /v6/deployments --paginateAutomatically fetching all pages of deployments.
The --include option, shorthand -i, includes response headers in the output.
vercel api /v2/user -iIncluding HTTP response headers in the output.
The --silent flag suppresses response output. The exit code indicates success (0) or failure (1).
vercel api /v2/user --silent && echo "Success"Running silently and checking the exit code.
The --verbose flag shows debug information including the full request and response details.
vercel api /v2/user --verboseEnabling verbose output for debugging.
The --raw flag outputs JSON without pretty-printing.
vercel api /v2/user --rawOutputting raw, non-formatted JSON.
The --refresh flag forces a refresh of the cached OpenAPI specification used for interactive mode.
vercel api --refreshRefreshing the cached API specification.
The --generate option outputs the request in a different format instead of executing it. Currently supports curl.
vercel api /v2/user --generate=curlGenerating a curl command with a token placeholder.
The --dangerously-skip-permissions flag skips confirmation prompts for DELETE operations. Use with caution.
vercel api /v13/deployments/dpl_abc123 -X DELETE --dangerously-skip-permissionsSkipping the confirmation prompt for a DELETE request.
The list subcommand (alias ls) displays all available API endpoints.
vercel api lsListing all available API endpoints.
You can output the list as JSON:
vercel api ls --format jsonListing endpoints in JSON format for scripting.
The following global options can be passed when using the vercel api command:
For more information on global options and their usage, refer to the options section.
Was this helpful?