cURL converter · PowerShell
cURL to PowerShell
Paste a curl command and get a splatted Invoke-RestMethod call. We build a real hashtable for headers, use -Body for JSON, -Form for -F uploads, and translate -u into a PSCredential instead of stringifying auth into the URL.
$headers = @{
"Authorization" = "Bearer sk_test_123"
}
$body = "{`"to`":`"+15551234567`",`"body`":`"Hello from curl`"}"
$response = Invoke-RestMethod `
-Uri "https://api.example.com/v1/messages" `
-Method "POST" `
-Headers $headers `
-ContentType "application/json" `
-Body $body `
-MaximumRedirection 0
$response | ConvertTo-Json -Depth 10Top guides for PowerShell
All guides →POST in PowerShell
/how-to/curl-post-in-powershell
GET in PowerShell
/how-to/curl-get-in-powershell
JSON in PowerShell
/how-to/send-json-with-curl-in-powershell
multipart form-data in PowerShell
/how-to/send-multipart-with-curl-in-powershell
Bearer token in PowerShell
/how-to/curl-bearer-auth-in-powershell
Basic auth in PowerShell
/how-to/curl-basic-auth-in-powershell
Common questions
- Invoke-RestMethod or Invoke-WebRequest?
- We default to Invoke-RestMethod because you usually want the parsed response. Invoke-WebRequest is right when you need raw bytes, redirects with cookies, or the full HTTP response object.
- Does the alias `curl` on Windows work?
- It's not real curl on older PowerShell — it aliases to Invoke-WebRequest with different flags. This tool emits the native cmdlet so your script is portable and doesn't rely on the alias.
- PowerShell 5.1 or 7+?
- The output targets PowerShell 7+ (cross-platform). Flags like -SkipCertificateCheck and -Authentication Basic don't exist in 5.1 — drop those two lines to fall back.
- Is my curl sent anywhere?
- No. Parsing and code generation happen entirely in your browser.
Also convert cURL to
All guides →Same parser, same idiomatic output — swap the target language whenever your stack changes. Every hub carries its own reference guides for methods, payloads, and auth.