CurlDotNet 9.8.11

dotnet add package CurlDotNet --version 9.8.11
                    
NuGet\Install-Package CurlDotNet -Version 9.8.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CurlDotNet" Version="9.8.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CurlDotNet" Version="9.8.11" />
                    
Directory.Packages.props
<PackageReference Include="CurlDotNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CurlDotNet --version 9.8.11
                    
#r "nuget: CurlDotNet, 9.8.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CurlDotNet@9.8.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CurlDotNet&version=9.8.11
                    
Install as a Cake Addin
#tool nuget:?package=CurlDotNet&version=9.8.11
                    
Install as a Cake Tool

CurlDotNet: run curl commands in C# and .NET

Paste any curl command from API documentation into your .NET app and run it in-process. CurlDotNet is a pure-C# reimplementation of curl's command-line parser and transfer engine on top of HttpClient: no curl.exe, no Process.Start, no native libcurl. It targets .NET Standard 2.0, .NET Framework 4.7.2/4.8 and .NET 8, 9 and 10, so it runs in ASP.NET Core, Blazor Server, MAUI, Azure Functions, AWS Lambda and Linux containers.

Run a curl command in C#

using CurlDotNet;

var result = await Curl.ExecuteAsync("curl -H 'Accept: application/json' https://api.github.com/users/octocat");

Console.WriteLine(result.StatusCode);      // 200
Console.WriteLine(result.Body);            // JSON body
var user = result.ParseJson<GitHubUser>(); // typed JSON

Commands may span lines with \, ^ or PowerShell backticks, use single or double quotes, read bodies from @file, and omit the leading curl. Curl.Execute(...) is the synchronous form. Commands pasted from bash, Windows CMD, PowerShell or PowerShell's Invoke-WebRequest alias are detected automatically, or forced with Curl.ExecuteAsync(command, CurlFlavor.PowerShell). CurlFlavor.Native reads commands with the rules of the operating system's own shell.

The curl commands people actually paste

using CurlDotNet;
using CurlDotNet.Core;

// POST JSON (curl --json / -X POST -d)
var a = await Curl.ExecuteAsync("curl --json '{\"name\":\"Alice\"}' https://httpbin.org/post");
var b = await Curl.PostJsonAsync("https://httpbin.org/post", new { name = "Alice" });

// Bearer token and basic auth
var c = await Curl.ExecuteAsync("curl -H 'Authorization: Bearer TOKEN' https://api.example.com/me");
var d = await Curl.ExecuteAsync("curl -u alice:secret https://httpbin.org/basic-auth/alice/secret");

// Multipart file upload (curl -F)
var e = await Curl.ExecuteAsync("curl -F 'file=@report.pdf' -F 'name=Q3' https://httpbin.org/post");

// Download a file, binary-safe (curl -o), following redirects (-L)
await Curl.ExecuteAsync("curl -L -o report.xlsx https://example.com/report.xlsx");

// Ignore certificate errors (curl -k), proxies (-x), timeouts and retries
var f = await Curl.ExecuteAsync("curl -k --connect-timeout 5 --max-time 30 --retry 3 -x http://proxy:8080 https://api.example.com");

// Fluent builder when you have variables instead of a command string
var g = await CurlRequestBuilder.Post("https://httpbin.org/post").WithJson(new { name = "Alice" }).WithBearerToken("TOKEN").ExecuteAsync();

Convert curl to C#

Curl.ToHttpClient(command) generates HttpClient code for a curl command; Curl.ToFetch, Curl.ToPythonRequests and Curl.ToPowershellCode do the same for JavaScript, Python and PowerShell.

Why CurlDotNet instead of HttpClient

  • Zero translation: the command in the docs is the code in your app, including --digest, --ntlm, --aws-sigv4, --json, @file, -F, --retry, --compressed and --trace.
  • Behaves like curl: default User-Agent and Accept headers, curl's redirect and -d/--data-binary/--data-urlencode semantics, exit codes surfaced as typed exceptions that explain how to fix the problem.
  • Verified against curl's own test suite: all 631 runnable HTTP tests from curl/curl pass (v9.8.11), replayed offline against a local stub server with the exact bytes, output and error text compared, and checked against real curl on Linux. Plus 2,073 unit tests.
  • Cookie jars (-b/-c), .netrc, -K config files, --variable, URL globbing, multiple URLs and --next, every -w variable, pure-C# Digest and NTLM.
  • Binary-safe downloads even when a server lies about Content-Type.

Documentation

