Home
/
Framework Examples
/
cURL
cURL JSON API examples (GET, POST, headers, debugging)
Last updated 2026-05-20
When to use this
Use this when you are exploring an API from the terminal, scripting a smoke test, or pasting commands into a runbook. Every example below works against the live JsonExamples API.
Example JSON
Reference JSON payload returned by /users/1 (used in every snippet below).
{
"id": 1,
"firstName": "Emily",
"lastName": "Johnson",
"email": "emily.johnson@x.example",
"username": "emilys",
"image": "https://jsonexamples.com/image/200?text=User+1",
"address": {
"address": "626 Main Street",
"city": "Phoenix",
"state": "OK",
"postalCode": "29920",
"country": "United States"
}
}
Request examples
GET single
GET list with params
POST create
PUT update
DELETE
With Bearer token
Verbose (debug headers)
Show status only
Copy
curl -s https://jsonexamples.com/users/1 | jq .
Copy
curl -s -G https://jsonexamples.com/users \
--data-urlencode 'limit=10' \
--data-urlencode 'skip=0' \
--data-urlencode 'select=firstName,lastName,email'
Copy
curl -s -X POST https://jsonexamples.com/users/add \
-H 'Content-Type: application/json' \
-d '{"firstName":"Ada","lastName":"Lovelace"}'
Copy
curl -s -X PUT https://jsonexamples.com/users/1 \
-H 'Content-Type: application/json' \
-d '{"firstName":"Updated"}'
Copy
curl -s -X DELETE https://jsonexamples.com/users/1
Copy
curl -s https://jsonexamples.com/auth/me \
-H 'Authorization: Bearer YOUR_TOKEN_HERE'
Copy
curl -v https://jsonexamples.com/users/1 -o /dev/null
Copy
curl -s -o /dev/null -w '%{http_code}\n' https://jsonexamples.com/http/404
Try the live endpoint
Click below to call /users/1 from your browser.
Call /users/1
// click the button to populate this block
Common variations
Following redirects + retry
{
"snippet": "curl --retry 3 --retry-delay 2 -L https://jsonexamples.com/users/1"
}
Copy link to this example
https://jsonexamples.com/framework-examples/curl