Error NotAuthorized creating promoted tweets


Hi! I’m trying to create a new campaign for one of my accounts and I’m succeeding, but when I try to create tweets for that campaign I receive this error. (I have the permissions for create promoted tweet in the account…)

NotAuthorized object at ######## code=401 details=[{u’message’: u’User ######## is not authorized to create tweets for user id #####’, u’code’: u’UNAUTHORIZED_ACCESS’}]>

Does someone knows why?!


@nicomilie: Thanks for the question. Please make sure you are using the as_user_id parameter.

Users granted an Ads Manager role via the Twitter UI at can create Tweets on behalf of the advertiser using the as_user_id parameter. For more information on Ads Manager permissions, see Obtaining Ads Access.

More information here: POST accounts/:account_id/tweet.


Thanks! Where can I get my ‘as_user_id’ param?? i need it only for creating tweets or something else?

thanks again


@nicomilie: Are you asking where to find this value? If so, you can use the GET users/show endpoint. Look for the id_str attribute. See the following example:

$ twurl -H "/1.1/users/show.json?screen_name=twitterdev" | jq
  "id": 2244994945,
  "id_str": "2244994945",
  "name": "TwitterDev",
  "screen_name": "TwitterDev",
  "location": "Internet",
  "profile_location": null,
  "description": "Developer and Platform Relations @Twitter. We are developer advocates. We can't answer all your questions, but we listen to all of them!",
  "url": "",
  "entities": {
    "url": {
      "urls": [
          "url": "",
          "expanded_url": "",
          "display_url": "",
          "indices": [
    "description": {
      "urls": []
  "protected": false,
  "followers_count": 437141,
  "friends_count": 1535,
  "listed_count": 1045,
  "created_at": "Sat Dec 14 04:35:55 +0000 2013",
  "favourites_count": 1887,
  "utc_offset": -25200,
  "time_zone": "Pacific Time (US & Canada)",
  "geo_enabled": true,
  "verified": true,
  "statuses_count": 2796,
  "lang": "en",
  "status": ...,
  "contributors_enabled": false,
  "is_translator": false,
  "is_translation_enabled": false,
  "profile_background_color": "FFFFFF",
  "profile_background_image_url": "",
  "profile_background_image_url_https": "",
  "profile_background_tile": false,
  "profile_image_url": "",
  "profile_image_url_https": "",
  "profile_banner_url": "",
  "profile_link_color": "0084B4",
  "profile_sidebar_border_color": "FFFFFF",
  "profile_sidebar_fill_color": "DDEEF6",
  "profile_text_color": "333333",
  "profile_use_background_image": false,
  "has_extended_profile": false,
  "default_profile": false,
  "default_profile_image": false,
  "following": true,
  "follow_request_sent": false,
  "notifications": false,
  "translator_type": "regular"

You need to use this value with the as_user_id parameter if creating Tweets on behalf of another user (as long as the user you’re trying to Tweet as has given you permission to do so).


This post might also help.