MIT licensed. Written by Jacob Mellor (CTO, IronSoftware); sponsored by IronSoftware (https://ironsoftware.com), makers of IronPDF, IronOCR, IronXL and IronBarcode. Part of the UserLand.NET initiative. curl itself is the work of Daniel Stenberg and the curl contributors.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.8.11 165 10/25/2026
9.8.2 104 10/24/2026
9.8.1 95 10/24/2026
9.8.0 111 10/24/2026
9.7.0 278 9/9/2026
9.6.0 1,292 6/3/2026
9.5.2 1,024 2/19/2026
9.5.1 143 2/13/2026
9.5.0 121 2/12/2026
9.4.1 119 2/12/2026
9.4.0 123 2/10/2026
9.3.3 130 2/8/2026
9.2.1 979 12/1/2025
9.2.0 530 12/1/2025
9.1.0 522 12/1/2025
9.0.0 526 12/1/2025
3.0.0 508 12/1/2025
1.3.5 517 12/1/2025
1.2.27 488 11/18/2025
1.2.25 422 11/18/2025
Loading failed

Version 9.8.11 - every runnable curl test passes (631 of 631), checked against real curl on Linux

PARITY: all 631 runnable HTTP tests from curl's own suite pass (286 byte-exact); known-failures.txt is empty.
  The replay now also compares standard error, applies curl's stripfile/strippart rules, and its stub
  server behaves like curl's sws. tests/CurlDotNet.CurlSuite/reference builds real curl from the same
  commit in Docker and runs curl's own runtests.pl, so every disputed behaviour is settled from curl's logs.
NEW: CurlResult.Warnings / CurlException.Warnings (curl's exact Warning:/Note: lines), CurlException.CurlErrorMessage
  (curl's own error text, also used by -w %{errormsg}), CurlException.IsUsageError (exit 2 usage errors)
NEW: CurlFlavor.Native - read commands with the shell of the operating system (cmd.exe on Windows, bash elsewhere);
  Auto stays the default
NEW: --haproxy-protocol and --haproxy-clientip (.NET 5+), -#/--progress-bar draws curl's bar, -D % writes to stderr,
  opt-in Curl.DefaultReadConfigFile reads ~/.curlrc like curl (off by default), -w on file:// URLs
FIXED: proxy NTLM through CONNECT tunnels negotiated by CurlDotNet with curl's exact bytes; first header line starting
  with whitespace; two user Connection headers; connection reuse across --next with a same-host --connect-to;
  TLS handshake inside --connect-timeout is exit 28 with -w connection facts; bad hosts such as domain..tld mapped
  by --resolve; redirects with close-delimited bodies no longer wait for EOF; tracing never changes wire bytes;
  gzip/deflate errors (exit 61) and multi-member gzip (exit 23) like curl; multipart Content-Type and empty
  names like curl; %{size_delivered}; %{header_json} layout; --retry-max-time uses a monotonic clock
TESTS: CI and test-all-locally.csx run the whole unit project (2073 tests) with no category filter

Version 9.8.2 - documentation site navigation fix (folder URLs redirect to their own pages); library unchanged since 9.8.0

Version 9.8.0 - curl parity release: tested against curl's own test suite

PARITY: tests/CurlDotNet.CurlSuite replays 1,092 HTTP tests from curl's own suite against a local stub
  server and compares the exact bytes on the wire. 607 of 620 runnable tests pass (97.9%), 216 byte-exact;
  the 13 remaining are documented in known-failures.txt (HttpClient CONNECT/NTLM, .NET URI rules, no ~/.curlrc).
NEW: complete curl 8.7.1 option table; combined short flags (-sSL), attached values (-ofile, -m10), --long=value,
  --url, --next, multiple URLs, {a,b}/[1-3] globbing with #1 in -o, -K config files, --variable, .netrc, -G, -T,
  -z, -r multi-ranges, --oauth2-bearer, --http1.0/1.1/2, --request-target, --connect-to, --resolve, --path-as-is
NEW: curl flavors - CurlFlavor.Auto/Posix/WindowsCmd/PowerShell/InvokeWebRequest. Commands pasted from bash,
  Windows CMD, PowerShell or PowerShell's Invoke-WebRequest alias are detected and read with that shell's rules
  (Curl.ExecuteAsync(cmd, CurlFlavor.PowerShell), Curl.DefaultFlavor, Curl.DetectFlavor)
NEW: cookie engine (-b FILE, -c JAR, -j, Netscape jars), curl-exact multipart (-F ;type= ;filename= <file --form-string),
  -D/-J/--output-dir/--create-dirs/--no-clobber/-R/-C -, every -w variable incl. %{json}, --retry family with
  Retry-After, --limit-rate/--speed-limit, --cacert/--capath/--cert/--key/--pinnedpubkey/--tlsv1.x (.NET 5+)
NEW: pure-C# Digest and NTLM negotiation matching curl byte for byte; --anyauth; proxy auth; Proxy-Connection,
  preemptive proxy Basic, --noproxy/NO_PROXY, http_proxy env vars, --socks4/4a/5/5-hostname, -p CONNECT tunnels
NEW: curl exit codes as typed exceptions (2, 3, 5-8, 18, 22, 23, 26, 28, 33, 35, 43, 47, 49, 52, 56, 60, 61, 63, 77,
  90, 94, 100); every exception says what happened, how to fix it and links the documentation
NEW: Curl.ExecuteAsync(CurlOptions), Curl.DefaultUserAgent (curl/8.7.1 like curl), Accept: */* default,
  -H "Name:" suppression, CurlException.StandardOutput, CurlOptions.UnknownOptions/UnsupportedOptions
NEW: full XML documentation on every public member (parameters, formats, defaults, worked examples, cross-links)
FIX: (#45) Post/PostJson/Download helpers no longer break on quotes or spaces
FIX: --compressed only sends Accept-Encoding when asked; -o leaves Body empty like curl; -i -o writes headers to
  the file; -L turns POST into GET on 301/302/303 and strips Authorization across hosts; --max-redirs exact
FIX: no hidden 30 s / 100 s timeouts; --max-time covers the body; --connect-timeout enforced; decimals accepted
FIX: cancellation is OperationCanceledException; LibCurl returns failed results instead of throwing and honours
  proxy/-k/redirect settings; CurlSettings Proxy/UserAgent/Cookies/OnRedirect/Progress/Retries now apply
FIX: ParseJson is case-insensitive; AsJsonDynamic returns a real dynamic object; credentials masked in logs
PACKAGE: net10.0 added; unused Ninject and System.CommandLine dependencies removed
TESTS: 1,788 unit tests run offline in seconds against an in-process server (no fixed ports, no internet)
Frameworks: netstandard2.0, net472, net48, net8.0, net9.0, net10.0
Sponsored by IronSoftware

Documentation: https://jacob-mellor.github.io/curl-dot-net/