I have a API endpoint where it will do input validation using rest_framework\'s serializer.is_valid() where it will return custom error message and response.
serializer.is_valid()
You can write custom error handler:
from rest_framework.views import exception_handler def custom_exception_handler(exc, context): response = exception_handler(exc, context) if response is not None: response.data['Failure'] = 'Error' return response