Modify campaign via API



I have Application ID with permission for Twitter Ads API and able to get data for my campaigns.

However, when I try to perform an update request like changing the campaign status or bid, I’m getting the error:

{u’message’: u’The client application making this request does not have access to this API’, u’code’: u’UNAUTHORIZED_CLIENT_APPLICATION’}

Please assist.



Hi @eladzaa,

Would you be able to provide us with the full request/response you’re getting when you successfully fetch campaign data, as well as an example request/response for the error you mention? That should provide us with the information we need to help you troubleshoot.



I’m using the python twitter_ads SDK for API access.

This is the relevant code snippet:

from twitter_ads.client import Client

ads_client = Client(app_id,

account = ads_client.accounts(id=account_id)
line_item = account.line_items(id=line_item_id)
campaign = account.campaigns(id=line_item.campaign_id)
campaign.paused = status == is_status_paused

All the commands work as expected and return the requested line items and campaigns besides the line which yields an exception as mentioned above.


@eladzaa: Thanks for the question.

The error response in your original post usually indicates that the authentication credentials are missing or incorrect. I’d recommend using twurl to ensure that your app actually has access. Twurl knows how to grant the access token and signs all requests with the necessary credentials.

In terms of the Python SDK, please note that the .save() method is what actually performs the operation on the object and its attributes, as you’ve specified them.


@juanshishido Thank you for your response.

I’ve tried twurl authentication and was able to fetch my account tweets. However, the python SDK is our preferred Twitter Ads API access technology and as I understand, the ‘twitter_ads’ python package is officially supported by Twitter.

I’m getting the error message only after I’m using an update request. Does the Ads API have different permissions for getting and for updating campaigns and line items?

If so, I need an update Ads API permission for my Twitter app. If not, how can it be that authentication credentials are missing or incorrect when I’m getting valid line items data?


@eladzaa: Glad you’ve got it working with twurl. To confirm, you’re able to use twurl to make the same request you’re trying to make with the Python SDK, right (e.g., pausing the campaign)?

Also, ceck your .twurlrc file—should be in $ cd ~—and make sure you’re using those authentication credentials when using the SDK.


@juanshishido That’s not the case, as twurl is not working on Ads API related requests which is the API I need.

After sending the command:

twurl -H /1/accounts

I’m getting the message:

The Twitter REST API v1 is no longer active. Please migrate to API v1.1.

Also, when I’m sending:

twurl authorize -H --consumer-key <KEY> --consumer-secret <SECRET>

I get the response:

Authorization failed. Check that your consumer key and secret are correct, as well as username and password.

I’m using the same consumer key and secret like in the Python SDK and I have no problems there getting the accounts list.

I’ve also checked the .twurlrc file. The consumer key and secret are the same but the access token and access token secret are different from what I have in my Twitter app which I use in Python SDK.


@eladzaa: That error message is returned only when making a request to the host with a /1/ resource path. Please double check your request. I’d like to confirm that you’re able to successfully make a GET request using twurl to the accounts endpoint, especially given:

Finally, what is your app ID?


@juanshishido I’m making requests to not to

In your Ads API documentation it says that the Ads account GET request is Isn’t the Ads API account latest version is 1?

When sending request:
twurl -H /1.1/accounts

I get:

{"errors":[{"code":"ROUTE_NOT_FOUND","message":"The requested resource could not be found"}],"request":{"params":{}}}

My App ID is 12438526.


That’s correct, @eladzaa. We are currently on version 1 of the Ads API.

The previous comment was intended to clarify the fact that the error message you previously shared (shown below) is only returned when making a /1/ request to—after all, it calls out “REST API.” For the domain, we have no such message defined.

"The Twitter REST API v1 is no longer active. Please migrate to API v1.1."

Please share a successful Ads API GET request using twurl, so we may further assist you.


@juanshishido I’ve successfully managed to get my accounts list using the following twurl request:

twurl -H /1/accounts/

But when sending the request:

twurl -X PUT -H /1/accounts/<ACCOUNT ID>/line_items/<LINE ITEM ID>?paused=true

I’m getting the error:

"errors":[{"code":"UNAUTHORIZED_CLIENT_APPLICATION","message":"The client application making this request does not have access to this API"}]


That’s great. Thanks for confirming, @eladzaa! Your app should now be able to make writes (it was originally set for read-only access). Please let us know if this resolves your issue.


@juanshishido Yes, this resolves my issue.

Thank you for your assistance.


@juanshishido, Hello again,

I now able to perform update requests in my ads API account. However, I would like to create promoted tweets in order to create campaigns via the API. When I try to make a POST request to the endpoint:

'/1/accounts/<ACCOUNT ID>/tweet'

I’m getting an error:

[{u'message': u'User <USER ID> is not authorized to create tweets for user id <USER ID>', u'code': u'UNAUTHORIZED_ACCESS'}]

Would you please enable access for tweet creation for my user?


Guidance for UNAUTHORIZED_ACCESS issues

@eladzaa: Please remember to provide the full request and response when asking questions here. See Guidelines for Reporting Issues for a refresher.

In addition, don’t forget to search the forums for similar questions.

In any case, this post and this thread should help you.



I hope this thread is the right place for my message.

I have the same problem with modifying campaigns.
Request: GET works just fine, but
POST is returning UNAUTHORIZED_CLIENT_APPLICATION (The client application making this request does not have access to this API).

I’m confused because my app (app id: 13993779, Basic licence) has “Read and write” access level permission.
Any advice?

Best regards,