跳转至

模块与任务

本页由 docs/llms-metadata.json 的 workflows 段自动生成, 发布门禁会校验其中每个 RPC 真实存在且可调用。 逐 RPC 的字段契约见接口参考。

模块划分

模块 门面 RPC 数 覆盖
AccountSecurityApi account.security 16 begin_biometric_liveness, begin_palm_verification, create_face_liveness_session, delete_self_custody_backup, face_liveness_results, fetch_self_custody_backup, finish_biometric_liveness, finish_palm_verification, generate_cash_deposit_barcode, passkeys, public_keys, self_custody_backup_status, selfie_age_verification_status, start_identity_verification, start_selfie_age_verification, upload_self_custody_backup
AdsApi account.ads 4 audience_estimates, budgets, create_campaign, default_location
AndroidApi x.android.AndroidClient 1 login
BookmarkApi account.bookmark 10 add, add_to_collection, collection, collections, create_collection, delete_collection, list, remove, search, update_collection
CommunitiesApi account.communities 13 detail_timeline, explore_timeline, get, hashtag_search, join, joined, leave, media_timeline, popular_by_topic, ranked_timeline, search, timeline, user_topics
DmApi account.dm 48 accept_message_request_mutation, add_welcome_message_to_conversation_mutation, add_x_chat_public_key_mutation, av_permissions, clear_grok_conversations, connect_page, connect_tab_timeline, conversation_key_change_events, conversation_page, conversation_timeline, delete_x_chat_public_key_mutation, dm_block_mutation, dm_unblock_mutation, finalize_x_chat_media_upload_mutation, generate_x_chat_token_mutation, grok_delete_conversation_mutation, grok_delete_message_mutation, grok_rename_conversation_mutation, grok_search_page, group_invite_details, group_join_requests, inbox_page_conversation_data, inbox_page_request, initial_xchat_page, initialize_group_conversation_mutation, initialize_x_chat_media_upload_mutation, mark_message_requests_seen_mutation, message_events_by_sequence_id, message_events_page, message_read_timestamps, message_requests_page, report_franked_message_mutation, send_message_create_mutation, send_message_event_mutation, settings, update_x_chat_user_realm_state_mutation, x_chat_accept_enrollment_mutation, x_chat_complete_enrollment_mutation, x_chat_create_enrollment_session_mutation, x_chat_deny_enrollment_mutation, x_chat_get_enrollment_session_mutation, x_chat_initiate_passcode_retrieval_mutation, x_chat_send_enrollment_encrypted_keys_mutation, x_chat_send_enrollment_public_key_mutation, x_chat_send_grok_message_plaintext_mutation, typeahead, users_by_ids, users_by_screen_name
FinanceApi account.finance 4 asset_data, chart_candles_batch, chart_data, chart_lines_batch
GrokApi account.grok 5 compose_prompt_revisions, history, home, set_memory, set_preferences
JobsApi account.jobs 1 company_jobs
ListApi account.lists 23 all_subscribed, create, delete, get_by_id, add_member, create_recommended_users, delete_banner, edit_recommended_users, management, members, membership, mute, ownerships, product_subscriptions, put_banner, remove_member, subscribe, subscribers, unmute, unsubscribe, by_user, suggested, update
MediaApi account.media 10 card_preview_from_url, embed_preview, gif_category, gif_search, grok_media_history, jetfuel_composer, set_metadata, set_video_downloads, upload, upload_video
ModerationApi account.moderation 7 birdwatch_home, create_feedback_report, moderate_tweet, moderated_tweets, report_spam, send_urt_feedback, unmoderate_tweet
MoneyApi account.money 81 activate_issued_cards_with_challenge, add_payment_method, cancel_payment_request_transfer, cancel_payment_transaction_by_id, cancel_payment_transfer, claim_payment_transfer, claim_payment_transfer_link, confirm_unrecognized_payment, create_check_deposit, create_check_upload_session, create_deposit_payment_transaction, create_direct_deposit_switching_session, create_internal_transfer_payment_transaction, create_issued_check, create_outgoing_international_wire, create_outgoing_wire, create_payment_auth_token, create_payment_bank_card_linking_session, create_payment_financial_institution_linking_session, create_payment_financial_institution_update_session, create_payment_method_session, create_transfer_link_transaction, create_transfer_payment_transaction, create_withdrawal_payment_transaction, creator_subs_manage_info_query, creator_subs_product_query, delete_payment_method, finish_payment_two_factor_auth_challenge, get_card_preview, get_claims, get_payment_bank_card_linking_session, get_payment_customer_actions, get_payment_customer_pending_consents, get_payment_eligibility, get_payment_home_data, get_payment_invitation_details, get_payment_nearest_places, get_payment_recent_participants, get_payment_transaction_result_by_id, get_payment_transaction_status_update_by_id, get_payment_transactions, get_payment_transfer_link_details, get_payment_user, get_payment_wire_bank_details, home_timeline_subscriptions, in_app_purchase_intent_create, in_app_purchase_redeem_offer, lock_issued_card, mark_direct_deposit_switching_session_completed, payment_get_grok_transaction_search_by_id, payment_initiate_grok_transaction_search, payment_offboard, payment_reonboard, payments_active_card_payment_authentications, payments_link_payout_account, payments_respond_to_card_payment_authentication, payments_send_phone_verification_code, payments_verify_phone, prefill_payment_customer_info, premium_hub_query, premium_obfuscated_id_query, premium_product_catalog_query, quick_promote_billing_confirm_card_mutation, quick_promote_billing_delete_payment_method_mutation, quick_promote_billing_payment_methods_query, quick_promote_billing_setup_intent_mutation, quick_promote_billing_switch_default_card_mutation, quick_promote_iap_products_query, quick_promote_iap_redeem_mutation, request_transfer_payment_transaction, respond_to_payment_request_transfer, search_payment_typeahead, start_payment_two_factor_auth_challenge, subscription_journey_config, subscription_paywall_data_query, unlock_issued_card, update_audience_rewards_entity, update_bank_card_linking_session_submission_status, update_card_pin, update_payment_method_linkage, user_in_app_purchase_redeem_v2
NotificationApi account.notification 2 email_settings, update_email_settings
PostsApi account.posts 53 add_content_disclosure, auto_translate_language_enabled, conversation_control_delete, conversation_control_put, conversation_control_settings, create_draft, create_note_post, create_poll_card, create, create_repost_v2, delete_content_disclosure, delete_draft, delete, delete_v2, delete_repost_v2, dislike, drafts, edit_draft, edit_history, editable, exclusive_follow, exclusive_unfollow, favorite_v2, follow_retweets, get_by_id, is_highlighted, like, parody_label_settings, pin, pin_timeline, pinnable_timelines, pinned_timelines, highlights_add, highlights_delete, quote, reply, reply_device_follow, reply_device_unfollow, reposters, retweet, translate, undo_dislike, unfavorite_v2, unfollow_retweets, unlike, unmention, unpin, unpin_timeline, unretweet, unsynced_drafts, update_auto_translate_language, update_parody_label, update_pinned_timelines
SearchApi account.search 9 finance_tags, hashtag_typeahead, jobs, location_typeahead, mention_typeahead, quick_promote_location, place_name, typeahead, users_typeahead
SettingsApi account.settings 7 reset_passcode, subscriber_consent, two_factor_auth_settings, update_business_location_preference, update_customer_consents, update_dm_settings, update_inferred_location_preference
SocialApi account.social 15 accept_follow_request, add_super_follower_privacy, block, cancel_follow_request, deny_follow_request, device_follow, device_unfollow, follow, live_follow, live_unfollow, mute, remove_super_follower_privacy, unblock, unfollow, unmute
SpacesApi account.spaces 10 add_sharing, authenticate_periscope, broadcast, browse_topics, by_id, delete_sharing, search, sharings, subscribe_scheduled, unsubscribe_scheduled
TelemetryApi account.telemetry 2 log_actions, save_client_events
TimelineApi account.timeline 29 device_follow_posts, favouriters, friends_following, home, home_latest, immersive_explore, immersive_profile, incoming_friendships, notification_detail, notifications, search_timeline, set_notification_last_seen_cursor, timeline_by_id, user_affiliates, user_articles, user_favorites, user_highlights, user_media, user_new_replies, user_photos, user_promoted, user_replies, user_reposts, user_super_followers, user_tweets, user_videos, user_with_profile_tweets_v2, viewer_blocking, viewer_muting
TopicApi account.topic 3 ai_trend, explore, page
UsersApi account.users 24 about_profile, about_profile_by_screen_name, ads_stats, get_user, me, profile_analytics, connection_page, connection_page_by_screen_name, profile_modules, quick_promote_ad_accounts, set_for_you_recommendations, set_hide_verification_info, set_xai_data_sharing, set_xai_personalization, by_rest_id, by_screen_name, preferences, username_availability, avatars_by_ids, by_ids, verification_info, viewer_user, write_installed_apps, write_status
WebAccountApi account.account 5 settings, update_settings, update_profile, update_profile_banner, update_profile_image
WebBookmarkApi account.bookmark 1 add
WebChainApi account.chain 5 account_update_account_settings_from_profile, account_update_profile_banner_from_profile, account_update_profile_from_profile, account_update_profile_image_from_profile, social_follow_from_profile
WebMediaApi account.media 1 upload
WebPostsApi account.posts 1 like
WebSocialApi account.social 1 follow
WebTimelineApi account.timeline 1 user_tweets_and_replies
WebUsersApi account.users 4 followers, following, by_rest_id, by_screen_name

