Handle Duplicate Contract

​

CRM-8463 — duplicate an existing contract into a new DRAFT contract.

The request body is the final, client-edited state of the copy (name, optional product change, the final service lines, and the carry-over selection). All behavior lives in ContractsManager.duplicate_contract; this handler only maps its result onto HTTP status codes:

  • source missing → 404
  • unacknowledged dates overlap → 409 (ContractDatesOverlapResponse)
  • created → 201 (ContractCreatedResponse)

Path Parameters

Body·

required
application/json

Body for POST /contracts/{contract_id}/duplicate.

The modal is a client-side editing surface: the user edits the copy before anything is persisted, and this payload is the final result. The server creates the new contract from the source plus these values — it never reads a draft state. The duplicate is always created in DRAFT regardless of the source's status.

  • Name for the new contract (FE pre-fills ' Copy')

  • Set true to proceed after the caller has acknowledged a dates-overlap conflict (see 409 response)

  • Which source data to copy onto the duplicate

    Properties: 6
  • Product for the duplicate; when it differs from the source the FE has already replaced the service lines

  • Final, edited service lines to create on the duplicate

    Properties: 25

Responses

  • application/json
  • application/json
  • application/json
Request Example for post/{contract_id}/duplicate
curl 'https://crm.dreamhub.ai/api/v1/contracts/{contract_id}/duplicate' \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "name": "",
  "productId": "",
  "revenueItems": [
    {
      "contractId": "",
      "dealId": "",
      "serviceItemId": "",
      "serviceItemName": "",
      "serviceItemPricingId": "",
      "serviceStartDate": "",
      "serviceEndDate": "",
      "autoRenewal": false,
      "quantity": 1,
      "isDiscountPercentage": true,
      "discountAmount": 1,
      "total": 1,
      "totalLocal": 1,
      "billingStartDate": "",
      "billingEndDate": "",
      "customBillingFrequency": 1,
      "customServiceDuration": 1,
      "customOptOutDate": "",
      "customDuration": 1,
      "eqPaymentsNumOfPayments": 1,
      "eqPaymentsBillingFrequency": 1,
      "itemOrder": 1,
      "scheduledPayments": [
        {
          "paymentNumber": 1,
          "billingDate": "",
          "amount": 1,
          "percentage": 1
        }
      ],
      "pricePerUnit": 1,
      "customFieldValues": {
        "additionalProperty": "anything"
      }
    }
  ],
  "carryOver": {
    "retentionWorkflowsData": true,
    "onboardingStatusAndWorkflows": true,
    "customFieldValues": true,
    "contractOwners": true,
    "filesAndAttachments": true,
    "peopleInContract": true
  },
  "acknowledgeOverlap": false
}'
{
  "id": "string"
}