Ayrshare for Claude Code
The unified social media API for AI agents. Publish, schedule, and analyze across 14+ networks directly from Claude Code, with post history for brand voice and validation against each platform's rules before every post. Powered by the Ayrshare API.
Install
claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin
claude plugin install ayrshare@ayrshare
Requires Claude Code 2.1.119 or later. Then, inside Claude Code, run /plugin configure ayrshare@ayrshare and enter your API key, then run /reload-plugins (or restart Claude Code) so the tools load. Claude Code stores the key in your system's secure credential store. If you added Ayrshare from Claude's plugin directory on claude.ai instead, Claude Code knows it as ayrshare@synced, so run /plugin configure ayrshare@synced. Plugins from claude.ai appear in Claude Code 2.1.273 or later; on an older version, update Claude Code or install from this repository's marketplace as above. If your Claude Code doesn't open the settings from either command, run /plugin, open the Installed tab, select ayrshare, then Configure options. In the VS Code extension, type /plugins and click the gear icon on the ayrshare row. /ayrshare:setup walks you through it. Scopes and other install paths are under Installation below.
Then use the plugin by asking in plain English (e.g. "show my recent Instagram posts", "post this to LinkedIn tomorrow at 9am"); the tools fire on intent, and the trigger-skills route them. /ayrshare:setup is the only slash command, so there is no /ayrshare:post or /ayrshare:get_post_history to type.
Overview
The plugin lets an agent run the full social workflow without leaving Claude Code. Before publishing, the agent validates each post against the target network's rules and asks you to confirm, so avoidable rejections are caught before anything goes live. A single request publishes to Facebook, Instagram, LinkedIn, X, TikTok, YouTube, Pinterest, Reddit, Telegram, Threads, Bluesky, and others. Post history is available for matching a brand's voice, and analytics can be read back to inform the next post. Platform integrations are maintained by Ayrshare, so upstream API changes are handled outside your code. The API currently handles 30M+ calls per day.
The loop
- Learn. Retrieve a profile's post history for brand-voice context and review how past posts performed.
- Act. Publish and schedule across 13+ networks in a single call.
- Observe. Read live analytics to inform the next post.
- Stay safe. Validate each post against platform rules, then confirm before publishing.
Why use the API instead of a custom integration?
An LLM can generate an OAuth flow, but it does not cover Meta Tech Provider approval, X's pay-per-use API changes, or ongoing maintenance when a network changes its rules. The plugin handles:
- Pre-publish validation.
validate_post dry-runs content against each network's rules (length, format, media requirements) before you publish, and validate_media checks that a media URL is reachable before you attach it in mediaUrls. X BYOK is supported for the 2026 mandate, and platform integrations are maintained so an upstream API change does not break your integration.
- One call, 13+ networks. A single request publishes to all connected platforms, each validated against its own rules.
- Multi-tenant. Post on behalf of many user profiles rather than a single brand.
- History API. Retrieve a profile's past posts for brand-voice context, and use historical performance data to inform future posts.
Safety
By default the plugin validates a post and requests confirmation before publishing. The agent prepares the draft; the user approves it.
A PreToolUse hook (hooks/hooks.json) also makes Claude Code ask you before it runs any tool with a live side effect. If you decline, the tool does not run and no request reaches Ayrshare. The hook covers these tools:
| Tool | Why it asks |
|---|
create_post, update_post, retry_post | Publishes, schedules, or changes a post on real social accounts. |
add_comment, reply_comment | Posts a comment in public. |
send_message | Sends a direct message. |
set_auto_response | Turns the DM auto-responder on or off, or changes its reply. |
create_profile | Creates a client profile, which uses profile quota and cannot be deleted through MCP. |
update_ad | Pauses, resumes, deletes, or archives a boosted ad, which changes real ad spend. The same status is also set on the ad's ad set and campaign, so other ads there change too. |
boost_post | Boosts a published post as a paid ad, which spends real money from the ad account. |
register_webhook, unregister_webhook | Changes where Ayrshare sends your account's events, including message and comment content. |