← Back to Blog

curl POST JSON: Complete Examples for API Testing

How to send JSON POST requests with curl: headers, authentication, file upload, and error handling. Copy-paste examples.

Basic POST with JSON

curl -X POST https://api.example.com/users \\n  -H 'Content-Type: application/json' \\n  -d '{"name": "John", "email": "john@example.com"}'

With Auth Token

curl -X POST https://api.example.com/data \\n  -H 'Authorization: Bearer eyJhbGci...' \\n  -H 'Content-Type: application/json' \\n  -d @payload.json

Try It Free

Use our free online tool — 100% client-side, no data leaves your browser.

Open JSON Formatter

Related Tools & Articles