API V2 PHP Domain update says domain record is not included

March 1, 2015 1.2k views

Hey there,

I have strange problem here.

I started writing script yesterday for updating a domain name, and it was working fine.
But today I am getting error:

string(81) "{"id":"unprocessable_entity","message":"Record type is not included in the list"}" {"type":"A","name":"home","data":""}

This is the code:

  $ch = curl_init($request_uri);
  $headers = array(
    'Authorization: Bearer ' . file_get_contents('token.txt') );
  $rawdata = array(
  'type'      => 'A',
  'name'      => 'sub',
  'data'      => '',
  'priority'  => null,
  'port'      => null,
  'weight'    => null
  $postdata = json_encode($rawdata);

  $ch = curl_init();                    // initiate curl
  $url = ""; 
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_POST, true); 
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  $output = curl_exec ($ch); // execute
  curl_close ($ch); // close curl handle
  var_dump($output); // show output
  echo $postdata;//show what I am posting

There is no difference how I format the json POST request - it never detects the type and returns that error.

Any help will appreciated.


  • Hi! Using nearly identical code, I am able to successfully create an A record. Could you describe the environment this is being run on at all? PHP version, OS, etc...

  • Hey asb,

    Thanks a lot for the comment.

    Tried the code on both my localhost and a droplet here, and got the same result.
    Here is the specs-
    Ubuntu 14.04.2 LTS 3.13.0-46-generic;
    Apache/2.4.7 (Ubuntu);
    PHP 5.5.9-1ubuntu4.6;

    Ubuntu 12.04.5 LTS 3.2.0-24-virtual;
    PHP 5.3.10-1ubuntu3.15;
    Apache/2.2.22 (Ubuntu);
    varnishd (varnish-3.0.2 revision cbf1284);

    Also there is a error in the posted code here - it should be without the first $ch

    Can you share the code that is working for you?
    Well of course without the API and the actual request URL.

    I also posted a question in stackoverflow as I thinking there should be something wrong with my code equivalent request from CLI is working, but nobody was able to tell this for now.
    You can see it here -

    Many thanks,

  • Ok, for me this API is not working properly.

    Played around with domain update.
    When I request something from existing subdomain at

    I got response


    And when I try to update the very same domain name I got not found!

    {"id":"not_found","message":"The resource you were accessing could not be found."}

    As described here:

    How can the ID can't be found as I am requesting to the very same URL?

    Look for a commit to your API around 26-28 of February - before that everything was working fine.


Be the first one to answer this question.