Feature

Write contract pipeline stages via the Partner API

Until now, the Partner API exposed contract pipeline stages as read-only — primaryPipelineStageId and secondaryPipelineStageId came back on GET /api/partner/contracts/:id, but there was no way to change them. Integrations that wanted to push stage updates back into Sure Send had to fall back to the UI.

This release adds two ways to set pipeline stages programmatically:

Inline on the contract body — pass primaryPipelineStageId and/or secondaryPipelineStageId to POST /api/partner/contracts or PUT /api/partner/contracts/:id. Sending secondaryPipelineStageId: null on update clears the secondary pipeline status entirely.

Dedicated sub-resource — for partners that prefer a REST-style verb:

  • GET /api/partner/contracts/:id/pipeline_statuses — read both pipeline statuses
  • GET /api/partner/contracts/:id/pipeline_statuses/primary (or /secondary) — read one
  • PUT /api/partner/contracts/:id/pipeline_statuses/primary with { "stageId": "<uuid>" } — set it (idempotent)
  • DELETE /api/partner/contracts/:id/pipeline_statuses/secondary — clear it

Both shapes go through the same validation and side effects as a UI-driven stage change:

  • The stageId must belong to the contract type’s primary or secondary pipeline; otherwise the call returns 422 with a descriptive error
  • Webhooks (contractPipelineStatusesCreated, contractPipelineStatusesUpdated) fire
  • Stage history is recorded
  • Automations and milestone definitions tied to the new primary stage activate
  • “Won” primary stages auto-set actualClosingDate

The primary pipeline status cannot be cleared via API — every contract keeps a primary stage.