403 Forbidden Error on X (Twitter) Media Upload

Hi everyone,

I am trying to upload an image to X (Twitter) using the HTTP Request Node but I keep receiving a 403 Forbidden error.

My Setup:

  • n8n Version: 2.1.5 (Self-hosted)

  • Endpoint: https://api.x.com/2/media/upload

  • Auth Method: X OAuth2 API (Built-in n8n credential)

  • Permissions: App is set to “Read and Write and Direct Messages” in X Developer Portal.

The Request:

  • Method: POST

  • Body Type: Form-Data

  • Parameters: * media: (Binary file from previous node)

    • media_category: tweet_image

    • media_type: image/png

Even though my credentials seem correct and have full write permissions, I cannot bypass this error. Is there a specific header or parameter I’m missing for the v2 media upload endpoint in n8n?

1 Like

Hi @Fikri_Tekin
stop using the predefined x credential. just create a standard ‘OAuth2 API’ credential for that node instead.

set the authorization url to https://twitter.com/i/oauth2/authorize and the token url to https://api.twitter.com/2/oauth2/token.

then in the scope field, manually type tweet.read tweet.write users.read media.write offline.access.

once you save that and reconnect your account, n8n generates a fresh token with that explicit media scope.

Tweet Images using the Twitter v2 API
this video walks through the v2 media upload flow and the required scopes if you want to double-check how the backend expects the payload.

3 Likes

Hi! I am also running into a problem with chuncking a video to upload to Twitter. Is that even possible? i can’t seem to make Append note work and then I always get “incorrect media format”, even though it’s mp4 with MIP video. The video is only 24.5MB for the test, it should be technically possible, but I can’t seem to find a solution. Sorry if it’s a wrong place to ask, I am very new to N8N and automation

Is this possible for free tier X apps?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.