Search for Companies by Domain returns 405 Status code



Every time I try to execute this particular call, I get a 405 error. I’m able to get and post several other calls with no problem. I checked in the Companies section of the GUI, and I see that “Company Domain Name” is set to “” so I’m not sure what the problem is. Here’s my code:

$hapikey = “XXXXXXXX”;

//get company by domain
$endpoint = ‘’ . $hapikey;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_errors = curl_error($ch);
echo "curl Errors: " . $curl_errors;
echo "\nStatus code: " . $status_code;
echo "\nResponse: " . $response;

Obviously hapikey is filled in. When I execute the request in cli, this is the response:

curl Errors:
Status code: 405

Thanks in advance for your help.


Hi @vbhubspotuser,

The company search by domain requires using the POST method, not GET. Here’s the documentation for the search by domain method:


Hi @Derek_Gervais,

Thanks for the response. I added this line to the code:

@curl_setopt($ch, CURLOPT_POST, true);

The call works now, but I am receiving a 400 error: “No content (empty input stream)”. I know that the company I’m searching for:, exists. What am I doing wrong?


Hi @vbhubspotuser,

Are you including a request body? Check the example in the article above to see what should be included in your request body.