Create a community
Create an X Community owned by your account.
/client/communities/createYour account, your proxy, your risk.
Account actions run with the session cookie of your own X account and go out through your own proxy. Use only accounts you control and follow X's rules. Automated posting, following or liking can get the account limited or suspended; that is between you and X. Treat the cookie like a password: it gives full access to the account. Trial keys cannot call these endpoints.
Parameters
cookiebody · string · requiredCookie header of your own logged-in X session. Must contain auth_token and ct0; guest_id is used when present.
proxybody · string · requiredYour proxy, format http://user:pass@host:port. The requests to X go out through it. Used only for this request.
namebody · string · requiredCommunity name.
descriptionbody · string · optionalCommunity description.
joinPolicybody · string · optional · default OpenPassed to X as is.
invitesPolicybody · string · optional · default MemberInvitesAllowedPassed to X as is.
questionbody · string · optionalQuestion for people who ask to join.
Body parameters are sent as a JSON object with Content-Type: application/json.
Example request
curl -X POST 'https://api.twittrapi.com/client/communities/create' \
--header 'X-API-KEY: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"cookie":"auth_token=...; ct0=...","proxy":"http://user:pass@host:port","name":"API testers"}'import httpx
resp = httpx.post(
"https://api.twittrapi.com/client/communities/create",
headers={"X-API-KEY": "YOUR_API_KEY"},
json={
"cookie": "auth_token=...; ct0=...",
"proxy": "http://user:pass@host:port",
"name": "API testers",
},
timeout=60,
)
print(resp.status_code, resp.json())const resp = await fetch("https://api.twittrapi.com/client/communities/create", {
method: "POST",
headers: { "X-API-KEY": process.env.TWITTRAPI_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
cookie: "auth_token=...; ct0=...",
proxy: "http://user:pass@host:port",
name: "API testers",
}),
});
console.log(resp.status, await resp.json());Base URL https://api.twittrapi.com, key in the X-API-KEY header. The SDKs do not wrap account actions, so the examples are plain HTTP calls.
Response
Wrapper built by the API: {"status_code": <X status>, "response": "<X response body as a string>"}. The HTTP status is X's status when X answered 4xx or 5xx, otherwise 200. Parse response a second time to get X's JSON.
Simple format (?format=simple or X-Response-Format: simple): {data: Community}: the community you created. When X reports an error inside the wrapper (for example a tweet that is already liked), the usual wrapper is returned unchanged. Schema.
{
"status_code": 200,
"response": "{\"data\":{\"community_create\":{\"result\":{\"__typename\":\"Community\",\"actions\":{\"id\":\"Q29tbXVuaXR5QWN0aW9uczoxNzYyNDk0Mjc2NTY1NDI2NTky\",\"join_action_result\":{\"__typename\":\"CommunityJoinAction\"},\"list_members_action_result\":{\"__typename\":\"CommunityListMembersAction\"}},\"created_at\":1709046355754,\"creator_results\":{\"id\":\"VXNlclJlc3VsdHM6MTAwMDAwMDAwMDAwMDAwMDAwMQ==\",\"result\":{\"__typename\":\"User\",\"id\":\"VXNlcjoxMDAwMDAwMDAwMDAwMDAwMDAx\",\"is_blue_verified\":true,\"legacy\":{\"screen_name\":\"example_user_1\",\"verified\":false}}},\"custom_banner_media\":{\"id\":\"QXBpTWVkaWE6DAATCgABG9hLw10WsAAAAA==\",\"media_info\":{\"__typename\":\"ApiImage\",\"color_info\":{\"palette\":[{\"percentage\":71.75,\"rgb\":{\"blue\":74,\"green\":45,\"red\":21}},{\"percentage\":14.72,\"rgb\":{\"blue\":119,\"green\":61,\"red\":28}},{\"percentage\":8.78,\"rgb\":{\"blue\":19,\"green\":8,\"red\":4}},{\"percentage\":3.89,\"rgb\":{\"blue\":190,\"green\":141,\"red\":75}},{\"percentage\":0.17,\"rgb\":{\"blue\":189,\"green\":120,\"red\":56}}]},\"original_img_height\":720,\"original_img_url\":\"https://pbs.twimg.com/community_banner_img/2006436936446029824/n1OK-QV1?format=jpg&name=orig\",\"original_img_width\":1800}},\"default_banner_media\":{\"id\":\"QXBpTWVkaWE6DAABCgABFECTH+kUUAQKAAITiFWq8lUQBAAA\",\"media_info\":{\"__typename\":\"ApiImage\",\"color_info\":{\"palette\":[{\"percentage\":57.34,\"rgb\":{\"blue\":178,\"green\":171,\"red\":3}},{\"percentage\":23.51,\"rgb\":{\"blue\":129,\"green\":117,\"red\":247}},{\"percentage\":6.99,\"rgb\":{\"blue\":159,\"green\":149,\"red\":224}},{\"percentage\":4.78,\"rgb\":{\"blue\":194,\"green\":188,\"red\":159}},{\"percentage\":1.32,\"rgb\":{\"blue\":103,\"green\":90,\"red\":246}}]},\"original_img_height\":480,\"original_img_url\":\"https://pbs.twimg.com/media/FECTH-kUUAQMe8W.jpg\",\"original_img_width\":1200}},\"description\":\"Discuss the state of AI from industry insiders and anons 🕵️♂️\",\"id\":\"Q29tbXVuaXR5OjE3NjI0OTQyNzY1NjU0MjY1OTI=\",\"invites_result\":{\"__typename\":\"CommunityInvitesUnavailable\"},\"is_member\":false,\"is_nsfw\":false,\"join_policy\":\"Open\",\"join_requests_result\":{\"__typename\":\"CommunityJoinRequestsUnavailable\"},\"member_count\":30718,\"members_facepile_results\":[{\"id\":\"VXNlclJlc3VsdHM6MTAwMDAwMDAwMDAwMDAwMDAwMQ==\",\"result\":{\"__typename\":\"User\",\"id\":\"VXNlcjoxMDAwMDAwMDAwMDAwMDAwMDAx\",\"legacy\":{\"profile_image_url_https\":\"https://pbs.twimg.com/profile_images/1000000000000000000/example_normal.jpg\"}}},{\"id\":\"VXNlclJlc3VsdHM6MTAwMDAwMDAwMDAwMDAwMDAwMg==\",\"result\":{\"__typename\":\"User\",\"id\":\"VXNlcjoxMDAwMDAwMDAwMDAwMDAwMDAy\",\"legacy\":{\"profile_image_url_https\":\"https://pbs.twimg.com/profile_images/1000000000000000000/example_normal.jpg\"}}},{\"id\":\"VXNlclJlc3VsdHM6MTAwMDAwMDAwMDAwMDAwMDAwMw==\",\"result\":{\"__typename\":\"User\",\"id\":\"VXNlcjoxMDAwMDAwMDAwMDAwMDAwMDAz\",\"legacy\":{\"profile_image_url_https\":\"https://pbs.twimg.com/profile_images/1000000000000000000/example_normal.jpg\"}}},{\"id\":\"VXNlclJlc3VsdHM6MTAwMDAwMDAwMDAwMDAwMDAwNA==\",\"result\":{\"__typename\":\"User\",\"id\":\"VXNlcjoxMDAwMDAwMDAwMDAwMDAwMDA0\",\"legacy\":{\"profile_image_url_https\":\"https://pbs.twimg.com/profile_images/1000000000000000000/example_normal.jpg\"}}},{\"id\":\"VXNlclJlc3VsdHM6MTAwMDAwMDAwMDAwMDAwMDAwNQ==\",\"result\":{\"__typename\":\"User\",\"id\":\"VXNlcjoxMDAwMDAwMDAwMDAwMDAwMDA1\",\"legacy\":{\"profile_image_url_https\":\"https://pbs.twimg.com/profile_images/1000000000000000000/example_normal.jpg\"}}}],\"name\":\"AI — Rumors & Insights\",\"primary_community_topic\":{\"topic_name\":\"Artificial Intelligence\"},\"rest_id\":\"1762494276565426592\",\"role\":\"NonMember\",\"rules\":[{\"description\":\"Post useful, relevant, informative AI insights\",\"id\":\"Q29tbXVuaXR5UnVsZToxOTg1NzY2MzU5MzUyMTY0Nzg2\",\"name\":\"Make relevant and useful posts 🙂\",\"rest_id\":\"1985766359352164786\"},{\"description\":\"Post high quality, original content\",\"id\":\"Q29tbXVuaXR5UnVsZToxOTg0NDQxNzQzNTIyMDc5MDYx\",\"name\":\"Make sure content is High Quality 📈\",\"rest_id\":\"1984441743522079061\"},{\"description\":\"Do not self-quote. Quote posts must add useful info.\",\"id\":\"Q29tbXVuaXR5UnVsZToxOTg0NDQyNDI0NDM4MDEwMDY2\",\"name\":\"Quote Posts must add useful info ⚠️\",\"rest_id\":\"1984442424438010066\"},{\"description\":\"No spam, promo / ads, off-topic, hashtags\",\"id\":\"Q29tbXVuaXR5UnVsZToyMDMyMzg0MzkxNTgyODE0NTM0\",\"name\":\"Do not post Spam 🗑️\",\"rest_id\":\"2032384391582814534\"},{\"description\":\"Don't post about same thing if others posts first.\",\"id\":\"Q29tbXVuaXR5UnVsZToxOTI3ODEzMzE0NjgxMTU5ODY4\",\"name\":\"Check earlier posts 💬\",\"rest_id\":\"1927813314681159868\"},{\"description\":\"Provide source directly in the main post!\",\"id\":\"Q29tbXVuaXR5UnVsZToxOTI1MDkyMDA2Nzc2MTgwOTg3\",\"name\":\"Source the insights 🔎\",\"rest_id\":\"1925092006776180987\"},{\"description\":\"Do not vague post and verify your information before you post!\",\"id\":\"Q29tbXVuaXR5UnVsZToxOTU0NTAyMzk5MzE5NTYwMzQ0\",\"name\":\"Verify your information 🕵♂\",\"rest_id\":\"1954502399319560344\"},{\"description\":\"Do not share working methods to access info on unreleased products / services in the scope of AI.\",\"id\":\"Q29tbXVuaXR5UnVsZToyMDQ1NTg2NDkyODMyMDMwODY1\",\"name\":\"Don't share access methods 🤫\",\"rest_id\":\"2045586492832030865\"}],\"trending_hashtags_slice\":{\"__typename\":\"CommunityHashtagSlice\",\"items\":[]}}}}}"
}{
"data": {
"id": "1762494276565426592",
"name": "AI — Rumors & Insights",
"description": "Discuss the state of AI from industry insiders and anons 🕵️♂️",
"createdAt": "2024-02-27T15:05:55Z",
"memberCount": 30718,
"moderatorCount": 0,
"joinPolicy": "Open",
"nsfw": false,
"topic": "Artificial Intelligence",
"bannerUrl": "https://pbs.twimg.com/community_banner_img/2006436936446029824/n1OK-QV1?format=jpg&name=orig",
"creator": null,
"rules": [
{
"id": "1985766359352164786",
"name": "Make relevant and useful posts 🙂",
"description": "Post useful, relevant, informative AI insights"
},
{
"id": "1984441743522079061",
"name": "Make sure content is High Quality 📈",
"description": "Post high quality, original content"
},
{
"id": "1984442424438010066",
"name": "Quote Posts must add useful info ⚠️",
"description": "Do not self-quote. Quote posts must add useful info."
},
{
"id": "2032384391582814534",
"name": "Do not post Spam 🗑️",
"description": "No spam, promo / ads, off-topic, hashtags"
},
{
"id": "1927813314681159868",
"name": "Check earlier posts 💬",
"description": "Don't post about same thing if others posts first."
},
{
"id": "1925092006776180987",
"name": "Source the insights 🔎",
"description": "Provide source directly in the main post!"
},
{
"id": "1954502399319560344",
"name": "Verify your information 🕵♂",
"description": "Do not vague post and verify your information before you post!"
},
{
"id": "2045586492832030865",
"name": "Don't share access methods 🤫",
"description": "Do not share working methods to access info on unreleased products / services in the scope of AI."
}
]
}
}In the raw format, field names and nesting come from X and can change without notice. See Response format; the simple format keeps a fixed schema.
Errors
- 400The body is not valid JSON.
- 422cookie, proxy or name is missing.
- 500The session could not be prepared (for example the cookie has no ct0, or the proxy is unreachable). Refunded.
- X'sAny status X answers with: passed through with X's body.
Errors every endpoint can return (401, 402, 403, 404, 408, 409, 429, 5xx), and which of them are charged, are on the Errors page. Calls that fail with 400, 408, 409 or a 5xx error are refunded.