PHP CURL API call suddenly stopped working with 400 error


We have an API call to add an item to a contact's property that was working great up until recently. I'm wondering if there's an API update that cause our code to break. We're suddenly receiving a 400 error and know that the email address for the contact is correct.

Here are the functions we are running

private function call_curl($post_json, $endpoint, $return_type = 'string', $custom_req = 'POST') {
    $ch = @curl_init();

    // Default is "POST", but allow for options like "DELETE"
    // -------------------------------------------------------------------------------
    if($custom_req != 'POST') {
        @curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $custom_req);
    } else {
        @curl_setopt($ch, CURLOPT_POST, true);

    @curl_setopt($ch, CURLOPT_POSTFIELDS, $post_json);
    @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);

    if($return_type == 'response') {
        return $response;
    } else {
        return $this->process_status_code($status_code, $return_type);

public function create_or_update_contact($email, $properties, $return_type = 'string') {
    if($email && $properties) {
        $post_json = json_encode($properties);
        $endpoint = ''.$email.'?hapikey='.$this->hapikey;

        return $this->call_curl($post_json, $endpoint, $return_type);

    return $this->default_error;

Here is the data that we're passing in

$args = array(
'properties' => array(
'property' => 'resources_download',
'value' => 'Resource Title'


Hi @hmdev,

Are you getting this error consistently? Can you give me the full error you're seeing, and the specific endpoint you're hitting when you get the error?