{
  "openapi": "3.0.3",
  "info": {
    "title": "Twitter API - Community Endpoints",
    "version": "1.0.0",
    "description": "Consolidated API documentation for Twitter community-related endpoints."
  },
  "servers": [
    {
      "url": "https://api.aisa.one/apis/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "CommunityInfo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "question": {
            "type": "string",
            "nullable": true
          },
          "member_count": {
            "type": "integer"
          },
          "moderator_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "nullable": true
          },
          "join_policy": {
            "type": "string",
            "nullable": true
          },
          "invites_policy": {
            "type": "string",
            "nullable": true
          },
          "is_nsfw": {
            "type": "boolean"
          },
          "is_pinned": {
            "type": "boolean"
          },
          "role": {
            "type": "string",
            "nullable": true
          },
          "primary_topic": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "nullable": true
              },
              "name": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "banner_url": {
            "type": "string",
            "nullable": true
          },
          "search_tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rules": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                }
              }
            }
          },
          "creator": {
            "$ref": "#/components/schemas/User"
          },
          "admin": {
            "$ref": "#/components/schemas/User"
          },
          "members_preview": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "userName": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "isBlueVerified": {
            "type": "boolean"
          },
          "verifiedType": {
            "type": "string"
          },
          "profilePicture": {
            "type": "string"
          },
          "coverPicture": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "followers": {
            "type": "integer"
          },
          "following": {
            "type": "integer"
          },
          "canDm": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string"
          },
          "favouritesCount": {
            "type": "integer"
          },
          "hasCustomTimelines": {
            "type": "boolean"
          },
          "isTranslator": {
            "type": "boolean"
          },
          "mediaCount": {
            "type": "integer"
          },
          "statusesCount": {
            "type": "integer"
          },
          "withheldInCountries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "possiblySensitive": {
            "type": "boolean"
          },
          "pinnedTweetIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "isAutomated": {
            "type": "boolean"
          },
          "automatedBy": {
            "type": "string"
          },
          "unavailable": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "unavailableReason": {
            "type": "string"
          },
          "profile_bio": {
            "type": "object",
            "properties": {
              "description": {
                "type": "string"
              },
              "entities": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "object",
                    "properties": {
                      "urls": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "display_url": {
                              "type": "string"
                            },
                            "expanded_url": {
                              "type": "string"
                            },
                            "indices": {
                              "type": "array",
                              "items": {
                                "type": "integer"
                              }
                            },
                            "url": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  },
                  "url": {
                    "type": "object",
                    "properties": {
                      "urls": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "display_url": {
                              "type": "string"
                            },
                            "expanded_url": {
                              "type": "string"
                            },
                            "indices": {
                              "type": "array",
                              "items": {
                                "type": "integer"
                              }
                            },
                            "url": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Tweet": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "retweetCount": {
            "type": "integer"
          },
          "replyCount": {
            "type": "integer"
          },
          "likeCount": {
            "type": "integer"
          },
          "quoteCount": {
            "type": "integer"
          },
          "viewCount": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string"
          },
          "lang": {
            "type": "string"
          },
          "bookmarkCount": {
            "type": "integer"
          },
          "isReply": {
            "type": "boolean"
          },
          "inReplyToId": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "displayTextRange": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "inReplyToUserId": {
            "type": "string"
          },
          "inReplyToUsername": {
            "type": "string"
          },
          "author": {
            "$ref": "#/components/schemas/User"
          },
          "entities": {
            "type": "object",
            "properties": {
              "hashtags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "indices": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              },
              "urls": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "display_url": {
                      "type": "string"
                    },
                    "expanded_url": {
                      "type": "string"
                    },
                    "indices": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "url": {
                      "type": "string"
                    }
                  }
                }
              },
              "user_mentions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id_str": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "screen_name": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "quoted_tweet": {
            "type": "string"
          },
          "retweeted_tweet": {
            "type": "string"
          },
          "isLimitedReply": {
            "type": "boolean"
          }
        }
      },
      "CommunityInfoResponse": {
        "type": "object",
        "properties": {
          "community_info": {
            "$ref": "#/components/schemas/CommunityInfo"
          },
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error"
            ]
          },
          "msg": {
            "type": "string"
          }
        }
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/twitter/community/info": {
      "get": {
        "x-aisa-pricing": {
          "model": "dynamic",
          "currency": "USD",
          "basis": "provider_cost x 1",
          "nominal_usd": 0.0022,
          "observed_usd": {
            "min": 0.0002,
            "p50": 0.0002,
            "p95": 0.0022,
            "max": 0.0022
          },
          "cost_drivers": [
            {
              "param": "result count",
              "effect": "charge scales with number of tweets/users returned"
            }
          ],
          "cost_tier": "variable",
          "note": "nominal_usd is a static reference, NOT a guaranteed minimum; actual charge = provider_cost x multiplier and can be higher or lower"
        },
        "tags": [
          "https://docs.twitterapi.io/api-reference/endpoint/get_community_by_id"
        ],
        "summary": "Get Community Info By Id",
        "operationId": "get_twitter_community_info",
        "description": "Get metadata for an X Community by its numeric community ID — name, description, member count, and access rules. Use this to qualify a community before pulling its members or posts. Returns the object under `community_info`. To discover communities by topic, search their posts with `get_twitter_community_tweets_all`.",
        "parameters": [
          {
            "name": "community_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID of the community"
          }
        ],
        "responses": {
          "200": {
            "description": "Community info response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommunityInfoResponse"
                }
              }
            }
          }
        }
      }
    },
    "/twitter/community/members": {
      "get": {
        "x-aisa-pricing": {
          "model": "dynamic",
          "currency": "USD",
          "basis": "provider_cost x 2",
          "nominal_usd": 0.0022,
          "observed_usd": {
            "min": 0.0022,
            "max": 0.0072
          },
          "cost_drivers": [
            {
              "param": "result count",
              "effect": "charge scales with number of tweets/users returned"
            }
          ],
          "cost_tier": "variable",
          "note": "nominal_usd is a static reference, NOT a guaranteed minimum; actual charge = provider_cost x multiplier and can be higher or lower"
        },
        "tags": [
          "https://docs.twitterapi.io/api-reference/endpoint/get_community_members"
        ],
        "summary": "Get Community Members",
        "operationId": "get_twitter_community_members",
        "description": "List the members of an X Community, cursor-paginated. Use this to map who participates in a topic-specific group — usually a higher-signal audience than general followers, because membership is opt-in. Returns full user objects. For the subset who moderate it, use `get_twitter_community_moderators`.",
        "parameters": [
          {
            "name": "community_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID of the community"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Cursor for pagination"
          }
        ],
        "responses": {
          "200": {
            "description": "Community members response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/User"
                      }
                    },
                    "has_next_page": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": "string"
                    },
                    "has_next": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "error"
                      ]
                    },
                    "msg": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/twitter/community/moderators": {
      "get": {
        "x-aisa-pricing": {
          "model": "dynamic",
          "currency": "USD",
          "basis": "provider_cost x 2",
          "nominal_usd": 0.0022,
          "observed_usd": {
            "min": 0.0072,
            "max": 0.0072
          },
          "cost_drivers": [
            {
              "param": "result count",
              "effect": "charge scales with number of tweets/users returned"
            }
          ],
          "cost_tier": "variable",
          "note": "nominal_usd is a static reference, NOT a guaranteed minimum; actual charge = provider_cost x multiplier and can be higher or lower"
        },
        "tags": [
          "https://docs.twitterapi.io/api-reference/endpoint/get_community_moderators"
        ],
        "summary": "Get Community Moderators",
        "operationId": "get_twitter_community_moderators",
        "description": "List the moderators of an X Community, cursor-paginated. Use this to identify the people who set the agenda in a community — the highest-leverage contacts for outreach or partnership. Returns full user objects. For the full membership use `get_twitter_community_members`.",
        "parameters": [
          {
            "name": "community_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID of the community"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Cursor for pagination"
          }
        ],
        "responses": {
          "200": {
            "description": "Community moderators response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/User"
                      }
                    },
                    "has_next_page": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": "string"
                    },
                    "has_next": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "error"
                      ]
                    },
                    "msg": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/twitter/community/tweets": {
      "get": {
        "x-aisa-pricing": {
          "model": "dynamic",
          "currency": "USD",
          "basis": "provider_cost x 2",
          "nominal_usd": 0.0022,
          "observed_usd": {
            "min": 0.0022,
            "max": 0.006
          },
          "cost_drivers": [
            {
              "param": "result count",
              "effect": "charge scales with number of tweets/users returned"
            }
          ],
          "cost_tier": "variable",
          "note": "nominal_usd is a static reference, NOT a guaranteed minimum; actual charge = provider_cost x multiplier and can be higher or lower"
        },
        "tags": [
          "https://docs.twitterapi.io/api-reference/endpoint/get_community_tweets"
        ],
        "summary": "Get Community Tweets",
        "operationId": "get_twitter_community_tweets",
        "description": "Get posts published inside one specific X Community, cursor-paginated. Use this to read what a known community is actually discussing. Returns full tweet objects with engagement counts. If you do not know which community to look at, search across all of them with `get_twitter_community_tweets_all`.",
        "parameters": [
          {
            "name": "community_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "ID of the community"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Cursor for pagination"
          }
        ],
        "responses": {
          "200": {
            "description": "Community tweets response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tweets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Tweet"
                      }
                    },
                    "has_next_page": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": "string"
                    },
                    "has_next": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "error"
                      ]
                    },
                    "msg": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/twitter/community/get_tweets_from_all_community": {
      "get": {
        "x-aisa-pricing": {
          "model": "dynamic",
          "currency": "USD",
          "basis": "provider_cost x 2",
          "nominal_usd": 0.0022,
          "observed_usd": {
            "min": 0.0022,
            "max": 0.006
          },
          "cost_drivers": [
            {
              "param": "result count",
              "effect": "charge scales with number of tweets/users returned"
            }
          ],
          "cost_tier": "variable",
          "note": "nominal_usd is a static reference, NOT a guaranteed minimum; actual charge = provider_cost x multiplier and can be higher or lower"
        },
        "tags": [
          "https://docs.twitterapi.io/api-reference/endpoint/get_all_community_tweets"
        ],
        "summary": "Search Tweets From All Communities",
        "operationId": "get_twitter_community_tweets_all",
        "description": "Search posts across all X Communities by keyword, sorted by Latest (default) or Top, cursor-paginated. Use this to find topic-specific discussion happening inside communities rather than on the public timeline — signal density is usually higher and noise lower. Returns full tweet objects. Once you identify a community worth following, use `get_twitter_community_tweets` to read it directly, or `get_twitter_community_info` for its metadata. For public-timeline search use `get_twitter_tweet_advanced_search`.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search query (e.g., keyword)"
          },
          {
            "name": "queryType",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "Latest",
                "Top"
              ],
              "default": "Latest"
            },
            "description": "Query type (Latest or Top)"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Cursor for pagination"
          }
        ],
        "responses": {
          "200": {
            "description": "Tweets response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tweets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Tweet"
                      }
                    },
                    "has_next_page": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
