Statuses/update_with_media : Getting "Missing or invalid url parameter"


Our app has been using the Twitter client Ruby gem ( (ver 4.8.1) to update statuses with media images.

It was working before, but sometime recently (not exactly sure when), it has begun to fail. We get the message “Missing or invalid url parameter.”

Updating a status without media works.

Generic calling code: :oauth_token => token, :oauth_token_secret => secret ).update_with_media(the_status,

We are using carrierwave to store our photos first then post them to Twitter in this manner.

The code hasn’t been touched in months, and now it has started to fail. Anyone have any idea what’s going on?


I’m looking into a few issues folks are having at the moment with statuses/update_with_media. Thank you for letting me know that this library is having trouble also.


I’m not able to reproduce unfortunately. Here’s the code I’m using:

now = file ='./test.jpg') response = Twitter.update_with_media("Current status: #{now}", file) puts response.inspect

It’s resulting in a successful post:

Here are the gem versions I’m using:
faraday (0.8.8)
multi_json (1.7.9)
multipart-post (1.2.0)
simple_oauth (0.2.0)
twitter (4.8.1)

I’m not familiar with carrierwave… What kind of media are you sending? (What’s the ultimate Content-Type?). Is that raw image data that you’re sending?


Right now, our calls to update_with_media gets just dropped by the API server. No response, nothing, just a dead TCP socket after a couple seconds of inactivity.

Same thing happens with stream api but only when the querystring parameters are large (like tracking 100s of keywords). It feels like we can not deliver more than a a hundred bytes or something to twitter APIs in our HTPP request payloads. (other endpoints work just fine)


That’s pretty strange. You’re using the Ruby Twitter gem as well? Are you able to produce any kind of capture of that connection, using a tool like wireshark?


Nope, we are using hand crafted node.js code using request.js for oauth signatures. (code to post update_with_media:

Gonna try and have a capture on the production environment. However, all I get from Node.JS’s high level tcp api is a “Socket hang up” error without any response. (not a single byte on the stream).

This does not happen on US based AWS instances though. Only on our europe servers (not aws / same software).


Thanks. But you’re able to make other API requests from the same servers that aren’t working for statuses/update_with_media in Europe?


That’s correct.

Tested 4 of our EUR servers (same datacenter):
update, retweet, search and oembed routes seems to be working just fine. update_with_media always fails. filter stream works if the querysting is short, fails the same way as update_with_media when qs is long.

Everything works fine with the exact same code base and node.js version on AWS US.


I have encountered the same problem. I have a hand-written code using tmhOauth library for posting news with photos attached. It had been working fine since 3 Jul 2013 until 20 Aug 2013. Then API call update_with_media started to fail returning 403 error and json response {“errors”:[{“code”:195,“message”:“Missing or invalid url parameter”}]}. Though I still can publish tweets with pictures manually (via browser). update, search and some other API calls work fine.

P.S. Sorry for my poor English.


any update on this issue ?


Sorry for the late reply. I’m the developer that submitted the original issue.

It seemed to work on and off since I posted.

Currently it doesn’t seem to be working.

We’re sending an image/jpg file. It is raw image data that we fetch via carrierwave from Amazon S3.

Edit: Also fyi, we’re using twitter gem version 4.5.0. Perhaps we need to update?
Edit 2: Tried updating to 4.8.1, still the same problem.


Okay, I think I’ve figured it out.

It turns out that the way we’re sending the photo data that we fetch with carrierwave was incorrect:

We shouldn’t be passing the string of the image data. It should be a File object apparently:


That change makes everything kosher.


I have the same error at the moment. It’s the first time I’m trying to upload a media so for me it never worked. I found this issue ( that is exactly what I am experiencing. I wrote a message in another discussion, but here is the details:

My application is hosted on AWS (N. Virginia) tested for the past 2-3 hours (5 to 7am UTC) and getting the same error message: “Missing or invalid url parameter”.

Using :

$params = array();
$params[‘media[]’] = ‘@’.realpath($this->getTempLocalFile($url));
$params[‘status’] = $message;
$response = $this->post(‘statuses/update_with_media’, $params);

I can update “statuses/status” without any problem.


I can confirm that it’s coming from Abraham’s twitterAuth library. I’ve switch part of my code to use and it looks like it’s working fine. This library must have an issue in the encoding of the file. I’ll report the bug on github.

Here is the new code I’m using:

$localFile = realpath($this->getTempLocalFile($url));
$params = array();
$params[‘media[]’] = ‘@’.$localFile;

if (null !== $message) {
$params[‘status’] = $message;

$tmhOAuth = new \tmhOAuth(array(
‘consumer_key’ => $this->consumerKey,
‘consumer_secret’ => $this->consumerSecret,
‘token’ => $this->oauthToken,
‘secret’ => $this->oauthTokenSecret,

$response = $tmhOAuth->user_request(array(
‘method’ => ‘POST’,
‘url’ => $tmhOAuth->url(“1.1/statuses/update_with_media”),
‘params’ => $params,
‘multipart’ => true


i tried this library but it returns 0 to me .


We are experiencing this issue as well as of sometime last week. We used to be able to post using update_with_media using PHP’s Oauth libarary (which uses Curl) by doing the following:

$msgdata[’@media[]’] = “@file1;type=image/jpeg;filename=file1”;

We had no problem with this until recently, and are now experiencing the same “missing or invalid url” error response. Regular status updates continue to work fine.

Is there any update on if this was a change at Twitter’s end or not? Or what can be done about it?


Our back end definitely changed, and some undocumented behavior that may have enabled your approach to function previously no longer functions. Make sure that the OAuth library you’re using properly handles the case where a POST body is not of the standard x-www-form-urlencoded type (it’s a special case) and that you’re performing a multipart request.


Any chance you could explain in more detail what you mean by the body being a special case or not? Or what encoding type should be used if not x-www-form-urlencoded? We are definitely sending a multipart request. In case they help, here are the request headers. Trying to figure out post body encoding now.

[request_headers] => Array ( [user-agent] => [host] => [accept] => */* [accept-encoding] => gzip [authorization] => OAuth [content-length] => 56277 [content-type] => multipart/form-data; boundary=----------------------------af7dea0a8938 )


Ok… some progress. If I use the pecl Oauth to generate the auth signature, and construct a Curl request myself by setting those up in the header, and then adding the status/media as postfields, it works! BUT, if I do this with only a status (no media, using just the update API endpoint), it fails with auth issues.

Can you explain why this is the case?


A few hours ago, I had come up with a solution for image posts. Got them to work. Now, it no longer works. Has twitter changed something again?

Now receiving: “Could not authenticate you”

Auth is clearly not the issue here, since I can post normal updates that do not contain media.

It’s like shooting at a moving target here. Please give me any information you can about what exactly changed or is changing.