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
| Name | Type | Required | Description |
|---|---|---|---|
companyId | string | Yes | HubSpot internal company ID. |
properties | object | Yes | Map of property names to new values. |
Returns
{ id, properties } reflecting the state after update.
Throws
[xHubspot] companies.update requires a companyId— ifcompanyIdis falsy.[xHubspot] companies.update requires a properties object— ifpropertiesis 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
- companies.getById — read current state before updating
- companies.batchUpdate — update multiple companies at once
AI Context
package: "@xenterprises/fastify-xhubspot"
method: fastify.companies.update(companyId, updateData)
use-when: Update properties on an existing HubSpot company
returns: { id, properties }