任务编排

首次接入一个账号 first_login

目标:用账号密码(可选 2FA)完成 Android 冷启动登录,产出可长期复用的完整状态。

前置条件: - 已启动 Go server 并可连通 - 持有自有测试/业务账号的用户名、密码,账号开启 2FA 时还需当前验证码

步 调用 目的 输入与来源 响应与下一步
1 x.android.AndroidClient.login
AndroidApi/Login
执行跨端点登录状态机并即时验证会话归属。 username / password 来自调用方;totp 为当前 2FA 码,账号无 2FA 时省略;version 与 proxy 可选。每次调用只执行一次登录,重试由调用方编排。 返回完整 AndroidAccountState。★必须持久化★——其中含设备身份,后续调用复用。

步骤间参数传递:

  • LoginResponse.state → 调用方持久化存储:状态含明文 token 与 secret,必须加密存储;后续每个 RPC 都从这里取。

注意

同一账号不要并发登录,也不要在每次操作前重新登录——保存的状态可长期复用。 成功判据不是 HTTP 2xx,而是会话中的 user_id/screen_name 与登录账号一致且服务端已 whoami 复核。

发布纯文字推文 post_text

目标:用已保存的状态发一条文字推文,并在需要时删除。

前置条件: - 已持有登录产出的完整 AccountState

