APIs & Integrations

cruiseBuilder
Member

API Error Get all contacts

SOLVE

I am able to get the token okay, however, when I send the request for contacts I get the following error:

            [input] => Array
                (
                    [token] => 8c*************************************
                    [url] => https://api.hubapi.com/contacts/v1/lists/all/contacts/all?count=1
                )

            [resultRaw] => {"status":"error","message":"Any of the listed authentication credentials are missing","correlationId":"f8054a17-ebc6-4c6d-b4e9-2b304d4a07c0","engagement":{"vendorkey-gae":"vendorkey-gae not engaged. Vendorkey not found in request headers.","hapikey":"hapikey not engaged. hapikey is not present in query params.","oauth-token":"oauth-token not engaged. Malformed OAuth access token found in request header.","shhkey-v1":"shhkey-v1 not engaged. Shhkey not found in the request header.","internal-cookie":"internal-cookie not engaged. Cookie not found in the request.","app-cookie":"app-cookie not engaged. App cookie is not present on the request."},"requestId":"cf6d3859b8fd01fe396cdcb8235ac6f5"}
            [resultArray] => Array
                (
                    [status] => error
                    [message] => Any of the listed authentication credentials are missing
                    [correlationId] => f8054a17-ebc6-4c6d-b4e9-2b304d4a07c0
                    [engagement] => Array
                        (
                            [vendorkey-gae] => vendorkey-gae not engaged. Vendorkey not found in request headers.
                            [hapikey] => hapikey not engaged. hapikey is not present in query params.
                            [oauth-token] => oauth-token not engaged. Malformed OAuth access token found in request header.
                            [shhkey-v1] => shhkey-v1 not engaged. Shhkey not found in the request header.
                            [internal-cookie] => internal-cookie not engaged. Cookie not found in the request.
                            [app-cookie] => app-cookie not engaged. App cookie is not present on the request.
                        )

                    [requestId] => cf6d3859b8fd01fe396cdcb8235ac6f5
                )

I am using the following Code:

 

$header = array("Authorization: Bearer {$token}");
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_HTTPHEADER => $header,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true
));
$result["resultRaw"] = $response = curl_exec($curl);
curl_close($curl);
$result["resultArray"] = json_decode($result["resultRaw"], true);
curl_close ($ch);
return $result;

0 Upvotes
1 Accepted solution
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

API Error Get all contacts

SOLVE

Welcome, @cruiseBuilder.

 

I'm happy to help, but please do not share full authentication credentials on this public forum. If you post a HubSpot API key or OAuth access or refresh token on the Community, it should be considered compromised and should be deactivated immediately.

 

I've taken the liberty of obscuring the "token" you shared. For your security, please also disconnect the app which generated the token as soon as possible. You can then reconnect and generate new valid tokens.

 

With that said, I don't believe you used the correct OAuth token. From the appearance of the token, it seems you used the refresh_token returned from this endpoint. You must use the access_token to authenticate API requests.

Isaac Takushi

Associate Certification Manager

View solution in original post

0 Upvotes
2 Replies 2
cruiseBuilder
Member

API Error Get all contacts

SOLVE

Just to be clear, I am following the directions found here:

https://developers.hubspot.com/docs/methods/contacts/get_contacts

 

There error msg suggests that I am missing informtion, however, the only thing required is "OAuth Access Token" which I provide.

This is my first attempt to use the API.  Once I get anything working, I suspect the rest will be easy.

0 Upvotes
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

API Error Get all contacts

SOLVE

Welcome, @cruiseBuilder.

 

I'm happy to help, but please do not share full authentication credentials on this public forum. If you post a HubSpot API key or OAuth access or refresh token on the Community, it should be considered compromised and should be deactivated immediately.

 

I've taken the liberty of obscuring the "token" you shared. For your security, please also disconnect the app which generated the token as soon as possible. You can then reconnect and generate new valid tokens.

 

With that said, I don't believe you used the correct OAuth token. From the appearance of the token, it seems you used the refresh_token returned from this endpoint. You must use the access_token to authenticate API requests.

Isaac Takushi

Associate Certification Manager
0 Upvotes