How to make a DELETE request using curl

For more information about curl, checkout the “What is curl” article. This article will discuss how to interact with an API using DELETE requests through curl.

Make a simple DELETE request

The basic syntax for sending a DELETE request using curl is:

1
curl -X DELETE https://example.com

NOTE: The -X flag is a shorthand for --request.

DELETE request example

1
2
curl -X DELETE \
    https://jsonplaceholder.typicode.com/posts/1

In the example above, a DELETE request is sent to the JSONPlaceholder API to delete a post with an id of 1.