I’m working with the MailGun API to fetch all unsubscribed email addresses from my domain using PHP and cURL. However, I’m running into an issue where the response doesn’t contain the expected data.
Instead of getting the unsubscribed email list, I only receive this response:
Mailgun Magnificent API
I expected to get a JSON response with the unsubscribed email addresses, but it seems like something is not configured properly. Has anyone encountered this issue before? What could be causing this unexpected response from the MailGun API?
That generic response means you’re hitting the wrong endpoint or having auth issues. I ran into the same thing when I started with MailGun - turns out I was using the wrong base URL for my region. Check if you need the EU endpoint (api.eu.mailgun.net) instead of the standard one. Make sure your domain format in the URL matches exactly what’s in your MailGun dashboard. Also check if your API key has the right permissions for unsubscribe data. Sometimes keys work fine for sending but don’t have read access for other endpoints.
try double checking your API key and domain. also, the URL might have typos, it’s easy to overlook. logging the status code with curl_getinfo could help ya figure out what’s up. good luck!
Had this exact problem a few months ago - drove me nuts for hours. That “Mailgun Magnificent API” response usually means you’re getting redirected or your auth is messed up. Here’s what fixed it for me: add CURLOPT_FOLLOWLOCATION and make sure SSL verification is working. Add these to your curl setup: curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, true) and curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true). Double-check your API key format is exactly “api:key-yourkey” - no extra spaces or weird characters. The unsubscriptions endpoint is picky about headers too, so try adding curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array(‘Accept: application/json’)). This combo fixed all my auth issues.