packages/cli/src/commands/curl/README.md
vercel curl CommandA powerful passthrough command for curl that simplifies testing your Vercel deployments by automatically handling deployment URLs and protection bypass authentication.
Testing API endpoints on Vercel deployments typically requires:
vercel curl automates all of this, letting you focus on testing your APIs.
vercel curl <path> [options] [-- <curl-args>]
path (required): The API path to request
/ (e.g., /api/hello) or without (e.g., api/hello)--deployment <id>--deployment <id|url>: Target a specific deployment by ID or URL
dpl_ prefix, or a full deployment URLdpl_ERiL45NJvP8ghWxgbvCM447bmxwV, ERiL45NJvP8ghWxgbvCM447bmxwV, or https://your-project-abc123.vercel.appdpl_ prefix is automatically added for IDs when omitted--protection-bypass <secret>: Provide a protection bypass secret
VERCEL_AUTOMATION_BYPASS_SECRET environment variable--help: Display help information
All arguments after -- are passed directly to the curl command:
vercel curl /api/endpoint -- --header "Content-Type: application/json" --request POST --data '{"key":"value"}'
vercel curl /api/hello
Equivalent to:
curl --url https://your-project-abc123.vercel.app/api/hello \
--header "x-vercel-protection-bypass: <auto-generated-secret>"
vercel curl /api/users -- \
--request POST \
--header "Content-Type: application/json" \
--data '{"name": "John", "email": "[email protected]"}'
# Test a specific deployment by ID
vercel curl /api/status --deployment ERiL45NJvP8ghWxgbvCM447bmxwV
# Or with the dpl_ prefix
vercel curl /api/status --deployment dpl_ERiL45NJvP8ghWxgbvCM447bmxwV
# Or by passing a full deployment URL
vercel curl /api/status --deployment https://your-project-abc123.vercel.app
vercel curl /api/test -- \
--request PUT \
--header "Content-Type: application/json" \
--header "X-Custom-Header: value" \
--data '{"updated": true}'
vercel curl /api/protected \
--protection-bypass your-secret-key \
-- --request GET
vercel curl /api/ziltoid/visitPlanet -- \
--request POST \
--header "Content-Type: application/json" \
--data '{
"nebulo": 9,
"omniscient": false,
"ultimateCupOfCoffee": true,
"time": "6 earth minutes"
}'
The command follows this workflow:
The target deployment URL is determined automatically:
With --deployment flag: Fetches the specified deployment's URL
dpl_ prefix is automatically added if not providedERiL45NJvP8ghWxgbvCM447bmxwV → dpl_ERiL45NJvP8ghWxgbvCM447bmxwVWithout --deployment flag: Uses the latest deployment from your linked project
For deployments with Vercel Protection enabled, the command automatically manages authentication:
Priority order:
--protection-bypass flag value (if provided)VERCEL_AUTOMATION_BYPASS_SECRET environment variableIf automatic token creation fails, you'll see instructions for manual setup.
The command constructs and executes the curl command with:
https://<deployment-url><path>x-vercel-protection-bypass: <secret> (if available)-- are passed directly to curlThe command will attempt to create an automation bypass token automatically. This works for most Vercel plans.
If automatic creation isn't available or fails:
Navigate to your project:
Access Deployment Protection settings:
Generate automation bypass secret:
Use the secret:
Option A - With the flag:
vercel curl /api/endpoint --protection-bypass your-secret-here
Option B - With environment variable:
export VERCEL_AUTOMATION_BYPASS_SECRET=your-secret-here
vercel curl /api/endpoint
Ensure curl is installed on your system:
# macOS (using Homebrew)
brew install curl
# Ubuntu/Debian
sudo apt-get install curl
# Windows (using Chocolatey)
choco install curl
Make sure:
vercel link if needed)vercel deploy to create one)This means automatic token creation failed. Follow the manual setup steps above to create a protection bypass secret.
When using --deployment:
When invoking vercel curl, pass only the API path (e.g., /api/hello).
https://my-app.vercel.app/api/hello)--deployment <id|url> and keep <path> relativevercel link in your project directory)