> ## Documentation Index
> Fetch the complete documentation index at: https://developers.projectcor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Contract

> Deletes a contract from your COR instance using its external ID

Deletes a contract from your COR instance using its external ID. Also removes related entity associations if a `corId` is provided.

## Path Parameters

<ParamField path="id" type="string" required>
  External contract ID that was used when creating the contract
</ParamField>

## Request Body Requirements

<ParamField body="metadata" type="object" required>
  <Expandable title="properties">
    <ParamField body="source" type="string" required>
      Integration source identifier
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="corId" type="number">
  COR internal ID to remove associations (optional)
</ParamField>

## Known Errors

* `ContractNotFoundError` — No contract found with the specified external ID
* `ValidationError` — Missing required `metadata.source` field
* `DeletionError` — Contract cannot be deleted due to active user associations

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request DELETE 'https://integrations.projectcor.com/v2/integrations/contracts/SF-CONTRACT-12345' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "metadata": {
      "source": "SALESFORCE"
    }
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://integrations.projectcor.com/v2/integrations/contracts/SF-CONTRACT-12345"

  payload = {
      "metadata": {
          "source": "SALESFORCE"
      }
  }

  headers = {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN",
      "Content-Type": "application/json"
  }

  response = requests.delete(url, json=payload, headers=headers)
  print(response.status_code)
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://integrations.projectcor.com/v2/integrations/contracts/SF-CONTRACT-12345',
    {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        metadata: {
          source: 'SALESFORCE'
        }
      })
    }
  );

  console.log(response.status);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Contract deleted successfully",
    "external_id": "SF-CONTRACT-12345",
    "cor_id": 30001
  }
  ```

  ```json 404 theme={null}
  {
    "error": "ContractNotFoundError",
    "message": "Contract with external ID 'SF-CONTRACT-12345' not found",
    "code": "ZC004"
  }
  ```
</ResponseExample>
