Getting error code 405 sent back from curl when trying to update Deal value


Hi, I'm trying to update a Deal value from my remote server to the hubspot server. When I run the script from my remote server to update the hubspot deal, curl returns the following error message back:

Error: call to URL failed with status 405, response , curl_error , curl_errno 0

The part of script that handles curl is below:

$url = "";

$content = '{"properties": [{"name": "amount","value": "70000"}]}';

$curl = @curl_init();
@curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
@curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Content-type: application/json"));
@curl_setopt($curl, CURLOPT_URL, $url);
@curl_setopt($curl, CURLOPT_POST, true);

@curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ( $status != 201 ) {
die("Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));


$response = json_decode($json_response, true);

Any help would be appreciated.



In your example, you're missing the dealId parameter in URL.

$dealId = 19320611;
$hapikey = '<THIS IS MY HUBSPOT API KEY>';

$urlPattern = "";
$url = sprintf($urlPattern, $dealId, $hapikey);

That could be the problem. Unless you have just removed the information for the purpose of publishing the code here.


Thanks but that didn't seem to fix the problem as I'm getting the same error. I put in fake deal id and hubspot api key which the forum must have removed after I posted.


Hi @cmartin19,

That endpoint accepts PUT requests to update deals, not POST requests. Can you try making a PUT request?