Tutorial: Cancel a Contract¶
This tutorial walks you through the workflow for canceling an existing contract using the public API layer in People Cloud.
The public endpoint is routed through the platform's internal contract termination logic. Depending on the public wrapper configuration, the contract may be terminated and then permanently removed from the database so it no longer appears in the UI.
Step 1: Make a POST Request to Cancel a Contract¶
Send a POST request to one of the following public API endpoints depending on whether you want to address the contract by its public id or numeric DB id:
POST /api/v1/contracts/{the_contract_id}/cancel
POST /api/v1/contracts/id/{id}/cancel
Authorization¶
This endpoint requires authentication. Use the Bearer token from an authenticated user session.
Request Headers¶
Authorization: Bearer <your_token_here>
Accept: application/json
Content-Type: application/json
Request Body¶
No request body is required for this cancel request — it's an action trigger.
Step 2: Cancel the Contract (cURL examples)¶
Use one of the following curl commands to cancel a contract. Replace https://api.sbox2.peoplecloudpro.com, $TOKEN, CNTR-2026-0005 and numeric ids with real values.
curl -X POST "https://api.sbox2.peoplecloudpro.com/api/v1/contracts/CNTR-2026-0005/cancel" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
curl -X POST "https://api.sbox2.peoplecloudpro.com/api/v1/contracts/id/25/cancel" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json"
Step 3: Evaluate Response¶
If the cancellation succeeds the public wrapper will return a JSON response. Typical successful responses are short messages such as:
{
"message": "Contract deleted successfully"
}
or
{
"message": "Contract terminated successfully"
}
Because implementations vary, you may also receive a 200 with an alternate message or a 204 in other setups.
| Status | Meaning | Description |
|---|---|---|
| 200 | OK | Contract terminated/deleted successfully. |
| 204 | No Content | Action performed successfully with no body. |
| 401 | Unauthorized | Missing or invalid Bearer token. |
| 403 | Forbidden | You don’t have permission to cancel this contract. |
| 404 | Not Found | Contract not found by the provided id. |
| 409 | Conflict | Contract cannot be canceled due to state (business rules). |
| 500 | Server error | Server-side error |
Notes & Tips¶
- Always include
-H "Accept: application/json"in your requests to avoid HTML redirects to login pages. - If you use the numeric-id variant (
/id/{id}/cancel), the wrapper will usually look up the public id and dispatch termination via an internal request; the public-id route directly targets the contract identifier used across the platform. - The public wrapper in this project performs termination and then deletes the contract record (so it vanishes from UI lists). If you need a soft-delete instead, update the server logic accordingly.