Delete Context Variable Definition
Delete an existing context variable definition. Note that default system variables cannot be deleted.
Endpoint
DELETE /api/v1/context-variables/{variable_id}/delete
Authentication
This endpoint requires an API key with the can_write_contacts
permission.
Path Parameters
Parameter | Type | Required | Description |
---|
variable_id | integer | Yes | ID of the variable definition to delete |
Response
{
"message": "Variable definition deleted successfully"
}
Error Codes
Status Code | Error Code | Description |
---|
401 | authentication_required | No API key was provided |
401 | invalid_key | The API key is invalid or inactive |
403 | permission_denied | The API key doesn’t have the required permission |
403 | delete_not_allowed | Cannot delete default variables |
404 | not_found | Variable definition not found |
500 | server_error | An unexpected server error occurred |
Example Request
curl -X DELETE 'https://api.klen.ai/api/v1/context-variables/3/delete' \
-H 'Authorization: Bearer klen_abcdef123456789'
Example Response
{
"message": "Variable definition deleted successfully"
}
Notes
- Deleting a variable definition does not automatically remove the variable values from your contacts or business profile
- Default system variables (
is_default: true
) cannot be deleted
- You can only delete variable definitions that belong to your account
- Use this endpoint with caution, as deleting a variable definition can affect personalization in your AI calls and templates
Responses are generated using AI and may contain mistakes.