Skip to main content

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

HeaderRequiredDescription
content-typeYesapplication/json
cv-api-keyYesOrganization API key

Path Parameters

NameTypeDescription
caseIdUUIDCase identifier

Request Body

{
"action": "CANCEL_CALENDAR_EVENT",
"calendar": {
"id": "987fcdeb-51a2-43d7-9876-543210fedcba"
}
}

Field Reference

Root

FieldTypeRequired
actionstringYes (CANCEL_CALENDAR_EVENT)
calendarobjectYes

calendar

FieldTypeRequiredNotes
idUUIDYesCalendar 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

StatusMeaning
400Invalid payload
401Invalid or missing API key
404Case not found
500Internal 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 isDeleted flag to true.
  • 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.