Error 1001 when trying to delete DNS record via API

I’m using the PHP SDK, but have also made simple cURL requests. I can create DNS records, list existing records, etc. I can NOT delete a record. Each time I attempt it, no matter the method I use, I receive the error:

“code”: 1001,
“error”: “method_not_allowed”

Am I missing a permission thing? When trying using cURL I’m sending a DELETE request, and it seems that the PHP SDK is doing the same. I’m not sure if the error is on my end, or Cloudflare’s.

Hi there,

Sorry to hear about the issues you are having with using our API to update your DNS records. It does appear from the error message that the issue looks to be due to an unexpected HTTP method being used.

As you correctly identified our API here says a DELETE ( method is needed for this call.

That being said, I wanted to confirm – were you able to complete this using cURL or were you only getting the error from the SDK integration?

I get the exact same error whether using the PHP SDK and manually calling everything through cURL. cURL is making a DELETE request and I poked through the SDK code and it looks to be as well.

Hi there,

My sincerest apologies for the delay in my reply back!

It does sound somewhat unexpected that while using the DELETE call to the API that you would receive the error message that you are, since this HTTP method should be supported.

I wanted to check with you and confirm whether you per chance were are using your API key, or if perhaps this script makes use of a more narrowly-scoped token?

Thank you very much in advance!

1 Like

I am indeed authenticating with a key, using Cloudflare\API\Auth\APIKey in the SDK. I can create subdomains just fine, but not remove them.

Here’s a code snippet:

$key = new \Cloudflare\API\Auth\APIKey(‘[email protected])’, ‘mykey’);
$adapter = new Cloudflare\API\Adapter\Guzzle($key);

$zones = new \Cloudflare\API\Endpoints\Zones($adapter);
$zoneID = $zones->getZoneID(“”);
$dns = new \Cloudflare\API\Endpoints\DNS($adapter);
$dns->deleteRecord(self::$cf_zoneID, “”);

Sorry to hear about the continued troubles you are having here and indeed this does seem like unexpected behavior.

I think it might be best we can troubleshoot this issue with your directly since it appears we might need to dig into these failed requests on our side.

Do you think it might be possible to have you open a Support Ticket with our team so that we can take a look into this further?

Thank you very much in advance!

Hi @vanderzwet,

to contact Cloudflare Customer Support, login & go to and select get more help. If you receive an automatic response that does not help you, please reply and indicate you need more help.

1 Like