I am trying to delete a media object from my Wordpress instance using the Wordpress API in Postman.

I'm having trouble finding the endpoint according to the documentation.

Here is my http method and route:

DELETE {{site}}/wp-json/wp/v2/media/{{mediaId}}?force=1

I keep getting route not found however:

    "code": "rest_no_route",
    "message": "No route was found matching the URL and request method",
    "data": {
        "status": 404

This is how I'm trying to call it generated in curl:

curl -X DELETE \
  http://<site>/<subsite>/wp-json/wp/v2/media/?force=1 \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Basic <token>' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: ' \
  -H 'Host: <Host IP>' \
  -H 'Postman-Token: <Postman-Token>' \
  -H 'User-Agent: PostmanRuntime/7.15.2' \
  -H 'cache-control: no-cache' \

Following the documentation for the delete endpoint.


  • 1
    But looking at the cURL request, you didn't specify the media ID: http://<site>/<subsite>/wp-json/wp/v2/media/?force=1 ? – Sally CJ Jul 25 '19 at 2:39
  • Yeah I caught that. Postman isn't populating my value correctly. – Kyle Calica-St Jul 25 '19 at 15:12
  • FIXED: Postman had double variable names in it's environment. Deleted the empty one and populated the last one. IT WORKS! – Kyle Calica-St Jul 25 '19 at 15:32
  • 1
    Well, to be honest, I don't use Postman.. and I think you should write that into an answer. It might help someone having similar issue (in the future). :) – Sally CJ Jul 25 '19 at 15:39
  • 1
    yes definitely will do thank you! – Kyle Calica-St Jul 25 '19 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.