Twitter campaign constraints for PUT calls on budget fields


I have read several pages on how to unset fields via PUT api calls. The Twitter Ads API documentation says to pass an empty string.

We are finding that we can’t unset the daily_budget_amount_local_micro on a twitter campaign via a PUT call. The sample request and response are shown below:

  curl --request 'PUT' \
'<account_id>/campaigns/<campaign_id>' \
--data 'daily_budget_amount_local_micro=' --header 'Authorization: OAuth \
oauth_consumer_key="<value>", oauth_nonce="<value>", \
oauth_signature="<value>", \
oauth_signature_method="HMAC-SHA1", \
oauth_timestamp="1473719906", oauth_token="<value>", \
oauth_version="1.0"' --verbose

"message":"Expected Long, got \"\" for daily_budget_amount_local_micro",
"request":{"params":{"campaign_id":"<the campaign id>",
"account_id":"< the account id>"}}}

Here are the settings for the campaign that we’re using, minus the Ids:

{"request":{"params":{"campaign_id":"<campaign id>",
"account_id":"<account id>"}},
"data":{"name":"Mon Sep 12 2016 18:38:42 GMT-0400 (EDT)102219",
"funding_instrument_id":"<funding instrument id>",

Is there an undocumented restriction on unsetting daily_budget_amount_local_micro? Maybe, it can’t be unset if total_budget_amount_local_micro is null?


Hi, @chris_august7. Does this happen for other parameters? This may be due to the fact that daily_budget_amount_local_micro is a required param. Have you tried changing this value instead of trying to unset it?


Ah. The documentation for PUT says its “optional” because its optional to change the value you’ve set. The field itself is required (as explained in the POST documentation).

That makes sense. In this case, it would be nice if the error handling were clearer, but this is basically just user error on our part. Thanks!


Thanks for confirming so quickly, @chris_august7. Glad this is cleared up now.

Also, the following is a good way to describe this for the PUT accounts/:account_id/campaigns/:campaign_id endpoint:

[It’s] “optional” because it’s optional to change the value you’ve set.