X Enterprises
fastify-xhubspot

companies.batchCreate / companies.batchUpdate

Create or update multiple HubSpot companies in a single API call.

companies.batchCreate / companies.batchUpdate

Create or update multiple HubSpot companies in a single API call.

Signatures

fastify.companies.batchCreate(
  companies: Array<Record<string, string>>
): Promise<Array<{ id: string; properties: Record<string, string> }>>

fastify.companies.batchUpdate(
  companies: Array<{ id: string; properties: Record<string, string> }>
): Promise<Array<{ id: string; properties: Record<string, string> }>>

Params

batchCreate

NameTypeRequiredDescription
companiesArray<object>YesNon-empty array of property maps (same shape as companies.create).

batchUpdate

NameTypeRequiredDescription
companiesArray<{ id, properties }>YesNon-empty array with id and properties to update.

Returns

Both return an array of { id, properties } for each processed company.

Throws

  • [xHubspot] companies.batchCreate requires a non-empty array
  • [xHubspot] companies.batchUpdate requires a non-empty array
  • Re-throws HubSpot API errors.

Examples

batchCreate — import companies from CSV

const created = await fastify.companies.batchCreate(
  csvRows.map(row => ({ name: row.name, domain: row.domain, industry: row.industry }))
);
console.log(`Created ${created.length} companies`);

batchUpdate — mark churned customers

const churned = churnedIds.map(id => ({
  id,
  properties: { lifecyclestage: "other", hs_lead_status: "UNQUALIFIED" },
}));
await fastify.companies.batchUpdate(churned);

See also

AI Context

package: "@xenterprises/fastify-xhubspot"
methods: fastify.companies.batchCreate(companies) | fastify.companies.batchUpdate(companies)
use-when: Bulk create or update multiple HubSpot companies in one API call
returns: { results }
Copyright © 2026