Nonsensical Error Message when Enabling Email Routing

I’m trying to use the enable email routing function like so:

https://api.cloudflare.com/client/v4/zones/zone_identifier/email/routing/enable

It returns this error message:

"messages":[{"code":2007,"message":"Invalid Input: must be a a subdomains of example.com"

That is not my typo, it literally says “be a a subdomains”.

My zone is configured with DNS and working. This is strange. I tried several other domains, same issue.

Thanks for reporting this!

Are you able to share, the code or curl command for the API call you are making, with the API token redacted?

I’m using a java unirest library. I do this for all my CF API calls, not really something I can cut and paste. And this API method was working for me for more than a year, so something changed in the past couple months

The only data passed is the zone identifier in the URL, if you want one of my zone identifiers I can send privately.

How do I report this bug? The API method was broken recently.

Here is the method:
https://developers.cloudflare.com/api/operations/email-routing-settings-enable-email-routing

Here is a sample call:

HttpResponse<String> response = Unirest.post("https://api.cloudflare.com/client/v4/zones/zone_identifier/email/routing/enable")
  .header("Content-Type", "application/json")
  .header("X-Auth-Email", "")
  .asString();

Hello. I can confirm this bug/error. Here sample output from my PHP script.

Trying to to POST to https://api.cloudflare.com/client/v4/zones/{zone_identifier}/email/routing/enable (https://developers.cloudflare.com/api/operations/email-routing-settings-enable-email-routing)

The HTTP header:

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'X-Auth-Email: '.$email.'',
    'X-Auth-Key: '.$apikey.'',
    'Cache-Control: no-cache',
    'Content-Type:application/json',
    'purge_everything: true'
  ));

Enable email routing result:

Sending JSON: {}
{
  "result": null,
  "success": false,
  "errors": [
    {
      "code": 2007,
      "message": "Invalid Input: must be a a subdomains of example.com"
    }
  ],
  "messages": [
    {
      "code": 2007,
      "message": "Invalid Input: must be a a subdomains of example.com"
    }
  ]
}

Thank you.

I would like to add that the API documentation must be wrong when getting invalid input from that post endpoint when there are no post fields in the current documentation?

Hard remark on:

  CURLOPT_POSTFIELDS => "",
https://developers.cloudflare.com/api/operations/email-routing-settings-enable-email-routing
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cloudflare.com/client/v4/zones/zone_identifier/email/routing/enable",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-Auth-Email: "
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}