How do i post a base 64 image to statuses/update_with_media


Hi Guys,

I want to post an image to twitter api.
If i use an binary image everything is working fine but i want to use base64 to post the image to the api.

I’ve tryed everything i know but i keep getting the
data: ‘{“errors”:[{“code”:189,“message”:“Error creating status”}]}’,

These are my headers:

-----------------------------d67b3e07c45e Content-Disposition: form-data; name="status"

Content-Disposition: form-data; name=“include_entities”

Content-Disposition: file; name=“media[]”; filename=“test.png”

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAAB+CAIAAABwE84BAAAYKGlDQ1BJQ0MgUHJvZmlsZQAAWAmtWXk81N/Xv59ZzRjbjH3f933f933JEqKQMfa9sYuitKGFZC+RlIhK2VJZKilEiURlSYiKpBB5PqN8v7/n9TzPf8 (… keeing it smal for the post)


If i dont add an image everything is working fine.

I’m using node js.

Does enybody know what i’m doing wrong?


Currently base64 encoded images aren’t accepted by the API. We’ll work on adding support for this but you should continue to send the raw binary data instead.


Kurrik thanx for your reply!

I already build it that way. Was not an big isseu.

Can i ask you to take a look at my application? Like to know what u think about it.
Why i ask is because i’m depanding on Twitter right know and i want to know if Twitter aproves my application. We want to open our application for other users. If we do i know about 50 to 70% of the biggest accounts (100K +) wil be in this application. (The are asking about the appication daily ( in whatsapp ))
I don’t want to mess things up on Twitter side and all the accounts that wil be in our application.

OOO, And site Stream would be awsume!



Does this still apply? No base64 is accepted? Or was this fixed in the meantime?



Reading the documentation, it seems to accept base64 string, but I can’t use.
Is this fault of my code? or base64 not allowed yet?


I dont know realy but binary is easy to. What language are u coding in?



I’m using JavaScript (in Chrome Extension OAuth), and also using HTML5 Canvas API.
Canvas gives base64 string more easily than image binary.


Take a look at:


Hi… I am also trying to upload binary image… Could you please share your code?


You can upload your media base64 encoded. Take a look at


We allow uploading your media base64 encoded or binary. Check out


Thanks a lot!


pass a parameter likes below may works:
array(‘media[]’ => file_get_contents($image_url),‘status’ =>$status_sent)


@jaakkosf …is it possible to send binary image data to media parameter. or should we only specify filepath.


You should not specify a filename/path in the media parameter, as that is a local thing, not visible to the API. You need to include the base64 data.


@andypiper I did specify base64 but no luck. Its complaining about authentication 401.


@andypiper…I tried to change callback url (eg: and generate new access and consumer key…but no luck. Can you please check details below of my header.

	<Header>POST / HTTP/1.1accept: application/json
authorization: OAuth oauth_signature="PPCcO%2BHTDGhl42v********%3D", oauth_version="1.0", oauth_nonce="ee589a7e-b221-4e****", oauth_consumer_key="oJFOmo4i5NkxuV******", oauth_signature_method="HMAC-SHA1", oauth_token="2894909697-lEcJkDj2abplxgZh3vLo9Zm******", oauth_timestamp="1418819912"

accept-encoding: gzip

content-type: text/plain

user-agent: Java/1.7.0_55

host: localhost:8336
connection: keep-alive
content-length: 0