Deals

Update Deal

Update a deal (partial update).

Contact operations run in a fixed order within the single transaction: remove_contact_ids -> add_contact_ids -> contact_roles. That order is what makes the useful combinations work:

  • a contact linked by add_contact_ids in THIS request can be given a role by contact_roles in the same call (roles run last);
  • an id in both remove_contact_ids and add_contact_ids ends up linked (add runs after remove), so a role for it still applies;
  • an id in remove_contact_ids and contact_roles but NOT in add_contact_ids is unlinked by the time roles run, so it is a 422 naming that id rather than a role written to a row that no longer exists.

A contact_roles entry for a contact that is neither already linked nor being added is a 422; the whole transaction rolls back, so a partially applied batch is not a state this endpoint can produce.

background_tasks carries the deal.stage_changed fan-out only. It is injected, not a body field, so it does not appear in the OpenAPI schema and the request contract is unchanged (pinned by developer_api/tests/test_deal_stage_events.py). Publishing there rather than inline keeps the Redis round trip off the caller's latency budget and makes "strictly after the commit" structural: the task is queued only after the session context has exited, and FastAPI attaches background tasks to the SUCCESS response, so a raise anywhere above publishes nothing.

patch/deals/{deal_id}

Request

  • Base URL: https://be.graph8.com/api/v1
  • URL: https://be.graph8.com/api/v1/deals/{deal_id}
  • Auth: HTTP bearer

Path parameters

deal_idstring required

Deal ID (UUID)

Headers

Authorizationstring nullable
X-Target-Org-Idstring nullable

Request body

expected_revisioninteger nullable

Apply only if the canonical CRM revision still matches; otherwise return 409. Omit for existing PATCH behavior.

namestring nullable

Deal name

descriptionstring nullable

Deal description

amountnumber nullable

Deal monetary value

currencystring nullable

Currency code

stage_idstring nullable

Stage ID

close_datestring nullable

Expected close date (ISO 8601)

owner_idstring nullable

Reassign deal owner (member id, email, or PropelAuth uid). Cannot be cleared.

add_contact_idsinteger[]

mashup_contact_ids to add to the deal (must match the deal's company; idempotent)

remove_contact_idsinteger[]

mashup_contact_ids to remove from the deal (idempotent — unlinked skipped)

contact_rolesobject nullable

Buying-committee roles keyed by mashup_contact_id, e.g. {"5500429": "champion", "5500914": null}. Valid roles: champion, decision_maker, influencer, blocker, coach, end_user. null clears a role. Each id must already be linked to the deal or be present in add_contact_ids in the same request (422 otherwise).

Response

Successful Response

Changes

No recorded changes to this operation across all 2 revisions of this API.