X Enterprises
fastify-xhubspot

contacts.update

Update properties on an existing HubSpot contact.

contacts.update

Update one or more properties on an existing HubSpot contact. Only the provided properties are changed — other properties are left untouched.

Signature

fastify.contacts.update(
  contactId: string,
  properties: Record<string, string>
): Promise<{ id: string; properties: Record<string, string>; updatedAt: string }>

Params

NameTypeRequiredDescription
contactIdstringYesHubSpot internal contact ID.
propertiesobjectYesMap of property names to new values. Only listed properties are updated.

Returns

FieldTypeDescription
idstringHubSpot contact ID.
propertiesobjectAll stored properties after the update.
updatedAtstringISO 8601 last-updated timestamp.

Throws

  • [xHubspot] contacts.update requires a contactId — if contactId is falsy.
  • [xHubspot] contacts.update requires a properties object — if properties is missing or not an object.
  • Re-throws the HubSpot API error on failure.

Examples

Basic — update a single property

await fastify.contacts.update("12345", { phone: "+15559876543" });

Realistic — sync profile changes

fastify.put("/profile", async (request) => {
  const { contactId } = request.user;
  const { firstName, lastName, company } = request.body;

  const updated = await fastify.contacts.update(contactId, {
    firstname: firstName,
    lastname: lastName,
    company,
  });

  return { id: updated.id, updatedAt: updated.updatedAt };
});

See also

AI Context

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