Upload Profile Image in Postman for Chrome



Hello! I’m an API beginner, and Postman for Chrome is fairly easy for me to navigate; I’ve been able to make GET/POST calls for textual data e.g. status updates, but never any POST calls for uploading media e.g. profile images.

Every time I try to attempt “POST account/update_profile_image”, I get the “Could not authenticate you” error, as seen in the screenshot below:

Again, my authentication has worked with non-media calls, so I don’t think that’s the issue, but I’ll post that screenshot (with my tokens blurred out) just in case:

Is there something I need to add to the “image” parameter?

Or, in the Body section, am I doing the wrong thing by using “form-data” and “media” as a key?

Thank you in advance for any help!


The parameter should be image (not media) with base64 encoded input, and I think you might want to use www-form-encoded. However, I have to admit I’m having trouble getting this to work for me using Postman, as well. It works fine using my command-line twurl recipe. Comparing the headers and requests, I’m not quite sure what Postman is doing to make the request behave differently.


Thank you for the tips! I’ve shifted to trying twurl as you suggested, and everything was going great until I actually tried testing a POST request, specifically the one recommended here:

twurl -d ‘status=Testing twurl’ /1.1/statuses/update.json

I received the following error message, despite only moments before having gotten “Authorization successful” with my consumer key/consumer secret/PIN number:

{“errors”:[{“code”:89,“message”:“Invalid or expired token.”}]}

I would love to try your recipe for updating profile images (thank you again!), but it looks like it won’t work until I get past this step.


That’s really weird, because if you have a working twurl setup then the recipe I linked to should work OK.

I assume you’ve run through the setup process for twurl to obtain a token?

What shell are you running?


Here is a screenshot with my keys blurred out (I’m using Ruby Gems/ruby 2.4.1p111):

twurl error

In the Twitter app, I have my Access Token/Access Token Secret generated as well as my consumer key/secret, but as you can see, I haven’t manually entered the Access Token/Token Secret in the Ruby command prompt, just the consumer key/secret. Is that a step I’m missing?


Is your system clock accurate?


Yes, my system clock is accurate! I’ve tried restarting my computer, using Chocolatey, and using different twurl command prompts, but they all return the same “Invalid or expired token” error, even after regenerating my keys and tokens or starting a new Twitter app. I did some googling and others said they had to change their permissions to “Read, write, and direct messages”, but that hasn’t fixed the problem for me either. Because I’m so new to API and twurl, I’m not really sure what else I can do at this point, but thank you again for trying to help!