If you are using the Contact Contact API library look for $curl_debug in the CC_Utility class. It was set to true by default in the version I downloaded and I had the same issues as you. Just set it to false and then it won't echo any content automatically when an API error occurs. You should handle all errors by checking the function return value and the $lastError value after making an API call.
... View more