Post Media to X/Twitter via API (NEW)

Hello community!

I’ve created a workflow for posting tweets to X (formerly Twitter) with media attachments. I wanted to share this solution since many users have been asking about this functionality.

Important API Update

X is deprecating the v1.1 media upload endpoint on March 31, 2025. The new endpoint /2/media/upload requires the media.write scope, which isn’t currently included in the n8n TwitterOAuth2API credentials.

Temporary Workaround

Until my PR is merged to officially add this scope, here’s how you can make it work:

  • When connecting to X in n8n, simply add +media.write to the end of the authorization URL during the OAuth process.
    image

Copy the URL from the authorization popup, open a new tab, paste it, and then add +media.write

Working Example

I’ve attached a sample workflow that demonstrates how to post tweets with media using this method. Feel free to import it and adapt it to your needs.

Let me know if you have any questions!

4 Likes

Ooooh my, thank you so much.
I’ve been looking for this for so long! And this works perfectly! Thank you

1 Like

Thank you very much!!

1 Like

for some reason I’m getting this error even if the credentials are correctly created: Unable to sign without access token

Error details

Other info

Node type

n8n-nodes-base.twitter

Node version

2 (Latest)

n8n version

1.74.1 (Self Hosted)

Time

3/27/2025, 8:38:43 PM

Stack trace

NodeApiError: Unable to sign without access token at ExecuteContext.twitterApiRequest (/root/.nvm/versions/node/v22.13.0/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/Twitter/V2/GenericFunctions.ts:55:9) at ExecuteContext.execute

Attachements are not supported due to Twitter V2 API limitations

I wish this node would…

Problem in node ‘X‘

Unable to sign without access token

1 Like

Hi @finbos

Could you please follow these steps to ensure the app is set up correctly?

I’m getting the same error for this node
the problem is with the type of input text

however without attachment the tweet is made easily.

1 Like

Nice, then you need to do this step manually because the scope isn’t supported yet

Can you give example with attachement?
I keep getting


NodeApiError: Bad request - please check your parameters at ExecuteContext.twitterApiRequest

The example is in the post itself!

Authorization to the http node that you made has problem after accepting the Authorize app.

I have done everything a second time just to make sure but same error. You are using OAuth 2.0 Client ID and Client Secret right? its the only id working for me.

Good morning, I am trying to get this working. forgetting the ignorance, but where do we add that piece of text? I don’t see where it’s supposed to go. I’ve looked at your working example up and down, and I don’t see where it’s added at. Could you maybe explain it please?

Hi,
When you click “Connect,” a popup appears. Instead of proceeding, copy the link from the popup, add +media.write at the end, and then continue.

You mean the pop-up when you’re creating the credential? My browser is not letting me edit the link. Which browser are you using? I’m using Chrome.

1 Like

Okay, never mind. I got it. I ended up opening a new window, pasting that link, and then adding the +media.right, like you said, and it worked. Amazing. Thank you!

1 Like

Nice, glad it worked!

@finbos , @hou_roc Can you please try again,

Open a new tab, copy the URL from the authorization popup, paste it, and then add +media.write

1 Like

Thanks so much for the solution! <3

I wanted to ask if you know how we could post multiple media files in one post? Currently, I can only post with one image. I’ve tried attaching lists and JSON arrays, but I can’t find a way to do it, and I haven’t seen any posts about this either.

1 Like

I think it’s not supported in the n8n X node yet, It seems like the node’s “Media ID” field is defined as a simple string rather than an array. Because of this, when you enter a value that looks like an array (or try to use multiple IDs), n8n serializes it as a string instead of an actual JSON array.

To be honest, this is a bit advanced for me.

But the simplest workaround is to use the HTTP node and call the endpoint directly—it will work…

Here is a working workflow to post multiple Media in one tweet using the HTTP node

1 Like

Hi my friend, I managed to configure it without any problems, it was very good, congratulations!!

I would like to know how I can post videos, I tried to adapt the HTTP Request node to upload media, but it keeps giving me the error “Bad request - please check your parameters
media type unrecognized”

If it is possible for you to answer me with a solution, I would be very grateful!!!

1 Like