A collection of methods related to the Comapny API
Methods
-
Update multiple companies with properties - see developer docs for an example of the properties object.
Name Type Description updates
array Updates to be actioned (see example below)
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); const updates = [{ id: 1234, updates: { name: 'Something else' } }, { id: 5678, updates: { name: 'Blah blah', ownerId: 12341231 } }]; hs.company.batchUpdate(updates).then(response => console.log(response))
-
Search for companies by domain name.
Name Type Description domain
string Domain name to search for
pagingProperties
object Paging & property criteria for the current request
Properties:
Name Type Argument Default Description pagingProperties.limit
number <optional>
The number of records to return in a single request. Supports values up to 100.
pagingProperties.offset
number <optional>
0 Each response will include a hasMore value and an offset object. If hasMore is true, then you would use the offset object in the next request to get the next set of results.
pagingProperties.properties
array <optional>
["domain", "createdate", "name", "hs_lastmodifieddate"] An array of properties that will be included for the returned companies. By default, no properties will be included in the response, so you must specify any properties that you want.
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); hs.company.byDomain('www.hubspot.com', {limit: 5, properties: ['name', 'createdate']}).then(response => console.log(response))
-
Search for companies by ID.
Name Type Description id
int VID of company to search for
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); const companyInfo = await hs.company.byId(1234);
-
Create a company with properties - see developer docs for an example of the properties object.
Name Type Description companyProperties
object An object containing company properties in key/value format. At least 1 property is required
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); hs.company.create({ name: 'Foobar' }).then(response => console.log(response))
-
Delete company
Name Type Description companyId
number Id of company to delete
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); hs.company.delete(companyId).then(response => console.log(response));
-
Retrieve all companies (max 250 at a time)
Name Type Description pagingProperties
object Paging criteria for the current request
Properties:
Name Type Argument Description pagingProperties.limit
number <optional>
The number of records to return. Defaults to 100, has a maximum value of 250.
pagingProperties.offset
number <optional>
Used to page through the results. If there are more records in your portal than the limit= parameter, you will need to use the offset returned in the first request to get the next set of results.
pagingProperties.properties
array <optional>
Used to include specific company properties in the results. By default, the results will only include the company ID, and will not include the values for any properties for your companies. Including this parameter will include the data for the specified property in the results.
pagingProperties.propertiesWithHistory
array <optional>
Works similarly to pagingProperties.properties, but this parameter will include the history for the specified property, instead of just including the current value. Use this parameter when you need the full history of changes to a property's value.
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); hs.company.getAll(pagingProperties).then(response => console.log(response))
-
Get contacts at a company
Name Type Description id
int VID of company
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); const companyInfo = await hs.company.getContacts(1234);
-
This endpoint will only return records created in the last 30 days, or the 10k most recently created records.
Name Type Description pagingProperties
object Paging criteria for the current request
Properties:
Name Type Argument Description pagingProperties.count
number <optional>
Specifies the number of companies to be returned.
pagingProperties.offset
number <optional>
This is used to get the next page of results. Each request will return an offset in the response, and you'd use that offset in the URL of your next request to get the next page of results.
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); hs.company.getRecentlyCreated({count: 5}).then(response => console.log(response))
-
This endpoint will only return records modified in the last 30 days, or the 10k most recently modified records.
Name Type Description pagingProperties
object Paging criteria for the current request
Properties:
Name Type Argument Description pagingProperties.count
number <optional>
Specifies the number of companies to be returned.
pagingProperties.offset
number <optional>
This is used to get the next page of results. Each request will return an offset in the response, and you'd use that offset in the URL of your next request to get the next page of results.
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); hs.company.getRecentlyModified({count: 5}).then(response => console.log(response))
-
Update a company with properties - see developer docs for an example of the properties object.
Name Type Description companyId
number The ID of the company you wih to update
companyProperties
object An object containing company properties in key/value format. At least 1 property is required
Returns:
Type Description Promise Example
const hs = new HubspotClient(props); hs.company.update(companyId, companyProperties).then(response => console.log(response))