Create Community Post With Media

POST/tw-v2/interaction/create-community-post-with-media

Description

Post a new tweet with media attachments to a specific community. Supports text content up to 280 characters for non-premium users (or 25,000 for premium users) and up to 4 images or 1 video.

Request Body

ParameterTypeRequiredDescription
authTokenstringrequiredAccount authentication token (auth_token cookie value)
textstringrequiredThe text content of the tweet (max 280 characters for non-premium, 25,000 for premium)
communityIdstringrequiredThe ID of the community to post to (numeric only)
mediaarrayrequiredArray of media objects (1-4 items). Each object must use exactly one source: {url: string}, {data: string, type: string}, or {media_id: string}.
proxystringrequiredProxy in format 'hostname:port@username:password' (required for better success rates)
disableLinkPreviewbooleanoptionalWhen true, disables link preview cards for tweets containing URLs (defaults to false)

Media Input

Each item in media can be one of:

  • { "url": "https://example.com/image.jpg" }: TweetAPI fetches and uploads the media.
  • { "data": "<base64>", "type": "image/png" }: TweetAPI uploads base64 media with the provided MIME type.
  • { "media_id": "1971008286821380096" }: attach a caller-managed Twitter media ID directly.

When using media_id, upload and finalize the media with the same Twitter/X account first, wait for video or GIF processing to finish, then pass the returned media_id_string. TweetAPI does not pre-validate ownership, expiry, processing state, or media category.

Code Examples

const body = {
  authToken: 'YOUR_AUTH_TOKEN',
  text: 'Sample post text 87088 for documentation.',
  communityId: '1234567890',
  media: [{"url":"https://example.com/link-94089/profile-29900/image.jpg"}],
  proxy: 'proxy.example.com:8080@user:pass'
};

const response = await fetch('https://api.tweetapi.com/tw-v2/interaction/create-community-post-with-media', {
  method: 'POST',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(body)
});

const data = await response.json();
console.log(data);

Response

Success Response (201 Created)

201
{
  "data": {
    "id": "9001658339092464914",
    "action": "create_community_post",
    "timestamp": "2025-10-05T13:57:08.672Z",
    "success": true,
    "metadata": {
      "tweet_id": "2009208775500310958",
      "author_username": "username",
      "text": "Sample post text 87088 for documentation.",
      "created_at": "Sun Oct 05 13:57:08 +0000 2025",
      "url": "https://example.com/link-94089/profile-41921/username/status/2001792974440559044"
    }
  }
}

Error Responses

Status CodeDescription
400Bad Request - Invalid parameters, community ID, or media format
401Unauthorized - Invalid or missing API key
403Forbidden - Account not authorized to post in this community
404Not Found - Community doesn't exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error

Notes

  • Community ID must be numeric only
  • Supports up to 4 media items per tweet
  • All timestamps are in ISO 8601 format
  • IDs are snowflake IDs (strings)
  • Tweets longer than 280 characters automatically use premium note tweet format

API Playground

POST/tw-v2/interaction/create-community-post-with-media

Sensitive Credentials Required

Requires your Twitter authToken. Use a test account.

Press ⌘ + Enter to execute

curl -X POST "https://api.tweetapi.com/tw-v2/interaction/create-community-post-with-media" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"
Response

Click "Try It!" to see the response