APIs & Integrations

morningdew830
Member

Can I use the HubSpot internal APIs?

We are building the integrating app with the exact same dashboard as HubSpot.

I saw the dashboard page fetch the number of contacts date by date from /contacts/search/v1/report/contacts.

I tried to call to that with access_token but failed in.

    const hs = new hubspot({
      clientId: config.clientId,
      clientSecret: config.clientSecret,
      redirectUri,
      refreshToken
    });
    hs.setAccessToken(access_token);
    if (hasExpiredToken() {
      hs.refreshAccessToken()
        .then(() => {
          hs._request({
            method: 'POST',
            path: '/contacts/search/v1/report/contacts',
            qs: { portalId: portalId },
            body: {
              aggregations: [
                {
                  includeEmpty: true,
                  intervalUnit: 'MONTH',
                  property: 'createdate',
                  size: 0,
                  type: 'DATE_HISTOGRAM'
                }
              ],
              filterGroups: [
                {
                  inclusive: true,
                  operator: 'TIME_UNIT_TO_DATE',
                  property: 'createdate',
                  rollForward: false,
                  timeUnit: 'YEAR',
                  timeUnitCount: 1,
                  _isDashOverride: true
                }
              ]
            }
          }, (ret) => {
          ... ... ...

So is there a way for us to use this API?

Best Ken

0 Upvotes
1 Reply 1
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Can I use the HubSpot internal APIs?

Hi @Ken_Kosaki,

That endpoint is for internal use only, and can’t be accessed using public authentication (API keys or OAuth access tokens). All publicly available endpoints are documented in out developer reference docs:

0 Upvotes