Pre-existing targeting criteria not found during batch delete


I have an error specific to a certain campaign when using the batch targeting criteria delete API call.

When I use the GET endpoint, I am able to get the targeting criterion object and its not deleted.

The batch targeting criteria endpoint reports that the targeting criteria can’t be found with a HTTP 404 error.

Deleting existing targeting criteria through `POST batch/accounts/:account_id/targeting_criteria` result in a 404

Hi Chris, are you able to delete this targeting criteria (or other targeting criteri associated with the campaign) using the original, non-batch targeting criteria DELETE endpoint?

See DELETE accounts/:account_id/targeting_criteria/:id


Hi Helen,

There appears to be a bug in the batch DELETE endpoint for targeting criteria. Can you investigate why it can’t find all the targeting criteria that are returned by the batch GET endpoint?

Also, when I delete all the targeting criteria via the non-batch endpoint, some of them will be returned with “deleted=false” from the batch GET endpoint.

I’d like to understand if there is some kind of cache or latency within your system that is affecting these batch endpoints. They are returning inconsistent data from the non-batch endpoints, and its causing difficult to reproduce issues with our campaign targeting.

On our campaigns, we sometimes have 300-400 targeting criteria we need to delete when changing the targeting. It is not a scalable solution to use the non-bulk endpoint for this kind of thing.




Here’s some more related information. Using the workaround @hwz provided, there is a another problem that occurs after using the non-batch delete endpoint.

  1. call batch GET targeting criteria endpoint, which returns a list of targeting criterion objects.
  2. call batch DELETE targeting criteria endpoint to attempt to delete all of them.
  3. batch DELETE returns an error saying that one of the targeting criterion objects can’t be found, even though it appeared in the results from step 1 above as “not deleted”.
  4. use non-batch delete endpoint to successfully delete the targeting criterion that was “not found” in step 3. You get an HTTP 200 OK result (targeting criterion deleted).
  5. call batch GET targeting criteria endpoint on the same twitter line item as step 1.
  6. The targeting criteria list returned includes the targeting criterion object deleted using the non-batch delete endpoint in step 4. It continues to appear in the list as “not deleted” / still an active targeting criterion on the line item.