Fully replace an existing contract's data
PUT/contracts/:id
Replaces the generalInfo/lifecycle/financial/administrativeAndLegal/clinicalAndQuality data of an existing Contract with the values supplied in the request body.
What it does: This is a full-replace operation for the contract's data sections - the stored data object is entirely overwritten with the request payload, not merged field by field, so any previously-set optional field left out of the request body is removed from the stored record. The contract's identity fields - id, planId, networkId, and documentId - are always preserved from the existing record; any values supplied for them in the request body are silently ignored, so this endpoint cannot be used to move a contract to a different plan or network. createdBy is likewise always preserved from the original record. updatedBy is set from the authenticated caller's user ID on every call.
When to use: Use this endpoint to update a contract you have previously created. There is no partial-update (PATCH) path for this resource - every call must supply the complete data payload, including the required generalInfo fields. Do not use this endpoint to create a new contract - use POST /contracts instead.
Preconditions: Requires the UPDATE_CONTRACT permission. The {id} path parameter is the server-assigned id of the contract to replace. generalInfo.contractId, contractName, contractType, and contractStatus are required in the request body; all other fields and sections are optional.
Response: Returns 200 OK with the full updated Contract object. This operation is not idempotent, since updatedBy changes on every successful call.
Request
Responses
- 200
- 400
- 401
- 403
- 404
The updated Contract, with data fully replaced and updatedBy set to the caller.
The request body failed validation - for example, a required generalInfo field was missing, or an enum field was set to a value outside its allowed set.
Unauthorized - Authentication required
Forbidden - Insufficient permissions
No contract exists with the given id. PUT never creates a new contract - use POST /contracts if the contract does not yet exist.