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.
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:
Making a GET request to the /v2/user endpoint.
List projects for a specific team:
Using the --scope option to target a specific team.
Create a project using a POST request with field data:
Using -X POST to set the method and -F to add a typed field.
Delete a specific deployment:
Making a DELETE request to remove a deployment.
Fetch all pages of deployments automatically:
Using --paginate to fetch all pages of results.
Send a request body from a JSON file:
Using --input to read the request body from a file.
Include custom headers in your request:
Using -H to add a custom HTTP header.
Launch interactive endpoint selection:
Running without an endpoint to enter interactive mode.
Output a curl command instead of executing the request:
Using --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.
Using -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.
Adding multiple fields to the request body.
The --raw-field option, shorthand -f, adds a string parameter without type parsing.
Adding a field as a raw string value.
The --header option, shorthand -H, adds a custom HTTP header to the request.
Adding a custom header to the request.
The --input option reads the request body from a file. Use - to read from stdin.
Reading the request body from a JSON file.
The --paginate flag fetches all pages of results and combines them into a single output.
Automatically fetching all pages of deployments.
The --include option, shorthand -i, includes response headers in the output.
Including HTTP response headers in the output.
The --silent flag suppresses response output. The exit code indicates success (0) or failure (1).
Running silently and checking the exit code.
The --verbose flag shows debug information including the full request and response details.
Enabling verbose output for debugging.
The --raw flag outputs JSON without pretty-printing.
Outputting raw, non-formatted JSON.
The --refresh flag forces a refresh of the cached OpenAPI specification used for interactive mode.
Refreshing the cached API specification.
The --generate option outputs the request in a different format instead of executing it. Currently supports curl.
Generating a curl command with a token placeholder.
The --dangerously-skip-permissions flag skips confirmation prompts for DELETE operations. Use with caution.
Skipping the confirmation prompt for a DELETE request.
The list subcommand (alias ls) displays all available API endpoints.
Listing all available API endpoints.
You can output the list as JSON:
Listing 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.