Sending DELETE Request with Curl [C#/.NET Code]

To make a DELETE request using Curl, you need to use the -X DELETE command-line option followed by the target URL. Use the- H command-line option to pass additional HTTP headers to the server. In this Curl DELETE Example, we send a request to the ReqBin echo URL to delete a resource from the server. Click Run to execute the Curl DELETE request online and see the results. The C#/.NET code was automatically generated for the Curl DELETE Request example.
Sending DELETE Request with Curl [C#/.NET Code] Run
curl -X DELETE
Updated: Viewed: 40086 times
C#/.NET code for Curl DELETE Request example

C#/.NET code for Curl DELETE Request Example

This C#/.NET code snippet was generated automatically for the Curl DELETE Request example.
<< Back to the Curl DELETE Request example

What is Curl?

Curl is a command-line utility that allows users to make requests from clients to servers. Curl supports over 25+ protocols, including HTTP, HTTPS, FTP, and SFTP. Curl has built-in support for SSL, certificate validation, HTTP Cookies support, and user authentication. Curl is available for Linux, Windows, and Mac, making it the perfect choice for developers on all platforms.


The DELETE method is one of the nine standard Hypertext Transfer Protocol (HTTP) request methods to delete a resource from the server. The DELETE request method asks the server to delete the resource specified in the Request-URI. The DELETE method is idempotent. Sending the same HTTP DELETE request multiple times will produce the same result on the server. The DELETE method, like the GET method, can not have a request body. Unlike GET and HEAD requests, DELETE requests can change the state of the server.

DELETE /sample/delete/json?id=1 HTTP/1.1
Accept: application/json

Curl DELETE Request Syntax

To send an HTTP DELETE request using Curl use the following syntax:

Curl DELETE Request Syntax
curl -X DELETE [URL] [options]

  • The -X flag specifies the HTTP request method to be used when communicating with the server. Curl uses the GET method by default if no other HTTP method is selected and no data is passed to Curl.

Curl DELETE Request Example

An example of sending an HTTP DELETE request to a ReqBin echo URL using Curl:

Curl DELETE Example
curl -X DELETE	
   -H "Accept: application/json"

In this Curl DELETE request example, we also pass the "Accept: application/json" header to the server using the -H command-line option to tell the server that the Curl client is expecting a JSON from the server.

See also

Generate code snippets for C#/.NET and other programming languages

Convert your Curl DELETE Request request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the C#/.NET code generator.