Ads OptOut Endpoint Returning 400 MIXED_REQUEST_DENIED

ads
api
json

#1

I’m trying to optout 100 emails in a batch request

MIXED_REQUEST_DENIED, Message: only one product type is supported in one batched request

I am in fact only using WEB_OPTOUT and not mixing anything. Is the error referring to something else? I thought I was following the documentation for optout–what’s the correct approach? Thanks.

Here’s my Python code for reference:

        oauth_header = ...
        post_data = [
            {
                'operation_type': 'Update',
                'params': {
                    'membership_type': 'WEB_OPTOUT',
                    'user_identifier': hash_id(email),
                    'user_identifier_type': 'EMAIL',
                    'effective_at': datetime.datetime.utcnow().strftime(ISO8601_WITH_Z)
                }
            } for email in emails
        ]
        res = requests.post(
            'https://ads-api.twitter.com/3/tailored_audience_memberships',
            headers={
                'content-type': 'application/json',
                'Host': 'ads-api.twitter.com'
            },
            auth=oauth_header,
            json=post_data,
        )

#2

Hey @chet

Thank you for bringing this to our attention. Your request is correct, however there’s currently an issue on our end when trying to use the WEB_OPTOUT parameter with the Real-Time API. In the meantime, I’d recommend using the Global Opt-Out endpoint as a workaround.

Thanks!