SCALIX help

← All tools

hubspot_update_deal

HubSpot write medium risk

Part of the HubSpot Agent.

What it does

Update an existing HubSpot deal by id (PATCH semantics -- only supplied properties change). Common updates: advance dealstage to a new internal stage id, set amount, set closedate, or write an attribution/custom field. Returns the standard envelope {success:true,data} where data is {applied, result}; result is the updated deal: id, resulting properties, updatedAt. Use to progress a client opportunity through the pipeline as a LinkedIn-sourced lead matures, or to record won/lost outcomes for closed-loop ROI reporting. Stage and pipeline values must be the portal's internal ids. Two-phase (ADR-028/029, the same gate as Google and LinkedIn writes): the first call (no preview_id) builds the request locally, apart from the read-only lookups described here, and returns a preview_id - nothing is changed in HubSpot; after the user approves that preview in a later message, re-call with that preview_id and identical arguments to COMMIT (single-use, 30 min; a changed, forged or replayed token fails closed). The preview includes the record's current values for the properties being changed (read when the preview is made; not re-read at commit). Where consent_confirmed exists it must be true at preview and at commit. [POLICY] Update ONLY the authorizing client's own deals with consented client data; never inject enriched/appended/cross-client data, and never modify deals outside the client's scope. [REMINDER] Use internal stage ids; show before/after and preview before writing. [WHEN TO USE] Use to apply an approved stage move or field change to a known deal id for the authorizing client; do NOT auto-advance stages without explicit approval.

When to use it

Use to apply an approved stage move or field change to a known deal id for the authorizing client; do NOT auto-advance stages or change amounts without explicit user approval.

Inputs

NameTypeRequiredDescription
deal_idstringyesHubSpot deal record id to update.
propertiesobjectyesProperty map to set; only these change (e.g., {dealstage:"<internalStageId>", amount, closedate, deal_currency_code, custom fields}).
consent_confirmedbooleanyesMust be true: caller attests the update uses the client's own consented data and the deal is in the client's scope.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Update ONLY the authorizing client's own deals with that client's consented data. NEVER inject enriched/appended/cross-client or member-derived data, and never modify deals outside the client's scope.

Reminder

PATCH only changes supplied fields; use INTERNAL stage ids and show a before/after preview before write.

Errors

Error classMeansWhat to doRetry
authInvalid or expired OAuth token / session (401 Unauthorized).Refresh the HubSpot OAuth token and retry; do not reuse the rejected token.no
permissionToken lacks crm.objects.deals.write scope or portal denied access (403 Forbidden).Grant crm.objects.deals.write and reconnect; surface the missing scope.no
validationHubSpot 400: invalid dealstage/pipeline internal id, read-only property, or malformed amount/closedate. Surface HubSpot's exact message.Resolve internal stage id via hubspot_list_deal_stages, fix typed fields, re-preview, then retry.no
not_foundNo deal with that id (404 Not Found) -- may be deleted.Verify the deal id (search by name/properties if needed); if deleted, do not recreate silently.no
rate_limitHubSpot 429 Too Many Requests (TEN_SECONDLY_ROLLING or daily policy).Honor Retry-After/X-HubSpot-RateLimit-*; back off with jitter; serialize sync writes.yes
platformHubSpot server error (500/502/503).Retry with exponential backoff; if persistent, report HubSpot unavailability without dropping the change.yes
invalid_argumentHubSpot API 2026-09 enforces this portal's validation rules on every write (conditionally required properties, properties required at creation, the Edit Associations permission). A violation is a 400 VALIDATION_ERROR: when errors[].code is MISSING_* the tool returns invalid_argument naming the rule and the property; any other invalid value returns invalid_argument with HubSpot's own message.Supply the property the rule names, or fix the value HubSpot's message names (HubSpot internal property names), then re-preview. For "Missing 'Edit Associations' permission." no argument change helps: a HubSpot admin must give the user who connected Scalix the Edit Associations permission (Settings > Users & Teams), then re-preview.no

Edge cases

  • PATCH is partial -- omitted properties keep prior values.
  • Moving to a stage from a different pipeline requires also setting pipeline to that stage's pipeline id, else 400.
  • Closed-won/closed-lost stages may trigger portal automations and set closedate automatically -- avoid double-setting.
  • Idempotent re-sends of identical values are safe; concurrent updates race (last write wins) -- serialize per deal id.
  • Read-only fields (createdate, hs_object_id) cannot be written.
  • Consent gate: block if consent_confirmed is false or the deal is outside the client's scope.