FAQ: How does the unsubscribe API work?

·

·

You can post unsubscribes over to MageMail by using the REST API. You can find your MageMail API key in the Magento module settings under Promotions > MageMail > Advanced.

Here is an example. You can actually run this yourself to test it – this is a valid API key for the MageMail demo account.

curl --data "api_key=aeb434592f1c0b8352&email=test@example.com" \
    https://magemail.co/app/api/unsubscribe

The response you can expect is:

    {
        "success":true,
        "username":"demo",
        "unsubscribed_email":"test@example.com"
    }

If you receive an error, the success value will be false.

    {
        "success":false,
        "message":"The email test1@example.com was already unsubscribed previously at: 2025-05-17 12:52:19"
    }

A few expected error cases are:

  • Invalid email format – Email address is already unsubscribed – Invalid API key