"is-contact" returning "" when getting user via utk




I have a custom form which makes a POST request to HubSpot’s form submission endpoint. The request is successful per a 204 status code returned.

Directly after the post request is made, the page makes a GET request to HubSpot’s contact retrieval endpoint via utk. The FIRST time that request is made, “is-contact” is empty. If I make the same request AGAIN then “is-contact” is 1.

I tried setting a sleep() in my script to see if HubSpot had some sort of delay, but this does not fix the problem.

Does anyone know why I would be getting “is-contact” as NULL for the first request, and then TRUE directly after it if I make an identical request?


@pmanca do you have any ideas on why this may be occurring?


@wd001 How are you making the call to the contact endpoint? Is it a client-side request?


It is a PHP cURL request.


@wd001 How long was your sleep() for?


@pmanca I tried 5 and 30 seconds, neither one appeared to fix the problem.


@pmanca It’s odd though, if I make the same request consecutively it always works properly the second time even if there’s not a significant time in between the two requests.


@wd001 can you post how you are making you call? That doesn’t sound right to me.


@pmanca Here is my code making the request using the WP function wp_remote_get().


$hapikey = 'redacted';

$cookie = $_COOKIE['hubspotutk'];

$get = wp_remote_get(
    'http://api.hubapi.com/contacts/v1/contact/utk/' . $cookie . '/profile?hapikey=' . $hapikey,
        'sslverify' => false
if (!$get->errors) {
    $body = json_decode($get['body']);

    # Code gets here, but not any further

    if ($body->{'is-contact'}) {

    # ...


Similar deal with cURL, is-contact is false the first time:


$hapikey = 'redacted';

$cookie = $_COOKIE['hubspotutk'];

$endpoint = 'http://api.hubapi.com/contacts/v1/contact/utk/' . $cookie . '/profile?hapikey=' . $hapikey;

$ch = @curl_init();
@curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = @curl_exec($ch);
$status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
$body = json_decode($response);
if ($body->{'is-contact'}) {
    # ...


This issue is now resolved, there was a problem with the synchronization. Thanks for the assistance.


@wd001 I’m glad you got it figured out. Thanks for letting me know!