API key permissions


#1

Hello there,

What does this mean? Do I need a payed subscription for this to work? Or is it possible with the free version?

This hapikey (**************) does not have proper permissions! (requires any of [social-access])


#2

Hi @Red_Melon,

It’s possible that your portal doesn’t have access to the API you’re making requests to. Can you send me your Hub ID and some info on what you’re trying to do?


#3

Yes, we have access to generate a key.
Our Hubspot ID is 4187015.


#4

Hi @Red_Melon,

That portal is a marketing free portal, which doesn’t have access to the social tools. What API were your trying to make requests to?


#5

The API to get a list companies.


#6

Hi @Red_Melon,

That should work fine, since you have access to the free CRM. Can you send me the full request URL (with hapikey redacted) that you’re using?


#7

There is no request URL, i use a class for it:
REDACTED

In example.php is the final code to put something on the screen including the Hapikey.


#8

Hi @Red_Melon,

While I’m not fluent with PHP, I can see a chunk of code at the bottom of example.php that appears to be making requests to the social broadcasting API. The portal you mentioned doesn’t have access to the social tools, so those requests will always return the error you mentioned. It also looks like whatever 3rd party library you’re using is out of date. For example, I’m seeing references to the Leads API, which was deprecated some time ago. I’d recommend either making changes to the example.php file to remove calls to deprecated APIs or APIs that you don’t have access to, or creating a new test file making requests to only the APIs you care about.

Lastly, I removed the reference to your code from your previous post, since it contained your hapikey. Since this is a public forum, you should remove any authentication references (hapikeys, secrets, access/refresh tokens, etc.) before posting. You might consider generating a new API key, since yours was potentially visible here for ~3 hours.


#9

Thanks for your reply. Do you have code examples for PHP to get all companies and their data through the API?


#10

And can you have a phone call about integration? We now use Teamleader to get company information into our Proposal system. The only data we need is the Company name, hourly rate and somehow a filter that we can set if a company is a client or just inside information for us. Like a tag. These three things i would like to use from the API of Hubspot.


#11

Hi @Red_Melon,

I don’t have any examples myself, but making requests to the Companies API is mostly the same as making requests to any other REST-ful API. I’ve included an article that has some PHP examples of REST calls below:


#13

Thanks. I found a way to get the data from the API.


#14

Hi Derek,

I have a question about requesting more than 250 records. As we speak our database contains around 350+ companies. Since it’s not possible with the hubspot API to have more than 250 records per request i am trying to get two requests of 200 records with this url’s, but it won’t return different companies with the offset versus limit parameter like this:

https://api.hubapi.com/companies/v2/companies/paged?hapikey=xxx&properties=name&offset=0&limit=200
https://api.hubapi.com/companies/v2/companies/paged?hapikey=xxx&properties=name&offset=201&limit=200

How can i make two different requests of 200 each (or 250 each)? Or which URL do i have to use to get what i want?


#15

Can i also filter on properties with the url? So let’s say i want only see the companies where a custom property value = true…
Or can you only receive data with the property parameter?


#16

Hi @Red_Melon,

The first request shouldn’t include an offset parameter, but that shouldn’t necessarily be an issue. I’d need some more info on what errors you’re seeing in order to continue troubleshooting. Additionally, it’s not possible to filter results server side.


#17

I just test the url in the browser to get the json data. So i don’t get errors. Only if i delete the offset parameter on the first url and include in the second url, i just get the same companies with both limit and offset.

Can you give some examples to get it right?

first one with limit 10:
https://api.hubapi.com/companies/v2/companies/paged?hapikey=xxx&properties=name&limit=10

second one with limit 10:
https://api.hubapi.com/companies/v2/companies/paged?hapikey=xxx&properties=name&limit=10&offset=11


#18

Hi @Red_Melon,

Your first request should be to a URL like this:

https://api.hubapi.com/companies/v2/companies/paged?hapikey=xxx&properties=name&limit=10

In the response you get, there will be an offset field with a value (e.g. 12345). This is what you need to include as the offset parameter in your next request. The offset parameter is not equal to the index of the next record you want (i.e. If you request 10 records, the offset parameter is not equal to 11). Your next request should be made to a URL like this:

https://api.hubapi.com/companies/v2/companies/paged?hapikey=xxx&properties=name&limit=10&offset=12345

Where 12345 is the offset you received from the last request.


#22

Hi, i already solved this, to use an array for each request and put in in a double foreach loop.