Can't include expanded and exclude a tailored audience


#1

I am using the batch targeting criteria endpoint, and getting BAD_REQUEST as a response when I try to include an audience as expanded, and then exclude the same audience as non-expanded.

This is what the Twitter Ads UI does in order to support “lookalikes only” targeting.

Is it anticipated that the Ads API will support this at some point? Our users would like this feature.

Status code 400

{  
  "errors":[  
    {  
      "code":"INVALID",
      "message":"TargetingCriteria 'Custom audience targeting' cannot be targeted both positively and negatively for CUSTOM_AUDIENCE.",
      "attribute":"negated"
    }
  ],
  "request":[  
    {  
      "params":{  
        "line_item_id":"942lr",
        "targeting_type":"TAILORED_AUDIENCE",
        "targeting_value":"pxcw",
        "account_id":"okrly1"
      },
      "operation_type":"Create"
    },
    {  
      "params":{  
        "line_item_id":"942lr",
        "account_id":"okrly1",
        "operator_type":"NE",
        "targeting_value":"pxcw",
        "targeting_type":"TAILORED_AUDIENCE"
      },
      "operation_type":"Create"
    }
  ],
  "operation_errors":[  
    [  

    ],
    [  
      {  
        "code":"INVALID_PARAMETER",
        "message":"More than one TargetingCriterion in the request have the same unique or primary key. Found duplicate values of [15306543, CUSTOM_AUDIENCE, 1209632] for type_value_idx.",
        "attribute":""
      }
    ]
  ]
}

POST to https://ads-api.twitter.com/1/batch/accounts/okrly1/targeting_criteria

It looks like, in our request, we aren’t including the “tailored_audience_expansion” parameter… when I include it, I get the same result, as shown below:

Payload

[{"operation_type":"Create","params":{"tailored_audience_expansion":true,"targeting_value":"pxcw","operator_type":"EQ","targeting_type":"TAILORED_AUDIENCE","line_item_id":"943rs"}},{"operation_type":"Create","params":{"tailored_audience_expansion":false,"targeting_value":"pxcw","operator_type":"NE","targeting_type":"TAILORED_AUDIENCE","line_item_id":"943rs"}}]

Response: HTTP 400 BAD REQUEST

{"errors":[{"code":"INVALID","message":"TargetingCriteria 'Custom audience targeting' cannot be targeted both positively and negatively for CUSTOM_AUDIENCE.","attribute":"negated"}],"request":[{"params":{"line_item_id":"943rs","account_id":"okrly1","operator_type":"EQ","targeting_value":"pxcw","targeting_type":"TAILORED_AUDIENCE"},"operation_type":"Create"},{"params":{"line_item_id":"943rs","account_id":"okrly1","operator_type":"NE","targeting_value":"pxcw","targeting_type":"TAILORED_AUDIENCE"},"operation_type":"Create"}],"operation_errors":[[],[{"code":"INVALID_PARAMETER","message":"More than one TargetingCriterion in the request have the same unique or primary key. Found duplicate values of [15308056, CUSTOM_AUDIENCE, 1209632] for type_value_idx.","attribute":""}]]}```

Ads API Version 3
#2

Thanks for the question, @chris_august7. Have you tried using "targeting_type":"TAILORED_AUDIENCE_EXPANDED" in the request?


#3

I didn’t realize its treated as a separate targeting type, rather than an additional parameter on the request. I’ll try that.

Yes, that resolves the problem. Thanks!


#4

Thanks, @chris_august7, for confirming! We will add this to the documentation and help make it clearer. Appreciate you raising this issue.