Cancel Custom Calendar Event
Description
Cancels a calendar event by setting its isDeleted flag to true. This endpoint can only cancel calendar events that were created with agentName set to "custom".
Endpoint
POST /api/v1/cases/{caseId}
Headers
| Header | Required | Description |
|---|---|---|
content-type | Yes | application/json |
cv-api-key | Yes | Organization API key |
Path Parameters
| Name | Type | Description |
|---|---|---|
caseId | UUID | Case identifier |
Request Body
{
"action": "CANCEL_CALENDAR_EVENT",
"calendar": {
"id": "987fcdeb-51a2-43d7-9876-543210fedcba"
}
}
Field Reference
Root
| Field | Type | Required |
|---|---|---|
action | string | Yes (CANCEL_CALENDAR_EVENT) |
calendar | object | Yes |
calendar
| Field | Type | Required | Notes |
|---|---|---|---|
id | UUID | Yes | Calendar event ID to cancel |
Example cURL
curl --request POST \
--url http://localhost:4000/api/v1/cases/{{caseId}} \
--header 'content-type: application/json' \
--header 'cv-api-key: {{generated_organization_api_key}}' \
--data '{
"action": "CANCEL_CALENDAR_EVENT",
"calendar": {
"id": "987fcdeb-51a2-43d7-9876-543210fedcba"
}
}'
Success Response
{
"status": 200,
"success": true,
"message": "Calendar event cancelled successfully",
"data": {
"success": true
}
}
Errors
| Status | Meaning |
|---|---|
| 400 | Invalid payload |
| 401 | Invalid or missing API key |
| 404 | Case not found |
| 500 | Internal error |
Example Error Response
A request can fail for several reasons, returning a 400 Bad Request or a specific error message.
Invalid action in the request body:
If the action field is not a recognized value like CANCEL_CALENDAR_EVENT, the API will return a bad request error.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Invalid action"
}
Invalid UUID format
If the calendar.id field is not a valid UUID format, the API will return a specific error message.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "id must be a valid UUID"
}
Calendar event not found
This response is returned if no calendar event exists with the provided ID.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Calendar event not found"
}
Calendar event already cancelled
This response is returned if the calendar event has already been cancelled.
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Calendar event has already been cancelled"
}
Not a custom event
This response is returned if the calendar event's agentName is not "custom".
{
"status": 400,
"success": false,
"message": "Invalid request",
"error": "Calendar event can only be cancelled if agentName is \"custom\""
}
Case Not Found
This response is returned if no case exists with the provided caseId.
{
"status": 404,
"success": false,
"message": "Invalid request",
"error": "No Case found for provided details!"
}
Notes
- This endpoint performs a soft delete by setting the
isDeletedflag totrue. - Only calendar events created with
agentName: "custom"can be cancelled. - Once cancelled, a calendar event cannot be uncancelled.
- Attempting to cancel an already cancelled event will result in an error.