步 调用 目的 输入与来源 响应与下一步
1 account.posts.create
PostsApi/CreatePost
发布文字推文。 state 来自持久化存储;text 为正文;media_ids 留空。 响应 tweet.tweet_id 非空即成功;同时保存刷新后的 state。
2 account.posts.delete
PostsApi/DeletePost
按 id 删除刚发布的推文(可选)。 tweet_id 使用上一步响应的 tweet.tweet_id。 无异常即删除成功;该操作幂等。

步骤间参数传递:

  • CreatePostResponse.tweet.tweet_id → DeletePostRequest.tweet_id:删帖必须用发帖响应返回的 id。

注意

CreatePost 非幂等:超时后先查证是否已发出再决定重试,盲目重试会产生重复推文。

发布带图推文 post_with_media

目标:先上传媒体拿到 media_id,再用它发布带图推文。

前置条件: - 已持有完整 AccountState - 准备好图片字节与其 MIME 类型

步 调用 目的 输入与来源 响应与下一步
1 account.media.upload
MediaApi/UploadMedia
分段上传媒体(INIT→APPEND→FINALIZE 在单个 RPC 内完成)。 data 为图片二进制;mime_type 如 image/jpeg。 响应 media_id 非空即成功。media_id 有有效期,应尽快使用。
2 account.posts.create
PostsApi/CreatePost
发布引用该媒体的推文。 media_ids 传上一步的 media_id;text 为正文。 响应 tweet.tweet_id 非空即成功。

步骤间参数传递:

  • UploadMediaResponse.media_id → CreatePostRequest.media_ids:上传返回值原样放入 media_ids 列表;跨账号不可复用。

注意

两步都非幂等,且 media_id 有有效期——上传后应立即发帖,不要缓存待用。

互动(点赞 / 转发及其撤销) engage

目标:对目标推文点赞、转发,或撤销这些操作。

前置条件: - 已持有完整 AccountState - 已知目标推文 id

步 调用 目的 输入与来源 响应与下一步
1 account.posts.like
PostsApi/Like 🔷
点赞目标推文(撤销用 Unlike)。 tweet_id 为目标推文 id。 无异常即成功;幂等,重复点赞不叠加。
2 account.posts.retweet
PostsApi/Retweet 🔷
转发目标推文。 tweet_id 为目标推文 id。 无异常即成功;幂等。
3 account.posts.unretweet
PostsApi/Unretweet 🔷
撤销转发。 ★tweet_id 必须是原始推文 id,不是转发产生的那条推文的 id★。 无异常即成功;传错 id 会静默失败。

步骤间参数传递:

  • 原始推文 id → UnretweetRequest.tweet_id:撤销转发用的是被转发的原推文 id,这一点最容易传错。

注意

四个互动操作都幂等,但都会在目标推文上留下对方可见的痕迹。

读取资料与时间线 read_profile_and_timeline

目标:读取自身或指定用户的资料,以及主页/用户推文时间线。

前置条件: - 已持有完整 AccountState

步 调用 目的 输入与来源 响应与下一步
1 account.users.me
UsersApi/Me
读取当前登录账号自身资料,同时可用于确认会话有效。 只需 state。 user 非空且 rest_id 与当前会话一致。
2 account.users.by_rest_id
UsersApi/UserByRestID 🔷
按数字 id 读取指定用户资料。 ★rest_id 是数字用户 id,不是 @screen_name★。可先由 Me 或其它读取接口获得。 user 非空。
3 account.timeline.home
TimelineApi/HomeTimeline 🔷
读取主页时间线。 只需 state。 raw_json 为可解析的非空 JSON,由调用方自行解析。

步骤间参数传递:

  • UserResponse.user.rest_id → UserByRestIDRequest.rest_id / UserTweetsRequest.rest_id:数字 id 在读取类接口之间传递,不要用 screen_name 代替。

注意

时间线与资料模块以 raw_json 原样返回,结构随上游变动——请做容错解析,不要硬编码路径。

🔷 标记的 RPC 已实现但未经真机验收,状态口径见接口验证状态。