X Enterprises
fastify-xhubspot

companies.update

Update properties on an existing HubSpot company.

companies.update

Update one or more properties on an existing HubSpot company.

Signature

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

Params

NameTypeRequiredDescription
companyIdstringYesHubSpot internal company ID.
propertiesobjectYesMap of property names to new values.

Returns

{ id, properties } reflecting the state after update.

Throws

  • [xHubspot] companies.update requires a companyId — if companyId is falsy.
  • [xHubspot] companies.update requires a properties object — if properties is missing or not an object.
  • Re-throws HubSpot API errors.

Examples

Basic

await fastify.companies.update("98765", {
  industry: "SOFTWARE",
  numberofemployees: "150",
});

Realistic — update lifecycle stage after a deal closes

fastify.post("/deals/:id/close", async (request) => {
  const deal = await fastify.deals.getById(request.params.id);
  const [association] = await fastify.deals.getAssociations(deal.id, "companies");

  if (association) {
    await fastify.companies.update(association.id, {
      lifecyclestage: "customer",
    });
  }

  return { closed: true };
});

See also

AI Context

package: "@xenterprises/fastify-xhubspot"
method: fastify.companies.update(companyId, updateData)
use-when: Update properties on an existing HubSpot company
returns: { id, properties }
Copyright © 2026