Uploading media



Im trying to upload images to the media library of an account, so i can use these images to create promoted tweets in this specific account. In my query im using the param ‘as_user_id’ also.
However, the images are uploaded to the account which is associated with the token we’re using in our queries.

How do i choose to which account to upload the image?



@nicomilie: What you describe—that the images are uploaded to the account associated with the credentials you’re using to make the requests—is expected behavior.

You need to use the additional_owners parameter when making a request to the POST media/upload endpoint to be enable another user to use the media. The additional_owners parameter allows you to specify the user(s), by user_id, who are allowed to use the media. Please see the example request below:

$ twurl -X POST -H upload.twitter.com "/1.1/media/upload.json?additional_owners={additional_owners}" --file image.jpg --file-field "media" | jq
  "media_id": 790053336116453400,
  "media_id_string": "790053336116453376",
  "size": 96203,
  "expires_after_secs": 86400,
  "image": {
    "image_type": "image/jpeg",
    "w": 900,
    "h": 360


Thanks @juanshishido! Can you send me an example of the additional_owners param? I tried using the id displayed in the URL and its not valid! thanks


@nicomilie: Do you mean an example user_id to use as the value for the additional_owners parameter? If so, you can find this value when making a request to the GET users/show endpoint. The id_str attribute is the user ID.


Perfect!! its working now!! thanks @juanshishido for the useful help!


Glad to hear it, @nicomilie!

Please consoder marking this thread as solved.


marked. thanks again