X Enterprises
fastify-xhubspot

customObjects.update

Update properties on an existing HubSpot custom object record.

customObjects.update

Update one or more properties on an existing record for a given HubSpot custom object type.

Signature

fastify.customObjects.update(
  objectType: string,
  objectId: string,
  properties: Record<string, string>
): Promise<{ id: string; properties: Record<string, string> }>

Params

NameTypeRequiredDescription
objectTypestringYesThe custom object type name or ID (e.g., "subscriptions", "2-12345").
objectIdstringYesHubSpot internal record ID to update.
propertiesobjectYesMap of property names to new values. Only provided properties are changed; others are left as-is.

Returns

FieldTypeDescription
idstringHubSpot record ID.
propertiesobjectAll stored properties after the update.

Throws

  • [xHubspot] customObjects.update requires an objectType — if objectType is missing.
  • [xHubspot] customObjects.update requires an objectId — if objectId is missing.
  • [xHubspot] customObjects.update requires a properties object — if properties is missing or not an object.
  • Re-throws the HubSpot API error on network failure after logging via fastify.log.error.

Examples

Basic — change a subscription status

const updated = await fastify.customObjects.update(
  "subscriptions",
  "1001",
  { status: "cancelled" }
);

console.log(updated.properties.status); // "cancelled"

Realistic — sync plan changes from a billing webhook

fastify.post("/billing/webhook", async (request, reply) => {
  const { hubspotRecordId, newPlan, billingCycle } = request.body;

  await fastify.customObjects.update("subscriptions", hubspotRecordId, {
    plan_name: newPlan,
    billing_cycle: billingCycle,
  });

  return reply.send({ synced: true });
});

See also

AI Context

package: "@xenterprises/fastify-xhubspot"
method: fastify.customObjects.update(objectTypeId, recordId, updateData)
use-when: Update properties on an existing custom object record
returns: { id, properties }
Copyright © 2026