## Pages Ayrshare website pages, in Markdown: - [Ayrshare Social Media API](https://www.ayrshare.com/index.md): The Ayrshare API lets you post, schedule, analyze, and manage engagement across 13+ social networks through a single integration. Includes publishing, history, analytics, moderation, and MCP servers for AI agents. - [About Ayrshare](https://www.ayrshare.com/about.md): Ayrshare is a remote software company building the compliant, unified social media API other products rely on. - [Ayrshare for AI Agents](https://www.ayrshare.com/ai-agent.md): Give your AI agents the full social loop. Ayrshare lets an agent learn a brand's voice, validate every post against each platform's rules, and publish across 13+ networks in one call — over MCP or the REST API. - [The Share](https://www.ayrshare.com/blog.md): Read Ayrshare API guides, platform updates, and product notes. - [Business Plan for Multiple Users](https://www.ayrshare.com/business-plan-for-multiple-users.md): Easy-to-integrate social media APIs let you manage all of your users' social accounts right from your product. Post, auto schedule, and analytics. Great for SaaS, CMS, DAM, agencies, and apps. - [Meet our customers](https://www.ayrshare.com/case-study.md): See how AI products, SaaS platforms, agencies, and real-estate teams ship social publishing on Ayrshare. - [Ayrshare Comparisons](https://www.ayrshare.com/compare.md): See how Ayrshare compares with social media APIs and dashboards. - [Ayrshare vs Zernio](https://www.ayrshare.com/compare/ayrshare-vs-zernio.md): Ayrshare vs Zernio, side by side. Compare networks, History and Validation APIs, pricing models, reliability, and developer experience for embedding social posting into your product. - [Ayrshare vs Buffer](https://www.ayrshare.com/compare/buffer-api-alternative.md): Ayrshare is a more advanced and affordable Buffer API alternative to post to your users' social media accounts. - [Ayrshare vs Bundle.social](https://www.ayrshare.com/compare/bundle-social-api-alternative.md): Ayrshare is a more advanced and affordable Bundle.social API alternative to post to your users' social media accounts. - [Cloud Campaign API Alternative](https://www.ayrshare.com/compare/cloud-campaign-api-alternative.md): Looking for a Cloud Campaign API alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — more advanced and more affordable. - [Ayrshare vs Data365](https://www.ayrshare.com/compare/data365-api-alternative.md): Ayrshare is a more advanced and affordable Data365 API alternative to post to your users' social media accounts. - [Ayrshare vs Hootsuite](https://www.ayrshare.com/compare/hootsuite-api-alternative.md): Ayrshare is a more advanced and affordable Hootsuite API alternative to post to your users' social media accounts. - [Later Social Media API Alternative](https://www.ayrshare.com/compare/later-api-alternative.md): Looking for a Later social media API alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — more advanced and more affordable. - [Loomly API Alternative](https://www.ayrshare.com/compare/loomly-api-alternative.md): Looking for a Loomly API alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — the most advanced and affordable option. - [Ayrshare vs Mallary](https://www.ayrshare.com/compare/mallary-api-alternative.md): Ayrshare is a more advanced and affordable Mallary API alternative to post to your users' social media accounts. - [Metricool API Alternative](https://www.ayrshare.com/compare/metricool-api-alternative.md): Looking for a Metricool API alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — more advanced and more affordable. - [Ayrshare vs OneAll](https://www.ayrshare.com/compare/oneall-alternative.md): Ayrshare is a more advanced and affordable OneAll API alternative to post to your users' social media accounts. - [Ayrshare vs Outstand](https://www.ayrshare.com/compare/outstand-api-alternative.md): Ayrshare is a more advanced and affordable Outstand API alternative to post to your users' social media accounts. - [Ayrshare vs Phyllo](https://www.ayrshare.com/compare/phyllo-api-alternative.md): Ayrshare is a more advanced and affordable Phyllo API alternative to post to your users' social media accounts. - [Ayrshare vs Publer](https://www.ayrshare.com/compare/publer-api-alternative.md): Ayrshare is a more advanced and affordable Publer API alternative to post to your users' social media accounts. - [Sendible API Alternative](https://www.ayrshare.com/compare/sendible-api-alternative.md): Looking for a Sendible API and white label alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — more advanced and more affordable. - [SocialOomph API Alternative](https://www.ayrshare.com/compare/socialoomph-api-alternative.md): Looking for a SocialOomph API alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — more advanced and more affordable. - [SocialPilot API Alternative](https://www.ayrshare.com/compare/socialpilot-api-alternative.md): Looking for a SocialPilot API and bulk upload alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — more advanced and more affordable. - [Ayrshare vs Sprout Social](https://www.ayrshare.com/compare/sprout-social-api-alternative.md): Ayrshare is a more advanced and affordable Sprout Social API alternative to post to your users' social media accounts. - [Ayrshare vs Twilio](https://www.ayrshare.com/compare/twilio-api-alternative.md): Ayrshare is a more advanced and affordable Twilio API alternative to post to your users' social media accounts. - [Ayrshare vs Upload-Post](https://www.ayrshare.com/compare/upload-post-api-alternative.md): Ayrshare is a more advanced and affordable Upload-Post API alternative to post to your users' social media accounts. - [Zoho Social API Alternative](https://www.ayrshare.com/compare/zoho-alternative.md): Looking for a Zoho Social API alternative? Ayrshare's social media API lets you publish, schedule, and manage posts across every major network — more advanced and more affordable. - [Contact Ayrshare](https://www.ayrshare.com/contact.md): Talk to Ayrshare about social media API architecture, volume pricing, compliance, and BYOK onboarding. - [The Social Media API for Creator Data](https://www.ayrshare.com/creator-data-api.md): Access powerful influencer marketing and creator capabilities with Ayrshare's Creator Data API. Easily gather essential social media account data. - [Data Processing Agreement](https://www.ayrshare.com/data-processing-agreement.md): Ayrshare's GDPR-compliant Data Processing Agreement, including sub-processors, security, and international data transfer terms. - [Submit a Feature Request](https://www.ayrshare.com/feature-request.md): Have an idea to improve the Ayrshare social media API? Submit a feature request or integration idea to help us build a better developer experience. - [The Social Media History API](https://www.ayrshare.com/history-api.md): Retrieve past posts and engagement data across 13+ social networks with one API call, including posts published outside Ayrshare. Train AI on real brand voice, no cold start. - [Instagram Banned Hashtag Checker](https://www.ayrshare.com/instagram-banned-hashtag-checker.md): Free Instagram banned hashtag checker. Paste your hashtags to instantly see which ones are banned or restricted before they get your account shadowbanned. Updated for 2026. - [Bubble Integration](https://www.ayrshare.com/integration/bubble.md): Add social media publishing, analytics, and account management to your Bubble app with the Ayrshare Bubble plugin and API Connector. - [Hurl Integration](https://www.ayrshare.com/integration/hurl.md): Test every Ayrshare endpoint from your terminal with the Ayrshare Hurl scripts for images, video, analytics, and more. - [Notion Integration](https://www.ayrshare.com/integration/notion.md): Post to your social accounts from a Notion no-code database, pick platforms and media, and schedule directly inside your workflow. - [Oracle Integration](https://www.ayrshare.com/integration/oracle.md): Post to all your social accounts from Oracle Content Management and extend OCM with Ayrshare analytics and historical data. - [PyPI Integration](https://www.ayrshare.com/integration/pypi.md): Use the Social-Post-API PyPI package to call Ayrshare from Python on the server-side across Premium, Business, and Enterprise plans. - [Social Media Auto Poster WordPress Plugin](https://www.ayrshare.com/integration/wordpress.md): Automatically publish your WordPress posts to all of your social media accounts with the official Ayrshare WordPress plugin. - [Ayrshare Integrations](https://www.ayrshare.com/integrations.md): Connect Ayrshare with the platforms your team already uses. Schedule posts, pull analytics, add comments, and more through no-code tools, SDKs, and direct social network APIs. - [Oracle Content Management Social Media Posting Guide](https://www.ayrshare.com/oracle-content-management-social-media-posting-guide.md): Step-by-step setup for publishing to social media from Oracle Content Management (OCM) with Ayrshare: link your accounts, configure the asset type, add the webhook, and publish across every network. - [Ayrshare Pricing](https://www.ayrshare.com/pricing.md): Embed the Ayrshare Social Media API into your product and pay for active social profiles, not users, seats, or internal team members. As your customers connect social accounts, your usage grows with them. When a customer churns, your costs go back down. - [Privacy Policy](https://www.ayrshare.com/privacy.md): Read Ayrshare's privacy policy and data handling practices. - [Automatically Post Your Newsletter to Your Social Media](https://www.ayrshare.com/rss-feed-substack-socialmedia.md): Automatically Post Your Substack Newsletter to Your Social Media - [Social Media Analytics API](https://www.ayrshare.com/social-media-analytics-api.md): Get real-time social media analytics through one API. Pull likes, shares, comments, impressions, video views, historical data, and link click analytics across 13+ networks. - [Social Media Analytics Metrics](https://www.ayrshare.com/social-media-analytics-metrics.md): Ayrshare's Analytics API returns 715 metrics across 12 networks: retention curves, reaction breakdowns, demographics, story taps. The full reference. - [Social Media Messaging API](https://www.ayrshare.com/social-media-messenger-apis.md): Get to market fast and scale effortlessly with the Ayrshare Messaging API for social media. Enable conversations that drive sales, engagement, and customer support across Facebook Messenger, Instagram, and X. - [API Solutions](https://www.ayrshare.com/solutions.md) - [Cross-Platform API Error 400: Duration & Metadata Validation Failed](https://www.ayrshare.com/solutions/cross-platform-api-error-400-duration-metadata-validation-failed.md): Posting one video to Instagram, YouTube, and TikTok at once triggers different duration and metadata errors on each. Ayrshare explains why, and the exact fix. - [Google API Error 403: Unverified App & How to Fix the Audit Pipeline](https://www.ayrshare.com/solutions/google-api-error-403-unverified-app-how-to-fix-the-audit-pipeline.md): Google API Error 403 on an unverified app? See why the OAuth audit and quota sandbox happen, and how Ayrshare's pre-verified access skips it entirely for you. - [Google Business API Error 403: Location Not Verified & How to Fix It](https://www.ayrshare.com/solutions/google-business-api-error-403-location-not-verified-how-to-fix-it.md): Google Business Profile posts failing with a 403 PERMISSION_DENIED? See why unverified locations get blocked and how Ayrshare handles the pre-flight check. - [Handling TikTok Rate Limits: Resolving the 429 Too Many Requests Error](https://www.ayrshare.com/solutions/handling-tiktok-rate-limits-resolving-the-429-too-many-requests-error.md): TikTok enforces a strict sliding-window rate limit that can lock out bursty traffic instantly. Ayrshare explains the mechanics and exactly how to avoid a 429. - [How to Bypass the YouTube 10k Unit Limit: Fixing the 403 Quota Exceeded Error](https://www.ayrshare.com/solutions/how-to-bypass-the-youtube-10k-unit-limit-fixing-the-403-quota-exceeded-error.md): YouTube's default 10,000 daily quota units allow only six video uploads before a 403 quotaExceeded error. Ayrshare explains why, and how to bypass it entirely. - [How to Fix Instagram API Error 100: "Media ID Not Found" and "Unknown Error"](https://www.ayrshare.com/solutions/how-to-fix-instagram-api-error-100-media-id-not-found-and-unknown-error.md): Instagram API Error 100 is almost always a race condition between container creation and publishing. See why it happens and how Ayrshare prevents it for good. - [How to Fix Meta Error 200: "Permissions Error" and Insufficient Scopes](https://www.ayrshare.com/solutions/how-to-fix-meta-error-200-permissions-error-and-insufficient-scopes.md): Meta Error 200 usually means Standard Access, a User Token instead of a Page Token, or a missing scope. Ayrshare explains the causes and how to fix each one. - [Instagram API Error 10: Application Permission Denied & How to Fix Direct Publishing](https://www.ayrshare.com/solutions/instagram-api-error-10-application-permission-denied-how-to-fix-direct-publishing.md): Instagram API Error 10 means the connected account is Personal, not Business or Creator. Ayrshare explains the account-type rule and exactly how to handle it. - [Instagram API Error 100: Carousel Validation Failed & How to Fix It](https://www.ayrshare.com/solutions/instagram-api-error-100-carousel-validation-failed-how-to-fix-it.md): Instagram carousel posts failing with Error 100 or invalid_children? See why nested container validation fails and how Ayrshare handles it automatically today. - [Instagram Graph API Error 9: The 25-Post Daily Limit & How to Fix It](https://www.ayrshare.com/solutions/instagram-graph-api-error-9-the-25-post-daily-limit-how-to-fix-it.md): Instagram's Graph API caps publishing at 25 posts per rolling 24-hour window. See why Error 9 triggers and how Ayrshare manages the limit automatically for you. - [LinkedIn 403: "Unpermitted Access" (URN Mismatches & Permissions)](https://www.ayrshare.com/solutions/linkedin-403-unpermitted-access-urn-mismatches-permissions.md): LinkedIn API 403 errors usually mean a person/organization URN mismatch or missing Marketing Developer Platform access. Ayrshare explains why, and the fix. - [LinkedIn API Error 401: Invalid Grant & How to Fix Token Expiration](https://www.ayrshare.com/solutions/linkedin-api-error-401-invalid-grant-how-to-fix-token-expiration.md): LinkedIn access tokens expire after 60 days, triggering invalid_grant errors. Ayrshare explains the refresh flow and how to avoid manual token rotation today. - [LinkedIn API v1 to v2 (Versioned) Migration: The Developer’s Survival Guide](https://www.ayrshare.com/solutions/linkedin-api-v1-to-v2-versioned-migration-the-developers-survival-guide.md): Migrating from LinkedIn's legacy API to the Versioned API (v2/rest)? Ayrshare covers the base URL, header, and payload changes, and how to avoid them entirely. - [LinkedIn & Meta API Error 400: Invalid Image Dimensions & How to Fix It](https://www.ayrshare.com/solutions/linkedin-meta-api-error-400-invalid-image-dimensions-how-to-fix-it.md): LinkedIn and Meta reject images that don't match a 1.91:1 aspect ratio. Ayrshare explains the Invalid Image Dimensions error and how auto-resizing fixes it. - [Meta Graph API Versioning Survival Kit: Staying Ahead of v21, v22, and Beyond](https://www.ayrshare.com/solutions/meta-graph-api-versioning-survival-kit-staying-ahead-of-v21-v22-and-beyond.md): Meta Graph API versions sunset on a 24-month clock, and Marketing API versions even faster. Ayrshare explains what breaks and how to stop tracking it yourself. - [Meta & LinkedIn API Error 401: Expired Token & How to Fix It](https://www.ayrshare.com/solutions/meta-linkedin-api-error-401-expired-token-how-to-fix-it.md): Meta and LinkedIn access tokens expire on a strict TTL, and manual refresh workers can hit race conditions. Ayrshare explains why, and how to avoid it entirely. - [Meta & Stripe API Error 401: Signature Mismatch & How to Fix Webhook Security](https://www.ayrshare.com/solutions/meta-stripe-api-error-401-signature-mismatch-how-to-fix-webhook-security.md): Getting a 401 or Signature Verification Failed on your Meta webhook? See why raw-body hashing fails and how Ayrshare's unified webhook signature simplifies it. - [Meta & X API Error 429: Polling Rate Limits & How to Fix Event Syncing](https://www.ayrshare.com/solutions/meta-x-api-error-429-polling-rate-limits-how-to-fix-event-syncing.md): Polling Meta or X for updates instead of using webhooks triggers 429 errors fast. Ayrshare explains the webhook alternative and how to secure it the right way. - [Moving from Twitter v1.1 to v2: Bridging the “JSON Gap”](https://www.ayrshare.com/solutions/moving-from-twitter-v1-1-to-v2-bridging-the-json-gap.md): Migrating from Twitter API v1.1 to X API v2 breaks JSON structure, auth, and media uploads. Ayrshare explains the changes and how to avoid them today for you. - [Pinterest API v5 Transition: The Complete Developer Guide](https://www.ayrshare.com/solutions/pinterest-api-v5-transition-the-complete-developer-guide.md): Everything you need to migrate from Pinterest API v4 to v5 — board access, refresh tokens, SDK setup, and how Ayrshare handles the complexity for you. Why You Need to Migrate to Pinterest API v5 If you are building or maintaining a social media scheduling tool, analytics dashboard, or any automation that touches Pinterest, you… - [Social Media API Error 400: Media Validation Failed & How to Fix Video Encoding](https://www.ayrshare.com/solutions/social-media-api-error-400-media-validation-failed-how-to-fix-video-encoding.md): Video uploads failing with a 400 Media Validation error? See the four codec, bitrate, and resolution rules platforms enforce, and how Ayrshare auto-fixes them. - [TikTok API 400: "Bad Request" (Encoding & Validation)](https://www.ayrshare.com/solutions/tiktok-api-400-bad-request-encoding-validation.md): TikTok API 400 errors are almost always video validation failures: bitrate, aspect ratio, duration, or codec. Ayrshare's autoResize fixes them automatically. - [TikTok API Error 10001: The Silent Shadowban & How to Fix It](https://www.ayrshare.com/solutions/tiktok-api-error-10001-the-silent-shadowban-how-to-fix-it.md): TikTok Error 10001 means bot detection has silently shadowbanned your app. Ayrshare explains exactly why it happens and how trusted infrastructure avoids it. - [TikTok & Meta API Error 400: Invalid Cover Asset & How to Fix Video Thumbnails](https://www.ayrshare.com/solutions/tiktok-meta-api-error-400-invalid-cover-asset-how-to-fix-video-thumbnails.md): TikTok, Meta, and YouTube each require a completely different video cover format. Ayrshare explains why, and how one thumbUrl works across all three platforms. - [Twitter/X Error 403: "Forbidden" (Tier Access & Scopes)](https://www.ayrshare.com/solutions/twitter-x-error-403-forbidden-tier-access-scopes.md): X API 403 errors usually trace back to your paid tier, read-only app permissions, or a v1.1/v2 endpoint mismatch. Ayrshare explains each cause and the fix. - [X & LinkedIn API Error 400: Invalid Media Metadata & How to Fix Alt-Text](https://www.ayrshare.com/solutions/x-linkedin-api-error-400-invalid-media-metadata-how-to-fix-alt-text.md): Adding image alt-text to X or LinkedIn posts triggers a 400 if the timing or JSON structure is off. Ayrshare explains the fix, or generates alt-text for you. - [X & LinkedIn API Error 400: Text Validation Failed & How to Fix Character Limits](https://www.ayrshare.com/solutions/x-linkedin-api-error-400-text-validation-failed-how-to-fix-character-limits.md): Standard string length checks fail on X and LinkedIn because of link wrapping and URN weighting. Ayrshare explains the real character math, and the exact fix. - [X (Twitter) API Error 403: Duplicate Post & How to Fix It](https://www.ayrshare.com/solutions/x-twitter-api-error-403-duplicate-post-how-to-fix-it.md): X blocks posts with matching content hashes for up to 12 hours. Ayrshare explains the anti-spam mechanics and exactly how to safely post repeat content again. - [X (Twitter) API Error 429: The Monthly Tweet Cap & How to Fix It](https://www.ayrshare.com/solutions/x-twitter-api-error-429-the-monthly-tweet-cap-how-to-fix-it.md): You’re monitoring your logs and everything looks perfectly normal. Your 15-minute rate limits are completely healthy, and your OAuth tokens are fresh. Then, out of nowhere, the X (formerly Twitter) API starts rejecting every single publish request with an aggressive HTTP 429 Too Many Requests response. You haven’t breached a speed limit. You’ve slammed into… - [Terms of Use](https://www.ayrshare.com/terms.md): Read the Ayrshare Terms of Use governing accounts, subscriptions, site access, and acceptable use. - [Ayrshare for AI Startups](https://www.ayrshare.com/use-cases/ai-startups.md): The AI-native social media API that gives your agents everything they need to operate on social platforms: learn a brand's voice, publish across 13+ networks, measure, and stay compliant. - [Ayrshare for Content Creator Platforms](https://www.ayrshare.com/use-cases/content-creator-platforms.md): The multi-tenant social media API behind creator platforms: let every creator publish, schedule, and analyze across 13+ networks, with isolated profiles proven at 25M+ daily API calls. - [Ayrshare for Digital Agencies](https://www.ayrshare.com/use-cases/digital-agencies.md): The white-label social media API agencies use to launch their own branded client tools. Publish, schedule, analyze, and manage engagement across 13+ networks for hundreds of client accounts through one API. - [Ayrshare for SaaS Platforms](https://www.ayrshare.com/use-cases/saas-platforms.md): The embedded social media API for vertical SaaS. Add publishing, scheduling, analytics, and engagement across 13+ networks for thousands of your customers' accounts, with multi-tenant architecture handled for you. - [Ayrshare for Video Content Platforms](https://www.ayrshare.com/use-cases/video-content-platforms.md): Your platform creates the video. Ayrshare publishes it, short- and long-form, to YouTube, TikTok, Reels, and more in a single call, then pulls analytics back. One API for the full publishing and feedback lifecycle across 12 of 13 networks. ## Case Studies Ayrshare customer case studies, in Markdown: - [How Curbfeed Onboards a Brokerage in About a Minute Without Building a Social Platform Layer](https://www.ayrshare.com/case-study/curbfeed-real-estate.md): See how Curbfeed, a real estate marketing platform, runs its entire automated office-level publishing pipeline on Ayrshare. - [How Quso.ai Scaled to 4M Users Without a Single Engineer on Social API Maintenance](https://www.ayrshare.com/case-study/vidyo-ai.md): Find out how Quso.ai (formerly Vidyo.ai), an AI video platform serving 4M+ users, has run its entire social publishing stack on Ayrshare since January 2022. ## Blog Every Ayrshare blog post, in Markdown: - [n8n Social Media Automation: Three Ways to Do It (and When You Need an AI Agent)](https://www.ayrshare.com/blog/n8n-social-media-automation.md): Three ways to run social media out of n8n: per-platform nodes, one REST call to a social media API, or an AI agent over MCP (and when each one fits) - [Ayrshare Is Now Native in Claude Code](https://www.ayrshare.com/blog/ayrshare-claude-code-plugin.md): An AI agent can now take a social post from draft to published across 13+ networks, with no per-platform integration code. - [Instagram Engagement Automations, Now in the Ayrshare API](https://www.ayrshare.com/blog/instagram-engagement-automations-ayrshare-api.md): The Ayrshare API now supports Instagram engagement automations: keyword-triggered DMs, webhooks, and emails that comply with Meta's policies. - [Is Your Social Media API Compliant with X’s Developer Policies?](https://www.ayrshare.com/blog/x-api-compliance-byo-app.md): X requires every third-party social media API to operate under a BYO model. Here's what that means and what compliant implementation looks like. - [Publish and Monetize X Video Content in One Workflow with Ayrshare](https://www.ayrshare.com/blog/monetize-x-video-with-ayrshare.md): Monetize your video content on X directly from your publishing workflow. With Ayrshare’s API, there’s no need to switch to Media Studio. - [Instagram Analytics Data in Ayrshare: A Product Manager’s Guide](https://www.ayrshare.com/blog/instagram-analytics-data-in-ayrshare-for-product-managers.md): Everything product managers need to know about Instagram analytics in Ayrshare: what each data type does and how to build better features. - [Coding with Multiple AI Agents to Build Scalable Rate-Limiting Infrastructure](https://www.ayrshare.com/blog/coding-with-multiple-ai-agents.md): How Ayrshare used ChatGPT, Claude Code, Gemini, and Ralph loops to refactor rate limits into a scalable, enterprise-ready policy engine. - [Threads API Integration: Authorization, Posting, & Analytics with Ayrshare](https://www.ayrshare.com/blog/threads-api-integration-authorization-posting-analytics-with-ayrshare.md): How to integrate Meta's Threads API into your platform. Easily manage your users' Threads accounts via Ayrshare's social API. - [Unlocking Real-Time Engagement with X Account Activity API via Ayrshare](https://www.ayrshare.com/blog/unlocking-real-time-engagement-with-x-account-activity-api-via-ayrshare.md): Unlock real-time engagement on X (formerly Twitter) using the Account Activity API, easily integrated via Ayrshare's powerful social media API. - [Implementing Multi-User Social Account Linking with Ayrshare](https://www.ayrshare.com/blog/implementing-multi-user-social-account-linking-with-ayrshare.md): Learn how to allow your users to link their social media accounts and manage these accounts using the social media API. - [Complete Guide to Handling API Rate Limits: Prevent 429 Errors](https://www.ayrshare.com/blog/complete-guide-to-handling-rate-limits-prevent-429-errors.md): Build robust client-side rate limiting for APIs with our 4-step JavaScript guide. Prevent 429 errors, implement retry logic, & more. - [Complete Guide to Snapchat API Integration: Authorization, Posting, & Analytics with Ayrshare](https://www.ayrshare.com/blog/complete-guide-to-snapchat-api-integration.md): The Snapchat API guide. How to integrate with Snapchat from authorizing, to publishing, to getting analytics. - [Make’s X (formerly Twitter) Integration Has Ended — Here’s a Better Alternative](https://www.ayrshare.com/blog/make-coms-x-integration-alternative.md): Make.com has deprecated its X (Twitter) integration. Use Ayrshare's social media API as an X automation alternative. - [Ayrshare Social Account Linking Page Customization Demo Video](https://www.ayrshare.com/blog/ayrshare-social-account-linking-page-customization-demo-video.md): Watch a demo video on how to customize the Ayrshare Social Account Linking page. Whitelabel the experience to perfectly match your platform's brand. - [Facebook Ads API: Boosting Facebook Posts with the Marketing API](https://www.ayrshare.com/blog/facebook-ads-api-boosting-with-the-marketing-api.md): Use the Facebook Ads API (Marketing API) to create boosted paid post directly from organic posts. Retrieve ad spend, clicks, and impressions. - [Instagram Demographics 2025: Key Audience Insights and Statistics](https://www.ayrshare.com/blog/instagram-demographics-2025-key-audience-insights-and-statistics.md): This guide provides a deep dive into the latest demographics on Instagram, including geographic, education, income, and gender distributions. - [How to Get Direct Download URLs from Dropbox](https://www.ayrshare.com/blog/how-to-get-direct-download-urls-from-dropbox.md): Learn how to transform Dropbox sharing links into direct download URLs for seamless integration with your applications and APIs. - [Top 10 Social Media APIs for Developers](https://www.ayrshare.com/blog/top-10-social-media-apis-for-developers.md): The top social media APIs developers integrate with Bluesky, Facebook, Instagram, X, LinkedIn, Pinterest, Reddit, TikTok, Telegram, YouTube. - [How to Get Direct Download URLs from Google Drive](https://www.ayrshare.com/blog/how-to-get-direct-download-urls-from-google-drive.md): Learn how to convert Google Drive sharing links into direct download URLs for programmatic access and API integrations. With code examples. - [HTTP Compression in Node.js: A Dive into Gzip, Deflate, and Brotli](https://www.ayrshare.com/blog/http-compression-in-node-js-a-dive-into-gzip-deflate-and-brotli.md): Reduce API payload size in Node.js using Gzip, Deflate, and Brotli compression. A guide with code examples and algorithm benchmarks. - [How to Retrieve Social Media Posts For All Your Users with an API](https://www.ayrshare.com/blog/how-to-retrieve-social-media-posts-for-all-your-users-with-an-api.md): How to Retrieve Social Media Posts For All Your Users with an API - [Complete Guide to Bluesky API Integration: Authorization, Posting, Analytics & Comments](https://www.ayrshare.com/blog/complete-guide-to-bluesky-api-integration-authorization-posting-analytics-comments.md): Learn how to integrate social media functionality with the Bluesky API in this comprehensive guide. Explore authentication, post publishing, analytics, comment management, and more to enhance your app or business. - [Get Social Media Post Analytics with Make & Ayrshare – A No-Code Quick Video Tutorial](https://www.ayrshare.com/blog/get-social-media-post-analytics-with-make-ayrshare-a-no-code-quick-tutorial.md): Watch this quick no-code tutorial to learn how to retrieve social media post analytics automatically using Make (Integromat) and Ayrshare. - [Testing Your Social Posting Integration With Random Content](https://www.ayrshare.com/blog/testing-your-social-posting-integration-with-random-content.md): Learn how to test your social media posting API integration using random text and image content to ensure a seamless setup before going live. - [Never Miss a Comment Again: How to Use Ayrshare’s Comments API Endpoint](https://www.ayrshare.com/blog/never-miss-a-comment-again-how-to-use-ayrshares-comments-api-endpoint.md): Learn how to use Ayrshare's API Comment Endpoint to publish, reply, delete, hide comments on TikTok, Facebook, Instagram, LinkedIn, YouTube. - [Create an API Proxy Server for No-Code](https://www.ayrshare.com/blog/create-an-api-proxy-server-for-no-code.md): Create a serverless API proxy sever for your no-code application that allows you to transform the API data response. - [10 Recent Enhancements to the Ayrshare Dashboard](https://www.ayrshare.com/blog/10-recent-enhancements-to-the-ayrshare-dashboard.md): Recent enhancements to Ayrshare Social Media API Dashboard. - [Ayrshare Reviews](https://www.ayrshare.com/blog/ayrshare-reviews.md): What you should look for when evaluating reviews for a potential SaaS partner, including Ayrshare Reviews. - [Top 7 Social Sign-On APIs For 2024](https://www.ayrshare.com/blog/top-7-social-login-apis.md): Reduce the friction of login, increase security with the top social sign-on APIs: Facebook, Google, X, and GitHub. - [Ayrshare Launches Messaging API for Facebook, Instagram, and X Direct Messages](https://www.ayrshare.com/blog/ayrshare-launches-messaging-api-for-facebook-instagram-and-x-direct-messages.md): Ayrshare's social media API now included the Messaging API for Facebook Messenger, Instagram Message, and X DMs. - [Best Practices for API Design](https://www.ayrshare.com/blog/best-practices-for-api-design.md): Learn how to create a superior API design. The best strategies for creating scalable, secure, and developer-friendly APIs. - [Build a Social Media Posting App with No Code](https://www.ayrshare.com/blog/build-a-social-media-posting-app-with-no-code.md): Watch our step-by-step tutorial on how to build your own social media posting web app using no-code platforms and the Ayrshare API. - [How to Query for Non-Existent Fields in Firestore](https://www.ayrshare.com/blog/how-to-query-for-non-existent-fields-in-firestore.md): How do you query Firebase's Firestore database for non-existent field? While there is no direct way, so work-arounds exist. - [5 Tips for Great Developer API Docs](https://www.ayrshare.com/blog/5-tips-for-great-developer-api-docs.md): The 5 top tips on how to write great developer API docs. With this guide you'll learn how to get developers excited about your API. - [Ayrshare Messaging API for Facebook, Instagram, and X/Twitter](https://www.ayrshare.com/blog/ayrshare-messaging-api-for-facebook-instagram-and-x-twitter.md): Ayrshare Messaging API for real-time direct messaging on Facebook, Instagram, and X/Twitter. Easily end and received DMs. - [User Profile Tagging in Ayrshare](https://www.ayrshare.com/blog/user-profile-tagging-in-ayrshare.md): Learn how to enable user profile tagging in your social media posts using Ayrshare's API. Tag users across multiple social networks seamlessly. - [Understanding the Ayrshare Auto-Schedule API Endpoint](https://www.ayrshare.com/blog/understanding-the-ayrshare-auto-schedule-api-endpoint.md): Auto schedule your social media post via an API. Automate the scheduling of posts with set pre-defined posting times and days. - [Why Do I Have to Test Your Code? (The 5-Minute Sniff Test)](https://www.ayrshare.com/blog/why-do-i-have-to-test-your-code-the-5-minute-sniff-test.md): If you can’t spend 5 minutes testing your work, then don’t make me. Why an software engineer need to test before handing to QA. - [The Top 5 Chakra UI Tips and Tricks for React Developers](https://www.ayrshare.com/blog/the-top-5-chakra-ui-tips-and-tricks-for-react-developers.md): If you're using Chakra UI with React, here are our top 5 tips and trick getting the most of out Chakra UI. - [Get Public Social Media Analytics, A No Code Tutorial Video](https://www.ayrshare.com/blog/get-public-social-media-analytics-a-no-code-tutorial-video.md): Follow this no-code video tutorial to easily gather public social media analytics from multiple networks using the Ayrshare API. - [Facebook Removes Groups API Access: Impact and Implications](https://www.ayrshare.com/blog/facebook-removes-groups-api-access-impact-and-implications.md): Facebook has announced that it will remove access to its Groups API. We discuss the impact and implications. - [Instagram Collaborator API](https://www.ayrshare.com/blog/instagram-collaborator-api.md): Add collaborators to Instagram posts using an API. These posts will show in the collaborator's feed and be sent to their followers. - [Best Social Media Posting and Scheduling APIs of 2024](https://www.ayrshare.com/blog/best-social-media-posting-and-scheduling-apis.md): A list of the 6 best social media APIs from 3rd party scheduling tools for posting, analytics, and comments. - [Reviews API: Review Management with an API](https://www.ayrshare.com/blog/reviews-api-review-management-with-an-api.md): Reviews management with the Reviews API. Easily manage your Facebook Page and Google Business Profile review with an API. - [Instagram Banned Hashtags to Avoid (Updated 2026)](https://www.ayrshare.com/blog/avoid-using-these-instagram-banned-hashtags.md): The definitive list of Instagram banned hashtags to avoid so your account isn't locked or shadow banned. Originally published February 2024, updated for 2026. - [What is a Webhook? How They Work With Examples](https://www.ayrshare.com/blog/what-is-a-webhook-how-they-work-with-examples.md): What is a webhook and how do they work? Learn all about webhooks from registering a webhook URL to calling a webhook. - [TikTok API : How to Post and Get Analytics Using the TikTok API](https://www.ayrshare.com/blog/tiktok-api-how-to-post-and-get-analytics.md): How to use the TikTok API to publish posts and get analytics for your users. - [Ayrshare Quick Start Guide [video]](https://www.ayrshare.com/blog/ayrshare-quick-start-guide-video.md): We take you through the Ayrshare Quick Start Guide to explain how to get started with the Ayrshare social media API. - [How to Use Firebase Queues](https://www.ayrshare.com/blog/how-to-use-firebase-queues.md): What are Firebase Queues? And how do we use them? - [Streamlining Webhook Development: How a Webhook Proxy Tool Can Transform Your Workflow](https://www.ayrshare.com/blog/streamlining-webhook-development-how-a-webhook-proxy-tool-can-transform-your-workflow.md): How to use a webhook relay proxy to simplify local webhook development and testing. - [Instagram Stories API: How to Publish a Story](https://www.ayrshare.com/blog/instagram-stories-api-how-to-post-a-story.md): We are excited to announce Ayrshare as the only API-first platform to offer direct posting to Instagram Stories via an API. - [Automatically Import All Your Social Media Analytics | No Code Tutorial Video](https://www.ayrshare.com/blog/automatically-import-all-your-social-media-analytics-no-code-tutorial-video.md): Learn how to use no-code Parabola and Ayrshare to get Facebook and X/Twitter social media analytics into a Google Sheet. - [How to Publish Stories with the Facebook Stories API](https://www.ayrshare.com/blog/how-to-publish-stories-with-the-facebook-stories-api.md): Learn how to publish Facebook Stories, both video and photos, using the Meta Stories API. - [Connect Your Social Accounts and Post via the Ayrshare Dashboard [video]](https://www.ayrshare.com/blog/connect-your-social-accounts-and-post-via-the-ayrshare-dashboard-video.md): Learn how to connect your social media accounts, then create a video post which goes out to 5 social networks. - [Google Business Profile: What is GBP, Why You Need It, and How to Use It?](https://www.ayrshare.com/blog/google-my-business-what-is-gmb-why-you-need-it-and-how-to-use-it.md): Google Business Profile is a powerful SEO tool for businesses. Find out what GBP is, why you need it, and how to use it with an API. - [Automatically Generate Image Caption Text Using Google Cloud Vision API with JavaScript and Node.js](https://www.ayrshare.com/blog/automatically-generate-image-caption-text-using-google-cloud-vision-api-with-javascript-and-node-js.md): Learn how to use the Google Cloud Vision API to generate image captions automatically and alt text, with code examples in JavaScript. - [Navigating the Intricacies of Social Media API Integration: Top 5 Challenges and How to Overcome Them](https://www.ayrshare.com/blog/navigating-the-intricacies-of-social-media-api-integration-top-5-challenges-and-how-to-overcome-them.md): What are the top social media API challenges? Learn how to navigate these challenges and easily integrate with the social networks. - [Max Pack: Take Your Social Media Marketing to the Next Level](https://www.ayrshare.com/blog/max-pack-take-your-social-media-marketing-to-the-next-level.md): The Max Pack is a powerful add-on to the Ayrshare Social API with even more capabilities to automate and improve your media marketing. - [The Importance of Alt Text: Making Images Accessible and SEO-Friendly](https://www.ayrshare.com/blog/the-unseen-importance-of-alt-text-making-images-accessible-and-seo-friendly.md): Learn why adding alt text to your website's images is crucial for accessibility and SEO + how to automatically generate alt text with an API. - [Build a Social Media Posting App in No-Code Platform FlutterFlow](https://www.ayrshare.com/blog/build-a-social-media-posting-app-in-no-code-platform-flutterflow.md): Learn how to use no-code Flutterflow to build a social media posting app that publishes both text and images. - [Leveraging Ayrshare: Go Beyond Basic Social Media API Integration](https://www.ayrshare.com/blog/leveraging-ayrshare-go-beyond-basic-social-media-api-integration.md): Learn why Ayrshare's social media APIs are often the right choice over directly integrating social APIs such the TikTok API or Instagram API. - [Rewrite Your Text with AI and Post to Your Social Networks [Video]](https://www.ayrshare.com/blog/rewrite-your-text-with-ai-and-post-to-your-social-networks-video.md): Learn of to use Ayrshare and no-code Bubble.io to build a AI rewriting and social posting app. - [How to Schedule Twitter Threads with the Twitter API](https://www.ayrshare.com/blog/how-to-schedule-twitter-threads-with-the-twitter-api.md): How to schedule your Twitter threads using the Twitter API with JavaScript and Node.js. - [The Instagram API Just Went to 11](https://www.ayrshare.com/blog/the-instagram-api-just-went-to-11.md): Instagram just updated their API with Creator account publishing, increase posting limit, user tagging, audio naming, and cover images. - [Artificial Intelligence Anxiety Around the U.S.](https://www.ayrshare.com/blog/ai-anxiety-around-the-us.md): The use of AI has been a hot topic since ChatGPT's release in 2022. Find out what Americans have to say about their fears surrounding AI at work here. - [Transcribe Your Audio or Video File, Summarize it, and Post it to Social in 4 Easy API Calls [video]](https://www.ayrshare.com/blog/transcribe-your-audio-or-video-file-summarize-it-and-post-it-to-social-in-4-easy-api-calls-video.md): Transcribe Your Audio or Video File, Summarize it, and Post it to Social in 4 Easy API Calls - [Ayrshare Unleashes Game-Changing Integrations for TikTok Direct Video Publishing & Twitter Enterprise API](https://www.ayrshare.com/blog/ayrshare-unleashes-game-changing-integrations-for-tiktok-direct-video-publishing-twitter-enterprise-api.md): Ayrshare announced 65 new features across the 10 most popular social networks including special API access to direct TikTok posting. - [Build A Twitter Analytics App in Retool [video]](https://www.ayrshare.com/blog/build-a-twitter-analytics-app-in-retool-video.md): Build A Twitter Analytics App in Retool - [Introducing TikTok Direct Publishing, Analytics, and Commenting](https://www.ayrshare.com/blog/introducing-tiktok-direct-publishing-analytics-and-commenting.md): Ayrshare now has automatic TikTok publishing, advanced post analytics, and managing comments with the TikTok API. - [The Best Hashtag Generator and Research Tools](https://www.ayrshare.com/blog/the-7-best-hashtag-generator-and-research-tools.md): Hashtags help reach your target audience. These are the best tools to generate the relevant hashtags for your social media posts. - [Creating Social Media Posts with ChatGPT API](https://www.ayrshare.com/blog/creating-social-media-posts-with-chatgpt-api.md): How to use the ChatGPT API to post to social media networks such as Instagram and Facebook. Combine AI with automated social posting. - [Facebook API: How to Post and Get Analytics Using the Facebook API](https://www.ayrshare.com/blog/facebook-api-how-to-post-and-get-analytics-using-the-facebook-api.md): Learn how the Facebook API can enhance your business and how to post or get analytics from your platform or app on behalf of your users. - [Understanding the Difference Between the Instagram Business, Creator, and Personal Profiles](https://www.ayrshare.com/blog/understanding-the-difference-between-the-instagram-business-creator-and-personal-profiles.md): What is the difference between the Instagram Business, Creator, and Personal Profiles, when do you want to use each, and what are the considerations when using the Instagram API. - [Speed Up Firebase Cold Starts with Firestore REST Calls](https://www.ayrshare.com/blog/speed-up-firebase-cold-starts-with-firestore-rest-calls.md): Firestore now has the preferRest option to speed up Firebase cold start up times. Here is how to use the new feature. - [Schedule Social Media Posts from Notion](https://www.ayrshare.com/blog/schedule-social-media-posts-from-notion.md): Discover how to automatically schedule and publish your social media posts directly from a Notion database using Ayrshare's no-code integrations. - [Google Business Profile: Own The Search Results For Your Business](https://www.ayrshare.com/blog/google-business-profile-own-the-search-results-for-your-business.md): Understand what is a Google Business Profile and why it is important for your business, plus how to post using an API. - [The Free Video Metadata Inspector](https://www.ayrshare.com/blog/the-free-video-metadata-inspector.md): Inspect remote video files easily with our free video metadata inspector tool. Analyze dimensions, codecs, and formats for optimal social media posting. - [Post To Social Media From Your Website Form Using Make & Ayrshare [video]](https://www.ayrshare.com/blog/post-to-social-media-from-your-website-form-using-make-ayrshare-video.md): A no-code video tutorial which explains how you can post to your user's social media accounts using Make and Ayrshare's social API. - [Twitter Bans Link In Bio Pages & Social Media Link Aggregators [updated]](https://www.ayrshare.com/blog/twitter-bans-link-in-bio-pages-social-media-link-aggregators.md): Twitter new policy bans social media aggregators and posting link to other social sites such as Facebook and Instagram. - [How to Enhance Firebase Emulator Logs](https://www.ayrshare.com/blog/how-to-enhance-firebase-emulator-logs.md): Firebase emulator console logging is pretty basic. Enhance the output with color, formatting, and quiet (remove system output). - [LinkedIn API: How to Post and Get Analytics With the LinkedIn API](https://www.ayrshare.com/blog/how-to-post-and-get-analytics-with-the-linkedin-api.md): Discover how the LinkedIn API can help your clients’ businesses by letting you post and get analytics directly from your platform or app on behalf of your clients. - [What is a Link In Bio Page?](https://www.ayrshare.com/blog/what-is-a-link-in-bio-page.md): But what does "link in bio" mean and why has it become such a prevalent tool for social media users? - [HURL: Run and Test HTTP API Requests](https://www.ayrshare.com/blog/hurl-run-and-test-http-api-requests.md): Hurl: run and test API request via the command line. Here is how to use Hurl with real example calling a social media API. - [Twitter API: How to Post and Get Analytics With the Twitter API](https://www.ayrshare.com/blog/twitter-api-how-to-post-and-get-analytics-with-the-twitter-api.md): How to Post and Get Analytics With the Twitter API - [Build A Social Profile Analytics App with Bubble and Ayrshare [video]](https://www.ayrshare.com/blog/build-a-social-profile-analytics-app-with-bubble-and-ayrshare-video.md): A no-code tutorial that explains how to build your own social media profile analytics app with the Bubble web app builder and the Ayrshare social media API. - [What Happened to the Buffer API?](https://www.ayrshare.com/blog/what-happened-to-buffers-api.md): If you want to post to social networks, you need an API What happened to the Buffer API and what are the alternative APIs for social? - [Getting Started with Retool: Build A Social Media Posting App With No-Code [Video]](https://www.ayrshare.com/blog/build-a-social-media-posting-app-with-retool-video.md): In this video we will show how an agency or a marketing team can build their own social media management system using Retool a no-code tool. - [Auto Create Real Estate Social Media Images Via a Template API](https://www.ayrshare.com/blog/automatically-create-real-estate-social-media-images-via-an-api.md): With Ayrshare, you can automatically create great images and post the image to your social media accounts using a social media template API. - [Ayrshare Reinvents Social Media Integrations With New Social Media API Features [Press Release]](https://www.ayrshare.com/blog/ayrshare-reinvents-social-media-integrations-with-new-social-media-api-features-press-release.md): Ayrshare, the leading social media API provider, announced that it has released over 50 new major features, available immediately to the thousands of businesses globally who rely on Ayrshare to power their platform. - [Facebook Reels API: How to Post Facebook Reels Using a Social Media API](https://www.ayrshare.com/blog/facebook-reels-api-how-to-post-fb-reels-using-a-social-media-api.md): How to use the Facebook Reels API to post short form videos. Learn how a social media API can make Reels integration easy. - [Which social media platform is best for attracting B2B clients?](https://www.ayrshare.com/blog/which-social-media-platform-is-best-for-attracting-b2b-clients.md): Let’s help you find the best social media platform for business-to-business (B2B) by weighing the pros and cons of each social media network. - [Get All Your Users Posting To Their Social Accounts on Bubble.io [video]](https://www.ayrshare.com/blog/get-all-your-users-posting-to-their-social-accounts-on-bubble-io-video.md): If you are using the Social API Business Plan or Enterprise Plan, this video shows you how to set up Bubble.io to enable all your users to link their social accounts. - [Automatically Post To Social Media From Airtable](https://www.ayrshare.com/blog/automatically-post-to-social-media-from-airtable.md): A demo of how to use Airtable and two additional no-code tools to build your own social media posting application, Twitter and LinkedIn. - [10 Tips for Using Hashtags Effectively on Facebook, Twitter & Instagram](https://www.ayrshare.com/blog/10-tips-for-using-hashtags-effectively-on-facebook-twitter-instagram.md): Hashtags are an essential tool for social media marketers. Learn 10 tips for using hashtags effectively in this post! - [What is an API? A Comprehensive Beginner’s Guide And Mini Tutorial](https://www.ayrshare.com/blog/what-is-an-api-a-comprehensive-beginners-guide-and-mini-tutorial.md): What is an API and how do you make API calls? Learn the importance of an API and how to use Postman to make API requests. - [Instagram Reels API: How to Post Videos to Reels Using a Social Media API](https://www.ayrshare.com/blog/instagram-reels-api-how-to-post-videos-to-reels-using-a-social-media-api.md): How to post Reels to Instagram using an API. Instagram recently updated their API to allow posting reel videos to Reels. - [How to Sequentially Resolve an Array of Promises in JavaScript](https://www.ayrshare.com/blog/how-to-sequentially-resolve-an-array-of-promises-in-javascript.md): Sometimes you need to process an array of Promises in sequence. Here is how to do it in JavaScript with a for loop. - [Introducing Twitter Notes: Long Form Essays Up to 2,500 Words + Edits](https://www.ayrshare.com/blog/twitter-notes-long-form-essays.md): Twitter has released a new post type for long form writing. Twitter Notes long form written essays allow up to 2,500 words and editing. - [Announcing The Ayrshare WordPress Plugin](https://www.ayrshare.com/blog/announcing-the-ayrshare-wordpress-plugin.md): Announcing the Ayrshare Wordpress plugin for posting to all your social media accounts: Instagram, Facebook, Twitter, and more. - [5 Types of Social Media Content That Convert Traffic Into Customers](https://www.ayrshare.com/blog/5-types-of-social-media-content-that-convert-traffic-into-customers.md): How do you convert traffic into customers? Here are 5 Types of Social Media Content that will do the trick. - [Get Social Media Analytics with the Ayrshare API (Video)](https://www.ayrshare.com/blog/get-social-media-analytics-with-the-ayrshare-api-video.md): In this one minute video see how it easy it is to get the post analytics from all of the social networks: Instagram, TikTok, and Facebook. - [Social Media Demographics Comparison](https://www.ayrshare.com/blog/social-media-demographics-comparison.md): Social media demographics are important when you are putting your marketing strategy. Learn how to approach each social network. - [Best Times & Frequency to Post on Social Media Networks](https://www.ayrshare.com/blog/best-times-frequency-to-post-on-social-media-networks.md): These are the best times to publish on Instagram, Twitter, Facebook and LinkedIn! - [Proven Social Media Content Strategies With Examples from Brands](https://www.ayrshare.com/blog/proven-social-media-content-strategies-with-examples-from-brands.md): Different Approaches to Publishing Social Media Content With Examples from Brands - growing on Instagram, TikTok, and Twitter. - [Top 7 Tips and Tricks For X/Twitter API Posting](https://www.ayrshare.com/blog/top-7-tips-and-tricks-for-twitter-api-posting.md): Top 7 Tips and Tricks For X API Posting. If you are planning to use an API for your connectivity to the social network, then you have to do things a bit differently. - [Press Release: Ayrshare Announces 100 million API Calls as Demand for Social Media Integrations Surges](https://www.ayrshare.com/blog/press-release-ayrshare-announces-100-million-api-calls-as-demand-for-social-media-integrations-surges.md): Ayrshare Announces 100 million API Calls as Demand for Social Media Integrations Surges - [Changelog: What’s New with Facebook Graph API and Marketing API Version 13.0](https://www.ayrshare.com/blog/whats-new-with-facebook-graph-api-version-13-0-and-marketing-api-version-13-0.md): Facebook updated their Graph and Marketing APIs to v13.0, including the Instagram API and WhatsApp API. Here's what's new in the changelogs. - [Twitter Launches “Automated” Label for Bots](https://www.ayrshare.com/blog/twitter-launches-automated-label-for-bots.md): Twitter launches new automation rules requiring bots to add the Automated label. Here is how to enable it on your Twitter account. - [Social Media APIs for Beginners](https://www.ayrshare.com/blog/social-media-apis-for-beginners.md): A Beginner’s Guide to Understanding What are Social Media APIs and How to Use Them. - [How to Improve Content with Social Media APIs: 3 Tips from Marketing Pros](https://www.ayrshare.com/blog/how-to-improve-content-with-social-media-apis-3-tips-from-marketing-pros.md): How to use Social Media, Analytics, and Marketing APIs, to tap into your social audiences and improve your content. - [How to Automatically Post to Social Media from Your Blog or Newsletter’s RSS Feed](https://www.ayrshare.com/blog/how-to-automatically-post-to-social-media-from-rss-feed.md): How to automatically post your blog or newsletter to your social media accounts, Facebook, Instagram, Twitter, using the RSS Feed. - [YouTube API: How to Upload YouTube Shorts](https://www.ayrshare.com/blog/post-youtube-shorts-with-an-api.md): YouTube Shorts are the latest entry in the short-form video arena. See how to upload a YouTube Shorts video using the YouTube API. #Shorts - [TikTok API: How to Post TikTok Videos Using a Social Media API](https://www.ayrshare.com/blog/tiktok-api-how-to-post-to-tiktok-using-a-social-media-api.md): How to post videos to TikTok using an API. Either share your own videos or on behalf of your users from your platform. - [Instagram Hashtag Guide: The Best Way to Use Hashtags on Instagram](https://www.ayrshare.com/blog/instagram-hashtag-guide.md): Create an Instagram strategy to find the most popular and relevant hashtags so your posts get the most engagement. - [Instagram and Twitter Character Counter Tool](https://www.ayrshare.com/blog/instagram-and-twitter-character-counter-tool.md): Use a character counter tool so you never go over the Instagram caption limit or Twitter's character limits - [How To Share a Podcast on Instagram](https://www.ayrshare.com/blog/how-to-share-a-podcast-on-instagram.md): How do you share a podcast on Instagram? You can’t directly upload an audio file to Instagram stories, but you can create an Audiogram! - [The Definitive Bubble Review: A Flexible No Code App Builder Growing Over 50%](https://www.ayrshare.com/blog/the-definitive-bubble-review-a-flexible-no-code-app-builder-growing-over-50.md): The definitive Bubble.io review. No code app builders, web and mobile apps, are hot and Bubble IO is one of the most popular, growing at 50%. - [Pinterest API Integration on Ayrshare](https://www.ayrshare.com/blog/pinterest-api-integration-on-ayrshare.md): Our Pinterest API integration is available on Ayrshare. You can now share Pins to Pinterest's 454 million active monthly users. - [What is Social Media?](https://www.ayrshare.com/blog/what-is-social-media.md): Social Media has become ingrained in our society, so we look at how to answer what is social media and where did it come from? - [Why You Should Put a CDN Like Cloudflare in Front of Firebase](https://www.ayrshare.com/blog/why-you-should-put-a-cdn-like-cloudflare-in-front-of-firebase.md): There are three good reasons you should consider putting a CDN like Cloudflare in front of Firebase. - [How to Put a CDN in Front of Firebase Cloud Storage](https://www.ayrshare.com/blog/how-to-put-a-cdn-in-front-of-firebase-cloud-storage.md): A work-around to put Firebase Cloud Storage behind a CDN such as Cloudflare to speed up access to your content. - [Top 5 Tips To Optimize Your Instagram Posting in 2021](https://www.ayrshare.com/blog/top-5-tips-to-optimize-your-instagram-posting-in-2021.md): The top 5 tips to optimize your Instagram posts and stories to create the perfect Instagram post for maximum engagement and SEO. - [Ayrshare Launches YouTube, Instagram, Google My Business API Enhancements for Social Media](https://www.ayrshare.com/blog/ayrshare-launches-youtube-instagram-google-my-business-api-enhancements-for-social-media.md): Ayrshare Launches YouTube, Instagram, Google My Business API Enhancements for Social Media - [How Many Hashtags Should I Use On Social Media?](https://www.ayrshare.com/blog/how-many-hashtags-should-i-use-on-social-media.md): Hashtags and their use on social media platforms differ. Here are details on how many hashtags you should use on each. - [A Better White Label Social Media Management Platform](https://www.ayrshare.com/blog/a-better-white-label-social-media-management-platform.md): Using a pre-built white label solution will always end up in some frustration. And you may be saving 30% to 80% by using an API solution. - [What Is Spintax, And Why Is It Bad for SEO?](https://www.ayrshare.com/blog/what-is-spintax-and-why-is-it-bad.md): Spintax spins the syntax of social media posts to make them different. Though it sounds good, the concept doesn’t help your SEO strategy. - [A Firebase Cloud Functions Cold Start Solution](https://www.ayrshare.com/blog/a-firebase-cloud-functions-cold-start-solution.md): Firebase Cloud Functions cold start problem finally has a solution with minimum instances. Your functions will now run fast, but at a price. - [What’s New with Facebook Graph API and Marketing API Version 12.0](https://www.ayrshare.com/blog/whats-new-with-facebook-graph-api-and-marketing-api-version-12-0.md): On September 14th, 2021 Facebook released their latest Graph API version 12.0 and Marketing API version 12.0. Here is what is new. - [Ayrshare Alternatives: When to use (and not use) Ayrshare for Social Media Management](https://www.ayrshare.com/blog/why-you-shouldnt-use-ayrshare.md): When to use and not to use Ayrshare's social media API for managing your users' social media accounts. - [Emailing with Firebase: The Trigger Email Extension](https://www.ayrshare.com/blog/fireabase-email-extension-guide.md): How do you send emails from Firebase. The new Firebase extension Trigger Email makes it easy, and here's how. - [Twitter Launches Spaces API for Live Audio Conversations](https://www.ayrshare.com/blog/twitter-launches-spaces-api-for-live-audio-conversations.md): Twitter has launched their Spaces API for live audio conversations, allowing discovery and lookup integrations for 3rd party apps. - [Build A Social Media Posting Mobile App With No Code](https://www.ayrshare.com/blog/build-a-social-media-posting-mobile-app-with-no-code.md): In this tutorial, we show you how to make your own mobile social media scheduling app using the no-code platform AppGyver and the Ayrshare API. - [How To Create A Social Media Scheduling App With No Code](https://www.ayrshare.com/blog/how-to-create-a-social-media-scheduling-app-with-no-code.md): How to build a no-code web app to create and schedule a post for multiple social media destinations using Bubble.io and Ayrshare's API - [Top 3 Reasons Real Estate Social Media Video Posts Drive Business](https://www.ayrshare.com/blog/top-3-reasons-real-estate-social-media-video-posts-drive-business.md): Posting beautiful and professional videos to social media can help Real Estate agents to find new listings and engage buyers. - [Upptime: An open-source uptime monitor for website and API uptime status](https://www.ayrshare.com/blog/upptime-monitor-status-website-api.md): I'm on the hunt for a system to monitor and show our users the website and API's uptime status - important for any SaaS or API service. I found Upptime. - [Why did Hootsuite Raise Prices 1200%?](https://www.ayrshare.com/blog/why-did-hootsuite-raise-prices-1200.md): Hootsuite just increased their prices 1200% for a lot of their long time users. Why did they do this? - [What Is The Most Popular Social Media Platform in 2021?](https://www.ayrshare.com/blog/what-is-the-most-popular-social-media-platform-in-2021.md): A look at the most popular social media platforms in 2021 including Instagram, Facebook, TikTok, and WhatsApp. - [How We Got 1,000 Users by Engaging Developers](https://www.ayrshare.com/blog/how-we-got-1000-users-by-engaging-developers.md): How do you effectively market to your developer or technical audience? There are three ways to boost your lead generation efforts by 30%. - [Ayrshare Supports Direct Posting to Instagram](https://www.ayrshare.com/blog/ayrshare-supports-direct-posting-to-instagram.md): Direct social media posting to Instagram via Ayrshare's API. Now you can post images or videos directly to Instagram. - [The Future Of Twitter](https://www.ayrshare.com/blog/the-future-of-twitter.md): Twitter is innovating with new community features like Spaces and Ad formats like Carousel and Branded Likes. Learn what is next for Twitter. - [Ayrshare’s YouTube API to Upload Videos](https://www.ayrshare.com/blog/ayrshare-api-posting-videos-to-youtube.md): Want to upload and share a video to YouTube via an API? Ayrshare's YouTube API integration allows you to upload and post a video a thumbnail. - [How to Post Facebook Images as a Carousel](https://www.ayrshare.com/blog/post-a-series-of-facebook-images-as-a-carousel.md): Post a series of Facebook carousel images via Ayrshare's API with the new "carousel" feature. It is easy to setup and post beautiful images. - [Post to Multiple Social Media Accounts from Bubble](https://www.ayrshare.com/blog/post-to-multiple-social-media-accounts-from-bubble.md): How to connect and post to social media networks like Twitter, Instagram, or Facebook from no-code tool Bubble.io. - [Why Your Business Should Have a Telegram Strategy](https://www.ayrshare.com/blog/why-your-business-should-have-a-telegram-strategy.md): Telegram is a popular and global communications platform that helps you grow your brand and be a powerful content marketing channel. - [The Power of Javascript Promise.all()](https://www.ayrshare.com/blog/the-power-of-javascript-promise-all.md): Javascript's Promise.all() is a powerful function that allows you to resolve multiple Promises and return the results. - [Ayrshare Launches the API-First Social Media Management Platform](https://www.ayrshare.com/blog/ayrshare-launches-the-api-first-social-media-management-platform.md): Today we announced the global launch of the API-First Social Media Management Platform. As the first focused API-first solution in the market, we are excited with the great feedback and traction we have with our early users. - [What are Twitter Fleets and How to Use Them](https://www.ayrshare.com/blog/what-are-twitter-fleets-and-how-to-use-them.md): Twitter Fleets are here! They are new. They are exciting. They are innovative. They are...well, kind of a copy of other social networks. - [What’s New with Facebook Graph API 9.0?](https://www.ayrshare.com/blog/whats-new-with-facebook-graph-api-9-0.md): On November 10th, 2020 Facebook released version 9.0 of their Graph API. Here is what is new and important. - [What Is Driving Twitter’s User Growth?](https://www.ayrshare.com/blog/what-is-driving-twitters-user-growth.md): In the most recent quarter ended June 2020, Twitter reported worldwide mDAU of 186 million, which was a 12% increase from the prior quarter. In the last few quarters, the growth of mDAU has been accelerating. This indicates that the strategy Twitter has taken to improve user engagement on the platform has been working. - [Our Firebase Tech Stack](https://www.ayrshare.com/blog/our-firebase-tech-stack.md): How we used Firebase and Firestore to build Ayrshare: the API to automatically publish to your social media networks. - [Automate Your Social Media Strategy](https://www.ayrshare.com/blog/automate-your-social-media-strategy.md): One way to enhance your social media strategy and presence is by automating the creation and publication of your content. - [Automatically Publish Cryptocurrency Prices to Social Media Networks](https://www.ayrshare.com/blog/automatically-publish-cryptocurrency-prices-social-media-networks.md): Publish Cryptocurrency prices to social media networks via an API using Firebase, Coin Gecko, and Ayrshare # Connect to the MCP Server Source: https://www.ayrshare.com/docs/additional/mcp-action-connect Connect any MCP client to the Ayrshare MCP Server — transport, endpoint, and authentication. The Ayrshare [MCP Server](/docs/additional/mcp-action-server) lets an AI agent drive the Ayrshare API. This page covers how to connect to it and how authentication works. ## Endpoint and transport The production MCP Server is available at: `https://api.ayrshare.com/mcp` It uses **Streamable HTTP** transport and is **stateless** — there is no session to maintain between calls. ## Authentication Authentication is enforced by the same Ayrshare API chain that powers the REST API. ### Precedence: argument wins over header When a tool call includes a `profileKey` argument **and** the connection has a `Profile-Key` header, the **per-call `profileKey` argument wins**. The header is used only when no valid argument is provided. One exception: on `get_platform_history` and `get_social_network_analytics`, an X/Twitter `userId`/`userName` lookup must use the account API key only; supplying a `profileKey` argument or `Profile-Key` header there returns Error 400. The `initialize` and `tools/list` MCP methods are reachable **before** authentication — they return metadata only and execute nothing. **Every tool call is authenticated.** ### Authentication errors An unauthenticated or invalid key on a tool call returns an Ayrshare **error 403 / code 102** with message **"API Key not valid"**. Per the MCP spec, tool-execution errors are returned in-band: the tool result carries `isError: true` and this message, while the MCP transport itself responds **HTTP 200**. (The `403`/`102` are Ayrshare's application error, not the transport status.) ## Connect ### Option A: Claude Code plugin If you use Claude Code, install the Ayrshare plugin. It bundles the MCP Server configuration, a setup command, agents, skills, and a confirmation hook. See the [Claude Code Plugin](/docs/additional/mcp-claude-code-plugin) page for the full install steps. ### Option B: Any MCP client For any MCP client that supports Streamable HTTP, register the server directly. In Claude Code: ```bash theme={"system"} claude mcp add --transport http ayrshare https://api.ayrshare.com/mcp --header "Authorization: Bearer YOUR_API_KEY" ``` To target a sub-profile on every call, add the optional `Profile-Key` header: ```bash theme={"system"} claude mcp add --transport http ayrshare https://api.ayrshare.com/mcp \ --header "Authorization: Bearer YOUR_API_KEY" \ --header "Profile-Key: YOUR_PROFILE_KEY" ``` The MCP connection initializes at session start. **Restart your MCP client** after installing the server or changing your key so the new configuration takes effect. ## X/Twitter BYO credentials Since March 31, 2026, X/Twitter operations through Ayrshare require your own OAuth 1.0a credentials. When a tool call targets X/Twitter, forward these two headers on the connection alongside your `Authorization` (and optional `Profile-Key`) headers: | Header | Description | | ----------------------------- | ------------------------------------------------ | | `X-Twitter-OAuth1-Api-Key` | Your OAuth 1.0a API Key (Consumer Key) | | `X-Twitter-OAuth1-Api-Secret` | Your OAuth 1.0a API Key Secret (Consumer Secret) | These are the same headers used by the REST API — one OAuth 1.0a key pair per Ayrshare account, sent on every X-targeting request (the same pair applies to all sub-profiles). Ayrshare does not use OAuth 2.0 here. See the [API Overview](/docs/apis/overview#xtwitter-byo-credentials) and the [X BYO Key Setup Guide](/docs/dashboard/connect-social-accounts/x-twitter-byo-keys) for setup, policy, and troubleshooting. Without these headers, an X/Twitter tool call returns error `419` (`x_credentials_required`). ### Connect with the BYO headers To set up X/Twitter BYO credentials from the start, add the server with both OAuth 1.0a headers alongside your `Authorization` header (include `Profile-Key` too if you target a sub-profile on every call): ```bash theme={"system"} claude mcp add --transport http ayrshare https://api.ayrshare.com/mcp \ --header "Authorization: Bearer YOUR_API_KEY" \ --header "X-Twitter-OAuth1-Api-Key: YOUR_TWITTER_CONSUMER_KEY" \ --header "X-Twitter-OAuth1-Api-Secret: YOUR_TWITTER_CONSUMER_SECRET" ``` ### Add the BYO headers to an existing connection Connection headers are fixed when the server is added, so if you already connected without the BYO headers, remove the server and re-add it with the full set (re-include any headers you were already using, such as `Profile-Key`): ```bash theme={"system"} claude mcp remove ayrshare claude mcp add --transport http ayrshare https://api.ayrshare.com/mcp \ --header "Authorization: Bearer YOUR_API_KEY" \ --header "X-Twitter-OAuth1-Api-Key: YOUR_TWITTER_CONSUMER_KEY" \ --header "X-Twitter-OAuth1-Api-Secret: YOUR_TWITTER_CONSUMER_SECRET" ``` Restart your MCP client after changing headers so the new configuration takes effect. Using the Claude Code plugin instead of a raw connection? See [Claude Code Plugin → X/Twitter BYO credentials](/docs/additional/mcp-claude-code-plugin#xtwitter-byo-credentials). ## Next steps The 27 tools grouped by domain, with scope and purpose. Install the Ayrshare plugin for Claude Code. # MCP Server Source: https://www.ayrshare.com/docs/additional/mcp-action-server Let AI agents drive the Ayrshare API through the Model Context Protocol (MCP) Server. Looking for the read-only docs-search MCP? See [Documentation MCP](/docs/additional/mcp-server). **This page documents the Action MCP** that lets an AI agent drive the Ayrshare API. The Ayrshare **MCP Server** lets AI agents drive the Ayrshare API through [Model Context Protocol (MCP)](https://modelcontextprotocol.io) tools. Instead of writing REST calls by hand, an agent connects to the MCP Server and calls Ayrshare tools to publish posts, fetch history and analytics, manage comments and direct messages, create profiles, and more. ## How it works Each MCP tool call is dispatched in-process through the same Ayrshare API chain that powers the REST API: Because tools run through the real API chain, the MCP Server returns the same data and enforces the same rules as the REST API. There is no separate behavior to learn or maintain. ## Who it's for Working with profiles and sub-profiles requires a **Business plan** (or Enterprise). See the [Business Plan Overview](/docs/multiple-users/business-plan-overview). ## Endpoint and transport The production MCP Server is available at: `https://api.ayrshare.com/mcp` It uses **Streamable HTTP** transport and is **stateless** — there is no session to maintain between calls. See [Connect & Setup](/docs/additional/mcp-action-connect) for the full connection and authentication details. ## Relationship to the REST API and Documentation MCP ## Next steps Transport, endpoint, and authentication for any MCP client. The 27 tools grouped by domain, with scope and purpose. Install the Ayrshare plugin for Claude Code. Mint social-linking URLs for client sub-profiles. # MCP Tool Catalog Source: https://www.ayrshare.com/docs/additional/mcp-action-tools The 27 tools exposed by the Ayrshare MCP Server — posts, history, analytics, comments, direct messages, profiles, media, generation, webhooks, and errors — grouped by domain with scope and purpose. The Ayrshare [MCP Server](/docs/additional/mcp-action-server) exposes **27 tools**, grouped below by domain. Each tool is dispatched in-process through the real Ayrshare API chain. ## Scope Every tool is either **Profile** or **Account** scope: The six tools that take **no** `profileKey` argument are: `create_profile`, `list_profiles`, `explain_error`, `validate_media`, `generate_post`, and `recommend_hashtags`. All other tools accept a `profileKey`; `generate_jwt_social_linking_url` **requires** one. Note: `recommend_hashtags` takes no `profileKey` argument but still reads the connection's `Profile-Key` header to pick whose linked TikTok account it draws on, so its results are profile-specific. When both a per-call `profileKey` argument and a `Profile-Key` header are present, the argument wins. See [Connect & Setup](/docs/additional/mcp-action-connect#precedence-argument-wins-over-header) for the precedence rules. ## Posts | Tool | Scope | Purpose | | --------------- | ------- | ------------------------------------------------ | | `create_post` | Profile | Publish to one or more linked platforms. | | `validate_post` | Profile | Dry-run validation, same input as `create_post`. | | `get_post` | Profile | Fetch a post by Ayrshare Post ID. | | `update_post` | Profile | Update a scheduled or awaiting-approval post. | | `retry_post` | Profile | Re-submit a failed post. | ## History | Tool | Scope | Purpose | | ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `get_post_history` | Profile | Posts sent via Ayrshare. | | `get_platform_history` | Profile | Posts and analytics direct from the network, including non-Ayrshare posts. For an X/Twitter `userId`/`userName` lookup, use the account API key only; a `profileKey` argument or `Profile-Key` header there returns Error 400. | ## Analytics | Tool | Scope | Purpose | | --------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `get_post_analytics` | Profile | Per-post metrics by Ayrshare Post ID. | | `get_post_analytics_by_social_id` | Profile | Per-post metrics by native Social Post ID. | | `get_social_network_analytics` | Profile | Account-wide analytics and demographics for a connected social account. For an X/Twitter `userId`/`userName` lookup, use the account API key only; a `profileKey` argument or `Profile-Key` header there returns Error 400. | ## Comments | Tool | Scope | Purpose | | --------------- | ------- | ------------------------ | | `get_comments` | Profile | Read comments on a post. | | `add_comment` | Profile | Top-level comment. | | `reply_comment` | Profile | Reply to a comment. | ## Messages / DMs | Tool | Scope | Purpose | | ------------------- | ------- | ------------------------------- | | `get_messages` | Profile | Fetch DMs for a platform. | | `send_message` | Profile | Send a DM. | | `get_auto_response` | Profile | Read DM auto-response settings. | | `set_auto_response` | Profile | Configure DM auto-response. | ## Profiles | Tool | Scope | Purpose | | --------------------------------- | ------- | ------------------------------------------------------ | | `list_profiles` | Account | List sub-profiles. | | `create_profile` | Account | Create a sub-profile. | | `generate_jwt_social_linking_url` | Profile | Mint a JWT social-linking URL (requires `profileKey`). | ## Media | Tool | Scope | Purpose | | ---------------- | ------- | ----------------------------------------------------------- | | `validate_media` | Account | HEAD-check a media URL is reachable; returns `contentType`. | ## Generate | Tool | Scope | Purpose | | -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `generate_post` | Account | AI-draft post copy. | | `recommend_hashtags` | Account | Hashtag suggestions from TikTok view-count data. Uses the linked TikTok account on the profile set by the `Profile-Key` header; takes no per-call `profileKey`. | ## Webhooks | Tool | Scope | Purpose | | -------------------- | ------- | ------------------------- | | `register_webhook` | Profile | Register a webhook. | | `unregister_webhook` | Profile | Unregister a webhook. | | `list_webhooks` | Profile | List registered webhooks. | ## Errors | Tool | Scope | Purpose | | --------------- | ------- | ------------------------------------------------------------------ | | `explain_error` | Account | Decode an Ayrshare error code into cause, classification, and fix. | This catalog is verified against the live server's `tools/list`. More tools are planned (e.g. Links tools). If in doubt, query `tools/list` for the authoritative set. The catalog is maintained by the MCP server team. # Claude Code Plugin Source: https://www.ayrshare.com/docs/additional/mcp-claude-code-plugin Install the Ayrshare plugin for Claude Code to publish, schedule, and analyze social posts from your editor — with pre-publish validation, a confirm-before-publish prompt, brand-voice drafting, and analytics read-back. The Ayrshare plugin for Claude Code bundles the [MCP Server](/docs/additional/mcp-action-server) configuration, a setup command, agents, skills, and a safety hook. With it installed, you can publish posts, fetch history and analytics, manage profiles, and more — directly from Claude Code. Before anything goes live, the agent validates each post against the target network's rules and asks you to confirm, catching avoidable rejections up front. Post history is available for matching a brand's voice, and analytics can be read back to inform the next post. The plugin is open source. See the repository for internals: [ayrshare/ayrshare-social-media-api-claude-plugin](https://github.com/ayrshare/ayrshare-social-media-api-claude-plugin). ## Install ```bash theme={"system"} claude plugin marketplace add ayrshare/ayrshare-social-media-api-claude-plugin ``` ```bash theme={"system"} claude plugin install ayrshare@ayrshare ``` ### Install scopes | Scope | Where it applies | | ----------------- | ----------------------------------------------------- | | Global (default) | Every project on this machine. | | `--scope local` | Current project, not committed to git. | | `--scope project` | Current project, committed and shared with your team. | Claude Code's CLI calls the global scope `--scope user`. ## Credentials Provide your Ayrshare API key in either of these ways: The plugin's bundled `.mcp.json` already declares the `Authorization` header plus the optional `Profile-Key` and X BYOK headers, each with an empty default (`${VAR:-}`), so you enable a header simply by setting its environment variable (Claude Code substitutes the values at startup). To target a sub-profile on every call, set `AYRSHARE_PROFILE_KEY` (via `/ayrshare:setup` or your `settings.json` `env` block) and restart Claude Code; the bundled `Profile-Key` header carries it, and stays empty (treated as not provided) when unset. To target a sub-profile for a single call instead, pass a `profileKey` tool argument (no config change needed). You do not need to edit the bundled `.mcp.json`, and you should not, because `claude plugin update` overwrites it. The MCP server initializes at session start. **Restart Claude Code** after installing the plugin or changing your key. ### X/Twitter BYO credentials Posting to X/Twitter requires your own X Developer App credentials (the X BYO-key mandate, effective March 31, 2026; see the [API Overview](/docs/apis/overview#xtwitter-byo-credentials)). The bundled `.mcp.json` already declares both X BYOK headers with empty defaults, alongside `Authorization` and `Profile-Key`: ```json theme={"system"} "headers": { "Authorization": "Bearer ${AYRSHARE_API_KEY}", "Profile-Key": "${AYRSHARE_PROFILE_KEY:-}", "X-Twitter-OAuth1-Api-Key": "${X_TWITTER_OAUTH1_API_KEY:-}", "X-Twitter-OAuth1-Api-Secret": "${X_TWITTER_OAUTH1_API_SECRET:-}" } ``` So you only set the matching environment variables (`X_TWITTER_OAUTH1_API_KEY`, `X_TWITTER_OAUTH1_API_SECRET`) via `/ayrshare:setup` or your `settings.json` `env`, then **restart Claude Code**; you do not edit the bundled `.mcp.json` (it is overwritten on `claude plugin update`). Set **both** or neither: with neither set an X/Twitter call returns error `419` (`x_credentials_required`); with only one set it returns error `400`. This is one key pair per Ayrshare account, sent on every X-targeting request (the same pair for all sub-profiles). Prefer a raw connection over the plugin? The same BYO headers can be passed via `claude mcp add --header` — see [Connect & Setup → X/Twitter BYO credentials](/docs/additional/mcp-action-connect#xtwitter-byo-credentials). ## What it ships ### Command ### Agents ### Skills | Skill | Purpose | | ---------------------------- | ----------------------------------------------------------- | | `getting-started` | Orient and connect for first-time use. | | `post` | Create, validate, update, and retry posts. | | `history` | Retrieve post and platform history. | | `analytics` | Pull per-post and account-level analytics. | | `comments` | Read, add, and reply to comments. | | `messages` | Read and send direct messages and configure auto-responses. | | `profiles` | Create and list sub-profiles. | | `media` | Validate that media URLs are reachable. | | `generate` | AI-draft post copy and recommend hashtags. | | `webhooks` | Register, unregister, and list webhooks. | | `errors` | Decode Ayrshare error codes. | | `draft-in-brand-voice` | Draft post copy in a consistent brand voice. | | `plan-and-schedule-campaign` | Plan and schedule a multi-post campaign. | ### Confirmation hook A `PreToolUse` hook asks for confirmation before any publish or send action. It covers exactly these 7 tools: ## FAQ Yes. The plugin runs `validate_post` to dry-run your content against each network's rules — length, format, and media requirements — before it publishes, so you catch avoidable rejections up front. Yes. A `PreToolUse` confirmation hook prompts you to approve before any publish or send action: `create_post`, `update_post`, `retry_post`, `add_comment`, `reply_comment`, `send_message`, and `set_auto_response`. Yes. The `draft-in-brand-voice` skill reads your post history to draft new copy in a consistent brand voice. It produces drafts only — nothing publishes without your confirmation. Yes. The analytics tools return per-post and account-level metrics, so you can read results back and let them guide your next post. An Ayrshare API key (a Business plan key for profiles and sub-profiles) and Claude Code. Configure the key with `/ayrshare:setup` or the `AYRSHARE_API_KEY` environment variable, then restart Claude Code. Yes. X/Twitter requires your own OAuth 1.0a credentials, added as two connection headers (`X-Twitter-OAuth1-Api-Key` and `X-Twitter-OAuth1-Api-Secret`). See [X/Twitter BYO credentials](#xtwitter-byo-credentials) above. ## Next steps Authentication, profile targeting, and BYO credentials. The 27 tools grouped by domain, with scope and purpose. # Onboard Client Social Accounts Source: https://www.ayrshare.com/docs/additional/mcp-client-onboarding Use the MCP Server to onboard clients' social accounts under sub-profiles with a JWT social-linking URL. Integrators on a Business or Enterprise plan can onboard their clients' social accounts under **sub-profiles**. Using the [MCP Server](/docs/additional/mcp-action-server), an agent creates a sub-profile, targets it, and mints a single sign-on linking URL the client opens to connect their accounts. ## Flow Call `create_profile` (account-level — no `profileKey`). It returns a **profile key** for the new sub-profile. Use the returned profile key on subsequent calls — either via the `Profile-Key` header on the connection or as a per-call `profileKey` argument. See [Connect & Setup](/docs/additional/mcp-action-connect#precedence-argument-wins-over-header) for precedence. Call `generate_jwt_social_linking_url` to mint a single sign-on linking URL. The JWT signing key and onboarding domain are derived **server-side** — the caller supplies **no** `X-Ayrshare-*` headers and no private key or domain. The client opens the URL and authorizes (OAuths) their social accounts. The connected accounts are linked to the sub-profile. ## Requirements `generate_jwt_social_linking_url` **requires** a `profileKey`. If none resolves, the call returns **400** with the message **"Profile Key is required…"**. A **social-linking domain must be provisioned** for your account. This is available on the **Business** and **Enterprise** plans. ### Error states | Condition | Response | | --------------------- | -------------------------------------------------------------------------------------------------------------- | | No provisioned domain | **400** — "No social-linking domain is provisioned for this account (available on Business/Enterprise plans)." | | No signing key | **400** — "No signing key found for this account's social-linking domain." | ## Next steps Authentication and profile targeting. The 27 tools grouped by domain, with scope and purpose. # n8n Source: https://www.ayrshare.com/docs/additional/mcp-n8n Connect n8n's AI Agent to the Ayrshare MCP Server to publish, schedule, and analyze across 13 social networks, with no per-platform API code. n8n is where you wire your tools together. Ayrshare is the one API that publishes to Facebook, Instagram, LinkedIn, YouTube, TikTok, Pinterest, Reddit, Threads, Bluesky, Telegram, Google Business Profile, Snapchat, and X in a single call. Connect them with the [Ayrshare MCP Server](/docs/additional/mcp-action-server) and your n8n AI Agent can run the whole loop on its own: draft a post, validate it against each network's rules, publish or schedule it, then read the analytics back. The n8n starter workflow on the canvas: a chat trigger into an AI Agent, with an Anthropic chat model and the Ayrshare MCP tool node attached below, plus setup and usage sticky notes. Because the MCP Server is a hosted Streamable HTTP endpoint, you connect it with n8n's built-in **MCP Client Tool** node. There is nothing to host, no custom code, and no community node to install. You point one node at one URL and your agent gets all 27 social tools. The workflow shown above, ready to import: Chat Trigger, AI Agent, an Anthropic chat model, and the Ayrshare MCP node pre-wired with the validate-first system prompt. To use it: in n8n, **Workflows → Import from file**, select the JSON, then create the two credentials it expects (a **Bearer Auth** credential holding your Ayrshare key, and an **Anthropic API** credential). The two warning badges clear once the credentials are attached. Self-hosted instances need outbound access to `api.ayrshare.com` and your model provider. This guide covers the MCP-first path end to end. If you would rather build a fixed, non-agent workflow, there is a short [REST fallback](#rest-fallback-no-agent) at the end. ## Why MCP instead of writing API calls You can call Ayrshare's REST API directly from an HTTP Request node, which is fine for fixed, predictable workflows. The MCP Server earns its place when an LLM is in the loop: ## How it connects The **AI Agent** node is the brain. The **MCP Client Tool** sub-node attaches to it, connects to the Ayrshare MCP Server at `https://api.ayrshare.com/mcp`, discovers the available tools, and exposes them to the agent. When the agent acts, the node dispatches the call to Ayrshare, which publishes to the networks. ``` Trigger -> AI Agent (+ Chat Model) -> MCP Client Tool -> Ayrshare MCP Server -> 13 networks ``` For the endpoint, transport, and authentication details, see [Connect & Setup](/docs/additional/mcp-action-connect). For the full tool list, see the [Tool Catalog](/docs/additional/mcp-action-tools). ## Prerequisites ## Set up the MCP Client Tool node Open or create a workflow and add an **AI Agent** node (under the *Advanced AI* nodes). On the AI Agent node, click the **Tool** connector and add an **MCP Client Tool** node. Configure it: | Field | Value | | -------------------- | --------------------------------------------------- | | **Endpoint** | `https://api.ayrshare.com/mcp` | | **Server Transport** | `HTTP Streamable` | | **Authentication** | `Bearer Auth` | | **Tools to Include** | `All` (or `Selected` to expose only specific tools) | For **Credential**, create a new **Bearer Auth** credential and paste your Ayrshare API key as the token. n8n sends it as `Authorization: Bearer YOUR_API_KEY`. When you save, n8n connects and lists the 27 tools. Attach a **Chat Model** sub-node and select your model credential. Give the agent a system prompt that sets the rules, for example: > You are a social media assistant with access to Ayrshare tools. Before publishing anything, always call `validate_post` first and report any issues. Only call `create_post` after validation passes. Default to the platforms the user names; if none are named, ask. Never invent media URLs; only use URLs the user provides, and confirm them with `validate_media` when in doubt. For testing, the **Manual Trigger** or **Chat Trigger** is easiest. For production, use whatever kicks off the workflow (schedule, webhook, form, new row in a sheet). **Use HTTP Streamable, not SSE.** The Ayrshare MCP Server uses the modern Streamable HTTP transport and is stateless. n8n's SSE option is deprecated, and the server rejects the SSE stream. Always choose **HTTP Streamable**. ## The tool surface Your agent sees all 27 tools through the one MCP node. You rarely call them by name; you describe intent and the agent selects. The domains are Posts, History, Analytics, Comments, Messages, Profiles, Media, Generate, Webhooks, and Errors. For the complete list with each tool's purpose and scope, see the [Tool Catalog](/docs/additional/mcp-action-tools). Two stand out for safety: **`validate_post`** dry-runs a post with the same input as `create_post` but publishes nothing, and **`explain_error`** turns any Ayrshare error code into a plain-English cause and fix, so the agent can self-diagnose. ## Example 1: draft, validate, and publish from a chat message The "hello world" of this integration. Trigger the workflow with a chat message or form, and let the agent do the rest. What the agent does on its own: it calls `validate_post` with your copy and both platforms; if anything breaks a network's rules it tells you instead of failing silently; once validation passes it calls `create_post` and returns the live post URLs. Because validation runs first, you find out about a problem before anything is public. ## Example 2: auto-publish new content across your channels Turn a content source into multi-network posts without touching it. You can lean on `recommend_hashtags` for data-driven tags and `generate_post` if you want Ayrshare to draft the copy rather than your chat model. ## Example 3: weekly analytics digest Run the loop in reverse: read performance and report it. A note on cadence: most posts get the bulk of their engagement in the first 24 hours, and metrics do not update by the second. A daily or weekly schedule is plenty. Do not poll analytics every few minutes or you will hit rate limits for no new data. ## Acting on behalf of clients (multi-tenant) If you manage social for multiple clients, Ayrshare's profiles let one account post to many separate sets of linked accounts. On a Business or Enterprise plan you have two ways to target a client from n8n: To onboard a new client, the agent can call `create_profile` and then `generate_jwt_social_linking_url` to mint a hosted page where the client links their own accounts. No credentials pass through your workflow. ## Posting to X/Twitter In n8n, switch the MCP Client Tool node's **Authentication** to **Multiple Headers** and add the two `X-Twitter-OAuth1-*` headers alongside `Authorization`. It is a one-time setup per Ayrshare account, and the same key pair applies to every profile. For everything else (Facebook, Instagram, LinkedIn, YouTube, TikTok, and the rest) no extra headers are needed. See [Connect & Setup → X/Twitter BYO credentials](/docs/additional/mcp-action-connect#xtwitter-byo-credentials). ## Keep a human in the loop The MCP tools make it trivial for an agent to publish, which is exactly why you should gate it. Two cheap safeguards: ## REST fallback (no agent) If you want a fixed, deterministic workflow with no LLM, skip MCP and call the REST API with an **HTTP Request** node: ```json theme={"system"} { "post": "Excited to announce our new feature!", "platforms": ["facebook", "linkedin", "instagram"], "mediaUrls": ["https://example.com/image.jpg"], "scheduleDate": "2026-07-01T10:00:00Z" } ``` Use the API host `api.ayrshare.com`, not the dashboard host `app.ayrshare.com`. (`app.ayrshare.com` will accept API calls, but it is not the documented endpoint and can return intermittent [502/504 gateway errors](/docs/help-center/technical-support/response_bad_gateway_502_or_504_error), so always use `api.ayrshare.com`.) The same pattern works for the other [REST endpoints](/docs/apis/overview). This is the right tool when the workflow is fully predictable and you do not need an agent deciding anything. ## Troubleshooting | Symptom | Likely cause | Fix | | --------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | Tool call returns `403` / code `102`, "API Key not valid" | Bad or missing API key | Check the Bearer Auth credential holds your exact Ayrshare key. Re-save the node after changing it. | | n8n cannot connect to the MCP server | Wrong transport or endpoint | Endpoint must be `https://api.ayrshare.com/mcp`; transport must be **HTTP Streamable**, not SSE. | | X/Twitter post fails with error `419` | Missing X BYO credentials | Add the two `X-Twitter-OAuth1-*` headers via Multiple Headers auth. | | Post fails for one platform only | That network is not linked, or a required field is missing | Link it in the dashboard; add `title` for YouTube, `title` + `subreddit` for Reddit, `mediaUrls` for Instagram. | | Instagram post rejected | No media | Instagram requires `mediaUrls` for most post types. Have the agent confirm with `validate_media`. | | Media attached as a file or binary does not appear | MCP is JSON-only | Reference media by public `mediaUrls` URL; the MCP path does not accept file uploads. Confirm the URL with `validate_media`. | | Calls work, but act on the wrong client | Profile targeting | Set a `Profile-Key` header (per connection) or `profileKey` argument (per call); the argument wins if both are set. | | `429 Too Many Requests` | Polling too often | Reduce analytics and comment polling frequency; metrics do not update by the second. | | Config change did not take effect | MCP connection initializes at session start | Re-save the node or restart the workflow after changing the key or headers. | You can also expose the `explain_error` tool to the agent so it decodes any Ayrshare error code into a cause and fix on its own. ## Next steps Endpoint, transport, authentication, profile targeting, and BYO credentials. The 27 tools grouped by domain, with scope and purpose. What the MCP Server is and how it maps to the Ayrshare API. The same server, packaged for Claude Code. # Documentation MCP Source: https://www.ayrshare.com/docs/additional/mcp-server Connect the read-only Ayrshare Documentation MCP server to your AI agent to search Ayrshare's API documentation This is the read-only **Documentation MCP** (it searches Ayrshare's API docs). To let an AI agent **drive** the Ayrshare API, see the [MCP Server](/docs/additional/mcp-action-server) (Action MCP). The Model Context Protocol (MCP) is an open standard that enables applications to share context and tools with Large Language Models (LLMs). By connecting the Ayrshare API documentation MCP server to your AI development tools like Cursor or Claude Desktop, you can give your AI agent direct access to Ayrshare's documentation. This integration allows your AI agent to: This means instead of manually looking up API details, your AI assistant can reference the documentation directly and help you implement Ayrshare functionality more efficiently. ## How to Get Started Ayrshare's MCP server is available at `https://www.ayrshare.com/docs/mcp`. ### Claude Desktop 1. Navigate to the Connectors page in the Claude settings. 2. Select Add custom connector. 3. Add `Ayrshare MCP` or any name you prefer as your MCP server name and `https://www.ayrshare.com/docs/mcp` as your MCP server URL. 4. Select Add. 5. When using Claude, select the attachments button (the plus icon). 6. Select your MCP server. ### Claude Code ```bash theme={"system"} claude mcp add --transport http ayrshare https://www.ayrshare.com/docs/mcp ``` ### VS Code [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge\&logo=visual-studio-code\&logoColor=white)](https://insiders.vscode.dev/redirect?url=vscode:mcp/install?%7B%22type%22%3A%22http%22%2C%22name%22%3A%22Ayrshare-MCP%22%2C%22url%22%3A%22https%3A%2F%2Fwww.ayrshare.com%2Fdocs%2Fmcp%22%7D) 1. Create a .vscode/mcp.json file. 2. In mcp.json, configure your server: ```json theme={"system"} { "servers": { "Ayrshare MCP": { "type": "http", "url": "https://www.ayrshare.com/docs/mcp" } } } ``` ### Cursor [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](cursor://anysphere.cursor-deeplink/mcp/install?name=Ayrshare-MCP\&config=eyJ1cmwiOiJodHRwczovL3d3dy5heXJzaGFyZS5jb20vZG9jcy9tY3AifQ==) 1. Use Command + Shift + P (Ctrl + Shift + P on Windows) to open the command palette. 2. Search for “Open MCP settings”. 3. Select Add custom MCP. This opens the mcp.json file. 4. In mcp.json, configure your server: ```json theme={"system"} { "mcpServers": { "Ayrshare MCP": { "url": "https://www.ayrshare.com/docs/mcp" } } } ``` ## Using MCP Server Connection Restart the app to apply the changes. In Cursor, you can test the MCP connector by typing `How do you publish a post in Ayrshare. Use the MCP server.` You will see the request to "Run tool" and Cursor will access the MCP server to get the response. # Boost Post Source: https://www.ayrshare.com/docs/apis/ads/facebook/boost-post POST /ads/facebook/boost Boost a post by submitting it to Facebook's ad platform Boost an existing Facebook post to create an ad. This endpoint allows you to convert your organic posts into paid advertisements with custom targeting, budget, and scheduling parameters. ### Ad Goals Each ad must have a goal. The goal determines how the ad will be optimized for display. Learn more about integrating the Facebook Marketing API with Ayrshare in our [Facebook Marketing API Integration Guide](https://www.ayrshare.com/blog/facebook-ads-api-boosting-with-the-marketing-api/). ## Header Parameters ## Body Parameters The ID of the Facebook ad account to boost the post on. The account ID can be retrieved from the [ad accounts endpoint](/docs/apis/ads/facebook/get-ad-accounts). Name for your ad (appears in Facebook Ad Manager) with the format `{adName} - {postId or fbPostId} - {current date}`. Maximum bid amount in USD. Minimum bid amount is \$1.00. Daily budget in USD. Minimum budget is \$1.00. The [Facebook social post ID](/docs/apis/overview#social-post-id) of the post to boost, which allows you to create an ad from a post created directly on Facebook. This is the ID of the [post on Facebook](/docs/apis/history/history-platform), not Ayrshare. Required if `postId` is not set. The goal of the ad. Values: `engagement`, `interactions`, `awareness_views`, and `awareness_audience`. See [ad goals details](/docs/apis/ads/facebook/boost-post#ad-goals) above for more information. Target ad locations with an object of arrays: `countries`, `regions`, `cities`. List of country codes. ```json theme={"system"} { "countries": ["US", "CA"] } ``` Regions require Facebook's region `key` value. See the [regions endpoint](/docs/apis/ads/facebook/get-ad-regions) for more information. ```json theme={"system"} { "regions": [{ "key": "3886" }] } ``` Cities require: `key` (from Facebook), `radius`, and `distance_unit`. `radius` is the distance around the city: 10–50 miles or 17–80 kilometers. `distance_unit` is `mile` or `kilometer`. See the [cities endpoint](/docs/apis/ads/facebook/get-ad-cities) for more information. ```json theme={"system"} { "cities": [ { "key": "2420605", "radius": 25, "distance_unit": "mile" } ] } ``` The [Ayrshare post ID](/docs/apis/overview#ayrshare-post-id) of the post to boost. Required if `fbPostId` is not set. The status of the ad. Values: `active` and `paused`. You can later change the status of the ad using the [update ad endpoint](/docs/apis/ads/facebook/put-ad-update). Controls Meta's campaign-level ad set budget sharing. Meta now requires this wire field on every campaign created without a campaign-level budget, so Ayrshare always sends it — defaulting to `false` for backward compatibility. Set to `true` to let Meta share up to \~20% of an ad set's budget across other ad sets in the same campaign to optimize overall performance. See Meta's [ad campaign group reference](https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/) for details. Track the ad using a Facebook Pixel. The ID of the Facebook Pixel to track the ad. ```json theme={"system"} { "pixelId": 1234567890 } ``` Add UTM tags to the ad URL. ```json theme={"system"} { "urlTags": ["utm_source=ayrshare", "utm_medium=social", "utm_campaign=ayrshare-social"] } ``` For example if the linking URL is `https://www.mysite.com/my-post` and the URL tags added are: `utm_source=ayrshare`, `utm_medium=social`, and `utm_campaign=ayrshare-social`. The ad URL will be: `https://www.mysite.com/my-post?utm_source=ayrshare&utm_medium=social&utm_campaign=ayrshare-social`. Meta requires advertisers in [special ad categories](https://www.facebook.com/business/help/298000447747885?helpref=faq_content) to must self-identify their campaign category. If your business is in one of these categories, you must select the appropriate category when boosting your post. The following values are supported:
  • `housing`: Ads that promote or directly link to a housing opportunity or related service, including but not limited to listings for the sale or rental of a home or apartment, homeowners insurance, mortgage insurance, mortgage loans, housing repairs and home equity or appraisal services.
  • `financial_product_services`: Ads that promote or directly link to a financial products and services offer, including credit.
  • `employment`: Ads that promote or directly link to an employment opportunity, including but not limited to part- or full-time jobs, internships or professional certification programs. Related ads that fall within this category include promotions for job boards or fairs, aggregation services or ads detailing perks a company may provide, regardless of a specific job offer.
  • `issues_elections_politics`: Ads made by, on behalf of, or about a candidate for public office, a political figure, a political party or advocating for the outcome of an election to public office. This also includes ads about any election, referendum or ballot initiative, including "Go out and vote" election campaigns. Ads regulated as political advertising or about social issues in any place where the ad is being placed. If selecting issues, elections, or politics, you must select the country in which you want to run these ads. You are required to be authorized to run ads about social issues, elections, or politics in the specified country.
Meta requires advertisers who have self-identified their campaign category. Meta uses human reviewers and machine-learning to identify these kinds of ads. If you send us an incorrect `specialAdCategory`, there is a risk your ads will be paused until the campaign is adjusted.
End date and time in ISO 8601 format (must be at least 30 hours after start), for example `2025-03-01T00:00:00Z`. If not set, the ad will run indefinitely and have end date of `ongoing`. Exclude locations using an object with arrays of `countries`, `regions`, and `cities`. List of country codes to exclude. ```json theme={"system"} { "countries": ["US", "CA"] } ``` Regions require Facebook's region `key` value. See the [regions endpoint](/docs/apis/ads/facebook/get-ad-regions) for more information. ```json theme={"system"} { "regions": [{ "key": "3886" }] } ``` Cities require: `key` (from Facebook), `radius`, and `distance_unit`. `radius` is the distance around the city: 10–50 miles or 17–80 kilometers. `distance_unit` is `mile` or `kilometer`. See the [cities endpoint](/docs/apis/ads/facebook/get-ad-cities) for more information. ```json theme={"system"} { "cities": [ { "key": "2420605", "radius": 25, "distance_unit": "mile" } ] } ``` The gender of the audience. Values: `all`, `male`, `female`. The target interests of the ad as an array of Facebook [interest ids](/docs/apis/ads/facebook/get-ad-interests). Maximum age for targeting the ad (default: 65). Minimum age for targeting the ad (default: 18). Start date and time in ISO 8601 format, for example `2025-03-01T00:00:00Z`. If not set, the ad will start immediately. The beneficiary of the ad for Digital Services Act (DSA) compliance for EU countries. Must be set together with `dsaPayor` if either is provided. Please refer to our [DSA guide](/docs/apis/ads/facebook/get-dsa-recommendations) for more information. The payor of the ad for Digital Services Act (DSA) compliance for EU countries. Must be set together with `dsaBeneficiary` if either is provided. ```bash cURL theme={"system"} curl -X POST https://api.ayrshare.com/api/ads/facebook/boost \ -H "Authorization: Bearer API_KEY" \ -H "Content-Type: application/json" \ -d '{ "postId": "1234567890", "accountId": "1234567890", "adName": "My Ad", "status": "active", "goal": "engagement", "minAge": 18, "maxAge": 65, "locations": { "countries": ["US"] }, "budget": 100, "bidAmount": 1, "startDate": "2025-03-01T00:00:00Z", "endDate": "2025-03-07T23:59:59Z", "interests": [1234567890, 1234567891] }' ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/boost", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}` }, body: JSON.stringify({ postId: "1234567890", accountId: "1234567890", adName: "My Ad", status: "active", goal: "engagement", minAge: 18, maxAge: 65, locations: { countries: ["US"] }, budget: 100, bidAmount: 1, startDate: "2025-03-01T00:00:00Z", endDate: "2025-03-07T23:59:59Z", interests: [1234567890, 1234567891] }) }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests API_KEY = "API_KEY" url = "https://api.ayrshare.com/api/ads/facebook/boost" payload = { "postId": "1234567890", "accountId": "1234567890", "adName": "My Ad", "status": "active", "goal": "engagement", "minAge": 18, "maxAge": 65, "locations": {"countries": ["US"]}, "budget": 100, "bidAmount": 1, "startDate": "2025-03-01T00:00:00Z", "endDate": "2025-03-07T23:59:59Z", "interests": [1234567890, 1234567891] } response = requests.post(url, headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, json=payload) print(response.json()) ``` ```php PHP theme={"system"} "1234567890", "accountId" => "1234567890", "adName" => "My Ad", "status" => "active", "goal" => "engagement", "minAge" => 18, "maxAge" => 65, "locations" => ["countries" => ["US"]], "budget" => 100, "bidAmount" => 1, "startDate" => "2025-03-01T00:00:00Z", "endDate" => "2025-03-07T23:59:59Z", "interests" => [1234567890, 1234567891] ]; $ch = curl_init("https://api.ayrshare.com/api/ads/facebook/boost"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Content-Type: application/json", "Authorization: Bearer " . $API_KEY ]); $response = curl_exec($ch); $result = json_decode($response, true); print_r($result); curl_close($ch); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Text.Json; using System.Threading.Tasks; class Program { static async Task Main() { string API_KEY = "API_KEY"; var payload = new { postId = "1234567890", accountId = "1234567890", adName = "My Ad", status = "active", goal = "engagement", minAge = 18, maxAge = 65, locations = new { countries = new[] { "US" } }, budget = 100, bidAmount = 1, startDate = "2025-03-01T00:00:00Z", endDate = "2025-03-07T23:59:59Z", interests = new[] { 1234567890, 1234567891 } }; using var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", API_KEY); var content = new StringContent( JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json" ); var response = await client.PostAsync("https://api.ayrshare.com/api/ads/facebook/boost", content); var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } } ``` ```go Go theme={"system"} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { apiKey := "API_KEY" payload := map[string]interface{}{ "postId": "1234567890", "accountId": "1234567890", "adName": "My Ad", "status": "active", "goal": "engagement", "minAge": 18, "maxAge": 65, "locations": map[string]interface{}{"countries": []string{"US"}}, "budget": 100, "bidAmount": 1, "startDate": "2025-03-01T00:00:00Z", "endDate": "2025-03-07T23:59:59Z", "interests": []int{1234567890, 1234567891}, } jsonData, err := json.Marshal(payload) if err != nil { fmt.Println("Error marshaling JSON:", err) return } req, err := http.NewRequest("POST", "https://api.ayrshare.com/api/ads/facebook/boost", bytes.NewBuffer(jsonData)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+apiKey) client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response:", err) return } fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.databind.ObjectMapper; public class BoostPost { public static void main(String[] args) { String API_KEY = "API_KEY"; String url = "https://api.ayrshare.com/api/ads/facebook/boost"; Map payload = new HashMap<>(); payload.put("postId", "1234567890"); payload.put("accountId", "1234567890"); payload.put("adName", "My Ad"); payload.put("status", "active"); payload.put("goal", "engagement"); payload.put("minAge", 18); payload.put("maxAge", 65); Map locations = new HashMap<>(); locations.put("countries", Arrays.asList("US")); payload.put("locations", locations); payload.put("budget", 100); payload.put("bidAmount", 1); payload.put("startDate", "2025-03-01T00:00:00Z"); payload.put("endDate", "2025-03-07T23:59:59Z"); payload.put("interests", Arrays.asList(1234567890, 1234567891)); try { ObjectMapper objectMapper = new ObjectMapper(); String requestBody = objectMapper.writeValueAsString(payload); HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Content-Type", "application/json") .header("Authorization", "Bearer " + API_KEY) .POST(HttpRequest.BodyPublishers.ofString(requestBody)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } catch (IOException | InterruptedException e) { e.printStackTrace(); } } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'uri' require 'json' API_KEY = "API_KEY" uri = URI.parse("https://api.ayrshare.com/api/ads/facebook/boost") payload = { postId: "1234567890", accountId: "1234567890", adName: "My Ad", status: "active", goal: "engagement", minAge: 18, maxAge: 65, locations: { countries: ["US"] }, budget: 100, bidAmount: 1, startDate: "2025-03-01T00:00:00Z", endDate: "2025-03-07T23:59:59Z", interests: [1234567890, 1234567891] } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request["Content-Type"] = "application/json" request["Authorization"] = "Bearer #{API_KEY}" request.body = payload.to_json response = http.request(request) puts response.body ``` ```json 200: Post Boosted theme={"system"} { "status": "success", "adId": "120217670757750410", "adName": "API Post - DE6gpw8kxlonHy2b7Lo - 2025-03-26T23:42:43", "adStatus": "active", "bidAmount": 10, "budget": 100, "endDate": "2026-03-28T22:30:00Z", "goal": { "title": "Get More Engagement", "description": "This goal seeks to increase engagement...", "type": "engagement" }, "interests": [ "6003195554098" ], "locations": { "countries": ["US"] }, "maxAge": 65, "minAge": 18, "postId": "DE6gpw8kxlonHy2b7Lo", "startDate": "2026-03-26T22:30:00Z" } ``` ```json 400: Invalid Account ID theme={"system"} { "action": "boost post", "status": "error", "code": 369, "message": "Unable to boost post. Please try again or contact us if the issue persists.", "details": "The accountId likely does not exist. Please check the accountId and try again." } ``` ```json 400: Missing Required Parameters theme={"system"} { "action": "request", "status": "error", "code": 101, "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis", "details": "Missing required fields: budget" } ``` # Accounts Source: https://www.ayrshare.com/docs/apis/ads/facebook/get-ad-accounts GET /ads/facebook/accounts Get Facebook Ad Accounts Retrieve available Facebook ad accounts associated with the authenticated profile. This endpoint allows you to access basic account information as well as key metrics for the ad accounts.
  • The `metrics` object contains aggregate performance data across all ads in the account
  • Results are cached for 10 minutes to optimize performance and reduce API calls to Facebook
  • Account status in the JSON response may be one of: `active`, `disabled`, `unsettled`, `pending review`, or `closed`
## Header Parameters ## Query Parameters Limit the number of ad accounts returned. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/ads/facebook/accounts ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/accounts", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/ads/facebook/accounts', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/ads/facebook/accounts", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY" ] ]); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { string apiKey = "API_KEY"; using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}"); HttpResponseMessage response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/accounts"); string content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } } ``` ```go Go theme={"system"} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { apiKey := "API_KEY" req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/accounts", nil) req.Header.Add("Authorization", "Bearer " + apiKey) client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println(err) return } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class GetAdAccounts { public static void main(String[] args) { try { String apiKey = "API_KEY"; URL url = new URL("https://api.ayrshare.com/api/ads/facebook/accounts"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", "Bearer " + apiKey); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } catch (Exception e) { e.printStackTrace(); } } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'json' uri = URI('https://api.ayrshare.com/api/ads/facebook/accounts') req = Net::HTTP::Get.new(uri) req['Authorization'] = 'Bearer API_KEY' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) } puts response.body ``` ```json 200: Success theme={"system"} { "status": "success", "adAccounts": [ { "accountId": "274948345", "ageInDays": 2870.86, "amountSpent": 191.33, "balance": 7.84, "budgetRemaining": 1, "business": { "name": "Fun Fun Fun", "city": "New York", "country": "US", "state": "NY", "street": "178 Columbus Ave", "zip": "10023" }, "created": "2012-01-05T03:11:31-0800", "currency": "USD", "disableReason": null, "fundingSource": { "id": "13157487252022", "type": "Credit Card" }, "hasNotificationsEnabled": true, "isPersonal": false, "isPrepayAccount": false, "metrics": { "spend": 191.33, "impressions": 24994, "reach": 20410, "clicks": 622, "ctr": 2.488597, "cpm": 7.655037, "cpp": 9.374326, "frequency": 1.224596, "uniqueClicks": 432, "uniqueCtr": 2.11661, "costPerUniqueClick": 0.442894, "inlineLinkClicks": 538, "costPerInlineLinkClick": 0.355632, "outboundClicks": 468, "costPerOutboundClick": 0.408825, "websiteCtr": [ { "action_type": "link_click", "value": "2.152517" } ], "accountCurrency": "USD", "accountName": "John Smith", "accountId": "274948321" }, "minDailyBudget": 1, "name": "John Smith", "owner": "3205611418413", "spendCap": 0, "status": "Active", "tax": { "id": "824087134", "type": "Business Tax ID (EIN/SSN)", "status": "Pending", "isRequired": false }, "timezoneName": "America/Los_Angeles", "tosAccepted": { "webCustomAudienceTos": true, "customAudienceTos": true } } ], "count": 1, "lastUpdated": "2025-03-26T19:33:51.571Z", "nextUpdate": "2025-03-26T19:44:51.571Z" } ``` ```json 400: Ad accounts error theme={"system"} { "action": "get ad accounts", "status": "error", "code": 366, "message": "Error getting ad accounts. Please verify you have an active ad account at Facebook." } ``` # Cities Source: https://www.ayrshare.com/docs/apis/ads/facebook/get-ad-cities GET /ads/facebook/cities Get Facebook Ad Cities by Name Search for cities to be used for targeting when boosting an ad.
  • Cities use Facebook's key identifier and support radius targeting.
  • Each city result includes its parent region as region (the region name) and regionId (the region's numeric identifier), so you can target the city's region when it is available.
  • If a returned city has supportsRegion true, the region for this city is available for targeting. If supportsCity is true, this city is available for targeting.
  • Some locations may be returned as subcity with additional hierarchy fields.
## Header Parameters ## Query Parameters The search string to filter cities. Provide a partial or full city name. Maximum number of cities to return. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET "https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan" ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY" ], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY"); var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } ``` ```go Go theme={"system"} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan", nil) req.Header.Add("Authorization", "Bearer API_KEY") resp, _ := client.Do(req) body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetAdCities { public static void main(String[] args) throws Exception { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan")) .header("Authorization", "Bearer API_KEY") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'json' uri = URI('https://api.ayrshare.com/api/ads/facebook/cities?search=Manhattan') req = Net::HTTP::Get.new(uri) req['Authorization'] = 'Bearer API_KEY' res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) } puts res.body ``` ```json 200: Success theme={"system"} { "status": "success", "cities": [ { "key": "2447439", "name": "Manhattan", "type": "city", "countryCode": "US", "countryName": "United States", "region": "Kansas", "regionId": 3859, "supportsRegion": true, "supportsCity": true }, { "key": "2703980", "name": "Manhattan", "type": "subcity", "countryCode": "US", "countryName": "United States", "region": "New York", "regionId": 3875, "supportsRegion": true, "supportsCity": true, "geoHierarchyLevel": "SUBCITY", "geoHierarchyName": "BOROUGH" } ], "count": 2 } ``` ```json 414: Location metadata error theme={"system"} { "action": "ads", "status": "error", "code": 414, "message": "Error getting ad location metadata. Please try again." } ``` # History Source: https://www.ayrshare.com/docs/apis/ads/facebook/get-ad-history GET /ads/facebook/history Get Historical Daily Facebook Ad Spend & Analytics Retrieve detailed daily ad spend and performance metrics for your Facebook ads. This endpoint provides comprehensive analytics on your ads with daily breakdowns, goal-specific performance, and aggregated metrics. The `dailySpend` array contains historical daily spend and performance metrics for each ad. The data is as of 8 AM EST. If real-time spend data is needed or spend has not yet occurred, please use the [ads endpoint](/docs/apis/ads/facebook/get-boosted-ads). The ad will **NOT** be returned if no spend data is available or spend has not yet occurred.
  • Metrics are calculated from Facebook's reporting API and may have slight delays (up to 24 hours).
  • The `byGoalType` and `byGoalTitle` sections group performance metrics by goal objectives.
  • Use either `adId` or `postId` filters to narrow results to specific campaigns.
  • All monetary values are in the ad account's currency (typically USD).
  • The `goalPerformance` section highlights your best-performing ad objectives.
This endpoint only returns Facebook ads created via the [Boost Post](/docs/apis/ads/facebook/boost-post) endpoint. Ads created in Facebook Ads Manager or other third-party tools are not returned. ## Header Parameters ## Query Parameters Filter results to a specific account ID. Filter results to a specific ad ID. Filter results to ads associated with a specific [Ayrshare post ID](/docs/apis/overview#ayrshare-post-id). Filter results to ads associated with a specific [Facebook social post ID](/docs/apis/overview#social-post-id). Retrieve a maximum of `limit` ads. Maximum is 500. Start date for the reporting period in ISO 8601 format (default: 30 days ago) End date for the reporting period in ISO 8601 format (default: today) ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/ads/facebook/spend?accountId=1234567890 ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/spend?accountId=1234567890", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/ads/facebook/spend', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/ads/facebook/spend", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error: " . $err; } else { echo $response; } ?> ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY"); var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/spend"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } ``` ```go Go theme={"system"} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/spend", nil) req.Header.Add("Authorization", "Bearer API_KEY") resp, err := client.Do(req) if err != nil { fmt.Println("Error:", err) return } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetAdSpend { public static void main(String[] args) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ayrshare.com/api/ads/facebook/spend")) .header("Authorization", "Bearer API_KEY") .GET() .build(); try { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } catch (Exception e) { e.printStackTrace(); } } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'json' require 'uri' uri = URI.parse('https://api.ayrshare.com/api/ads/facebook/spend') request = Net::HTTP::Get.new(uri) request['Authorization'] = 'Bearer API_KEY' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| http.request(request) end puts response.body ``` ```json 200: Success No Param theme={"system"} { "status": "success", "history": [ { "adId": "6683876017501", "adName": "API Post 1 - DE6gpw8kxlonHy6eb7L1 - 2025-03-30T17:11:26", "budgetDaily": 4, "budgetType": "daily", "deliveryStatus": "ACTIVE", "goal": { "description": "This goal seeks to increase engagement while ensuring that the ad reaches the maximum number of unique users. It balances visibility with engagement, showing the ad to as many different people as possible who may interact with it.", "title": "Get More Engagement", "type": "engagement" }, "isActive": true, "isComplete": false, "metrics": { "clicks": 3, "impressions": 1035, "reach": 1026, "frequency": 0, "ctr": 0, "cpm": 1.53, "cpp": 1.54, "cpc": 0 }, "network": "facebook", "postId": "DE6gpw8kxlonHy6eb7L1", "spend": 1.58, "spendDate": "2025-04-02T00:00:00.000Z", "status": "ACTIVE" }, { "adId": "120218167147110411", "adName": "API Post 2 - DE6gpw8kxlonHy6eb7L1 - 2025-03-30T16:41:15", "budgetDaily": 4, "budgetType": "daily", "deliveryStatus": "ACTIVE", "goal": { "description": "This goal seeks to increase engagement while ensuring that the ad reaches the maximum number of unique users. It balances visibility with engagement, showing the ad to as many different people as possible who may interact with it.", "title": "Get More Engagement", "type": "engagement" }, "isActive": true, "isComplete": false, "metrics": { "clicks": 4, "impressions": 1036, "reach": 1011, "frequency": 0, "ctr": 0, "cpm": 1.61, "cpp": 1.65, "cpc": 0 }, "network": "facebook", "postId": "DE6gpw8kxlonHy6eb7L1", "spend": 1.67, "spendDate": "2025-04-02T00:00:00.000Z", "status": "ACTIVE" } ], "dateRange": { "start": "2025-02-24T20:02:34.613Z", "end": "2025-03-26T20:02:34.613Z", "postId": "eSNkaAiFZVin6wm6f" }, "metrics": { "totalSpend": 3.25, "totalClicks": 7, "totalImpressions": 2071, "totalReach": 2052, "averageCTR": 0.1, "averageFrequency": 0, "cpm": 0.79, "cpp": 0.85, "cpc": 0.2, "costPerResult": 1.2, "byGoalType": { "engagement": { "spend": 7.62, "impressions": 9332, "clicks": 0, "reach": 8502, "count": 8, "ctr": 0, "cpm": 0.8165452207458208, "cpp": 0.8962597035991532, "cpc": 0 } }, "byGoalTitle": { "Get More Engagement": { "spend": 3.25, "impressions": 2071, "clicks": 7, "reach": 2052, "count": 1, "type": "engagement", "ctr": 0.1, "cpm": 0.79, "cpp": 0.85, "cpc": 0.2 } }, "goalPerformance": { "bestPerformingGoalType": { "type": "engagement", "clicks": 7, "spend": 3.25, "ctr": 0.1 }, "mostEfficientGoalType": { "type": "engagement", "cpc": 0.2, "spend": 3.25 } }, "count": 2, "firstDay": "2025-03-17T00:00:00.000Z", "lastDay": "2025-03-23T00:00:00.000Z" } } ``` ```json 200: Success by Ad ID theme={"system"} { "status": "success", "history": [ { "accountId": "274948332", "adId": "6683876017505", "adName": "API Post 13 - DE6gpw8kxlonHy6eb7Lo - 2025-03-30T17:11:26", "budgetDaily": 4, "budgetType": "", "deliveryStatus": "ACTIVE", "fbPostId": "106638148652329_672633202087926", "goal": { "description": "This goal seeks to increase engagement while ensuring that the ad reaches the maximum number of unique users. It balances visibility with engagement, showing the ad to as many different people as possible who may interact with it.", "title": "Get More Engagement", "type": "engagement" }, "isActive": true, "isComplete": false, "metrics": { "clicks": 2, "cpc": 0, "cpp": 1.6, "cpm": 1.55, "ctr": 0, "frequency": 0, "impressions": 452, "reach": 438 }, "network": "facebook", "postId": "DE6gpw8kxlonHy6eb7Lo", "spend": 0.7, "spendDate": "2025-04-03T00:00:00.000Z", "status": "ACTIVE" }, { "accountId": "274948332", "adId": "6683876017505", "adName": "API Post 13 - DE6gpw8kxlonHy6eb7Lo - 2025-03-30T17:11:26", "budgetDaily": 4, "budgetType": "daily", "deliveryStatus": "ACTIVE", "fbPostId": "106638148652329_672633202087926", "goal": { "description": "This goal seeks to increase engagement while ensuring that the ad reaches the maximum number of unique users. It balances visibility with engagement, showing the ad to as many different people as possible who may interact with it.", "title": "Get More Engagement", "type": "engagement" }, "isActive": true, "isComplete": false, "metrics": { "clicks": 1, "cpc": 0, "cpp": 1.5, "cpm": 1.5, "ctr": 0, "frequency": 0, "impressions": 2793, "reach": 2793 }, "network": "facebook", "postId": "DE6gpw8kxlonHy6eb7Lo", "spend": 4.19, "spendDate": "2025-04-02T00:00:00.000Z", "status": "ACTIVE" } ], "dateRange": { "start": "2025-03-04T18:49:18.159Z", "end": "2025-04-03T18:49:18.159Z", "adId": "6683876017505" }, "metrics": { "totalSpend": 4.89, "totalClicks": 3, "totalImpressions": 10553, "totalReach": 10339, "averageCTR": 0.03, "averageFrequency": 0, "cpm": 1.460248270633943, "cpp": 1.49047296643776, "cpc": 5.136666666666667, "costPerResult": 5.14, "byGoalType": { "engagement": { "spend": 4.89, "impressions": 10553, "clicks": 3, "reach": 10339, "count": 2, "ctr": 0.03, "cpm": 1.46, "cpp": 1.49, "cpc": 5.14 } }, "byGoalTitle": { "Get More Engagement": { "spend": 4.89, "impressions": 10553, "clicks": 3, "reach": 10339, "count": 2, "type": "engagement", "ctr": 0.03, "cpm": 1.5, "cpp": 1.49, "cpc": 5.14 } }, "goalPerformance": { "bestPerformingGoalType": { "type": "engagement", "clicks": 3, "spend": 4.89, "ctr": 0.03 }, "mostEfficientGoalType": { "type": "engagement", "cpc": 5.14, "spend": 4.89 } }, "count": 2, "firstDay": "2025-03-30T00:00:00.000Z", "lastDay": "2025-04-03T00:00:00.000Z" } } ``` ```json 400: Ad spend error theme={"system"} { "action": "get ad spend", "status": "error", "code": 367, "message": "Error getting ad spend. Please verify you have an active ad account." } ``` # Interests Source: https://www.ayrshare.com/docs/apis/ads/facebook/get-ad-interests GET /ads/facebook/interests Get Facebook Ad Interests Search for available Facebook ad targeting interests by keyword. Use this endpoint to look up interest IDs for the [Boost Post](/docs/apis/ads/facebook/boost-post) endpoint. This endpoint helps you discover interest-based targeting options for your Facebook ads, along with audience size estimates.
  • Interest IDs can be used in the `interests` array when boosting posts.
  • Results are cached for 10 minutes.
  • Use specific, relevant search terms for best results.
  • Facebook may return different results based on your ad account's industry and region.
  • The `audienceSizeLowerBound` and `audienceSizeUpperBound` fields in the JSON response provide an estimated range of audience size for the interest and it is useful for targeting.
## Header Parameters ## Query Parameters The search query to retrieve Facebook ad interests. Don't forget to escape the search query, for example `Rhythm%20and%20blues%20music`. Limit the number of ad interests returned. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY" ], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY"); var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } ``` ```go Go theme={"system"} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music", nil) req.Header.Add("Authorization", "Bearer API_KEY") resp, _ := client.Do(req) body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetAdInterests { public static void main(String[] args) throws Exception { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music")) .header("Authorization", "Bearer API_KEY") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'json' uri = URI('https://api.ayrshare.com/api/ads/facebook/interests?search=Rhythm%20and%20blues%20music') req = Net::HTTP::Get.new(uri) req['Authorization'] = 'Bearer API_KEY' res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) } puts res.body ``` ```json 200: Success theme={"system"} { "status": "success", "interests": [ { "id": "6003195554098", "name": "Rhythm and blues music", "topic": "News and entertainment", "audienceSizeLowerBound": 669180255, "audienceSizeUpperBound": 786955980 }, { "id": "6003470511564", "name": "Do it yourself (DIY)", "topic": "Hobbies and activities", "audienceSizeLowerBound": 418387661, // Lower bound of audience size "audienceSizeUpperBound": 492023890 // Upper bound of audience size }, { "id": "6002926036121", "name": "Italy", "topic": "Travel, places and events", "audienceSizeLowerBound": 279313350, // Lower bound of audience size "audienceSizeUpperBound": 328472500 // Upper bound of audience size } ], "count": 3, "lastUpdated": "2025-03-27T01:01:38.547Z", "nextUpdate": "2025-03-27T01:12:38.547Z" } ``` ```json 400: Ad interests error theme={"system"} { "action": "get ad interests", "status": "error", "code": 368, "message": "Error getting ad interests. Please try again or contact us if the issue persists." } ``` # Regions Source: https://www.ayrshare.com/docs/apis/ads/facebook/get-ad-regions GET /ads/facebook/regions Get Facebook Ad Regions by Name Search for regions (states, provinces, etc.) to be used for targeting when boosting an ad.
  • Regions use Facebook's key identifier. Use this key when boosting ads with region targeting.
  • If a returned region has supportsRegion true, you can target this region. If supportsCity is true, the region has city codes.
  • To get all countries that support region targeting, call this endpoint without query parameters.
  • Results may vary based on Facebook data availability.
## Header Parameters ## Query Parameters The search string to filter regions. Provide a partial or full region name. Maximum number of regions to return. ```bash cURL theme={"system"} # All countries that support region targeting curl \ -H "Authorization: Bearer API_KEY" \ -X GET "https://api.ayrshare.com/api/ads/facebook/regions" ``` ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET "https://api.ayrshare.com/api/ads/facebook/regions?search=al" ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/regions?search=al", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/ads/facebook/regions?search=al', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/ads/facebook/regions?search=al", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY" ], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY"); var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/regions?search=al"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } ``` ```go Go theme={"system"} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/regions?search=al", nil) req.Header.Add("Authorization", "Bearer API_KEY") resp, _ := client.Do(req) body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetAdRegions { public static void main(String[] args) throws Exception { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ayrshare.com/api/ads/facebook/regions?search=al")) .header("Authorization", "Bearer API_KEY") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'json' uri = URI('https://api.ayrshare.com/api/ads/facebook/regions?search=al') req = Net::HTTP::Get.new(uri) req['Authorization'] = 'Bearer API_KEY' res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) } puts res.body ``` ```json 200: Success theme={"system"} { "status": "success", "regions": [ { "key": "3843", "name": "Alabama", "type": "region", "countryCode": "US", "countryName": "United States", "supportsRegion": true, "supportsCity": true }, { "key": "3844", "name": "Alaska", "type": "region", "countryCode": "US", "countryName": "United States", "supportsRegion": true, "supportsCity": true } ], "count": 2 } ``` ```json 414: Location metadata error theme={"system"} { "action": "ads", "status": "error", "code": 414, "message": "Error getting ad location metadata. Please try again." } ``` # Boosted Ads Source: https://www.ayrshare.com/docs/apis/ads/facebook/get-boosted-ads GET /ads/facebook/ads Get boosted ads from your Facebook account Retrieve ads that have been boosted for a specific Facebook post. This boosted ads endpoint provides detailed information about the boosted ads, including status, current spend, performance metrics (analytics), and preview links.
  • The metrics are real-time totals for the ads. If you need historical data, use the [get ad history endpoint](/docs/apis/ads/facebook/get-ad-history).
  • The `previewLink` URL allows you share the preview ad with your colleagues, so that they will see the ad for 24-hours across the various Facebook formats. Your colleagues' views of the ad will not be counted towards your ad spend.
## Header Parameters ## Query Parameters Retrieve all ads under the account ID. Required if `adId`, `fbPostId`, or `postId` is not set. Retrieve an ad with the ad ID. Required if `accountId`, `fbPostId`, or `postId` is not set. Retrieve ads with the [Facebook social post ID](/docs/apis/overview#social-post-id). Required if `accountId`, `adId`, or `postId` is not set. Retrieve a maximum of `limit` ads. Maximum is 500. Retrieve ads with the Ayrshare [post ID](/docs/apis/overview#ayrshare-post-id). Required if `accountId`, `adId`, or `fbPostId` is not set. Filter ads by status of the ad. Valid values are:
  • `active`
  • `paused`
  • `deleted`
  • `archived`
```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/ads/facebook/ads?adId=1234567890 ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/ads?adId=1234567890", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/ads/facebook/ads?adId=1234567890', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} true, CURLOPT_HTTPHEADER => $headers ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; namespace HistoryGETRequest_csharp { class History { static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/ads/facebook/ads?adId=1234567890"; using (var client = new HttpClient()) { client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); try { var response = await client.GetStringAsync(url); Console.WriteLine(response); } catch (HttpRequestException ex) { Console.WriteLine($"Error: {ex.Message}"); } } } } } ``` ```json 200: Success with Ad ID theme={"system"} { "status": "success", "ads": [ { "postId": "DE6gpw8kxlonHy6eb721", "ad": { "accountId": "274948331", "adId": "6683876017501", "budgetRemaining": 0, "created": "2025-03-30T10:11:34-0700", "creativeId": "1033490148629541", "dailyBudget": 0, "deliveryStatus": "ACTIVE", "endDate": "2025-04-03T22:30:00.000Z", "fbPostId": "106638148652329_672633202087922", "goal": { "title": "Get More Engagement", "description": "This goal seeks to increase engagement while ensuring that the ad reaches the maximum number of unique users. It balances visibility with engagement, showing the ad to as many different people as possible who may interact with it.", "type": "engagement" }, "isComplete": false, "lifetimeBudget": 0, "metrics": { "spend": 9.21, "impressions": 6495, "reach": 6272, "clicks": 3, "ctr": 0.046189, "cpm": 1.418014, "cpp": 1.468431, "frequency": 1.035555, "uniqueClicks": 3, "uniqueCtr": 0.047832, "costPerUniqueClick": 3.07, "inlineLinkClicks": 0, "costPerInlineLinkClick": 0, "outboundClicks": 0, "costPerOutboundClick": 0, "websiteCtr": [], "accountCurrency": "USD", "accountName": "John Doe", "accountId": "274948331" }, "name": "API Post - DE6gpw8kxlonHy6eb7L1 - 2025-03-30T17:11:26", "previewLink": "https://fb.me/22Cn31wXlzhxOC1", "spend": 9.21, "startDate": "2025-03-30T17:11:32.000Z", "status": "ACTIVE", "targeting": { "ageMax": 65, "ageMin": 18, "geoLocations": { "countries": [ "US" ], "locationTypes": [ "home", "recent" ] }, "interests": [ { "id": "6003195554098", "name": "Rhythm and blues music" } ] } } } ], "count": 1 } ``` ```json 200: Success with Account ID theme={"system"} { "status": "success", "ads": [ { "postId": "DE6gpw8kxlonHy6eb7Lo", "ad": { "accountId": "274948331", "adId": "6683876017501", "budgetRemaining": 0, "created": "2025-03-30T10:11:34-0700", "creativeId": "1033490148629541", "dailyBudget": 0, "deliveryStatus": "ACTIVE", "endDate": "2025-04-03T22:30:00.000Z", "fbPostId": "106638148652329_672633202087921", "goal": { "title": "Get More Engagement", "description": "This goal seeks to increase engagement while ensuring that the ad reaches the maximum number of unique users. It balances visibility with engagement, showing the ad to as many different people as possible who may interact with it.", "type": "engagement" }, "isComplete": false, "lifetimeBudget": 0, "metrics": { "spend": 9.21, "impressions": 6495, "reach": 6272, "clicks": 3, "ctr": 0.046189, "cpm": 1.418014, "cpp": 1.468431, "frequency": 1.035555, "uniqueClicks": 3, "uniqueCtr": 0.047832, "costPerUniqueClick": 3.07, "inlineLinkClicks": 0, "costPerInlineLinkClick": 0, "outboundClicks": 0, "costPerOutboundClick": 0, "websiteCtr": [], "accountCurrency": "USD", "accountName": "John Doe", "accountId": "274948331" }, "name": "API Post - DE6gpw8kxlonHy6eb7Lo - 2025-03-30T17:11:26", "previewLink": "https://fb.me/22Cn31wXlzhxOC1", "spend": 9.21, "startDate": "2025-03-30T17:11:32.000Z", "status": "ACTIVE", "targeting": { "ageMax": 65, "ageMin": 18, "geoLocations": { "countries": ["US"], "locationTypes": ["home", "recent"] }, "interests": [ { "id": "6003195554098", "name": "Rhythm and blues music" } ] } } }, { "ad": { "accountId": "274948331", "adId": "6685225314301", "budgetRemaining": 0, "created": "2025-03-30T18:36:39-0700", "creativeId": "628434386637341", "dailyBudget": 0, "deliveryStatus": "PAUSED", "endDate": "2025-04-03T22:30:00.000Z", "fbPostId": "106638148652329_672633202087921", "goal": { "title": "Get More Engagement", "description": "This goal seeks to increase engagement while ensuring that the ad reaches the maximum number of unique users. It balances visibility with engagement, showing the ad to as many different people as possible who may interact with it.", "type": "engagement" }, "isComplete": false, "lifetimeBudget": 0, "metrics": {}, "name": "API Post 14 - 106638148652329_672633202087926 - 2025-03-31T01:36:32", "previewLink": "https://fb.me/2nPlTIZEpzrCnY1", "spend": 0, "startDate": "2025-03-31T01:36:37.000Z", "status": "PAUSED", "targeting": { "ageMax": 65, "ageMin": 18, "geoLocations": { "countries": ["US"], "locationTypes": ["home", "recent"] }, "interests": [ { "id": "6003195554098", "name": "Rhythm and blues music" } ] } } } ], "count": 2 } ``` ```json 400: Submitted ads retrieval error theme={"system"} { "action": "get ads", "status": "error", "code": 370, "message": "Error getting ads. Please try again or contact us if the issue persists." } ``` # DSA Recommendations Source: https://www.ayrshare.com/docs/apis/ads/facebook/get-dsa-recommendations GET /ads/facebook/dsaRecommendations Get Facebook DSA Recommendations Get Digital Services Act (DSA) recommendations for your Facebook ad account. As part of the requirements set forth by the European Union (EU) Digital Services Act (DSA), [Facebook requires ads targeting](https://www.facebook.com/business/help/605021638170961) any part of the EU to provide string values defining the beneficiary and payor of the ad being created This endpoint provides a list of recommended DSA beneficiaries and payors that can be used when boosting posts. These fields may be used in [`dsaBeneficiary`](/docs/apis/ads/facebook/boost-post#param-dsa-beneficiary) and [`dsaPayor`](/docs/apis/ads/facebook/boost-post#param-dsa-payor).
  • Outputs a list of strings (maximum 25) that Facebook has identified to likely be the beneficiary/payor, based on recent activity of the ad account.
  • These recommendations can be used as values for the `dsaBeneficiary` and `dsaPayor` parameters in the [Boost Post](/docs/apis/ads/facebook/boost-post) endpoint.
  • Both `dsaBeneficiary` and `dsaPayor` must be set together if either is provided when boosting posts.
## Header Parameters ## Query Parameters The ID of the Facebook ad account to get DSA recommendations for. The account ID can be retrieved from the [ad accounts endpoint](/docs/apis/ads/facebook/get-ad-accounts). ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890 ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY" ], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main() { var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY"); var response = await client.GetAsync("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } ``` ```go Go theme={"system"} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890", nil) req.Header.Add("Authorization", "Bearer API_KEY") resp, _ := client.Do(req) body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetDsaRecommendations { public static void main(String[] args) throws Exception { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890")) .header("Authorization", "Bearer API_KEY") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'json' uri = URI('https://api.ayrshare.com/api/ads/facebook/dsaRecommendations?accountId=1234567890') req = Net::HTTP::Get.new(uri) req['Authorization'] = 'Bearer API_KEY' res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) } puts res.body ``` ```json 200: Success theme={"system"} { "status": "success", "dsaRecommendations": [ "Beneficiary 1", "Beneficiary 2", "Beneficiary 3" ], "count": 1 } ``` ```json 413: DSA Recommendations Error theme={"system"} { "action": "ads", "status": "error", "code": 413, "message": "There was an error getting the DSA recommendations. Please try again." } ``` # Update Ad Source: https://www.ayrshare.com/docs/apis/ads/facebook/put-ad-update PUT /ads/facebook/ads Update an Ad Update the status of a boosted ad to make it active, paused, deleted, or archived. ## Header Parameters ## Body Parameters The boosted ad ID to update. The status of the ad. Values: `active`, `paused`, `deleted`, or `archived`. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X PUT https://api.ayrshare.com/api/ads/facebook/ads -d '{"adId": 1234567890, "status": "active"}' ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/ads/facebook/ads", { method: "PUT", headers: { "Authorization": `Bearer ${API_KEY}` }, body: JSON.stringify({ adId: 1234567890, status: "active" }) }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.put('https://api.ayrshare.com/api/ads/facebook/ads', headers=headers, json={"adId": 1234567890, "status": "active"}) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/ads/facebook/ads", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY" ], CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_POSTFIELDS => json_encode(["adId" => 1234567890, "status" => "active"]) ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error: " . $err; } else { echo $response; } ?> ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY"); var response = await client.PutAsync("https://api.ayrshare.com/api/ads/facebook/ads", new StringContent(JsonConvert.SerializeObject(new { adId = 1234567890, status = "active" }), Encoding.UTF8, "application/json")); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } ``` ```go Go theme={"system"} package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, _ := http.NewRequest("PUT", "https://api.ayrshare.com/api/ads/facebook/ads", nil) req.Header.Add("Authorization", "Bearer API_KEY") resp, err := client.Do(req) if err != nil { fmt.Println("Error:", err) return } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={"system"} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class GetAdSpend { public static void main(String[] args) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.ayrshare.com/api/ads/facebook/ads")) .header("Authorization", "Bearer API_KEY") .PUT(HttpRequest.BodyPublishers.ofString(Json.stringify(new { adId = 1234567890, status = "active" }))) .build(); try { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } catch (Exception e) { e.printStackTrace(); } } } ``` ```ruby Ruby theme={"system"} require 'net/http' require 'json' require 'uri' uri = URI.parse('https://api.ayrshare.com/api/ads/facebook/ads') request = Net::HTTP::Put.new(uri) request['Authorization'] = 'Bearer API_KEY' request.body = JSON.generate({ adId: 1234567890, status: "active" }) response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| http.request(request) end puts response.body ``` ```json 200: Success theme={"system"} { "status": "success", "adId": "6691084804905", "requestedStatus": "ACTIVE" } ``` ```json 400: Ad update error theme={"system"} { "action": "request", "status": "error", "code": 101, "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis", "details": "Invalid status: actives. Status must be either 'active', 'paused', 'deleted', or 'archived'." } ``` # Ads API Overview Source: https://www.ayrshare.com/docs/apis/ads/overview Boost your posts by making them into Facebook ads using Ayrshare's API. ## Introduction to the Ads API The Ayrshare Ads API provides programmatic access to create, manage, and analyze social media ads. Currently supporting **Facebook**, the Facebook Ads API, also known as the Facebook Marketing API, allows you to transform existing posts into paid advertisements. This includes boosting posts (transforming a post into an ad), managing ads, tracking performance, and analyzing ad spend. Ads created and updated via Ayrshare can always be found in the Facebook Ads Manager. Ayrshare handles all of the settings at the ad, ad set, and campaign levels. There is never a need to manually edit any of the settings directly in the Facebook Ads Manager. 1. The Ads capabilites require the paid Ads add-on which can be enabled on the Account page of the [web dashboard](https://app.ayrshare.com/account). 2. The user must have [linked a payment method](https://business.facebook.com/billing_hub/payment_settings/?placement=ads_manager) at Facebook (Meta) prior to creating an ad. 3. User Profiles linked with a Facebook Page prior to April 1, 2025 should be re-linked to enable ads. For more information, see our [Facebook Ads API guide](https://www.ayrshare.com/blog/facebook-ads-api-boosting-with-the-marketing-api/). ## Create an Ad Flow Ads Flow Boosting a post on Facebook is a quick and simple way to turn one of your existing posts into an ad. Here is a high-level flow of how to implement it in your platform: Your user will choose the Facebook ad account which has all the billing details already configured. Select a post from your Facebook page. It can be a photo, video, status update, etc. > **Tip:** Posts with good organic engagement (likes, shares, comments) tend to perform better when boosted. Your user will click a button such as "Boost Post" in your platform to start setting up the ad. The user can set a number of parameters.
  • Choose the goal strategy for this boosted post by selecting a goal.
  • Customize the audience based on age, gender, location, interests, etc.
  • Choose how much to spend total.
  • Set the time period to run the ad.
Double-check all the settings. If everything looks good, the user will click a button such as **"Boost Post Now"** button. Facebook will review the ad — this usually takes anywhere from a few minutes to a few hours. Once approved, the boosted post goes live and runs according to the setup. Monitor the following: * Reach * Engagement * Clicks * Spend * Budget Remaining
## Ads API Best Practices 1. **Budget Management**: Start with small test budgets (e.g., \$5-10/day) to optimize performance before scaling. 2. **Ad Duration**: Facebook requires a minimum ad runtime of approximately 30 hours between start and end times. 3. **Interest Targeting**: Choose 2-5 relevant interests for optimal targeting precision. 4. **Creative Guidelines**: Use high-quality images and concise messaging to improve engagement rates. 5. **Performance Monitoring**: Regularly check your ad performance and adjust targeting or creative elements as needed. For detailed information about each endpoint, including request parameters, response formats, and examples, please refer to the individual API endpoint documentation pages. # Count of Instagram Followers Online Source: https://www.ayrshare.com/docs/apis/analytics/instagram-follower-count GET /analytics/getInstagramOnlineFollowers Retrieve the total historical count of your Instagram followers Retrieve the total historical count of your Instagram followers online per hour, which allows you to optimize posting for maximum engagement.
  • Not available on IG Users with fewer than 100 followers.
  • Analytics data only available for the last 30 days.
  • The time period for a requested day is the previous day at T07:00:00.000Z until the current day at T06:59:59.999Z in UTC. For example, use format `YYYY-MM-DDThh:mm:ssZ` and send as `2026-07-08T12:30:00Z`. Please see [utctime](https://www.utctime.net/) for more examples.
## Header Parameters ## Query Parameters A day with format: `YYYY-MM-DD`. For example, use format `YYYY-MM-DDThh:mm:ssZ` and send as `2026-07-08T12:30:00Z`. Please see [utctime](https://www.utctime.net/) for more examples. Format the output with UTC start and end dates. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03 ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const date = "2023-12-03"; fetch(`https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=${date}`, { method: "GET", headers: { Authorization: `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} ```json 200: Success theme={"system"} { "status": "success", "onlineFollowersByHour": { "0": 120, // 12 AM "1": 113, // 1 AM "2": 117, // 2 AM "3": 110, // 3 AM "4": 129, // 4 AM "5": 170, // 5 AM "6": 166, // 6 AM "7": 173, // 7 AM "8": 177, // 8 AM "9": 168, // 9 AM "10": 178, // 10 AM "11": 160, // 11 AM "12": 154, // 12 PM "13": 153, // 1 PM "14": 131, // 2 PM "15": 118, // 3 PM "16": 109, // 4 PM "17": 128, // 5 PM "18": 129, // 6 PM "19": 134, // 7 PM "20": 123, // 8 PM "21": 111, // 9 PM "22": 102, // 10 PM "23": 98 // 11 PM }, "startTime": "2024-03-29T07:00:00.000Z", "endTime": "2024-03-30T07:00:00.000Z" } ``` ```json 200: Success formatUTC theme={"system"} { "status": "success", "onlineFollowersByHour": [ { "start": "2024-03-29T07:00:00.000Z", "end": "2024-03-29T07:59:59.999Z", "onlineFollowers": 33 }, { "start": "2024-03-29T08:00:00.000Z", "end": "2024-03-29T08:59:59.999Z", "onlineFollowers": 90 }, { "start": "2024-03-29T09:00:00.000Z", "end": "2024-03-29T09:59:59.999Z", "onlineFollowers": 21 }, { "start": "2024-03-29T10:00:00.000Z", "end": "2024-03-29T10:59:59.999Z", "onlineFollowers": 109 }, { "start": "2024-03-29T11:00:00.000Z", "end": "2024-03-29T11:59:59.999Z", "onlineFollowers": 99 }, { "start": "2024-03-29T12:00:00.000Z", "end": "2024-03-29T12:59:59.999Z", "onlineFollowers": 10 }, { "start": "2024-03-29T13:00:00.000Z", "end": "2024-03-29T13:59:59.999Z", "onlineFollowers": 82 }, { "start": "2024-03-29T14:00:00.000Z", "end": "2024-03-29T14:59:59.999Z", "onlineFollowers": 101 }, { "start": "2024-03-29T15:00:00.000Z", "end": "2024-03-29T15:59:59.999Z", "onlineFollowers": 91 }, { "start": "2024-03-29T16:00:00.000Z", "end": "2024-03-29T16:59:59.999Z", "onlineFollowers": 12 }, { "start": "2024-03-29T17:00:00.000Z", "end": "2024-03-29T17:59:59.999Z", "onlineFollowers": 93 }, { "start": "2024-03-29T18:00:00.000Z", "end": "2024-03-29T18:59:59.999Z", "onlineFollowers": 21 }, { "start": "2024-03-29T19:00:00.000Z", "end": "2024-03-29T19:59:59.999Z", "onlineFollowers": 95 }, { "start": "2024-03-29T20:00:00.000Z", "end": "2024-03-29T20:59:59.999Z", "onlineFollowers": 97 }, { "start": "2024-03-29T21:00:00.000Z", "end": "2024-03-29T21:59:59.999Z", "onlineFollowers": 101 }, { "start": "2024-03-29T22:00:00.000Z", "end": "2024-03-29T22:59:59.999Z", "onlineFollowers": 74 }, { "start": "2024-03-29T23:00:00.000Z", "end": "2024-03-29T23:59:59.999Z", "onlineFollowers": 61 }, { "start": "2024-03-30T00:00:00.000Z", "end": "2024-03-30T00:59:59.999Z", "onlineFollowers": 31 }, { "start": "2024-03-30T01:00:00.000Z", "end": "2024-03-30T01:59:59.999Z", "onlineFollowers": 28 }, { "start": "2024-03-30T02:00:00.000Z", "end": "2024-03-30T02:59:59.999Z", "onlineFollowers": 19 }, { "start": "2024-03-30T03:00:00.000Z", "end": "2024-03-30T03:59:59.999Z", "onlineFollowers": 21 }, { "start": "2024-03-30T04:00:00.000Z", "end": "2024-03-30T04:59:59.999Z", "onlineFollowers": 23 }, { "start": "2024-03-30T05:00:00.000Z", "end": "2024-03-30T05:59:59.999Z", "onlineFollowers": 92 }, { "start": "2024-03-30T06:00:00.000Z", "end": "2024-03-30T06:59:59.999Z", "onlineFollowers": 32 } ], "startTime": "2024-03-29T07:00:00.000Z", "endTime": "2024-03-30T07:00:00.000Z" } ``` ```json 200: Success No Data theme={"system"} { "status": "success", "onlineFollowersByHour": {} } ``` ```json 400: Incorrect date theme={"system"} { "action": "request", "status": "error", "code": 101, "message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints" } ``` # Analytics API Overview Source: https://www.ayrshare.com/docs/apis/analytics/overview Get real-time analytical data for posts and social accounts, such as clicks, likes, shares, followers, and impressions One of the key capabilities of Ayrshare is the ability to get real-time analytics on your posts and social accounts. Specifically, you can measure and analyze your users' content performance and engagement, such as video views, likes, link clicks, and shares, and the influence of your users. With the analytics data, you can build custom reports for your users, feed the data back into your AI model, or do analysis of post performance. There are three main type of analytics endpoints: 1. Post Analytics: Get analytics on a post 2. Social Analytics: Get analytics on a social account 3. Link Analytics: Get analytics on a shortened link ## Post Analytics Individual post analytics are available. This is great if you want detailed analytics on a particular post, either one sent via Ayrshare or manually published at the social network. Post analytics are available for the following social networks:
  • Bluesky
  • Facebook
  • Instagram
  • LinkedIn
  • Pinterest
  • Reddit
  • Snapchat
  • Threads
  • TikTok
  • YouTube
  • X/Twitter
The analytics may be retrieved for a specific post by providing either the Ayrshare post ID or the original post's Social Post ID. ## Social Analytics You can also get the account level social analytics, such as engagement, follower count and demographics, and account meta data. Use this endpoint if you want to get the analytics for an entire social account, rather than a specific post. Social account level analytics are available for the following social networks:
  • Facebook
  • Google Business Profile
  • Instagram
  • LinkedIn
  • Pinterest
  • Reddit
  • Snapchat
  • Threads
  • TikTok
  • YouTube
  • X/Twitter
You may also choose to get aggregated summary or daily social analytics. ## Link Analytics You can also get analytics on a shortened link. This is great if you want to know how many clicks a link has received, either one sent via Ayrshare or manually published at the social network. Link analytics can be found in the /links endpoint. Get analytics on a shortened link. # Analytics on a Post Source: https://www.ayrshare.com/docs/apis/analytics/post POST /analytics/post Retrieve real-time likes, impressions, views, and reactions for a post sent via Ayrshare, with multiplatform partial-success handling. Get real-time analytics such as likes, impressions, views, and reactions for a post that was sent via Ayrshare using the [Ayrshare Post ID](/docs/apis/overview#ayrshare-post-id). For analytics on posts originating outside of Ayrshare, see [Analytics by Social Post ID](/docs/apis/analytics/social-by-id). **Facebook: some reach and video metrics were retired by Meta (June 15, 2026).** Meta removed the unique-impression and 3-second video-view Insights metrics across all Graph API versions, so the Facebook `analytics` object no longer returns `impressionsUnique`, `impressionsFanUnique`, `impressionsOrganicUnique`, `impressionsPaidUnique`, or `videoViewsUnique`. Use `mediaView` for reach (a Total Unique Media Views successor is planned). Other commonly used fields such as `reactionsByType` and `videoViews` are unaffected. Reference: [Upcoming API Changes — June 15, 2026](/docs/whatsnew/upcoming-api-changes#june-15-2026). #### Additional Information
  • The following platforms are currently supported: Bluesky, Facebook Pages, Instagram, X/Twitter, LinkedIn, Pinterest, Reddit, Snapchat, Threads, TikTok, and YouTube.
  • Facebook and Instagram comment counts shown in the API may differ from counts displayed in the social apps. This occurs for two reasons: - Some users have privacy settings that hide their comments from non-friends or users without mutual connections. These private comments are still included in the total comment count. - There may be inconsistencies in the data reported by Meta.
  • Instagram igReelsAggregatedAllPlaysCount and playsCount shown in the API may differ from the counts displayed in the social apps. This can occur for a couple of reasons:
    • The post was promoted. Only organic plays are included in the API response.
    • There may be inconsistencies in the data reported by Meta.
  • X/Twitter Threads return as an Array of objects, with each object corresponding to a Tweet in the Thread.
  • YouTube can take 24-48 hours to process analytics for videos with few video views or channel followers.
  • TikTok Analytics:
    • TikTok can take 24-48 hours to update their analytics data, such as video views, demographics, likes, shares, and comments.
    • For TikTok analytics access, account owners must: 1. Publish at least one video. 2. Tap the "[Turn On](https://www.tiktok.com/feedback?id=7133058093574806018\&lang=en\&type=)" button on the Analytics page of their mobile TikTok app. 3. Have 100 followers to receive additional insights about viewers and content engagement.
    • TikTok does not return post analytics if the media contains copyrighted material or has been flagged for a copyright violation. Examples of copyrighted material can include audio on reels (TikTok will mute these videos). You can check in the TikTok app under Activity -> System Notifications.
    • Some TikTok analytics fields may be unavailable if the video has been inactive for more than 7 days. To retrieve this data, generate new activity on the video (view, like, comment, or share) and retry after 24-48 hours. If a video is not returned in the response, the reason is likely to be that the video has been filtered out due to violations, such as music copyright violation. These fields include:
      • `reach`
      • `fullVideoWatchedRate`
      • `totalTimeWatched`
      • `averageTimeWatched`
      • `impressionSources`
      • `audienceCountries`
  • LinkedIn personal (member) profiles now return an expanded post analytics matrix. The available member metrics are:
    • `impressionCount` — Impressions on the post
    • `uniqueImpressionsCount` — Unique members reached (LinkedIn `MEMBERS_REACHED`)
    • `likeCount` — Reaction count
    • `commentCount` — Comments count
    • `shareCount` — Reshares of the post
    • `engagement` — Organic clicks, likes, comments, and shares over impressions
    • `reactions` — Per-type reaction breakdown (when reactions are present)
    • For video posts: `videoViews`, `videoViewers`, and `videoWatchTimeMs`
    Video metrics are only returned for video posts and are unavailable more than one year after the post was created.
  • Instagram Story insights are only available for 24 hours, regardless of whether stories are archived or highlighted. Note:
    • Story media metrics with values less than `5` return as `0`.
    • For Stories created by users in Europe and Japan, the `replies` metric returns a value of `0`.
  • Facebook Story analytics are not available.
  • Pinterest analytics data (impressions, user followers, and clicks) becomes available after 24-72 hours.
  • For YouTube Shorts, views will return the number of times a Short starts to play or replay, with no minimum watch time requirement.
## Multiplatform Reads & Partial Success A single [Ayrshare Post ID](/docs/apis/overview#ayrshare-post-id) can span several platforms. Ayrshare fans out one request ("leg") per platform and returns a **partial success** when some legs succeed and others fail — the healthy platforms' analytics are always returned, and each failed leg is enumerated in a top-level `errors[]` array.
  • Some platforms succeed, some fail: the response is HTTP 200 with status: "partial". The healthy per-platform `analytics` blocks are returned as usual, and a top-level errors\[] array lists every failed leg with its platform, status, code, message, and id.
  • Every platform fails: the response has status: "error" and the full errors\[] array. The HTTP status is mapped from the representative top-level error code. Code 485 maps to HTTP 404; other representative codes use their own mappings.
  • All platforms succeed: the response is unchanged — HTTP 200, status: "success", and no errors\[] key.
**Behavior change — inspect `errors[]`, don't branch on HTTP status.** Because a multiplatform read with a failing leg now returns HTTP `200` instead of collapsing the whole response to an error, integrators should always check for the presence of a top-level `errors[]` array to detect per-platform failures rather than relying on the HTTP status code alone. ### Expired or Unavailable Instagram Story Analytics An Instagram Story analytics leg that is expired or unavailable — so its insights cannot be retrieved — surfaces in `errors[]` with code [`485`](/docs/errors/errors-ayrshare#expired-or-unavailable-story-errors). A representative message is *"Instagram Story expired or unavailable — comments/insights cannot be retrieved."* Facebook Story analytics remain unavailable and are not covered by this behavior. If another platform succeeds, its analytics are still returned and the overall response is **HTTP `200`**. For an all-fail response, representative code `485` maps to HTTP `404`; other representative codes use their own mappings. Match on the `code` (`485`), not the exact message text. (See also the note above: Instagram Story insights are only available for 24 hours.) #### Example: Partial Success Response ```json 200: Partial Success theme={"system"} { "facebook": { "id": "1397547544885713_2159201585286968", "postUrl": "https://www.facebook.com/1397547544885713_2159201585286968", "analytics": { "commentsCount": 1, "likeCount": 23, "sharesCount": 12, "mediaView": 450 }, "lastUpdated": "2026-07-14T18:44:29.778Z", "nextUpdate": "2026-07-14T19:19:29.778Z" }, "status": "partial", "id": "IHvCLacgPc6hMU9IQ6oK", "errors": [ { "platform": "instagram", "status": "error", "code": 485, "message": "Instagram Story expired or unavailable — comments/insights cannot be retrieved.", "id": "17895695668004550" } ] } ``` ## Header Parameters ## Body Parameters [Ayrshare Post ID](/docs/apis/overview#ayrshare-post-id) returned from the [/post endpoint](/docs/apis/post/post). This is the top-level Ayrshare `id` returned and not the social post ids in `postIds`. String array of platforms to retrieve analytics. Accepts an array of strings with values: ```json theme={"system"} { "platforms": [ "bluesky", "facebook", "instagram", "linkedin", "pinterest", "reddit", "snapchat", "threads", "tiktok", "twitter", "youtube" ] } ``` If platforms is not included, analytics will be returned for all social networks to which the post was sent. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "id": "Post ID", "platforms": ["bluesky", "facebook", "instagram", "linkedin", "pinterest", "snapchat", "threads", "tiktok", "twitter", "youtube"]}' \ -X POST https://api.ayrshare.com/api/analytics/post ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/analytics/post", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}` }, body: JSON.stringify({ id: "Post ID", // required platforms: [ "bluesky", "facebook", "instagram", "linkedin", "pinterest", "snapchat", "threads", "tiktok", "twitter", "youtube" ] // optional }) }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'id': 'Post ID', 'platforms': ['bluesky', 'facebook', 'instagram', 'linkedin', 'pinterest', 'snapchat', 'threads', 'tiktok', 'twitter', 'youtube']} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/analytics/post', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} 'Post ID', // Replace with your actual Post ID 'platforms' => ['bluesky', 'facebook', 'instagram', 'linkedin', 'pinterest', 'snapchat', 'threads', 'tiktok', 'twitter', 'youtube'] // optional ]); $curl = curl_init($apiUrl); curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $data ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```go Go theme={"system"} package main import ( "bytes" "encoding/json" "log" "net/http" ) func main() { message := map[string]interface{}{ "id": "Post ID", "platforms": []string{"bluesky", "facebook", "instagram", "linkedin", "pinterest", "snapchat", "threads", "tiktok", "twitter", "youtube"}, } bytesRepresentation, err := json.Marshal(message) if err != nil { log.Fatalln(err) } req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/analytics/post", bytes.NewBuffer(bytesRepresentation)) req.Header.Add("Content-Type", "application/json; charset=UTF-8") req.Header.Add("Authorization", "Bearer API_KEY") res, err := http.DefaultClient.Do(req) if err != nil { log.Fatal("Error:", err) } res.Body.Close() } ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace PostAnalyticsPOSTRequest_csharp { class PostAnalytics { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/analytics/analytics/post"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); string json = "{\"id\": \"Post ID\"," + "\"platforms\": [\"bluesky\", \"facebook\", \"instagram\", \"linkedin\", \"pinterest\", \"snapchat\", \"tiktok\", \"twitter\", \"youtube\"]}"; try { var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(url, content); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` When cumulative metrics (e.g., likes, comments, views) are temporarily unavailable from the social network, the API automatically backfills them from stored data. Two optional fields may appear in the per-platform `analytics` object: * **`backfilledFrom`** (string, ISO 8601) — Present when one or more cumulative metrics were substituted from stored data. The timestamp indicates when the stored data was last updated. * **`recoveredFrom`** (string, ISO 8601) — Present when the entire analytics response was recovered from stored data due to a complete API failure. The timestamp indicates when the stored data was last updated. Stored data older than 4 days is considered stale and will not be used for backfill or recovery. **LinkedIn personal (member) analytics — re-link required.** Personal LinkedIn profiles linked before member post analytics shipped do not have the required analytics scopes. Analytics requests for those profiles return [error code `475`](/docs/errors/errors-ayrshare#linkedin-analytics-errors) ("re-link your LinkedIn profile to enable analytics"). The account owner must re-link their LinkedIn profile on the Social Accounts page to grant the new scopes. Allow a few minutes after re-linking for code `475` to clear (Ayrshare and LinkedIn both briefly cache the permission state, typically \~5-10 minutes). Posting is unaffected. LinkedIn member post counts are best-effort: the aggregate `shareCount` (RESHARE), `likeCount` (REACTION), and `commentCount` (COMMENT) totals may differ slightly from the numbers shown in the LinkedIn UI. ```json 200: Response {2, 24, 171, 253, 287, 331, 401, 417, 449, 463, 598, 751} theme={"system"} { "bluesky": { "id": "at://did:plc:n7atrjd22xgkmgwig6dzlhzd/app.bsky.feed.post/3lez7fwx457", // Bluesky Social Post ID "postUrl": "https://bsky.app/profile/madworlds.bsky.social/post/3lez7fwx457", "analytics": { "cid": "bafyreigh7nz7x6pl4atgsextqtcbh33mg66yqt3caeihutn7ojkmpdtnzm", // Bluesky Content ID "created": "2025-01-05T18:04:28.316Z", "id": "at://did:plc:n7atrjd22xgkmgwig6dzlhzd/app.bsky.feed.post/3lfb57nxgxs2e", // Bluesky Social Post ID "indexedAt": "2025-01-05T18:04:29.150Z", "labels": [], "likeCount": 3, "post": "The day is what you make it!", "postUrl": "https://bsky.app/profile/madworlds.bsky.social/post/3lez7fwx45723", "quoteCount": 2, "replyCount": 1, "repostCount": 1, "viewer": { // Information about the viewing user's relationship "threadMuted": false, // Whether the viewing user has muted the thread containing this content "embeddingDisabled": false // Whether embedding/sharing of this content is disabled for the viewing user } } }, /* If the FB page has fewer than 100 likes then not all analytics data available. */ "facebook": { "id": "1397547544885713_2159201585286968", // Facebook Social Post ID "postUrl": "https://www.facebook.com/1397547544885713_2159201585286968", "analytics": { "blueReelsPlayCount": 136, // Reels: The number of times your reel starts to play after an impression is already counted. This is defined as reels sessions with 1ms or more of playback and excludes replays. "commentsCount": 1, // Count of comment for the post // impressionsFanUnique / impressionsOrganicUnique / impressionsPaidUnique / impressionsUnique were retired by Meta (June 15, 2026); see the note at the top of this page. "likeCount": 23, // Count of likes for the post "likedBy": [ // Users who liked the post { "id": "7101149746568432", "name": "John Smith" } ], "mediaUrls": [ { "media": { "image": { "height": 405, "src": "https://scontent-lga3-1.xx.fbcdn.net/v/t", "width": 720 }, "source": "https://video-lga3-2.xx.fbcdn.net/o1/v/t2/f2/m69/AQN" }, "mediaType": "video", "type": "story" } ], "mediaView": 12, // The number of times this post was played or displayed. Content includes videos, posts, stories and ads. "mediaViewIsFromAds": 0, // The number of times this post was played or displayed from ads. "mediaViewIsFromFollowers": 0, // The number of times this post was played or displayed from followers. "postVideoAvgTimeWatched": 4470, // Reels: The average time (in ms) your reel was played, including any time spent replaying the reel during a single instance of it playing. Because this metric includes replays, this number could be greater than the total length of the reel "postVideoSocialActions": { // Reels: The number of comments, shares, and reactions on your reel "share": 1 }, "postVideoViewTime": 608011, // Reels: Total time (in ms) your reel was played, including any time spent replaying your reel. "reactions": { "like": 1, // Like reactions - The "like" reaction counts include both "like" and "care" reactions. "love": 1, // Love reactions "anger": 1, // Anger reactions "haha": 1, // Haha reactions "wow": 1, // Wow reactions "sorry": 1, // Sorry reactions "total": 6 // Total number of reactions }, "reactionsByType": 6, // The total types of reactions "sharesCount": 34, // Total number of times post shared /** The following fields are available for videos */ "totalVideo10SViews": 621, // Total number of times your video was viewed for 10 seconds or viewed to the end, whichever came first. "totalVideo10SViewsAutoPlayed": 564, // Number of times people clicked to play your video and viewed it for 10 seconds or viewed it to the end, whichever came first. "totalVideo10SViewsClickedToPlay": 46, // Number of times your video started automatically playing and people viewed it for 10 seconds, or viewed it to the end, whichever came first. "totalVideo10SViewsOrganic": 621, // Number of times your video was viewed for 10 seconds or viewed to the end, whichever came first, without a paid promotion. "totalVideo10SViewsPaid": 0, // Number of times your video was viewed for 10 seconds or viewed to the end, whichever came first, after a paid promotion. "totalVideo10SViewsSoundOn": 380, // Number of times your video sound was turned on and was viewed for 10 seconds or viewed to the end, whichever came first. "totalVideo10SViewsUnique": 621, // Number of unique people who viewed your video for 10 seconds or viewed to the end, whichever came first. "totalVideo15SViews": 525, // Total number of times your video was viewed for at least 15 seconds. "totalVideo60SExcludesShorterViews": 0, // Total number of times your video was viewed for 60 seconds only if the video is 60 seconds or longer. "totalVideoAvgTimeWatched": 8494, // Lifetime: Average time video viewed "totalVideoCompleteViews": 430, // Total number of times your video was watched at 95% of its length, including watches that skipped to this point. "totalVideoCompleteViewsAutoPlayed": 374, // Number of times your video started automatically playing and people watched it at 95% of its length, including watches that skipped to this point. "totalVideoCompleteViewsClickedToPlay": 56, // Number of times people clicked to play your video and watched it at 95% of its length, including watches that skipped to this point. "totalVideoCompleteViewsOrganic": 430, // Number of times your video was watches at 95% of its length without any paid promotion, including watches that skipped to this point. "totalVideoCompleteViewsOrganicUnique": 430, // The number of unique people who watched your video at 95% of its length without any paid promotion, including people that skipped to this point "totalVideoCompleteViewsPaid": 0, // Number of times your video was watched at 95% of its length after paid promotion, including watches that skipped to this point. "totalVideoCompleteViewsPaidUnique": 0, // The number of unique people who watched your video at 95% of its length after paid promotion, including people that skipped to this point. "totalVideoCompleteViewsUnique": 430, // Total number of unique people who watched your video at 95% of its length or more, including people that skipped to this point. // The totalVideoImpressions* family (Video Impressions) was retired by Meta (June 15, 2026); see the note at the top of this page. "totalVideoReactionsByTypeTotal": { // The total number of reactions to your post by type. "like": 13, "haha": 2 }, "totalVideoStoriesByActionType": { // Number of stories created about your Page Video, by action type. "like": 15 }, "totalVideoViewTimeByAgeBucketAndGender": { // Video view time (in ms) by age bucket and gender. "f1317": 23521, "m1317": 184052, "u1824": 2774, "f1824": 118193, "m1824": 1340281, "u2534": 11975, "f2534": 407006, "m2534": 3960750, "u3544": 27054, "f3544": 332576, "m3544": 5477331, "u4554": 41804, "f4554": 375449, "m4554": 3794202, "u5564": 35717, "f5564": 159041, "m5564": 3582574, "u65+": 8245, "f65+": 423739, "m65+": 2866201 }, "totalVideoViewTimeByDistributionType": { // Video view time (in ms) by distribution type. On asset level, there are three possible distribution types: (page_owned/shared/crossposted) "pageOwned": 23172485 }, "totalVideoViewTimeByRegionId": { // Video view time (in ms) by region ID. "californiaUnitedStates": 791788, "texasUnitedStates": 480891, "karnatakaIndia": 390297, "uttarPradeshIndia": 368698, "tamilNaduIndia": 359103, "queenslandAustralia": 295491, "newSouthWalesAustralia": 284222, "newYorkUnitedStates": 250035, "maharashtraIndia": 248465, "washingtonUnitedStates": 237430 }, "totalVideoViewTotalTime": 23172485, // Total time (in ms) video has been viewed. "totalVideoViewTotalTimeOrganic": 23172485, // Total time (in ms) video has been viewed in Feed or ticker or on your Page's Timeline. "totalVideoViewTotalTimePaid": 0, // Total time (in ms) video has been viewed after paid promotion. "totalVideoViews": 1283, "totalVideoViewsAutoplayed": 1237, // Number of times your video started automatically playing and people viewed it for 3 seconds or viewed it to the end, whichever came first. "totalVideoViewsByDistributionType": { // Video views by distribution type. On asset level, there are three possible distribution types: (page_owned/shared/crossposted) "pageOwned": 1283 }, "totalVideoViewsClickedToPlay": 46, // Number of times people clicked to play your video and viewed it for 3 seconds or viewed it to the end, whichever came first. "totalVideoViewsOrganic": 1283, // Number of times your video was viewed for 3 seconds or viewed to the end, whichever came first, without any paid promotion. "totalVideoViewsPaid": 0, // Number of times your video was viewed for 3 seconds or viewed to the end, whichever came first, after paid promotion. "totalVideoViewsSoundOn": 743, // Number of times your video sound was turned on and was viewed for 3 seconds or viewed to the end, whichever came first. "videoViews": 3 // Times your videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. During a single instance of a video playing, we'll exclude any time spent replaying the video. This includes live views. // videoViewsUnique was retired by Meta (June 15, 2026); see the note at the top of this page. }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, "instagram": { "id": "17856916804532520", // Instagram Social Post ID "postUrl": "https://www.instagram.com/p/ChALNdaOT3G/", "analytics": { /* FEED Data */ "caption": "It always seems impossible until it's done. - Nelson Mandela", "commentsCount": 1, // Comments total "created": "2022-09-07T22:39:06Z", // Time post was created "engagementCount": 3, // Likes, comments, and saves "followsCount": 2, // Number of followers gained "likeCount": 1, // Likes total - organic likes, promoted post likes not included "mediaProductType": "FEED", // Type of IG Share: AD, FEED, STORY or REELS "mediaType": "IMAGE", // Media type: CAROUSEL_ALBUM, IMAGE, or VIDEO "mediaUrls": [ { "mediaUrl": "https://scontent.cdninstagram.com/v/t51.82787-15/516601117_17872451562389336_3472858781474899926_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=107&ccb=1-7&_nc_sid=18de74&_nc_ohc=-LOY7upopXoQ7kNvwEkqUMq&_nc_oc=AdmN47ZBlmciajpv7udoP1ku6J-FBgBGIrRskGgPmIOjT5D3WI9F21_Fg1Gi60-aI70&_nc_zt=23&_nc_ht=scontent.cdninstagram.com&edm=AEQ6tj4EAAAA&_nc_gid=PZY4V4Pvo8ePuq2CfSBp1A&oh=00_AfQplZLqrCEYwXkCutbmMAGIgpcBUkKqGcfRdDLZU4QHRA&oe=6872DFF9" } ], "profileActivityCount": 1,// The number of actions people take when they visit your profile after engaging with your post "profileVisitsCount": 11, // The number of times your profile was visited. "reachCount": 71, // Unique accounts that have seen the post "savedCount": 1, // Unique accounts have saved the post "sharesCount": 12, // Number of times the post was shared "username": "jackthegiant", "viewsCount": 71, // Total number of times the post has been seen. /* REELS Data */ "caption": "Gorgeous gifts for new Mum & Bub \n\n@mikimoocreations @romperandco @obdesigns @salusbody @enaproducts", "clipsReplaysCount": 21, // The number of times your reel starts to play again after an initial play of your reel. This is defined as replays of 1ms or more in the same reel session. "commentsCount": 1, // Comments total "created": "2022-09-15T06:58:55Z", "engagementCount": 183, // Number of likes, saves, comments, and shares on the reel, minus the number of unlikes, unsaves, and deleted comments. "igReelsAggregatedAllPlaysCount": 42, // The number of times your reel starts to play or replay after an impression is already counted. This is defined as plays of 1ms or more. Replays are counted after the initial play in the same reel session. Organic plays only; promoted post plays are not included. "igReelsAvgWatchTimeCount": 23, // The average amount of time spent playing the reel. This is calculated by the watch time divided by the number of plays. "igReelsVideoViewTotalTimeCount": 21, // The total amount of time the reel was played, including any time spent replaying the reel. "likeCount": 21, // Likes total on the reel "mediaProductType": "REELS", // Type of IG Share: AD, FEED, STORY or REELS "mediaType": "VIDEO", // Always "VIDEO" "mediaUrls": [ { "mediaUrl": "https://instagram.flis9-1.fna.fbcdn.net/o1/v...amug&oe=686ED4D3" } ], "playsCount": 680, // Number of times the reels starts to play after an impression is already counted. This is defined as video sessions with 1 ms or more of playback and excludes replays. Organic plays only; promoted post plays are not included. "reachCount": 689, // Number of unique accounts that have seen the reel at least once. Reach is different from impressions, which can include multiple views of a reel by the same account. "savedCount": 0, // Number of saves of the reel. "sharesCount": 2, // Number of shares of the reel. "username": "mordiallocflorist", "viewsCount": 40, // Total number of times the reel has been seen. /* STORY Data - Fewer than 5 insights will not show metric data. */ "commentsCount": 2, "created": "2024-09-16T08:37:57Z", "engagementCount": 10, "followsCount": 0, "likeCount": 3, "mediaProductType": "STORY", "mediaType": "IMAGE", "mediaUrls": [ { "mediaUrl": "https://scontent.cdninstagram.com/v/t51.82787-15/517935...we32" } ], "notEnoughViews": true, // True if fewer than 5 unique insights. If fewer than 5 unique insights, metric data not available. "navigationCount": 15, // Total nav interactions of taps and swipes "profileActivityCount": 3, "profileVisitsCount": 1, "reachCount": 10, "repliesCount": 3, "sharesCount": 2, "swipeForwardCount": 1, // Swipes "Next Story" on the native interface. "tapBackCount": 2, // Taps "Back" on the native interface. "tapForwardCount": 9, // Taps "Forward" on the native interface. "tapExitCount": 3, // Taps "Exit" on the native interface. "username": "ayrshare", "viewsCount": 10, // Total number of times the story has been seen. }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, /* Corporate LinkedIn Account Example. Past 12 months, using a rolling 12-month window. */ "linkedin": { "id": "6783586276949000192", // LinkedIn Social Post ID "postUrl": "https://www.linkedin.com/feed/update/urn:li:share:6783586276949000192", "type": "corporate", // corporate or personal. Please see notes on personal analytics "analytics": { "clickCount": 0, // Clicks on a post - company only "commentCount": 0, // Comments count "comments": [ // Comment IDs - can be used to look up comments "urn:li:comment:(urn:li:activity:7226002855806021632,7226004971362627585)" ], "commentsState": "OPEN", // Comments allowed or not "engagement": 0, // Organic clicks, likes, comments, and shares over impressions - company only "impressionCount": 0, // Impressions on a post - company only "likeBy": [ "urn:li:person:Z_yXaxh_AB" // Look up the user with the brands endpoint ], "likeCount": 1, // Likes on a count "reactions": { // Get reactions on a LinkedIn share "like": 1, // "Like in the UI "praise": 2, // "Celebrate" in the UI "maybe": 3, // "Curious" in the UI "empathy": 3, // "Love" in the UI "interest": 2, // "Insightful" in the UI "appreciation": 5 // "Support" in the UI }, "shareCount": 0, // Shares on a post - company only "totalFirstLevelComments": 1, // COunt of the firt level comments "uniqueImpressionsCount": 0, // Unique impressions for a post - company only "videoViews": 1 // Number of times video viewed - company only }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, /* Personal LinkedIn Account Example. Past 12 months, using a rolling 12-month window. */ "linkedin": { "id": "urn:li:share:7221186087895920444", "type": "personal", "analytics": { "commentCount": 12, // Comments count "comments": [ "urn:li:comment:(urn:li:activity:7221186088390799360,7224469537784479744)" ], "commentsState": "OPEN", "engagement": 0.07, // Organic clicks, likes, comments, and shares over impressions "impressionCount": 1543, // Impressions on the post "likeBy": [ { "from": { "name": "John Smith", "id": "qDyUWJx2s", "url": "https://www.linkedin.com/in/js", "description": "Business Analyst at Ayrshare" }, "media": { "id": "urn:li:image:C4D03AQG_8MpwM6tDzw", "mediaExpiresSeconds": 1728518400000, "url": "https://media.licdn.com/dms/image/C4D03AQG_8MpwM6tDzw" }, "platform": "linkedin", "profileImageUrl": "https://media.licdn.com/dms/image/C4D03AQG_8MpwM", "userName": "js", "originalUrn": "urn:li:like:(urn:li:person:qDyUWJxqIO,urn:li:activity:722118608839074444)", "type": "like" } ], "likeCount": 87, // Reaction count "reactions": { // Per-type reaction breakdown "like": 60, "praise": 15, "maybe": 0, "empathy": 12, "interest": 0, "appreciation": 0 }, "share": "urn:li:activity:7221186088390794444", "shareCount": 9, // Reshares of the post "totalFirstLevelComments": 1, "uniqueImpressionsCount": 1201, // Unique members reached (MEMBERS_REACHED) "videoViewers": 280, // Video posts only "videoViews": 320, // Video posts only "videoWatchTimeMs": 451000 // Video posts only }, "lastUpdated": "2024-08-04T22:46:15.660Z", "nextUpdate": "2024-08-04T22:57:15.660Z" }, "pinterest": { "id": "718464946813167315", // Pinterest Social Post ID "postUrl": "https://www.pinterest.com/pin/718464946813167315/", "analytics": { "altText": "Hello", "boardId": "480126078963936788", "boardOwner": { "username": "johnsmith" }, "boardSectionId": 12232, "createdAt": "2024-10-20T06:25:08", "creativeType": "REGULAR", "description": "The most amazing board", "dominantColor": "#4e6279", "hasBeenPromoted": false, "id": "480126010294119688", "impression": 26, "isOwner": true, "isStandard": true, "link": "https://www.mywebsite.com", "media": { "media_type": "image", "images": { "150x150": { "width": 150, "height": 150, "url": "https://i.pinimg.com/150x150/2b/86/64/2b.jpg" }, "400x300": { "width": 400, "height": 300, "url": "https://i.pinimg.com/400x300/2b/86/64/2b.jpg" }, "600x": { "width": 564, "height": 296, "url": "https://i.pinimg.com/564x/2b/86/64/2b.jpg" }, "1200x": { "width": 1200, "height": 630, "url": "https://i.pinimg.com/1200x/2b/86/64/2b.jpg" } } }, "note": "", "outboundClick": 4, "parentPinId": 23233, "pinClick": 2, "pinMetrics": null, "productTags": [], "profileVisit": 5, // Available for images only "quartile95PercentView": 4, "save": 1, "saveRate": 1, "title": "Looking great", "totalComments": 2, "totalReactions": 1, "userFollow": 1, // Available for images only /* Available for videos */ "video10sView": 3, "videoAvgWatchTime": 0, "videoMrcView": 0, "videoStart": 0, "videoV50WatchTime": 0 }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, "reddit": { "id": "182zitr", "postUrl": "https://www.reddit.com/r/test/comments/182zitr/reddit_post_title/", "analytics": { "author": "ayrshare", "created": "2023-11-24T19:10:06.000Z", "permalink": "/r/test/comments/182zitr/reddit_post_title/", "subreddit": "test", "title": "Reddit Post Title", "ups": 2, "upvoteRatio": 1, "url": "https://www.reddit.com/r/test/comments/182zitr/reddit_post_title/" }, "lastUpdated": "2023-11-24T19:10:41.635Z", "nextUpdate": "2023-11-24T19:21:41.635Z" }, "snapchat": { "id": "490edf20-4068-5bab-bf65-a5882b1ezuec", "postUrl": "https://www.snapchat.com/add/chrisalpha1980/490edf20-4068-5bab-bf65-a5882b1ezuecc", "analytics": [ { "avgViewTime": 5230, // Average view time in milliseconds "completes": 187, // Number of times the post was played to completion "interactions": 42, // Number of times a user interacted with an asset. These include: tap forwards/backwards, swipe-away "mediaId": "490edf20-4068-5bab-bf65-a5882b1ezuec", "replies": 8, // Number of replies to this snap/story "shares": 12, // Number of times this post has been shared "snapCombinedUniques": 642, // Combined total of snapPaidUniques and storyUniques "snapCombinedViews": 829, // Combined total of snapPaidViews and views "snapPaidUniques": 174, // The sum of paid uniques for ads promoting the snaps within the Public Story "snapPaidViews": 203, // The sum of paid impression for ads promoting the snaps within the Public Story "storyAvgViewTime": 4870, // The calculation of the storyViewTime divided by storyUniques (milliseconds) "storyFavorites": 28, // Number of times the post has been liked "storySubscribes": 5, // Number of subscribe events occuring on the story post "storyUniques": 468, // Unique users who have viewed a story/snap within a story "storyViewTime": 2279160, // Milliseconds a story & snap in story asset has been viewed "storyViews": 626, // Views for Story container "swipeDowns": 15, // Number of swipe downs on this post "swipeUps": 23, // Number of swipe ups on this post "uniqueSessions": 512, // Number of unique sessions an asset has been engaged in "viewTime": 3264000, // Milliseconds this post has been viewed "viewers": 598, // Number of unique users who have viewed this post "views": 712 // Number of times an asset has been viewed } ], "lastUpdated": "2025-05-21T11:14:40.570Z", "nextUpdate": "2025-05-21T11:25:40.570Z" }, "threads": { "id": "17890643139123701", "postUrl": "https://www.threads.com/@ayrshare/post/DI4nmXrNQA1", "analytics": { "views": 2, "likes": 1, "replies": 1, "reposts": 0, "shares": 0, "quotes": 0 }, "lastUpdated": "2025-04-25T22:41:05.752Z", "nextUpdate": "2025-04-25T22:52:05.752Z" }, "tiktok": { "id": "7034682002927550598", // TikTok Social Post ID "postUrl": "https://www.tiktok.com/@borneild/video/7034682002927550598?utm_campaign=tt4d_open_api&utm_source=awawnhyictaos7o", "analytics": { "audienceCities": [ // Available 24-48 hours after posting. City distribution of video viewers for the top 10 cities. Must be an active post. See endpoint details. { "city_name": "US Teton County", "percentage": 3.1 }, { "city_name": "US Queens", "percentage": 6.3 } ], "audienceCountries": [ // Available 24-48 hours after posting. Country distribution of video viewers for the top 10 countries. Must be an active post. See endpoint details. { "country": "GB", "percentage": 0.0029 }, { "country": "US", "percentage": 0.9604 } ], "audienceGenders": [ // Updated by TikTok every 24-48 hours. { "percentage": 0.25, "gender": "Female" }, { "percentage": 0.5, "gender": "Male" }, { "percentage": 0.25, "gender": "Other" } ], "audienceTypes": [ { "percentage": 0, "type": "FOLLOWER_PERCENT" }, { "percentage": 0, "type": "NEW_VIEWER" }, { "percentage": 0, "type": "NON_FOLLOWER_PERCENT" }, { "percentage": 0, "type": "RETURN_VIEWER" } ], "averageTimeWatched": 5.6679, // Available 24-48 hours after posting. "commentsCount": 23, // Total number of lifetime comments. Available 24-48 hours after posting. "created": "2022-08-09T15:08:22Z", "embedUrl": "https://www.tiktok.com/embed/v2/7129893524253756713", "fullVideoWatchedRate": 0.0866, // Percentage of views that completed watching the full video. Available 24-48 hours after posting. "impressionSources": [ // Different sources for the impressions, ranked from the largest contribution to the smallest. Available 24-48 hours after posting. { "impression_source": "Search", "percentage": 0.0217 }, { "impression_source": "Sound", "percentage": 0 }, { "impression_source": "Follow", "percentage": 0 }, { "impression_source": "For You", "percentage": 0.917 }, { "impression_source": "Hashtag", "percentage": 0 }, { "impression_source": "Personal Profile", "percentage": 0 } ], "likeCount": 22, // Total number of lifetime likes. Available 24-48 hours after posting. "mediaType": "video", "musicTitle": "♬ original sound - tiff",// If available "musicUrl": "https://www.tiktok.com/music/original-sound-6689804660171082501?refer=embed", // If available "name": "Mackly", "post": "Scramble up ur name & I'll try to guess it😍❤️ #foryoupage #petsoftiktok #aesthetic", "postUrl": "https://www.tiktok.com/@tiktoktime/video/7129893524253756713?utm_campaign=tt4d_open_api&utm_source=awawnhyictaos7o7", "reach": 252, // The number of people who watched your published content at least once. Available 24-48 hours after posting. "shareCount": 1, // Total number of lifetime shares. Available 24-48 hours after posting. "tags": [ // Tags included in the description { "tag": "#foryoupage", "url": "https://www.tiktok.com/tag/foryoupage" }, { "tag": "#petsoftiktok", "url": "https://www.tiktok.com/tag/petsoftiktok" }, { "tag": "#aesthetic", "url": "https://www.tiktok.com/tag/aesthetic" } ], "thumbnailHeight": 576, "thumbnailUrl": "https://p16-sign.tiktokcdn-us.com/obj/tos-useast5-p-0068-tx", "thumbnailWidth": 1006, "url": "https://www.tiktok.com/@tiktoktime", "videoDuration": 13.984, // Video duration in seconds. "videoViewRetention": [ // This metric indicates how many of your viewers are still watching after a certain amount of time. { "percentage": 0.1, "second": "155" }, { "percentage": 0.07, "second": "234" } ], /* Total number of lifetime users who viewed the video. Available 24-48 hours after posting. If the user swipes away from the ad then swipes back, it would be counted as 2 impressions. Therefore, a new video view will be counted again with the new impression session. */ "videoViews": 34 }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, /* Note: if the post was sent as a Twitter Thread, the return will be an array, "twitter": [] */ "twitter": { "id": "1313589441919827982", // Twitter Social Post ID "postUrl": "https://www.twitter.com/myaccount/1313589441919827982", "analytics": { "created": "2022-09-07T22:12:10.000Z", "entities": { "urls": [ { "start": 77, // Starting character position (inclusive) "end": 96, // Ending character position (exclusive) "url": "https://t.co/abc123", // Shortened t.co URL "expandedUrl": "https://www.ayrshare.com/docs", // Full URL after redirect "displayUrl": "ayrshare.com/docs", // User-friendly display version "unwoundUrl": "https://www.ayrshare.com/docs" // Final destination URL } ], "hashtags": [ { "start": 97, // Starting character position (inclusive) "end": 112, // Ending character position (exclusive) "tag": "SocialMediaAPI" // Hashtag text without # } ], "mentions": [ { "start": 113, // Starting character position (inclusive) "end": 122, // Ending character position (exclusive) "username": "ayrshare" // Username without @ } ], "cashtags": [ { "start": 123, // Starting character position (inclusive) "end": 128, // Ending character position (exclusive) "tag": "META" // Stock symbol without $ } ], "annotations": [ { "start": 46, // Starting character position (inclusive) "end": 54, // Ending character position (exclusive) "probability": 0.9456, // Confidence score (0.0 to 1.0) "type": "Product", // Entity type: Person, Place, Product, Organization, Other "normalizedText": "Ayrshare" // Standardized entity name } ] }, "media": [ { "width": 1920, "durationMs": 28240, "height": 1080, "mediaKey": "7_1739849636389814272", "previewImageUrl": "https://pbs.twimg.com/ext_tw_video_thumb/1739849636389814272/pu/img/bCkAdkD0R00-ZlkY.jpg", "type": "video", "mediaUrls": [ // available for videos and gifs { "bitRate": 256000, "contentType": "video/mp4", "mediaUrl": "https://video.twimg.com/ext_tw_video/1739849636389814272/pu/vid/avc1/480x270/4RoZCqynednVMFgy.mp4?tag=12" }, { "bitRate": 832000, "contentType": "video/mp4", "mediaUrl": "https://video.twimg.com/ext_tw_video/1739849636389814272/pu/vid/avc1/640x360/RYy5iHTIxu7_iyZm.mp4?tag=12" }, { "bitRate": 2176000, "contentType": "video/mp4", "mediaUrl": "https://video.twimg.com/ext_tw_video/1739849636389814272/pu/vid/avc1/1280x720/9UpR90ekFA-9Ucxo.mp4?tag=12" }, { "contentType": "application/x-mpegURL", "mediaUrl": "https://video.twimg.com/ext_tw_video/1739849636389814272/pu/pl/0AVy2xIOLQcsrEZG.m3u8?tag=12&container=fmp4" } ] } ], "name": "Wonder World", "post": "Just launched our social media campaign using Ayrshare! Check out the API at https://t.co/abc123 #SocialMediaAPI @ayrshare $META", "publicMetrics": { // Organic and paid metrics available publicly. Use this to measure Tweet engagement. "retweetCount": 0, // Retweets count "quoteCount": 0, // Times the Tweet was quoted count "likeCount": 0, // Likes for the Tweet count "replyCount": 0, // Replies count "quoteCount": 0, // Times the Tweet was quoted count "bookmarkCount": 0, // Bookmarks count "impressionCount": 23 // How many times the Tweet has been viewed (not unique by user). A view is counted if any part of the Tweet is visible on the screen. }, "nonPublicMetrics": { // Organic and paid metrics not available publicly. Not available for Tweets older than 30 days. Use this to determine the total number of impressions generated for the Tweet. "userProfileClicks": 1, // User profile clicks "engagements": 1, // How many times the Tweet has been engaged with. "impressionCount": 5, // How many times the Tweet has been viewed (not unique by user). A view is counted if any part of the Tweet is visible on the screen. "video": { // Users who played through to each quartile in a video. This reflects the number of quartile views across all Tweets in which the given video has been posted. "playback25Count": 4, "playback50Count": 2, "playback75Count": 1, "playback0Count": 4, "playback100Count": 1 } }, "organicMetrics": { // Non-paid metrics. Not available for Tweets older than 30 days. Use this to measure organic engagement for the Tweet. "likeCount": 0, // Tweet likes "impressionCount": 5, // How many times the Tweet has been viewed (not unique by user). A view is counted if any part of the Tweet is visible on the screen. "replyCount": 0, // Replies count "retweetCount": 0, // R countetweets "userProfileClicks": 1, // User profile clicks "video": { // Users who played through to each quartile in a video. This reflects the number of quartile views across all Tweets in which the given video has been posted. "playback25Count": 4, "playback0Count": 4, "playback100Count": 1, "viewCount": 4, "playback50Count": 2, "playback75Count": 1 } }, "poll": { // Present if Tweet has a poll "durationMinutes": 5, // Duration in minutes "endDatetime": "2023-05-29T17:28:05.000Z", "votingStatus": "open", // "open" or "closed" "id": "1663234520718371960", "options": [ { "position": 1, "label": "yes", "votes": 3 }, { "position": 2, "label": "maybe", "votes": 1 }, { "position": 3, "label": "no", "votes": 0 } ] }, "urls": [ // Available for long Tweets only { "start": 866, "end": 889, "url": "https://t.co/3r6xz4hBnM", "expandedUrl": "https://www.cnn.com", "displayUrl": "cnn.com" } ], "username": "wondrous" }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, "youtube": { "id": "RWJMpOUGicU", // YouTube Social Post ID "postUrl": "https://youtu.be/RWJMpOUGicU", "analytics": { "averageViewDuration": 6, // The average length, in seconds, of video playbacks. "averageViewPercentage": 92.01, // The average percentage of a video watched during a video playback. "channelTitle": "youtubeHandle", "comments": 22, "created": "2022-08-15T19:14:44Z", "description": "Doubt is not a pleasant condition, but certainty is absurd. - Voltaire", "dislikes": 3, "estimatedMinutesWatched": 23, // The number of minutes that users watched videos for the specified channel, content owner, video, or playlist. "likes": 54, "liveBroadcastDetails": { // Only present if liveBroadcast is "live" or "upcoming" "activeLiveChatId": "Cg0KC3Ez", // The ID of the currently active live chat attached to this video. Not present if broadcast complete and chat no longer live "actualStartTime": "2023-05-04T10:14:56Z", // The time that the broadcast actually started. "actualEndTime": "2023-05-04T10:15:15Z", // The time that the broadcast actually ended. "concurrentViewers": 384343, // The number of viewers currently watching the broadcast. Not present if the broadcast has ended. "scheduledEndTime": "2023-05-04T10:15:00Z", // The time that the broadcast is scheduled to end if a scheduled end time was set. "scheduledStartTime": "2023-05-04T10:15:00Z" // The time that the broadcast is scheduled to begin. }, "liveBroadcast": "live", // Values: "none", "live", "upcoming" "madeForKids": false, "privacyStatus": "public", "publishedAt": "2023-05-08T12:30:26Z", "subscribersGained": 23, // The number of times that users subscribed to a channel. "subscribersLost": 1, // The number of times that users unsubscribed from a channel. "tags": ["sweet", "sour"], // Tags assigned to video "thumbnailUrl": "https://i.ytimg.com/vi/RWJMpOUGicU/default.jpg", "title": "Yo time", "videosAddedToPlaylists": 2, // The number of times that videos were added to any YouTube playlists. The videos could have been added to the video owner's playlist or to other channels' playlists. "views": 153 }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, "status": "success", "code": 200, "id": "IHvCLacgPc6hMU9IQ6oK" } ``` ```json 200: Backfilled Response theme={"system"} { "facebook": { "id": "104923907983682_108329000309742", "postUrl": "https://www.facebook.com/104923907983682_108329000309742", "analytics": { "commentsCount": 5, "likeCount": 23, "sharesCount": 12, "mediaView": 450, "backfilledFrom": "2026-04-08T14:30:00.000Z" }, "lastUpdated": "2026-04-09T10:15:00.000Z", "nextUpdate": "2026-04-09T10:26:00.000Z" }, "status": "success", "code": 200, "id": "IHvCLacgPc6hMU9IQ6oK" } ``` ```json 200: Recovered Response theme={"system"} { "facebook": { "id": "104923907983682_108329000309742", "postUrl": "https://www.facebook.com/104923907983682_108329000309742", "analytics": { "commentsCount": 5, "likeCount": 23, "sharesCount": 12, "mediaView": 450, "recoveredFrom": "2026-04-08T14:30:00.000Z" }, "lastUpdated": "2026-04-09T10:15:00.000Z", "nextUpdate": "2026-04-09T10:26:00.000Z" }, "status": "success", "code": 200, "id": "IHvCLacgPc6hMU9IQ6oK" } ``` ```json 404 - Bad Request theme={"system"} /* Often if manually deleted at social network */ { "status": "error", "code": 116, "id": "N7GAZeJSAYcdCpHSm3xQ", // Ayrshare Post ID "facebook": { "action": "post", "status": "error", "code": 186, "message": "Post ID not found. Please verify the top level ID returned from the /post endpoint is being sent and the post at the social network has not been deleted.", "id": "104619420979033_588326339980968" // Facebook Platform ID }, "instagram": { "action": "post", "status": "error", "code": 186, "message": "Post ID not found. Please verify the top level ID returned from the /post endpoint is being sent and the post at the social network has not been deleted.", "id": "18349092271045074" // Instagram Platform ID }, "linkedin": { "action": "post", "status": "error", "code": 186, "message": "Post ID not found. Please verify the top level ID returned from the /post endpoint is being sent and the post at the social network has not been deleted.", "id": "urn:li:share:7038277251594878976" // LinkedIn Platform ID }, "pinterest": { "action": "post", "status": "error", "code": 186, "message": "Post ID not found. Please verify the top level ID returned from the /post endpoint is being sent and the post at the social network has not been deleted. Pin not found." }, "twitter": { "action": "post", "status": "error", "code": 186, "message": "Could not find tweet with id: [1632511562660433929].", "id": "1632511562660433929" // Twitter Platform ID }, "youtube": { "action": "post", "status": "error", "code": 186, "message": "Post ID not found. Please verify the top level ID returned from the /post endpoint is being sent and the post at the social network has not been deleted.", "id": "rAMFoqZeOGg" // YouTube Platform ID }, "lastUpdated": "2023-03-06T21:59:06.064Z", "nextUpdate": "2023-03-06T22:10:06.064Z" } ``` ```json 404 - Not Found theme={"system"} { "action": "analytics", "status": "error", "code": 186, "message": "Post ID not found.", "id": "7aVBe0jw27DNwFq92KZ" } ``` # Analytics on a Social Network Source: https://www.ayrshare.com/docs/apis/analytics/social POST /analytics/social Get analytics and demographics on a user's social profile, such as impressions, views, and followers Get analytics and demographics on a user's social profile, such as impressions, views, and followers. Currently available for Bluesky, Facebook Pages, Google My Business, Instagram, LinkedIn, Pinterest, Reddit, Snapchat, Threads, TikTok, X/Twitter, and YouTube. **Facebook: some reach and video metrics were retired by Meta (June 15, 2026).** Meta removed the unique impression and 3-second video-view (unique) Insights metrics across all Graph API versions, so the Facebook `analytics` object no longer returns the `pagePostsImpressions*` family (`pagePostsImpressions`, `pagePostsImpressionsPaid`, `pagePostsImpressionsUnique`, `pagePostsImpressionsOrganicUnique`, `pagePostsImpressionsViral*`, `pagePostsImpressionsNonviral*`, `pagePostsServedImpressionsOrganicUnique`) or `pageVideoViewsUnique`. Use `pageMediaView` for reach (a Total Unique Media Views successor is planned). `pagePostEngagements`, `pageVideoViews`, and `pageVideoViewsPaid` are unaffected. Reference: [Upcoming API Changes — June 15, 2026](/docs/whatsnew/upcoming-api-changes#june-15-2026).
  • Facebook Page analytics is only available on Pages with 100 or more likes, such as demographics. Facebook typically updates their metrics once every 24 hours.
  • Instagram may take up to 48 hours to calculate the analytics data. Follower count analytics is not available with fewer than 100 followers. Demographic metrics only return the top 45 performers, only viewers for whom we have demographic data are used in demographic metric calculations, and demographic data is not returned if the Instagram User has fewer than 100 engagements during the last 30 days.
  • When retrieving Instagram social analytics, demographic information may not appear in the response for particular metrics. Demographic information will appear when the metrics have more than 100 people in each breakdown. Please see [Instagram Analytics Demographics Warning](/docs/help-center/technical-support/instagram_analytics_demographics_warning) for more information.
  • LinkedIn supports both Company Page analytics and personal (member) profile analytics. For personal profiles, the `analytics` object includes a lifetime `followersCount`, daily follower growth in `followersDaily[]`, and aggregate post metrics (`impressionCount`, `uniqueImpressionsCount`, `likeCount`, `commentCount`, `shareCount`). LinkedIn `count` totals are eventually consistent, but not immediately consistent, and can take up to 24-48 hours in some cases. The aggregate `shareCount`, `likeCount`, and `commentCount` for personal profiles are best-effort and may differ slightly from the numbers shown in the LinkedIn UI.
  • TikTok can take 24-48 hours to update their analytics data, such as video views, demographics, likes, shares, and comments.
  • Please see the [post analytics endpoint](/docs/apis/analytics/post) for additional info.
## Header Parameters ## Body Parameters Social media platforms to get analytics. Accepts an array of strings with values: ```json theme={"system"} { "platforms": ["bluesky", "instagram", "facebook", "gmb", "linkedin", "pinterest", "reddit", "snapchat", "threads", "tiktok", "twitter", "youtube"] } ``` Specifies how many quarters of historical data to return. A quarter is: * 85 days for Facebook * 90 days for Instagram, TikTok, and YouTube * 90 days for Snapchat (capped at 1 quarter / 90 days max due to Snapchat API limitations) Available for Facebook, Instagram, Snapchat, TikTok, and YouTube platforms. Valid values: 1–4. Only values greater than 0 activate date filtering. **Date filtering (Instagram & TikTok):** Date filtering is active when `daily=true` OR `quarters > 0`. If neither `daily` nor `quarters` is provided, all-time data is returned with no date filter applied. Note: `quarters: 0` is now treated as no date range (all-time data). Previously, `quarters: 0` was treated as `quarters: 1`. When set to `true`, returns analytics data as daily time-series values instead of aggregated totals. This option is only available for Facebook, Instagram, Snapchat, TikTok, and YouTube platforms. Due to the larger data size, using [compression](/docs/apis/overview#compression) is recommended. For Instagram and TikTok, setting `daily=true` also activates date filtering using a default shorter quarters window. **Instagram reach:** With `daily=true`, the Instagram response returns a nested `reach` object (containing `period` and a `values` time-series) instead of the scalar `reachCount` field that is returned in non-daily mode. For TikTok analytics, when set to true, this returns only the 60-day aggregate totals for comments, shares, and views (`commentCountTotal`, `shareCountTotal`, `viewCountTotal`). This provides faster response times compared to retrieving the full analytics history. Note: Do not use this parameter together with `daily=true` as they are incompatible. Important: As of March 1, 2025, TikTok moved to 60-day totals. As of April 2026, TikTok uses quarters-based date filtering — use the `quarters` parameter to control the date window (e.g., `quarters: 1` = 90 days, `quarters: 2` = 180 days). See [upcoming changes](/docs/whatsnew/upcoming-api-changes#march-1-2025) for details. Platform-specific options for YouTube analytics. **`lifetime`** (boolean, default: `false`): When set to `true`, includes `lifetimeLikes` in the response - the sum of likes across all public videos on the channel. This is computed by fetching all videos and summing their like counts, so it may take longer for channels with many videos. **Threshold:** Channels with more than 1,000 videos will return `lifetimeLikes: null` and a warning in the top-level [`warnings`](#warnings) array. This prevents excessive API usage. **Caching:** Per-channel, with shorter TTLs for non-success outcomes so retries pick up state changes promptly: * Successful `lifetimeLikes` value: **24 hours**. * 1,000-video bailout (warning `code: 445`): **1 hour** — short enough that a channel which deletes videos to drop below the threshold doesn't have to wait a full day for a real value. * Transient YouTube Data API failures (warning `code: 446`): **not cached** — the next request retries. **Note:** Deleted or private videos are excluded from the sum, so the total may differ from the "true" lifetime likes for channels that have removed videos. **Request example:** ```json theme={"system"} { "platforms": ["youtube"], "youtube": { "lifetime": true } } ``` X/Twitter only. This parameter allows you to retrieve posts from a specific X/Twitter user by their numeric ID, rather than from your linked account. For example, to get all posts from the handle `@Google`, you would use their numeric userId `20536157`. You can find any X/Twitter user's numeric userId by using the [Brands Get User](/docs/apis/listen/brand-user) endpoint. Note: Use only the API KEY in the header to make this request. Do not include the Profile Key. X/Twitter only. This parameter allows you to retrieve posts from a specific X/Twitter user by their handle, rather than from your linked account. For example, to get all posts from the handle `@Google`. Note: Use only the API KEY in the header to make this request. Do not include the Profile Key. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"platforms": ["bluesky", "facebook", "gmb", "instagram", "linkedin", "pinterest", "reddit", "snapchat", "threads", "tiktok", "twitter", "youtube"], "quarters": 1}' \ -X POST https://api.ayrshare.com/api/analytics/social ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/analytics/social", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}` }, body: JSON.stringify({ platforms: [ "bluesky", "facebook", "gmb", "instagram", "linkedin", "pinterest", "reddit", "snapchat", "threads", "tiktok", "twitter", "youtube" ], quarters: 1 }) }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'platforms': ['bluesky', 'facebook', 'gmb', 'instagram', 'linkedin', 'pinterest', 'reddit', 'snapchat', 'threads', 'tiktok', 'twitter', 'youtube']} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/analytics/social', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} ['bluesky', 'facebook', 'gmb', 'instagram', 'linkedin', 'pinterest', 'reddit', 'snapchat', 'threads', 'tiktok', 'twitter', 'youtube'] // required ]); $curl = curl_init($apiUrl); curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $data ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```go Go theme={"system"} package main import ( "bytes" "encoding/json" "log" "net/http" ) func main() { message := map[string]interface{}{ "platforms": []string{"bluesky", "facebook", "gmb", "instagram", "linkedin", "pinterest", "reddit", "snapchat", "threads", "tiktok", "twitter", "youtube"}, } bytesRepresentation, err := json.Marshal(message) if err != nil { log.Fatalln(err) } req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/social", bytes.NewBuffer(bytesRepresentation)) req.Header.Add("Content-Type", "application/json; charset=UTF-8") req.Header.Add("Authorization", "Bearer API_KEY") res, err := http.DefaultClient.Do(req) if err != nil { log.Fatal("Error:", err) } res.Body.Close() } ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace SocialPOSTRequest_csharp { class Social { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/analytics/social"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); string json = "{\"platforms\": [\"bluesky\", \"facebook\", \"gmb\", \"instagram\", " + "\"linkedin\", \"pinterest\", \"reddit\", \"snapchat\", \"threads\", \"tiktok\", \"twitter\", \"youtube\"]}"; try { var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(url, content); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` When cumulative metrics (e.g., followers, likes) are temporarily unavailable from the social network, the API automatically backfills them from stored data. Two optional fields may appear in the per-platform `analytics` object: * **`backfilledFrom`** (string, ISO 8601) — Present when one or more cumulative metrics were substituted from stored data. The timestamp indicates when the stored data was last updated. * **`recoveredFrom`** (string, ISO 8601) — Present when the entire analytics response was recovered from stored data due to a complete API failure. The timestamp indicates when the stored data was last updated. Stored data older than 4 days is considered stale and will not be used for backfill or recovery. **LinkedIn `reactions`:** The post-level cumulative `reactions` metric (an object of per-type reaction counts) is subject to this empty-only backfill. When LinkedIn rate-limits the reactions fetch, the value carries forward from the last successful snapshot — and `backfilledFrom` is set to that snapshot's timestamp — instead of regressing to empty. **LinkedIn personal (member) analytics — re-link required.** Personal LinkedIn profiles linked before member analytics shipped do not have the required analytics scopes. Social analytics requests for those profiles return [error code `475`](/docs/errors/errors-ayrshare#linkedin-analytics-errors) ("re-link your LinkedIn profile to enable analytics"). The account owner must re-link their LinkedIn profile on the Social Accounts page to grant the new scopes. Allow a few minutes after re-linking for code `475` to clear (Ayrshare and LinkedIn both briefly cache the permission state, typically \~5-10 minutes). Posting is unaffected. **`warnings`** (array of objects, optional top-level field) — Present only when Ayrshare needs to inform the caller of a non-fatal condition (e.g., an opt-in computation was skipped). Absent from the response when there is nothing to warn about. Each entry is a structured object, not a free-form string: | Field | Type | Description | | --------- | ------ | --------------------------------------------------------------------- | | `action` | string | The operation context that produced the warning (e.g. `"analytics"`). | | `status` | string | Always `"warning"` for entries in the `warnings` array. | | `code` | number | Stable Ayrshare warning code. Safe to match on in client code. | | `message` | string | Human-readable description. | | `details` | string | Optional additional context specific to this warning instance. | Known warning codes: * `445` — `lifetimeLikes` skipped because the YouTube channel exceeds the 1,000-video threshold. * `446` — `lifetimeLikes` unavailable because the YouTube Data API returned errors for the uploads playlist or every `videos.list` batch. ```json 200: Success Aggregate {3, 29, 121, 138, 203, 265, 275, 353, 390, 459, 478, 556, 596} theme={"system"} { "status": "success", "bluesky": { "analytics": { "associated": { // Group of associated features and capabilities "lists": 0, // Number of lists created by the user "feedgens": 0, // Number of custom feeds generated by the user "starterPacks": 0, // Number of starter packs created by the user "labeler": false // Whether the user can create content labels }, "avatar": "https://cdn.bsky.app/img/avatar/plain/did:plc:n7atr", // URL to user's profile picture "created": "2024-12-14T20:39:21.343Z", // Timestamp when the account was created "displayName": "Jumping Jack", // User's chosen display name "followersCount": 15, // Number of users following this account "followsCount": 5, // Number of users this account follows "handle": "jack.bsky.social", // User's unique handle/username "id": "did:plc:n7atrjd22xgkmgwig6dzlh", // Bluesky Social ID "indexedAt": "2024-12-14T20:39:21.343Z", // Timestamp when this data was last indexed "labels": [], // Array of content labels applied to the account "postsCount": 20, // Number of posts made by the user "viewer": { // Information about the viewing user's relationship "muted": false, // Whether the viewing user has muted this account "blockedBy": false // Whether this account has blocked the viewing user } }, "lastUpdated": "2025-01-11T20:05:05.214Z", "nextUpdate": "2025-01-11T20:16:05.214Z" }, "facebook": { /* See specific time ranges - Lifetime unless otherwise noted */ "analytics": { "about": "The best site to watch movies online.", "birthday": "11/20/1985", // Applicable to Pages representing people "caterory": "Movie", // The Page's category. e.g. Product/Service, Computers/Technology. "emails": ["john@example.com"], "engagement": { // If available, otherwise use fanCount "count": 587, // Page like count, same as fanCount "socialSentence": "587 people like this." }, "fanCount": 587, "followersCount": 587, "id": "102619320979033", "instagramBusinessAccount": { "id": "17841452212707498" // Present if an Instagram account is linked with the Facebook page }, "isPublished": true, // If the FB Page is publicly visable. "link": "https://www.facebook.com/102619320979033", "location": { // If a location is set "street": "142 W 57th St", "zip": "10019" }, "name": "theGoodone", "pageFollows": 2, "pageMediaView": 929, // The number of times your content was played or displayed. Content includes videos, posts, stories and ads. "pageMediaViewIsFromAds": 1, // The number of times your content was played or displayed from ads. "pageMediaViewIsFromFollowers": 18, // The number of times your content was played or displayed from followers. "pagePostEngagements": 20, // The number of interactions with your posts such as reactions, comments, shares and more. // The pagePostsImpressions* family and pagePostsServedImpressionsOrganicUnique were retired by Meta (June 15, 2026); see the note at the top of this page. // --- Page Video Data --- "pageVideoCompleteViews30s": 32, // The number of times your Page's videos played for at least 30 seconds, or for nearly their total length if they're shorter than 30 seconds. During a single instance of a video playing, we'll exclude any time spent replaying the video. "pageVideoCompleteViews30sAutoplayed": 19, // Autoplayed 30s complete. "pageVideoCompleteViews30sClickToPlay": 5, // Click to play 30s complete. "pageVideoCompleteViews30sOrganic": 23, // Organic 30s complete. "pageVideoCompleteViews30sPaid": 2, // Paid 30s complete. "pageVideoCompleteViews30sRepeatViews": 3, // Repeat 30s complete. "pageVideoCompleteViews30sUnique": 3, // Unique 30s complete. "pageVideoRepeatViews": 4, // The number times of repeat views. "pageVideoViews": 31, // The number of times your Page's videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. During a single instance of a video playing, we'll exclude any time spent replaying the video. "pageVideoViewsAutoplayed": 115, // Number of views that autoplayed on a user's screen "pageVideoViewsOrganic": 32, // The number of organic video views. "pageVideoViewsPaid": 6, // The number of times your Page's promoted videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. For each impression of a video, we'll count video views separately and exclude any time spent replaying the video. "pageVideoViewsByPaidNonPaid": { // Breakdown of view views by paid and non-paid "total": 32, "unpaid": 5, "paid": 27 }, "pageVideoViewsByUploadedHosted": { // Daily video views on a page-level broken down by all variants of page-uploaded and page-hosted variants. "pageUploaded": 147, "pageUploadedFromCrossposts": 0, "pageUploadedFromShares": 3, "pageHostedCrosspost": 0, "pageHostedShare": 0, "pageOwned": 144 }, "pageVideoViewsClickToPlay": 32, // The number of times your Page's videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds, after people clicked play. During a single instance of a video playing, we'll exclude any time spent replaying the video. "pageVideoViewsOrganic": 147, // The number of times your Page's videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds, by organic reach. During a single instance of a video playing, we'll exclude any time spent replaying the video. "pageVideoViewsPaid": 0, // The number of times your Page's promoted videos played for at least 3 seconds, or for nearly their total length if they're shorter than 3 seconds. For each impression of a video, we'll count video views separately and exclude any time spent replaying the video. // pageVideoViewsUnique was retired by Meta (June 15, 2026); see the note at the top of this page. "reactions": { // Total over past 180 days "like": 1, // Like reactions - The "like" reaction counts include both "like" and "care" reactions. "love": 1, // Love reactions "anger": 1, // Anger reactions "haha": 1, // Haha reactions "wow": 1, // Wow reactions "sorry": 1, // Sorry reactions "total": 6 // Total number of reactions }, "unreadMessageCount": 12, // Total unread FB Messages - if applicable "username": "ayrshare", "verified": true, // verified Facebook Page "website": "https://www.theGoodone.com" }, "quarters": 4, "lastUpdated": "2024-04-25T21:28:10.877Z", "nextUpdate": "2024-04-25T21:39:10.877Z" }, /* * Google Business Profile analytics totals are for the past 24 months. */ "gmb": { "analytics": { "businessBookings": 0, // The number of bookings received from the business profile. "businessConversations": 0, // The number of message conversations received on the business profile. "businessDirectionRequests": 328, // The number of times a direction request was requested to the business location. "businessFoodOrders": 0, // The number of food orders received from the business profile. "businessImpressionsDesktopMaps": 153, // Business impressions on Google Maps on Desktop devices. Multiple impressions by a unique user within a single day are counted as a single impression. "businessImpressionsDesktopSearch": 9675, // Business impressions on Google Search on Desktop devices. Multiple impressions by a unique user within a single day are counted as a single impression. "businessImpressionsMobileMaps": 65, // Business impressions on Google Maps on Mobile devices. Multiple impressions by a unique user within a single day are counted as a single impression. "businessImpressionsMobileSearch": 2070, // Business impressions on Google Search on Mobile devices. Multiple impressions by a unique user within a single day are counted as a single impression. "callClicks": 2, // The number of times the business profile call button was clicked. "websiteClicks": 134 // The number of times the business profile website was clicked. }, "lastUpdated": "2024-04-25T21:28:10.877Z", "nextUpdate": "2024-04-25T21:39:10.877Z" }, "instagram": { "analytics": { /* * Demographics: The following audience demographic data is only available * for Intagram Users with at least 100 followers and engagements (last 30 days). * Additionally, audience demographic data is only available when * there is more than 100 people in each demographic category. */ "audienceCity": { "Sydney, New South Wales": 2, "London, England": 2, "Bridgewater, New Jersey": 1, "Puli, Nantou": 1 }, "audienceCityEngagedAudienceDemographics": { "KIRKLAND, WASHINGTON": 3, "LAKE BOSWORTH, WASHINGTON": 6, "WASHOUGAL, WASHINGTON": 1, "SEATTLE, WASHINGTON": 1, "BURLINGTON, WASHINGTON": 2 }, "audienceCountry": { "TW": 1, "HK": 5, "SG": 1, "AU": 2 }, "audienceCountryEngagedAudienceDemographics": { "DE": 0, "GB": 0, "US": 161 }, "audienceGenderAge": { "F.18-24": 1, "F.25-34": 6, "F.35-44": 13, "F.45-54": 16 }, "audienceGenderAgeEngagedAudienceDemographics": { "F.13-17": 2, "F.18-24": 11, "F.25-34": 15, "F.35-44": 24 }, "biography": "What to watch next? Get recommendations from your friends.", "commentsCount": 6, // Total comments of the past 500 posts "followersCount": 2, // Current total of followers - must have at least 100 followers to show "followsCount": 19, // Current total of users followed "id": "17941424040207809", "igId": 24372260340, // legacy Instagram user ID - only available when Instagram is linked via Facebook Page "igLoginId": "84739261504829371", // Instagram native user ID - only available when Instagram is linked via direct Instagram login "likeCount": 116, // Total like of the past 500 posts "mediaCount": 266, // Total media count on the account, always lifetime. Not filtered by `quarters` or `daily`. "name": "theGoodone", "profilePictureUrl": "https://scontent.fphl1-1.fna.fbcdn.net/v/t51.2885-15/74638883_536953567098493_7984001172816003072_n.jpg?_nc_cat=102&ccb=1-5&_nc_sid=86c713&_nc_ohc=krzDDPMjIZQAX-m1PsT&_nc_ht=scontent.fphl1-1.fna&edm=AL-3X8kEAAAA&oh=00_AT9uZhfkQyHWuThTgktvXxB8XEK_xV1_z72frRwtyGwHTA&oe=6246E46D", "reachCount": 1, // 180 day period - Total number of unique users who have viewed at least one media. Scalar value returned in non-daily mode; when daily=true a nested `reach` object is returned instead (see the Daily success example). "shareCount": 234, // Total number of shares on the Instagram account's content (posts, stories, reels, videos, live videos) aggregated per-day over the active date window. Follows the same 90-day rolling maximum as `viewsCount` and respects `quarters` / `daily`. Defaults to `0` for accounts where Meta does not return the `shares` metric. "username": "thegoodone", "viewsCount": 123212, // 90 day rolling window (maximum Meta allows on the User Metrics endpoint) - Total number of times the IG User's media have been viewed "website": "https://www.mywebsite.com/" }, "lastUpdated": "2022-05-09T00:52:30.530Z", "nextUpdate": "2022-05-09T02:07:30.530Z" }, /* LinkedIn Corporate: Lifetime analytics since start of account */ "linkedin": { // The likeCount and commentCount fields do not count likes or comments made by companies, including the company that authored the share and are not decremented when a like or comment is deleted. "analytics": { "clickCount": 10, "clicks": { // Only available for organizations that have career pages. This is a paid product. "mobileCareersPageClicks": { "careersPageJobsClicks": 2, "careersPagePromoLinksClicks": 0, "careersPageEmployeesClicks": 0 }, "careersPageClicks": { "careersPagePromoLinksClicks": 5, "careersPageBannerPromoClicks": 0, "careersPageJobsClicks": 0, "careersPageEmployeesClicks": 3 } }, "commentCount": 12, "engagement": 0.06060606060606061, // Number of organic clicks, likes, comments, and shares over impressions. "followers": { "organicFollowerCount": 7, "paidFollowerCount": 2, "totalFollowerCount": 12 // Total numuber might be higher than organic + paid. For total use this field. }, "impressionCount": 264, "likeCount": 6, // Number of likes. This field can become negative when members who liked a sponsored share later unlike it. "shareCount": 3, // Number of mentions of the company in a share across LinkedIn "uniqueImpressionsCount": 51, "views": { "aboutPageViews": 2, "allDesktopPageViews": 8, "allMobilePageViews": 8, "allPageViews": 16, "careersPageViews": 0, // Only available for organizations that have career pages "desktopAboutPageViews": 0, "desktopCareersPageViews": 0, "desktopInsightsPageViews": 0, "desktopJobsPageViews": 0, "desktopLifeAtPageViews": 0, "desktopOverviewPageViews": 8, "desktopPeoplePageViews": 0, "desktopProductsPageViews": 0, "insightsPageViews": 0, "jobsPageViews": 0, "lifeAtPageViews": 0, "mobileAboutPageViews": 2, "mobileCareersPageViews": 0, "mobileInsightsPageViews": 0, "mobileJobsPageViews": 0, "mobileLifeAtPageViews": 0, "mobileOverviewPageViews": 6, "mobilePeoplePageViews": 0, "mobileProductsPageViews": 0, "overviewPageViews": 14, "peoplePageViews": 0, "productsPageViews": 0 } }, "lastUpdated": "2022-05-09T00:52:30.530Z", "nextUpdate": "2022-05-09T02:07:30.530Z" }, /* LinkedIn Personal (member) */ "linkedin": { "description": "Founder", "id": "Z_yXaxh_Et", // LinkedIn Personal ID "name": "John Doe", "platform": "linkedin", "profileImageUrl": "https://media.licdn.com/dms/image/v2/C5103AQHORT70jVfKVA/profile", "url": "https://www.linkedin.com/in/johndoe", "userName": "johndoe", "analytics": { "commentCount": 410, // Aggregate comments "followersCount": 4210, // Lifetime follower count "followersDaily": [ // Daily follower growth (trailing 30 days) { "memberFollowersCount": 12, "dateRange": { "start": { "year": 2026, "month": 6, "day": 9 } } } ], "impressionCount": 98000, // Aggregate impressions across posts "likeCount": 2300, // Aggregate reactions "shareCount": 190, // Aggregate reshares "uniqueImpressionsCount": 41000 // Aggregate unique members reached } }, /* 90 days summary and daily details, board analytics full history */ "pinterest": { "analytics": { "board": { "boardPinsModifiedAt": "2023-03-14T22:32:06Z", "collaboratorCount": 0, "createdAt": "2019-03-07T22:02:22Z", "description": "", "followerCount": 24, "id": "4299544013183293", "media": { "pinThumbnailUrls": [ "https://i.pinimg.com/150x150/62/08/8b/62088b44a6152de7198efd3c2bc5c0.jpg", "https://i.pinimg.com/150x150/ac/b7/c9/acb7c9f8096317180c20022e9b9b8a.jpg", "https://i.pinimg.com/150x150/5a/d7/56/5ad756fb64a688934bd06853dff3a2.jpg", "https://i.pinimg.com/150x150/5a/d7/56/5ad755db64a688934bd06853dff3a2.jpg", "https://i.pinimg.com/150x150/a9/22/b6/a922ef5289639b617c24704d806998.jpg" ], "imageCoverUrl": "https://i.pinimg.com/400x300/f8/ec/14/f8ec14e7770a53b2e3595773564950.jpg" }, "name": "Places to Retire", "pinCount": 64, "privacy": "PUBLIC", "username": "glueUp" }, "clickthrough": 23, "clickthroughRate": 0.34, "closeup": 3, "closeupRate": 0.43, "engagement": 54, "engagementRate": 0.43, "fullScreenPlay": 23, "fullScreenPlaytime": 42, "impression": 12231, "outboundClick": 256, "outboundClickRate": 0.0.23, "pinClick": 32, "pinClickRate": 0.23, "quartile95PercentView": 42, "save": 45, "saveRate": 23, "video10sView": 902, "videoAvgWatchTime": 234, "videoMrcView": 23, "videoStart": 34, "videoV50WatchTime": 343, "daily": [ { "date": "2021-09-28", "metrics": { "SAVE_RATE": 0, "OUTBOUND_CLICK_RATE": 0, "IMPRESSION": 0, "CLOSEUP_RATE": 0, "ENGAGEMENT_RATE": 0, "VIDEO_10S_VIEW": 0, "VIDEO_AVG_WATCH_TIME": 0, "ENGAGEMENT": 0, "CLOSEUP": 0, "FULL_SCREEN_PLAY": 0, "SAVE": 0, "PIN_CLICK_RATE": 0, "OUTBOUND_CLICK": 0, "VIDEO_MRC_VIEW": 0, "VIDEO_V50_WATCH_TIME": 0, "QUARTILE_95_PERCENT_VIEW": 0, "VIDEO_START": 0, "CLICKTHROUGH": 0, "PIN_CLICK": 0, "CLICKTHROUGH_RATE": 0, "FULL_SCREEN_PLAYTIME": 0 } } ] }, "lastUpdated": "2022-05-09T00:52:30.530Z", "nextUpdate": "2022-05-09T02:07:30.530Z" }, /* Lifetime analytics since start of account */ "reddit": { "analytics": { "acceptFollowers": true, // Whether the user accepts new followers "awardeeKarma": 125, // Karma points received from Reddit awards given by others "awarderKarma": 45, // Karma points earned from giving awards to others "canCreateSubreddit": true, // Whether the user has permission to create new subreddits "coins": 250, // Number of Reddit coins the user currently has "commentKarma": 2847, // Karma points earned from comments "created": "2023-03-15T14:22:30.000Z", // Account creation date in ISO format "friends": 12, // Number of Reddit friends the user has added "hasSubscribed": true, // Whether the user has subscribed to any subreddits "hasVerifiedEmail": true, // Whether the user has verified their email address "hideFromRobots": false, // Whether the user has opted to hide their profile from search engines "iconImg": "https://www.redditstatic.com/avatars/default_5.png", // URL to the user's avatar image "id": "abc123def456", // Unique Reddit user ID "inboxCount": 3, // Number of unread messages in the user's inbox "isEmployee": false, // Whether the user is a Reddit employee "isGold": false, // Whether the user has Reddit Gold/Premium subscription "isMod": false, // Whether the user is a moderator of any subreddits "isSponsor": false, // Whether the user is a Reddit sponsor "isSuspended": false, // Whether the user's account is currently suspended "linkKarma": 1567, // Karma points earned from submitted links/posts "linkedIdentities": [ // Array of external identity providers linked to the account "https://accounts.google.com" ], "name": "RedditUser_Example123", // Reddit username "over18": true, // Whether the user is over 18 (affects NSFW content visibility) "profileImageSize": null, // Dimensions of the profile image (null if using default avatar) "profileImageUrl": "https://i.redd.it/1234567890.png", // URL to custom profile image (empty if using default avatar) "suspensionExpiration": null, // When account suspension expires (null if not suspended) "totalKarma": 4414, // Total karma points (sum of link karma and comment karma) "url": "https://www.reddit.com/user/RedditUser_Example123", // Direct URL to the user's Reddit profile "verified": true // Whether the user has a verified Reddit account }, "lastUpdated": "2025-07-29T00:31:47.080Z", "nextUpdate": "2025-07-29T00:42:47.080Z" }, "snapchat": { "analytics": [ { "adsSubscribes": 6, // Number of new subscribers acquired through ads "avgViewTime": 5430, // Average view time in milliseconds per viewer "favorites": 42, // Number of times content was favorited "interactions": 156, // Number of times users interacted with content (taps, swipes) "lensAvgViewTime": 8720, // Average view time in milliseconds for lens content "lensPlays": 387, // Number of times lenses were played "lensSubscribers": 18, // Total number of lens subscribers "lensSubscribes": 5, // New lens subscribers "lensUniques": 342, // Unique users who viewed lenses "lensViewTime": 2832800, // Total lens view time in milliseconds "lensViews": 432, // Total number of lens views "mediaId": "43548e97-edf1-44f9-984a-0a38470875bc", "playTime": 4268700, // Total play time in milliseconds "profilePaidViews": 176, // Profile views from paid promotions "profileViews": 834, // Total profile views "replies": 23, // Number of replies to snaps/stories "savedStoryAvgViewTime": 4950, // Average view time for saved stories in milliseconds "savedStoryFavorites": 19, // Number of favorites on saved stories "savedStorySnapCombinedUniques": 523, // Combined unique viewers of saved stories "savedStorySnapCombinedViews": 712, // Combined views of saved stories "savedStorySnapPaidUniques": 142, // Unique paid viewers of saved stories "savedStorySnapPaidViews": 178, // Number of paid views of saved stories "savedStorySubscribes": 8, // Number of subscribes from saved stories "savedStoryUniques": 381, // Unique viewers of saved stories "savedStoryViewTime": 1925850, // Total view time of saved stories in milliseconds "savedStoryViews": 534, // Total views of saved stories "scans": 98, // Number of Snapcode scans "screenshots": 12, // Total number of screenshots taken "shares": 36, // Number of times content was shared "snapCombinedUniques": 734, // Combined unique viewers across snaps "snapCombinedViews": 912, // Combined total views across snaps "snapPaidUniques": 203, // Unique users who viewed snaps through paid promotion "snapPaidViews": 267, // Number of paid snap views "snapViewTime": 3784200, // Total snap view time in milliseconds "socialUnlocks": 54, // Number of social unlocks "spotlightAvgViewTime": 7230, // Average view time for Spotlight content in milliseconds "spotlightCombinedUniques": 1247, // Combined unique viewers of Spotlight content "spotlightCombinedViews": 1672, // Combined views of Spotlight content "spotlightFavorites": 89, // Number of favorites on Spotlight content "spotlightPaidUniques": 324, // Unique paid viewers of Spotlight content "spotlightPaidViews": 412, // Number of paid views of Spotlight content "spotlightSubscribes": 17, // Number of subscribes from Spotlight content "spotlightUniques": 923, // Unique viewers of Spotlight content "spotlightViewTime": 6765290, // Total view time of Spotlight content in milliseconds "spotlightViews": 1260, // Total views of Spotlight content "storyAvgViewTime": 5180, // Average view time for stories in milliseconds "storyFavorites": 37, // Number of favorites on stories "storySubscribers": 63, // Total number of story subscribers "storySubscribes": 9, // New story subscribers "storyUniques": 532, // Unique viewers of stories "storyViews": 687, // Total views of stories "subscribers": 143, // Total number of subscribers "subscribes": 12, // New subscribers in the period "swipeDowns": 21, // Number of swipe downs "swipeUps": 43, // Number of swipe ups "uniqueScreenshots": 9, // Number of unique users who took screenshots "uniqueSessions": 672, // Number of unique sessions "unsubscribes": 3, // Number of unsubscribes in the period "viewTime": 4568300, // Total view time in milliseconds "viewers": 723, // Number of unique viewers "views": 879 // Total number of views } ], "lastUpdated": "2025-05-21T20:24:02.787Z", "nextUpdate": "2025-05-21T20:35:02.787Z" }, "threads": { "analytics": { "biography": "Post to social media with an API for yourself or your users: Instagram, Facebook, Twitter, TikTok, YouTube, and more", "followersCount": 123, "id": "92732926562", "isEligibleForGeoRestrictions": true, "isVerified": true, "likes": 1121, "name": "Ayrshare", "profileImageUrlHttps": "https://scontent.cdninstagram.com/v/t51.2885-15/357665262_1390047998231434_3968630539537390629_n.jpg?stp=dst-jpg_e35_tt6&_nc_cat=104&ccb=1-7&_nc_sid=18de74&_nc_ohc=CHlHbGcrCaAQ7kNvwFqZTDz&_nc_oc=Adkj3ocdD7bHn5qffGIB20t1C7icONIg8CS7t4Bcf6sssxxve-k94PkCEFDXGsY6ND0&_nc_zt=23&_nc_ht=scontent.cdninstagram.com&edm=AP4hL3IEAAAA&oh=00_AfTPLboqmm2iSOGMfvS29exnVLn5U8y9QPnL6cwLQIcZ9g&oe=68915ECD", "quotes": 2, "replies": 196, "reposts": 3, "username": "ayrshare", "views": 36721 }, "lastUpdated": "2025-04-27T15:40:28.885Z", "nextUpdate": "2025-04-27T15:51:28.885Z" }, "tiktok": { "analytics": { "addressClicks": 2, // Number of clicks collected on the Address button past 60 days "appDownloadClicks": 1, // Number of clicks collected on the App Download button past 60 days "audienceAges": [ // Updated by TikTok every 24-48 hours. Only available for TikTok accounts with at least 100 followers. { "percentage": 0.125, "age": "45-54" }, { "percentage": 0.053, "age": "55+" }, { "percentage": 0.138, "age": "18-24" }, { "percentage": 0.36, "age": "25-34" }, { "percentage": 0.324, "age": "35-44" } ], "audienceCountries": [ // Updated by TikTok every 24-48 hours. { "percentage": 0.25, "country": "NG" }, { "percentage": 0.75, "country": "US" } ], "audienceGenders": [ // Updated by TikTok every 24-48 hours. { "percentage": 0.25, "gender": "Female" }, { "percentage": 0.5, "gender": "Male" }, { "percentage": 0.25, "gender": "Other" } ], "bio": "My tiktok account", "bioLinkClicks": 2, // Number of clicks collected on the Bio Link button past 60 days "commentCountPeriod": "90 days",// quarters × 90 days when date range is active (e.g., "90 days", "180 days"); "60 days" when no date filter; "partial" when the post history could not be fully retrieved "commentCountTotal": 1807, // TikTok caps profile-level lookback at 60 days. When `quarters` is set, this is the sum of lifetime engagement on posts created within the window (not engagement that occurred within the window). "displayName": "Me and You", "durationAverage": "10.72", // Deprecated. Will be removed in the future. Updated every 12 hours "emailClicks": 0, // Number of clicks collected on the Email button past 60 days "followerCount": 34, // Current follower count "followingCount": 39, // Current following count "leadSubmissions": 0, // Number of leads submitted past 60 days "isBusinessAccount": true, // Whether the account is a business account "isVerified": false, // Whether TikTok has provided a verified badge to the account after confirming that it belongs to the user it represents "likeCountTotal": 2, // Genuine all-time total - the only TikTok profile metric that returns true lifetime data (sourced from TikTok's `total_likes` field). "phoneNumberClicks": 0, // Number of clicks collected on the Phone Number button past 60 days "profileViews": 79346, // Total profile views past 60 days "shareCountPeriod": "90 days", // quarters × 90 days when date range is active (e.g., "90 days", "180 days"); "60 days" when no date filter; "partial" when the post history could not be fully retrieved "shareCountTotal": 4, // TikTok caps profile-level lookback at 60 days. When `quarters` is set, this is the sum of lifetime engagement on posts created within the window (not engagement that occurred within the window). "url": "https://vm.tiktok.com/ZTRuw5kM6/", "userImage": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/f123c4b57351e266", "username": "@funnyone", "videoCountTotal": 18, // Video total video count "viewCountPeriod": "90 days", // quarters × 90 days when date range is active (e.g., "90 days", "180 days"); "60 days" when no date filter; "partial" when the post history could not be fully retrieved "viewCountTotal": 1493 // TikTok caps profile-level lookback at 60 days. When `quarters` is set, this is the sum of lifetime engagement on posts created within the window (not engagement that occurred within the window). }, "lastUpdated": "2022-05-09T00:52:30.530Z", "nextUpdate": "2022-05-09T02:07:30.530Z" }, /* Lifetime analytics since start of handle */ "twitter": { "analytics": { "created": "2019-11-12T15:22:57Z", "description": "The best X account", "displayName": "Ayrshare", "followersCount": 11253, "followingCount": 4242, "id": 11842743387998232, "isIdentityVerified": false, // Whether the account is a verified account "likeCount": 561, // The number of likes created by this user "listedCount": 17, // The number of lists that include this user "location": "New York, NY", "mostRecentTweetId": "1848848832072667321", "name": "ayrshare", "parody": false, // Whether the account is a parody account "pinnedTweet": { "text": "Happy Days!", "id": "184884883207266733342", "editHistoryTweetIds": [ "18488488320726673223" ] }, "profileBannerUrl": "https://pbs.twimg.com/profile_banners/87253/15041912", "profileImageUrl": "http://pbs.twimg.com/profile_images/1184/lvQZPpt_normal.png", "protected": false, // User has chosen to protect their posts (private posts) "receivesYourDM": true, // User has chosen to receive direct messages from others "subscription": { "subscribesToYou": false }, "subscriptionType": "Premium", // Premium, PremiumPlus, None "tweetCount": 2930, // The number of Tweets (including retweets) issued by the user "url": "https://t.co/2XqeJiBy", "username": "ayrshare", "verified": true, // When true, indicates that the user has a verified account "verifiedType": "blue", // "blue", "business", "none" "website": "https://www.wondrouswaffles.com/" }, "lastUpdated": "2022-05-09T00:52:30.530Z", "nextUpdate": "2022-05-09T02:07:30.530Z" }, "youtube": { /* Lifetime analytics since start of channel */ "analytics": { "averageViewDuration": 99, // The average length, in seconds, of video playbacks. "averageViewPercentage": 127.06, // The average percentage of a video watched during a video playback. "comments": 8, "created": "2010-01-10T15:30:57Z", "description": "This is the channel you want", "dislikes": 1, // The number of times that users indicated that they disliked a video by giving it a negative rating. "estimatedMinutesWatched": 72, // The number of minutes that users watched videos for the specified channel, content owner, video, or playlist. "hiddenSubscriberCount": false, // Indicates whether the channel's subscriber count is publicly visible. "isLinked": true, "likes": 3, // Sum of likes across all videos on the channel within the date window determined by `quarters` (default: last 360 days). YouTube does not expose a lifetime channel-wide like counter. For a lifetime total, pass `youtube: { lifetime: true }` to get the `lifetimeLikes` field. "lifetimeLikes": 8750, // Opt-in lifetime sum of likes across every public video on the channel. Shown here because this sample assumes the request included `youtube: { lifetime: true }` — the broad request example at the top of this page does NOT include that flag, so `lifetimeLikes` will be absent from responses to that example request. May be `null` if channel exceeds 1,000-video threshold. Cached for 24 hours per channel. Deleted and private videos are excluded. "longUploadsStatus": "allowed", "playlistId": "UUsp6CnxiNbUUYKZwXQ", // Primary playlist "playlists": [ // All playlists associated with the connected channel { "description": "Playlist 1", "id": "PLcLpmVOb3fDaf7", "publishedAt": "2022-10-21T21:05:55Z", "title": "Super Playlist", "url": "https://www.youtube.com/playlist?list=PLcLpmVOb3fDaf7" }, { "description": "Playlist 2", "id": "FLsp6CnxiNbU", "publishedAt": "2012-02-26T19:16:55Z", "title": "Favorites", "url": "https://www.youtube.com/playlist?list=FLsp6CnxiNbU" } ], "privacyStatus": "public", // "public", "private", or "unlisted" "shares": 34, // The number of times that users shared a video through the Share button "subscriberCount": "67", // The number of subscribers that the channel has. "subscribersGained": 34, // The number of times that users subscribed to a channel. "subscribersLost": 2, // The number of times that users unsubscribed from a channel. "thumbnailUrl": "https://yt3.ggpht.com/ytc/AMLnZu_lgyzY2EFDAP-no-rj", "title": "The Best Channel", "url": "https://www.youtube.com/@youtube53", // The Channel URL using the custom handle "videoCount": "202", "videosAddedToPlaylists": 23, "videosRemovedFromPlaylists": 2, "viewCount": "5", // The sum of the number of times all the videos in all formats have been viewed for a channel for all time. "views": 44 // The number of video views that occurred in the last time period (quarters) }, "quarters": 4, "lastUpdated": "2022-05-09T00:52:30.530Z", "nextUpdate": "2022-05-09T02:07:30.530Z" } // The top-level `warnings` array (see the "warnings" Info block above) // would appear here as a sibling of `youtube`/`instagram`/etc. only when // a non-fatal condition applies — e.g. `lifetimeLikes` being skipped // because a channel exceeds the 1,000-video threshold. It is omitted in // this success example because `lifetimeLikes: 8750` was computed // successfully above. } ``` ```json 200: Success Daily {4, 612, 671, 1590, 1832} theme={"system"} // Available for Facebook, Instagram, Snapchat, TikTok, and YouTube // Recommended: https://www.ayrshare.com/docs/apis/overview#compression { "facebook": { "analytics": { "about": "One of the best stie ever", "category": "Local Business", "emails": [ "hello@ayrshare.com" ], "fanCount": 48519, "followersCount": 48681, "id": "885526541490222", "instagramBusinessAccount": { "id": "1784145407231999" }, "isPublished": true, "link": "https://www.facebook.com/885526541490222", "location": { // Physical location details for the Page "city": "Rome", "country": "Italy", "latitude": 41.853696407098, "longitude": 12.573806071995, "street": "Via Vincenzo", "zip": "00174" }, "name": "Super Site", "overallStarRating": 0, // The average star rating of the page. "pageFollows": { "period": "day", "values": [ { "value": 3, "endTime": "2025-08-12T07:00:00.000Z" }, { "value": 3, "endTime": "2025-08-13T07:00:00.000Z" }, ], "total": 3 }, "pageMediaView": { "period": "day", "values": [ { "value": 100, "endTime": "2025-08-12T07:00:00.000Z" }, { "value": 200, "endTime": "2025-08-13T07:00:00.000Z" } ], "total": 300 }, "pageMediaViewIsFromAds": { "period": "day", "values": [ { "value": 22, "endTime": "2025-08-12T07:00:00.000Z" }, { "value": 41, "endTime": "2025-08-13T07:00:00.000Z" } ], "total": 63 }, "pageMediaViewIsFromFollowers": { "period": "day", "values": [ { "value": 67, "endTime": "2025-08-12T07:00:00.000Z" }, { "value": 29, "endTime": "2025-08-13T07:00:00.000Z" } ], "total": 96 }, "pagePostEngagements": { // The number of interactions with your posts such as likes, comments, shares and more "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoCompleteViews30S": { // The number of times videos played for at least 30 seconds "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoCompleteViews30SAutoplayed": { // The number of times videos played for at least 30 seconds when autoplayed "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoCompleteViews30SClickToPlay": { // The number of times videos played for at least 30 seconds after clicking play "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoCompleteViews30SOrganic": { // The number of times videos played for at least 30 seconds through organic reach "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoCompleteViews30SPaid": { // The number of times videos played for at least 30 seconds through paid reach "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoCompleteViews30SRepeatViews": { // The number of times videos were replayed after playing for at least 30 seconds "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoCompleteViews30SUnique": { // The number of unique people who watched your videos for at least 30 seconds "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoRepeatViews": { // The number of times videos were replayed "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViewTime": { // Total time in seconds that videos were viewed "period": "day", "total": 2.33, "values": [ { "value": 2.33, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews": { // The number of times your videos were viewed "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews10S": { // The number of times videos played for at least 10 seconds "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews10SAutoplayed": { // The number of times videos played for at least 10 seconds when autoplayed "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews10SClickToPlay": { // The number of times videos played for at least 10 seconds after clicking play "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews10SOrganic": { // The number of times videos played for at least 10 seconds through organic reach "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews10SPaid": { // The number of times videos played for at least 10 seconds through paid reach "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews10SRepeatViews": { // The number of times videos were replayed after playing for at least 10 seconds "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViews10SUnique": { // The number of unique people who watched your videos for at least 10 seconds "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViewsAutoplayed": { // The number of times your videos autoplayed "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViewsByPaidNonPaid": { // Breakdown of video views by paid vs non-paid distribution "period": "day", "values": [ { "value": { "total": 0, "unpaid": 0, "paid": 0 }, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": { "total": 0, "unpaid": 0, "paid": 0 }, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViewsByUploadedHosted": { // Breakdown of video views by uploaded vs hosted content "period": "day", "values": [ { "value": { "pageUploaded": 0, "pageUploadedFromCrossposts": 0, "pageUploadedFromShares": 0, "pageHostedCrosspost": 0, "pageHostedShare": 0, "pageOwned": 0 }, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": { "pageUploaded": 0, "pageUploadedFromCrossposts": 0, "pageUploadedFromShares": 0, "pageHostedCrosspost": 0, "pageHostedShare": 0, "pageOwned": 0 }, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViewsClickToPlay": { // The number of times people clicked play to view your videos "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViewsOrganic": { // The number of times your videos were viewed through organic reach "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, "pageVideoViewsPaid": { // The number of times your videos were viewed through paid reach "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-11-03T07:00:00.000Z" }, { "value": 0, "endTime": "2024-11-04T08:00:00.000Z" } ] }, // pageVideoViewsUnique was retired by Meta (June 15, 2026); see the note at the top of this page. "phone": "+39067265341", "reactions": { // Breakdown of reactions on your Page's content "like": 142, "love": 9, "wow": 1, "haha": 0, "sorry": 0, "anger": 0, "total": 152 }, "unreadMessageCount": 0, "username": "ayrshare", "verified": false, "website": "http://www.ayrshare.com" }, "quarters": 1, "lastUpdated": "2024-03-19T17:48:21.329Z", "nextUpdate": "2024-03-19T17:59:21.329Z" }, "instagram": { "analytics": { "audienceCity": { "KIRKLAND, WASHINGTON": 7, "LAKE BOSWORTH, WASHINGTON": 20, "BURLINGTON, WASHINGTON": 5, "SEATTLE, WASHINGTON": 22, "ARLINGTON HEIGHTS, WASHINGTON": 7, }, "audienceCountry": { "MM": 1, "CA": 2, "US": 2201, "LK": 1 }, "audienceGenderAge": { "F.13-17": 11, "F.18-24": 83, "M.13-17": 9, "M.18-24": 85, "M.65+": 10, "U.55-64": 25, "U.65+": 12 }, "biography": "Official Instagram feed for the best IG account", "commentsCount": 552, "followersCount": 2299, "followsCount": 26, "id": "17841407938064444", "igId": 79483284444, // legacy Instagram user ID - only available when Instagram is linked via Facebook Page "igLoginId": "84739261504829371", // Instagram native user ID - only available when Instagram is linked via direct Instagram login "likeCount": 30808, "mediaCount": 537, "name": "Best IG Account", "profilePictureUrl": "https://scontent-lga3-1.xx.fbcdn.net/v/t51.2885-15", "reach": { // Returned only when daily=true (replaces the scalar `reachCount` from non-daily mode) "period": "day", // Granularity of the time-series buckets "values": [ // Per-day reach time-series { "value": 387, "endTime": "2024-07-23T07:00:00.000Z" }, { "value": 46, "endTime": "2024-07-24T07:00:00.000Z" }, { "value": 4, "endTime": "2024-07-25T07:00:00.000Z" } ] }, "username": "instagram", "website": "https://www.instagram.com" }, "lastUpdated": "2024-07-25T16:09:33.608Z", "nextUpdate": "2024-07-25T16:20:33.608Z" }, "snapchat": { "analytics": [ { "adsSubscribes": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 0 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 0 }, "avgViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 7126 }, { "endTime": "2026-01-22T00:00:00Z", "value": 7003 } ], "total": 14129 }, "favorites": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 4 }, { "endTime": "2026-01-22T00:00:00Z", "value": 3 } ], "total": 7 }, "interactions": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 8 }, { "endTime": "2026-01-22T00:00:00Z", "value": 22 } ], "total": 30 }, "lensAvgViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3712 }, { "endTime": "2026-01-22T00:00:00Z", "value": 7837 } ], "total": 11549 }, "lensDauOverMau": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 0.074 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0.042 } ], "total": 0.116 }, "lensDauOverWau": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 0.194 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0.251 } ], "total": 0.445 }, "lensPlays": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 11 }, { "endTime": "2026-01-22T00:00:00Z", "value": 45 } ], "total": 56 }, "lensSubscribers": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 206 }, { "endTime": "2026-01-22T00:00:00Z", "value": 207 } ], "total": 413 }, "lensSubscribersGained": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3 }, { "endTime": "2026-01-22T00:00:00Z", "value": 1 } ], "total": 4 }, "lensSubscribes": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2 } ], "total": 5 }, "lensUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 30 }, { "endTime": "2026-01-22T00:00:00Z", "value": 5 } ], "total": 35 }, "lensViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 1153 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2231 } ], "total": 3384 }, "lensViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 29 }, { "endTime": "2026-01-22T00:00:00Z", "value": 25 } ], "total": 54 }, "mediaId": "6e9193cd-5013-478e-a272-d3d0e881f53f", "playTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 5273 }, { "endTime": "2026-01-22T00:00:00Z", "value": 5763 } ], "total": 11036 }, "profilePaidViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 2 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 2 }, "profileViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 25 }, { "endTime": "2026-01-22T00:00:00Z", "value": 44 } ], "total": 69 }, "replies": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 0 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2 } ], "total": 2 }, "savedStoryAvgViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 5471 }, { "endTime": "2026-01-22T00:00:00Z", "value": 3408 } ], "total": 8879 }, "savedStoryFavorites": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 2 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 2 }, "savedStorySnapCombinedUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 19 }, { "endTime": "2026-01-22T00:00:00Z", "value": 22 } ], "total": 41 }, "savedStorySnapCombinedViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 13 }, { "endTime": "2026-01-22T00:00:00Z", "value": 39 } ], "total": 52 }, "savedStorySnapPaidUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 3 }, "savedStorySnapPaidViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 8 }, { "endTime": "2026-01-22T00:00:00Z", "value": 4 } ], "total": 12 }, "savedStorySubscribes": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 2 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2 } ], "total": 4 }, "savedStoryUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 16 }, { "endTime": "2026-01-22T00:00:00Z", "value": 23 } ], "total": 39 }, "savedStoryViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 2287 }, { "endTime": "2026-01-22T00:00:00Z", "value": 4385 } ], "total": 6672 }, "savedStoryViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 14 }, { "endTime": "2026-01-22T00:00:00Z", "value": 12 } ], "total": 26 }, "scans": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 4 }, { "endTime": "2026-01-22T00:00:00Z", "value": 5 } ], "total": 9 }, "screenshots": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 0 }, { "endTime": "2026-01-22T00:00:00Z", "value": 6 } ], "total": 6 }, "shares": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 4 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2 } ], "total": 6 }, "snapCombinedUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 39 }, { "endTime": "2026-01-22T00:00:00Z", "value": 32 } ], "total": 71 }, "snapCombinedViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 88 }, { "endTime": "2026-01-22T00:00:00Z", "value": 111 } ], "total": 199 }, "snapPaidUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 15 }, { "endTime": "2026-01-22T00:00:00Z", "value": 7 } ], "total": 22 }, "snapPaidViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 10 }, { "endTime": "2026-01-22T00:00:00Z", "value": 16 } ], "total": 26 }, "snapViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3455 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2858 } ], "total": 6313 }, "socialUnlocks": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 2 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 2 }, "spotlightAvgViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 8990 }, { "endTime": "2026-01-22T00:00:00Z", "value": 5401 } ], "total": 14391 }, "spotlightCombinedUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 44 }, { "endTime": "2026-01-22T00:00:00Z", "value": 25 } ], "total": 69 }, "spotlightCombinedViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 45 }, { "endTime": "2026-01-22T00:00:00Z", "value": 84 } ], "total": 129 }, "spotlightFavorites": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2 } ], "total": 5 }, "spotlightPaidUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 9 }, { "endTime": "2026-01-22T00:00:00Z", "value": 4 } ], "total": 13 }, "spotlightPaidViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 13 }, { "endTime": "2026-01-22T00:00:00Z", "value": 4 } ], "total": 17 }, "spotlightSubscribes": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 0 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 0 }, "spotlightUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 33 }, { "endTime": "2026-01-22T00:00:00Z", "value": 18 } ], "total": 51 }, "spotlightViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 6286 }, { "endTime": "2026-01-22T00:00:00Z", "value": 5193 } ], "total": 11479 }, "spotlightViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 24 }, { "endTime": "2026-01-22T00:00:00Z", "value": 33 } ], "total": 57 }, "storyAvgViewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 6740 }, { "endTime": "2026-01-22T00:00:00Z", "value": 6862 } ], "total": 13602 }, "storyFavorites": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 4 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2 } ], "total": 6 }, "storySubscribers": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 546 }, { "endTime": "2026-01-22T00:00:00Z", "value": 547 } ], "total": 1093 }, "storySubscribersGained": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3 }, { "endTime": "2026-01-22T00:00:00Z", "value": 3 } ], "total": 6 }, "storySubscribes": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 2 }, { "endTime": "2026-01-22T00:00:00Z", "value": 1 } ], "total": 3 }, "storyUniques": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 9 }, { "endTime": "2026-01-22T00:00:00Z", "value": 13 } ], "total": 22 }, "storyViews": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 18 }, { "endTime": "2026-01-22T00:00:00Z", "value": 25 } ], "total": 43 }, "subscribers": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 273 }, { "endTime": "2026-01-22T00:00:00Z", "value": 274 } ], "total": 547 }, "subscribersGained": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 4 }, { "endTime": "2026-01-22T00:00:00Z", "value": 2 } ], "total": 6 }, "subscribes": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3 }, { "endTime": "2026-01-22T00:00:00Z", "value": 3 } ], "total": 6 }, "swipeDowns": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 6 }, { "endTime": "2026-01-22T00:00:00Z", "value": 4 } ], "total": 10 }, "swipeUps": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 5 }, { "endTime": "2026-01-22T00:00:00Z", "value": 11 } ], "total": 16 }, "uniqueScreenshots": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 3 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 3 }, "uniqueSessions": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 34 }, { "endTime": "2026-01-22T00:00:00Z", "value": 11 } ], "total": 45 }, "unsubscribes": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 0 }, { "endTime": "2026-01-22T00:00:00Z", "value": 0 } ], "total": 0 }, "viewTime": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 11140 }, { "endTime": "2026-01-22T00:00:00Z", "value": 7310 } ], "total": 18450 }, "viewers": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 42 }, { "endTime": "2026-01-22T00:00:00Z", "value": 53 } ], "total": 95 }, "views": { "period": "day", "values": [ { "endTime": "2026-01-21T00:00:00Z", "value": 33 }, { "endTime": "2026-01-22T00:00:00Z", "value": 74 } ], "total": 107 } } ], "lastUpdated": "2026-04-20T13:13:47.646Z", "nextUpdate": "2026-04-20T13:24:47.646Z" }, "tiktok": { // TikTok Analytics with "day" period - date range window determined by quarters parameter "analytics": { "addressClicks": { // Number of clicks collected on the Address button past 60 days "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 0, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "appDownloadClicks": { // Number of clicks collected on the App Download button past 60 days "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 0, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "audienceActivity": { // Hourly follower activity. Updated by TikTok every 24-48 hours after posting. Only available for TikTok accounts with at least 100 followers. "period": "day", "total": 14824, "values": [ { "value": [ { "count": 12386, "hour": "5" }, { "count": 2438, "hour": "9" } ], "endTime": "2025-01-21T00:00:00.000Z" } ] }, "audienceAges": [ // Updated by TikTok every 24-48 hours after posting. Only available for TikTok accounts with at least 100 followers. { "percentage": 0.125, "age": "45-54" }, { "percentage": 0.053, "age": "55+" }, { "percentage": 0.138, "age": "18-24" }, { "percentage": 0.36, "age": "25-34" }, { "percentage": 0.324, "age": "35-44" } ], "audienceCountries": [ { "country": "SV", "percentage": 0.003 }, { "country": "US", "percentage": 0.808 } ], "audienceGenders": [ { "percentage": 0.76, "gender": "Female" }, { "percentage": 0.24, "gender": "Male" }, { "percentage": 0, "gender": "Other" } ], "bio": "This is the bio of the TikTok account", "bioLinkClicks": { // Number of clicks collected on the Bio Link button past 60 days "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 0, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "commentCountTotal": { // Total comment count past 60 days "period": "day", "values": [ { "value": 6, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 6, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "displayName": "ayrshare", "emailClicks": { // Number of clicks collected on the Email button past 60 days "period": "day", "values": [ { "value": 0, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 0, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "followerCount": { // Daily follower count snapshots (past 60 days) "period": "day", "values": [ { "value": 58, // Total followers at end of this day "endTime": "2025-01-21T00:00:00.000Z" // End of day timestamp }, { "value": 92, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "leadSubmissions": { // Number of leads submitted past 60 days "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 0, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "likeCountTotal": { // Total Likes across past 60 days "period": "day", "total": 1161, "values": [ { "value": 625, // Number of likes received on this date "endTime": "2025-01-21T00:00:00.000Z" // End of the day timestamp }, { "value": 536, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "phoneNumberClicks": { // Number of clicks collected on the Phone Number button past 60 days "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 0, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "profileViews": { // Total profile views past 60 days "period": "day", "total": 713, "values": [ { "value": 360, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 353, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "shareCountTotal": { // Total share count past 60 days "period": "day", "total": 3, "values": [ { "value": 2, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 1, "endTime": "2025-01-20T00:00:00.000Z" } ] }, "url": "https://vm.tiktok.com/ZT2NdEX33/", "userImage": "https://p16-pu-sign-useast8.tiktokcdn-us.com/tos-useastc", "username": "ayrshare", "videoCountTotal": 121, // Total video count "viewCountTotal": { // Total view count past 60 days "period": "day", "total": 17808, "values": [ { "value": 9324, "endTime": "2025-01-21T00:00:00.000Z" }, { "value": 8484, "endTime": "2025-01-20T00:00:00.000Z" } ] } }, "lastUpdated": "2025-01-24T23:33:12.678Z", "nextUpdate": "2025-01-24T23:44:12.678Z" }, "youtube": { // If no analytics are available for a given day, not values will be returned "analytics": { "averageViewDuration": { "period": "day", "total": 4, "values": [ { "value": 4, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "averageViewPercentage": { "period": "day", "total": 61.99, "values": [ { "value": 61.99, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "comments": { "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "created": "2010-01-10T15:30:57Z", "description": "The best place to find the best products", "dislikes": { "period": "day", "total": 0, "values": [ { "value": 0, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "estimatedMinutesWatched": { "period": "day", "total": 23.12, "values": [ { "value": 23.12, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "handle": "@helmar1066", "hiddenSubscriberCount": false, "id": "UCsp6CnxiNbUU0AJtuYKZwXQ", "isChannelMonetizationEnabled": false, "isLinked": true, "likes": { "period": "day", "total": 12, "values": [ { "value": 12, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "longUploadsStatus": "allowed", "playlistId": "UUsp6CnxiNbUU0AJtuYKZwXQ", "playlists": [ { "description": "", "id": "PLcLpmVOb3fDaf7Mps-5GnCxRZy_FBBEv4", "publishedAt": "2022-10-21T21:05:55Z", "title": "Super One", "url": "https://www.youtube.com/playlist?list=PLcLpmVOb3fDaf7Mps-5GnCxRZy_FBBEv4", "channelId": "UCsp6CnxiNbUU0AJtuYKZwXQ" }, { "description": "", "id": "FLsp6CnxiNbUU0AJtuYKZwXQ", "publishedAt": "2012-02-26T19:16:55Z", "title": "Favorites", "url": "https://www.youtube.com/playlist?list=FLsp6CnxiNbUU0AJtuYKZwXQ", "channelId": "UCsp6CnxiNbUU0AJtuYKZwXQ" } ], "privacyStatus": "public", "shares": { "period": "day", "total": 3, "values": [ { "value": 3, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "subscriberCount": 0, "subscribersGained": { "period": "day", "total":80, "values": [ { "value": 8, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "subscribersLost": { "period": "day", "total": 1, "values": [ { "value": 1, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "thumbnailUrl": "https://yt3.ggpht.com/ytc/AIdro_lIMzJl5UC7MBEnCzuMpXzai_EvIk5Xh3ErDJ_VTBk=s88-c-k-c0x00ffffff-no-rj", "title": "helmar1066", "url": "https://www.youtube.com/@helmar1066", "videoCount": 5, "videosAddedToPlaylists": { "period": "day", "total": 2, "values": [ { "value": 2, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "videosRemovedFromPlaylists": { "period": "day", "total": 1, "values": [ { "value": 1, "endTime": "2024-03-18T00:00:00.000Z" } ] }, "viewCount": 7, "views": { "period": "day", "total": 3, "values": [ { "value": 3, "endTime": "2024-03-18T00:00:00.000Z" } ] } }, "quarters": 1, "lastUpdated": "2024-04-25T21:24:45.433Z", "nextUpdate": "2024-04-25T21:35:45.433Z" } "status": "success" } ``` ```json 200: Backfilled Response theme={"system"} { "status": "success", "twitter": { "analytics": { "created": "2025-12-19T14:09:06Z", "description": "", "displayName": "Andrew Williams", "followersCount": 1523, "followingCount": 412, "tweetCount": 8721, "likeCount": 3200, "listedCount": 5, "username": "andrewwil1985", "backfilledFrom": "2026-04-08T14:30:00.000Z" }, "lastUpdated": "2026-04-09T10:15:00.000Z", "nextUpdate": "2026-04-09T10:26:00.000Z" } } ``` ```json 200: Recovered Response theme={"system"} { "status": "success", "twitter": { "analytics": { "created": "2025-12-19T14:09:06Z", "description": "", "displayName": "Andrew Williams", "followersCount": 1523, "followingCount": 412, "tweetCount": 8721, "likeCount": 3200, "listedCount": 5, "username": "andrewwil1985", "recoveredFrom": "2026-04-08T14:30:00.000Z" }, "lastUpdated": "2026-04-09T10:15:00.000Z", "nextUpdate": "2026-04-09T10:26:00.000Z" } } ``` ```json 400: Bad Request theme={"system"} { "action": "request", "status": "error", "code": 101, "message": "Missing or incorrect parameters. Please verify with the docs. /rest-api/endpoints Details: One of the platforms requested in not supported." } ``` ```json 400: Social Not Linked theme={"system"} { "linkedin": { "action": "post", "status": "error", "code": 156, "message": "LinkedIn is not properly linked and must be re-linked. Please go to the Social Accounts ppage and re-link LinkedIn." }, "code": 156, "status": "error" } ``` ```json 400: Partial Error theme={"system"} { // A partial error response is returned if some of the data is available but there is an error. "youtube": { "views": 401, "comments": 2, "likes": 37, "dislikes": 2, "estimatedMinutesWatched": 102, "averageViewDuration": 12, "averageViewPercentage": 32.66, "subscribersGained": 2, "subscribersLost": 4, "videosAddedToPlaylists": 2, "videosRemovedFromPlaylists": 1, "shares": 25, "errors": [ { "action": "authorization", "status": "error", "code": 193, "message": "An error occurred connecting to YouTube. Please try your request once more or re-linking YouTube on the social linking page if the issue persists: https://www.ayrshare.com/docs/dashboard/connect-social-accounts/youtube", "details": "Error getting YouTube channel and playlist analytics: Insufficient Permission" } ], "status": "error" }, "lastUpdated": "2025-01-27T02:59:13.119Z", "nextUpdate": "2025-01-27T03:10:13.119Z", "status": "error" } ``` # Analytics on a Post by Social ID Source: https://www.ayrshare.com/docs/apis/analytics/social-by-id POST /analytics/post Get real-time analytics for posts using the Social Post ID Retrieve analytics for posts that did not originate via Ayrshare by providing the low-level [Social Post ID](/docs/apis/overview#social-post-id). This ID is returned in the `postIds` field of the [/post endpoint](/docs/apis/post/post). The linked account must be the owner of the post to retrieve the analytics (exception: YouTube; see below). Support platforms: `Facebook`, `Instagram`, `LinkedIn`, `Threads`, `TikTok`, `Twitter`, and `YouTube`.
  • The call is the same as the [Analytics on a Post endpoint](/docs/apis/analytics/post). The key difference is you use the post id return by the social network instead of the Ayrshare ID. Also include the `searchPlatformId: true` parameter to notify the endpoint you're searching by the Social Post ID.
  • Use the [Get All Post History endpoint](/docs/apis/history/overview) to retrieve posts and IDs originating outside of Ayrshare found in the `id` field.
  • Recommend to only use for posts not sent via Ayrshare. For posts sent via Ayrshare, use the [analytics endpoint](/docs/apis/analytics/post).
  • Analytics on Instagram posts that were published before the user's account was converted to a business account from a personal account have limited analytics.
  • If retrieving YouTube analytics for a post that doesn't belong to your channel using the social ID method, the API will return descriptive metadata about the content while showing zeros for all numerical metrics. Descriptive information such as title, description, tags, channel title, privacy status, and thumbnail URLs will be correctly populated, providing context about the video content. However, all numerical performance metrics including views, likes, comments, shares, subscriber changes, watch time, and playlist additions will return as zero values.
  • When using `postIds` for X/Twitter threads, each tweet's Social Post ID must be provided individually, thread tweets are not automatically included when querying the parent post.
## Header Parameters ## Body Parameters Either `id` or `postIds` must be provided. Use `id` for a single post or `postIds` for retrieving analytics on multiple posts in a single request. [Social Post ID](/docs/apis/overview#social-post-id) returned from the [/post endpoint](/docs/apis/post/post). This is the `id` field for an individual social network found in the `postIds` array. Either `id` or `postIds` is required. Array of [Social Post IDs](/docs/apis/overview#social-post-id) to retrieve analytics for multiple posts in a single request. Maximum of 100 IDs allowed. Either `id` or `postIds` is required. ```json theme={"system"} { "postIds": ["1979851549871354062", "2011793803951137234"] } ``` String array of platforms to retrieve analytics. Only one value is allowed. Available values: ```json theme={"system"} { "platforms": ["facebook", "instagram", "linkedin", "threads", "tiktok", "twitter", "youtube"] } ``` Set to `true` to search by the Social Post ID. ```json Single Post theme={"system"} { // Facebook Social Post ID "id": "104923907983682_108329000309742", "platforms": [ // Select only one platform at a time: // facebook, instagram, youtube, threads, tiktok, or twitter "facebook" ], "searchPlatformId": true // Required } ``` ```json Multiple Posts theme={"system"} { // Array of Social Post IDs (max 100) "postIds": ["1979851549871354062", "2011793803951137234"], "platforms": [ // Select only one platform at a time: // facebook, instagram, youtube, threads, tiktok, or twitter "twitter" ], "searchPlatformId": true // Required } ``` When cumulative metrics (e.g., likes, comments, views) are temporarily unavailable from the social network, the API automatically backfills them from stored data. Two optional fields may appear in the per-platform `analytics` object: * **`backfilledFrom`** (string, ISO 8601) — Present when one or more cumulative metrics were substituted from stored data. The timestamp indicates when the stored data was last updated. * **`recoveredFrom`** (string, ISO 8601) — Present when the entire analytics response was recovered from stored data due to a complete API failure. The timestamp indicates when the stored data was last updated. Stored data older than 4 days is considered stale and will not be used for backfill or recovery. ```json 200: Single Post Response theme={"system"} { /** The response is the same as Analytics on a Post. Please see that endpoint for details. Note: Some metrics are not available for posts not owned by the authorized account. For example: X does not return non-public metrics or organic metrics for Tweets not sent by the authorized user. */ } ``` ```json 200: Multiple Posts Response theme={"system"} { "twitter": [ { "id": "1313589441919827982", // Twitter Social Post ID "postUrl": "https://www.twitter.com/myaccount/1313589441919827982", "analytics": { "created": "2022-09-07T22:12:10.000Z", "entities": { "urls": [ { "start": 77, "end": 96, "url": "https://t.co/abc123", "expandedUrl": "https://www.ayrshare.com/docs", "displayUrl": "ayrshare.com/docs", "unwoundUrl": "https://www.ayrshare.com/docs" } ], "hashtags": [ { "start": 97, "end": 112, "tag": "SocialMediaAPI" } ], "mentions": [ { "start": 113, "end": 122, "username": "ayrshare" } ] }, "name": "Wonder World", "post": "Just launched our social media campaign using Ayrshare! Check out the API at https://t.co/abc123 #SocialMediaAPI @ayrshare", "publicMetrics": { "retweetCount": 0, "quoteCount": 0, "likeCount": 0, "replyCount": 0, "bookmarkCount": 0, "impressionCount": 23 }, "nonPublicMetrics": { "userProfileClicks": 1, "engagements": 1, "impressionCount": 5 }, "organicMetrics": { "likeCount": 0, "impressionCount": 5, "replyCount": 0, "retweetCount": 0, "userProfileClicks": 1 }, "username": "wondrous" }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" }, { "id": "1313589441919827999", // Twitter Social Post ID "postUrl": "https://www.twitter.com/myaccount/1313589441919827999", "analytics": { "created": "2022-09-08T14:30:00.000Z", "name": "Wonder World", "post": "Another great day for social media automation!", "publicMetrics": { "retweetCount": 5, "quoteCount": 2, "likeCount": 15, "replyCount": 3, "bookmarkCount": 1, "impressionCount": 150 }, "nonPublicMetrics": { "userProfileClicks": 8, "engagements": 12, "impressionCount": 145 }, "organicMetrics": { "likeCount": 15, "impressionCount": 145, "replyCount": 3, "retweetCount": 5, "userProfileClicks": 8 }, "username": "wondrous" }, "lastUpdated": "2022-04-23T18:44:29.778Z", "nextUpdate": "2022-04-23T19:19:29.778Z" } ], "status": "success", "code": 200 } ``` ```json 200: Backfilled Response theme={"system"} { "twitter": [ { "id": "1313589441919827982", "postUrl": "https://www.twitter.com/myaccount/1313589441919827982", "analytics": { "created": "2022-09-07T22:12:10.000Z", "name": "Wonder World", "post": "Just launched our social media campaign!", "publicMetrics": { "retweetCount": 5, "quoteCount": 2, "likeCount": 15, "replyCount": 3, "bookmarkCount": 1, "impressionCount": 150 }, "username": "wondrous", "backfilledFrom": "2026-04-08T14:30:00.000Z" }, "lastUpdated": "2026-04-09T10:15:00.000Z", "nextUpdate": "2026-04-09T10:26:00.000Z" } ], "status": "success", "code": 200 } ``` ```json 200: Recovered Response theme={"system"} { "twitter": [ { "id": "1313589441919827982", "postUrl": "https://www.twitter.com/myaccount/1313589441919827982", "analytics": { "created": "2022-09-07T22:12:10.000Z", "name": "Wonder World", "post": "Just launched our social media campaign!", "publicMetrics": { "retweetCount": 5, "quoteCount": 2, "likeCount": 15, "replyCount": 3, "bookmarkCount": 1, "impressionCount": 150 }, "username": "wondrous", "recoveredFrom": "2026-04-08T14:30:00.000Z" }, "lastUpdated": "2026-04-09T10:15:00.000Z", "nextUpdate": "2026-04-09T10:26:00.000Z" } ], "status": "success", "code": 200 } ``` ```json 400: Bad Request theme={"system"} { "lastUpdated": "2023-12-08T03:40:31.185Z", "nextUpdate": "2023-12-08T03:51:31.185Z", "youtube": { "action": "post", "status": "error", "code": 186, "message": "Post ID not found. Please verify the top level ID returned from the /post endpoint is being sent, the Profile Key is included if applicable, and the post at the social network has not been deleted. If you are trying to retrieve a post originating outside of Ayrshare, please use the /rest-api/endpoints/analytics#analytics-by-social-id", "id": "dtuu-jDp4381" } } ``` # YouTube Playlists Source: https://www.ayrshare.com/docs/apis/analytics/youtube-playlists GET /analytics/youTubePlaylists Get the YouTube playlists for the connected YouTube channel ## Header Parameters ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/analytics/youTubePlaylists ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/analytics/youTubePlaylists", { method: "GET", headers: { Authorization: `Bearer ${API_KEY}`, }, }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/analytics/youTubePlaylists', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} true, CURLOPT_HTTPHEADER => $headers ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; namespace YouTubePlaylistsGETRequest_csharp { class YouTubePlaylists { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/analytics/youTubePlaylists"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); try { HttpResponseMessage response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```json 200: Success theme={"system"} { "status": "success", "channelId": "UCsp6CnxiNbUU0AJtuYKZw", "playLists": [ { "averageTimeInPlaylist": 2.2, "averageViewDuration": 3.1, "description": "A great list", "estimatedMinutesWatched": 21, "estimatedRedMinutesWatched": 23, "id": "PLcLpmVOb3fDaf7Mps", "playlistStarts": 23, "thumbNail": { "url": "https://i.ytimg.com/vi/default.jpg", "width": 120, "height": 90 }, "title": "Super Playlist", "views": 55, "viewsPerPlaylistStart": 32 }, { "averageTimeInPlaylist": 2, "averageViewDuration": 4.5, "description": "A great list 2", "estimatedMinutesWatched": 2, "estimatedRedMinutesWatched": 3, "id": "FLsp6CnxiNbUU0AJtu", "playlistStarts": 23, "thumbNail": { "url": "https://i.ytimg.com/vi/default.jpg", "width": 120, "height": 90 }, "title": "Favorites", "views": 20, "viewsPerPlaylistStart": 23 } ], "lastUpdated": "2023-01-18T03:09:59.757Z", "nextUpdate": "2023-01-18T03:42:29.757Z" } ``` ```json 400: Error getting analytics theme={"system"} { "action": "analytics", "status": "error", "code": 294, "message": "Error getting analytics." } ``` # Delete Auto Schedule Source: https://www.ayrshare.com/docs/apis/auto-schedule/delete-schedule DELETE /auto-schedule/delete Delete a specified auto schedule Delete a particular auto schedule. Provide the title of the schedule or "default" is used. ## Header Parameters ## Body Parameters The title of the schedule to delete. This should match a schedule title that was previously created using the [Set Auto Schedule endpoint](/docs/apis/auto-schedule/set-schedule). If no title is provided, the system will attempt to delete the "default" schedule. Reset the schedule's starting point to the current time. When set to `true`, this will clear the last used schedule date, causing any new posts to be scheduled starting from the current time. Any posts that were already scheduled will remain unchanged and publish at their original times. ```javascript cURL theme={"system"} curl \ -H "Authorization: Bearer API Key" \ -H 'Content-Type: application/json' \ -d '{"title": "Schedule Title"}' \ -X DELETE https://api.ayrshare.com/api/auto-schedule/delete ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const title = "Schedule Title"; fetch("https://api.ayrshare.com/api/auto-schedule/delete", { method: "DELETE", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}` }, body: JSON.stringify({ title }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'title': 'Schedule Title'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.delete('https://api.ayrshare.com/api/auto-schedule/delete', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} $title ]; $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => "https://api.ayrshare.com/api/auto-schedule/delete", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "DELETE", // Set the request method to DELETE CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => [ "Content-Type: application/json", "Authorization: Bearer " . $API_KEY ] ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $json = json_decode($response, true); print_r($json); } curl_close($ch); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace AutoScheduleDELETERequest_csharp { class AutoScheduleDELETE { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/auto-schedule/delete"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); string json = "{\"title\": \"Schedule Title\"}"; try { var request = new HttpRequestMessage { Method = HttpMethod.Delete, RequestUri = new Uri(url), Content = new StringContent(json, Encoding.UTF8, "application/json") }; HttpResponseMessage response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```javascript 200: Success theme={"system"} { status: "success", title: "Schedule Title" } ``` # List Auto Schedule Source: https://www.ayrshare.com/docs/apis/auto-schedule/list-schedule GET /auto-schedule/list List the active auto schedules List the active auto schedules. Returns an array of schedules with titles, times, and last scheduled date. The `lastScheduleDate` timestamp is the next schedule date or the previously scheduled date if no pending posts. ## Header Parameters ```javascript cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/auto-schedule/list ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/auto-schedule/list", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/auto-schedule/list', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/auto-schedule/list", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer " . $API_KEY ] ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $json = json_decode($response, true); print_r($json); } curl_close($ch); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; namespace AutoScheduleGETRequest_csharp { class AutoSchedule { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/auto-schedule/list"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); try { HttpResponseMessage response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```javascript 200: Success theme={"system"} { "status": "success", "schedules": { "Title 1": { "lastScheduleDate": "2024-01-05T22:30:00Z", "schedule": [ "20:03Z", "22:34Z" ] }, "Title 2": { "schedule": [ "13:05Z", "22:14Z" ], "lastScheduleDate": "2024-01-04T22:30:00Z", "daysOfWeek": [ 2, 3, 4 ] } } } ``` # Auto Schedule Overview Source: https://www.ayrshare.com/docs/apis/auto-schedule/overview Create a schedule for future posts to automatically be published Auto scheduling allows you to create pre-defined posting schedules. You can set up multiple schedules, each with specific posting times on chosen days. Auto schedule is distinct from the `scheduleDate` field in the [Publish Post endpoint](/docs/apis/post/post). ## Key Features of Auto Schedule
  • Create custom schedules, e.g., post at 9 AM, 2 PM, and 5 PM on Mondays and Wednesdays.
  • Posts are automatically queued in the next available time slot.
  • No limit on the number of schedules you can create.
  • Auto schedule is distinct from the `scheduleDate` field in the [Publish Post endpoint](/docs/apis/post/post) and it is meant to automate scheduling. You should use either auto schedule or `scheduleDate`, but not both.
## Example Auto Schedule Scenario 1. Current time: Monday, 10 AM (GMT). 2. You create an auto schedule for posting at 9 AM and 5 PM. 3. You add three posts to this schedule. 4. The system automatically schedules these posts for: Monday at 5 PM, Tuesday at 9 AM, and Tuesday at 5 PM. Deleting a scheduled post doesn't free up its time slot. For example, if you delete the Monday 5 PM post and add a new post to the same schedule, it will be placed in the next available slot (in this case, Wednesday at 9 AM). ## Publish Using Auto Schedule The schedule may be applied with the [Publish Post endpoint](/docs/apis/post/post) using the following fields: ```json Auto Schedule theme={"system"} "autoSchedule": { "schedule": true, // required "title": "Schedule Title" // optional - case-sensitive } ```
  • `schedule`: (required) A Boolean value that must be set to `true` to enable auto scheduling.
  • `title`: (optional) A String value that specifies the name of the schedule. This `title` should match the name of a schedule created using the [Set Auto Schedule](/docs/apis/auto-schedule/overview) endpoint. If not provided, the default title is `default`. Note that the `title` is case-sensitive and must be an exact match.
See your list of auto schedules by calling the [List Auto Schedules](/docs/apis/auto-schedule/list-schedule) endpoint. Please see this article on [using the auto scheduling API](https://www.ayrshare.com/blog/understanding-the-ayrshare-auto-schedule-api-endpoint/) for more information. ## User Profile Auto Schedule Auto schedule for a particular user profile by [adding the PROFILE\_KEY in the header](/docs/apis/overview#profile-key-format). # Get Pending Auto Schedule Posts Source: https://www.ayrshare.com/docs/apis/auto-schedule/pending-auto-schedule GET /auto-schedule/pending Get pending auto schedule posts Retrieve all the pending (not yet published) auto schedule posts. ## Header Parameters ```javascript cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/auto-schedule/pending ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/auto-schedule/pending", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` } }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/auto-schedule/pending', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "https://api.ayrshare.com/api/auto-schedule/pending", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer " . $API_KEY ] ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $json = json_decode($response, true); print_r($json); } curl_close($ch); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; namespace AutoSchedulePendingGETRequest_csharp { class AutoSchedulePending { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/auto-schedule/pending"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); try { HttpResponseMessage response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```javascript 200: Schedule Set theme={"system"} { status: "success", message: "Auto schedule set.", title: "Schedule title", } ``` # Set Auto Schedule Source: https://www.ayrshare.com/docs/apis/auto-schedule/set-schedule POST /auto-schedule/set Set up an auto-post schedule by providing times to send Set up an auto-post schedule by providing times to send. Post will automatically be sent at the next available time. If no more times are available today, the first available time tomorrow will be used, and so on. If you're looking to just schedule a post for a future date, please see the `scheduleDate` parameter of [/post](/docs/apis/post/post) Use the auto-schedule by setting the /post autoSchedule parameter to `true` and the `title` if you want to use a particular schedule. Example, set the times to UTC time 13:05Z and 20:14Z and `autoSchedule: true` in the post. The post will be scheduled at the next available time of 13:05Z or 20:14Z. ## Header Parameters ## Body Parameters Array of strings of scheduled times to auto-post. The array will be treated as a set, so duplicates removed. Format: ISO-8601 UTC. Example: `["13:05Z", "22:14Z"]`. Not required if `setStartDate` provided. You can create multiple different posting schedules by assigning a unique title to each one. The title must contain only alphanumeric characters - special characters like `*`, `~`, `/`, `[`, or `]` are not allowed. If you specify the `title` in /post with autoScheduleTitle, that schedule will be used. Set a specific beginning date to start the auto schedule, provide a ISO-8601 UTC date time. E.g. `2021-07-08T12:30:00Z`. The start time will be applied to the provided "title" or will use the default title if one isn't provided. New posts will go out from the start date onwards. Previously scheduled posts are not affected. Specify which days of the week the post should be sent. Values 0-6 (Sunday - Saturday). For example `[1, 3]` will only publish posts on Mondays and Wednesdays. Exclude certain dates from auto scheduling occurring. For example `["2026-01-01"]` to exclude New Years. Note, only posts auto scheduled after the `excludeDates` has been set will be excluded. ```javascript cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"schedule": ["13:05Z", "20:14Z"], "title": "Instagram Schedule"}' \ -X POST https://api.ayrshare.com/api/auto-schedule/set ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const title = "Instagram Schedule"; fetch("https://api.ayrshare.com/api/auto-schedule/set", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}` }, body: JSON.stringify({ schedule: ["13:05Z", "20:14Z"], // required title: title // optional }) }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```php PHP theme={"system"} ["13:05Z", "20:14Z"], // required 'title' => "Instagram Schedule" // optional ]; $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => "https://api.ayrshare.com/api/auto-schedule/set", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => [ "Content-Type: application/json", "Authorization: Bearer " . $API_KEY ] ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $json = json_decode($response, true); print_r($json); } curl_close($ch); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; namespace AutoSchedulePOSTRequest_csharp { class AutoSchedule { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/auto-schedule/set"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); var payload = new { schedule = new[] { "13:05Z", "20:14Z" }, title = "Instagram Schedule" }; try { var content = new StringContent( System.Text.Json.JsonSerializer.Serialize(payload), System.Text.Encoding.UTF8, "application/json" ); HttpResponseMessage response = await client.PostAsync(url, content); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```go Go theme={"system"} package main import ( "bytes" "encoding/json" "log" "net/http" ) func main() { message := map[string]interface{}{ "schedule": []string{"13:05Z", "20:14Z"}, "title": "Instagram Schedule" } bytesRepresentation, err := json.Marshal(message) if err != nil { log.Fatalln(err) } req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/auto-schedule/set", bytes.NewBuffer(bytesRepresentation)) req.Header.Add("Content-Type", "application/json; charset=UTF-8") req.Header.Add("Authorization", "Bearer API_KEY") res, err := http.DefaultClient.Do(req) if err != nil { log.Fatal("Error:", err) } res.Body.Close() } ``` ```javascript 200: Schedule Set theme={"system"} { status: "success", message: "Auto schedule set.", title: "Instagram Schedule", } ``` # Create Automation Source: https://www.ayrshare.com/docs/apis/automations/create-automation POST /automations Create a new engagement-triggered automation **Beta.** See the [Automations Overview](/docs/apis/automations/overview) for the full feature description, including the Beta status. Create a new automation that fires one or more actions when any of its triggers matches. The automation activates immediately. See the [Overview](/docs/apis/automations/overview) for the full catalog of triggers, actions, template variables, and limits. The connected Instagram account is derived server-side from the caller's linked profile — **do not pass `accountId`** in the body; the request will be rejected as a validation error if you do. Pass a `profileKey` header to operate under a child profile. ## Header Parameters ## Body Parameters Target platform. Only `instagram` is supported in v1. Short human-readable name. Used in the dashboard and activity logs. Optional longer description. One or more triggers (1–50). Each entry is a discriminated union on `type`. See [Overview / Triggers](/docs/apis/automations/overview#triggers) for the full catalog. ```json comment_keyword trigger theme={"system"} { "type": "comment_keyword", "postId": "17895695668004550", // required — Instagram media id "keywords": ["INFO", "LINK"] // required — ≥1 entry, case-insensitive } ``` ```json story_reply trigger theme={"system"} { "type": "story_reply", "storyId": "17900000000000000" // optional — scope to one story } ``` ```json dm_reaction trigger theme={"system"} { "type": "dm_reaction", "emoji": "❤️" // optional — scope to one emoji } ``` ```json dm_keyword trigger theme={"system"} { "type": "dm_keyword", "keywords": ["help", "support"] // required — ≥1 entry, case-insensitive } ``` One or more actions (1–50). Each entry is a discriminated union on `type`. See [Overview / Actions](/docs/apis/automations/overview#actions) for the full catalog. Every action also accepts an optional top-level `dedupWindowMinutes` overriding the default 7-day per-recipient dedup window (`0` to disable, max `525600`). ```json send_dm action theme={"system"} { "type": "send_dm", "message": "Hey {{recipient_username}}, here is the link you wanted: https://example.com" } ``` ```json fire_webhook action theme={"system"} { "type": "fire_webhook" // POSTs to your account-level webhook URL (configured in the dashboard). // See Overview for the JSON payload shape. } ``` ```json send_email action theme={"system"} { "type": "send_email", "to": "alerts@example.com", "subject": "New {{platform}} engagement from @{{recipient_username}}", "message": "

{{recipient_username}} engaged with: {{comment_text}}

" } ``` ```json Action with per-action dedup override theme={"system"} { "type": "send_dm", "message": "Thanks {{recipient_username}}!", "dedupWindowMinutes": 1440 // 24h instead of the 7-day default } ```
**Platform compatibility.** Each trigger and action declares which platforms it supports. The validator rejects the request when an entry's `type` is not supported on the requested `platform`. All triggers and `send_dm` are currently Instagram-only; `fire_webhook` and `send_email` are platform-agnostic. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "platform": "instagram", "name": "Spring promo", "triggers": [ { "type": "comment_keyword", "postId": "17895695668004550", "keywords": ["INFO", "LINK"] } ], "actions": [ { "type": "send_dm", "message": "Hey {{recipient_username}}, here is the link you wanted: https://example.com" } ] }' \ -X POST https://api.ayrshare.com/api/automations ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/automations", { method: "POST", headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ platform: "instagram", name: "Spring promo", triggers: [ { type: "comment_keyword", postId: "17895695668004550", keywords: ["INFO", "LINK"], }, ], actions: [ { type: "send_dm", message: "Hey {{recipient_username}}, here is the link you wanted: https://example.com", }, ], }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = { "platform": "instagram", "name": "Spring promo", "triggers": [ { "type": "comment_keyword", "postId": "17895695668004550", "keywords": ["INFO", "LINK"], } ], "actions": [ { "type": "send_dm", "message": "Hey {{recipient_username}}, here is the link you wanted: https://example.com", } ], } headers = { "Authorization": "Bearer API_KEY", "Content-Type": "application/json", } r = requests.post( "https://api.ayrshare.com/api/automations", json=payload, headers=headers, ) print(r.json()) ``` ```php PHP theme={"system"} $curl = curl_init(); $data = [ "platform" => "instagram", "name" => "Spring promo", "triggers" => [ [ "type" => "comment_keyword", "postId" => "17895695668004550", "keywords" => ["INFO", "LINK"], ], ], "actions" => [ [ "type" => "send_dm", "message" => "Hey {{recipient_username}}, here is the link you wanted: https://example.com", ], ], ]; curl_setopt_array($curl, [ CURLOPT_URL => "https://api.ayrshare.com/api/automations", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY", "Content-Type: application/json", ], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "id": "auto_9xKp2Lm4nQ" } ``` ```json 400: Validation failed — unknown template variable theme={"system"} { "action": "request", "status": "error", "code": 473, "message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction", "details": { "formErrors": [], "fieldErrors": { "actions": ["message contains unknown template variables"] } } } ``` ```json 400: Validation failed — comment_keyword trigger missing keywords theme={"system"} { "action": "request", "status": "error", "code": 473, "message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction", "details": { "formErrors": [], "fieldErrors": { "triggers": ["Invalid input: expected array, received undefined"] } } } ``` ```json 400: Validation failed — unrecognized field (e.g. accountId) theme={"system"} { "action": "request", "status": "error", "code": 473, "message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction", "details": { "formErrors": ["Unrecognized key: \"accountId\""], "fieldErrors": {} } } ``` ```json 403: Plan tier required theme={"system"} { "action": "automation", "status": "error", "code": 468, "message": "Instagram DM automations require a Business or Enterprise plan" } ``` ```json 403: Feature flag not yet enabled theme={"system"} { "action": "request", "status": "error", "code": 472, "message": "This feature is not yet available on your account. Please contact us if you'd like early access." } ``` ```json 400: No linked social account for this platform theme={"system"} { "action": "automation", "status": "error", "code": 471, "message": "No social account linked on the requested platform for this profile. Link the account on the Social Accounts page and try again." } ``` ```json 429: Active automation cap reached theme={"system"} { "action": "automation", "status": "error", "code": 470, "message": "Active automation limit reached for your plan tier" } ``` # Delete Automation Source: https://www.ayrshare.com/docs/apis/automations/delete-automation DELETE /automations/:id Soft-delete an automation **Beta.** See the [Automations Overview](/docs/apis/automations/overview) for the full feature description. Soft-deletes the automation. The master row is flagged `deleted: true, active: false`; no new dispatches occur from this point on. Existing triggers, actions, and activity rows are **not** cascaded. The activity history remains queryable via [`GET /automations/:id/activity`](/docs/apis/automations/get-activity) for as long as the rows exist in Firestore (retention is indefinite for trace and analytics). Soft-deleted automations no longer count against your active automation cap. They cannot be restored via the API; create a new automation instead. ## Header Parameters ## Path Parameters The automation ID returned from `POST /automations`. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X DELETE https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const id = "auto_9xKp2Lm4nQ"; fetch(`https://api.ayrshare.com/api/automations/${id}`, { method: "DELETE", headers: { "Authorization": `Bearer ${API_KEY}` }, }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {"Authorization": "Bearer API_KEY"} automation_id = "auto_9xKp2Lm4nQ" r = requests.delete( f"https://api.ayrshare.com/api/automations/{automation_id}", headers=headers, ) print(r.json()) ``` ```php PHP theme={"system"} $id = "auto_9xKp2Lm4nQ"; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "DELETE", CURLOPT_HTTPHEADER => ["Authorization: Bearer API_KEY"], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "id": "auto_9xKp2Lm4nQ" } ``` ```json 404: Not found theme={"system"} { "action": "automation", "status": "error", "code": 469, "message": "Automation not found" } ``` # Get Automation Activity Source: https://www.ayrshare.com/docs/apis/automations/get-activity GET /automations/:id/activity Cursor-paginated audit log for one automation **Beta.** See the [Automations Overview](/docs/apis/automations/overview) for the full feature description. Returns every dispatch attempt for one automation, newest first. Each row records the recipient, the matched trigger, every action's result, and any error. Rows from the last **30 days** are returned. Older rows exist in Firestore (retention is indefinite for analytics) but are excluded from this endpoint for performance. ## Activity row status Each row has a top-level `status` plus a per-action `status` inside `actionResults[]`. | Status | When it's recorded | | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `pending` | Row was just written; the worker hasn't picked it up yet | | `in_flight` | The worker is currently dispatching | | `sent` | Every action was **accepted** by the platform. For `send_dm` this means Instagram accepted the message — **not** that the recipient received it (see the note below) | | `failed` | At least one action was rejected by the platform or could not run (and none hit an auth error). The reason is on `actionResults[].errorDetails` | | `auth_error` | The Instagram access token was invalid; the DM was not retried | | `rate_limited` | The daily DM cap (tier or per-profile) was hit. No DM was sent | | `deduplicated` | This action already fired to this recipient inside its dedup window (default 7 days, per-action configurable) | | `skipped` | The automation became inactive or was deleted between fan-out and dispatch | `pending` and `in_flight` are transient; everything else is terminal. **`sent` confirms Instagram accepted the message, not that the recipient received it.** Instagram exposes no delivery signal on any API surface, and if the recipient's **Message requests** setting blocks strangers, Meta accepts the send and silently drops it. See [Automation DM Sent but Not Delivered](/docs/help-center/technical-support/automation_dm_sent_but_not_delivered). ## Per-action result fields Each entry in `actionResults[]` describes one action's outcome: | Field | Type | Description | | -------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `actionId` | string | The action's stable ID within the automation | | `type` | string | The action type (`send_dm`, `fire_webhook`, `send_email`) | | `status` | string | Per-action status, using the same vocabulary as the row `status` above | | `errorDetails` | string \| `null` | Human-readable failure reason when the action did not succeed; `null` (or absent) on success. For a rejected `send_dm` this carries the mapped error message (e.g. the private-reply window is closed, or the comment already received a reply) | | `completedAt` | string | ISO 8601 timestamp when the action finished | For comment-triggered automations (`comment_keyword`), the row also carries a top-level `commentId` — the raw Instagram comment ID the DM was anchored to. It is `null` for message-driven triggers (`dm_keyword`, `story_reply`, `dm_reaction`). ## Header Parameters ## Path Parameters The automation ID returned from `POST /automations`. ## Query Parameters Page size. Default `25`, max `100`. Values outside `[1, 100]` are clamped; non-integer or `≤0` returns HTTP 400. Opaque cursor from a previous response's `meta.pagination.next`. Omit on the first request. Forward-only — passing `?previous=` returns HTTP 400. ## Response Shape The response wraps the result list in `activity[]` and the cursor info in `meta.pagination`: ```json theme={"system"} { "status": "success", "automationId": "auto_9xKp2Lm4nQ", "activity": [ /* …rows, newest first… */ ], "meta": { "pagination": { "hasMore": true, "limit": 25, "next": "eyJ0aW1lIjoiMjAyNi0wNS0xMlQwOTowMDoxMS4wMDBaIiwiaWQiOiJhdXRvXzl4S3AyTG00blE6dHJnX2ExYjJjMzpjb21tZW50X3JlY2VpdmVkOjE4MDEyMzQ1Njc4OTAwMDAwIn0=" } } } ``` `meta.pagination.next` is a base64-encoded opaque blob — treat it as a black box and pass it back unchanged in the next request's `?next=`. `meta.pagination.hasMore` is `true` when at least one more page exists. ```bash cURL — first page theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET "https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ/activity?limit=25" ``` ```bash cURL — next page theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET "https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ/activity?limit=25&next=eyJ0aW1lIjoiMjAyNi0wNS0xMlQw..." ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const id = "auto_9xKp2Lm4nQ"; // Paginate through every page let next; do { const url = new URL(`https://api.ayrshare.com/api/automations/${id}/activity`); url.searchParams.set("limit", "25"); if (next) url.searchParams.set("next", next); const res = await fetch(url, { headers: { "Authorization": `Bearer ${API_KEY}` }, }); const json = await res.json(); console.log(json.activity); next = json.meta?.pagination?.hasMore ? json.meta.pagination.next : undefined; } while (next); ``` ```python Python theme={"system"} import requests headers = {"Authorization": "Bearer API_KEY"} automation_id = "auto_9xKp2Lm4nQ" params = {"limit": 25} while True: r = requests.get( f"https://api.ayrshare.com/api/automations/{automation_id}/activity", params=params, headers=headers, ).json() print(r["activity"]) pagination = r.get("meta", {}).get("pagination", {}) if not pagination.get("hasMore"): break params["next"] = pagination["next"] ``` ```php PHP theme={"system"} $id = "auto_9xKp2Lm4nQ"; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id . "/activity?limit=25", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => ["Authorization: Bearer API_KEY"], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "automationId": "auto_9xKp2Lm4nQ", "activity": [ { "id": "auto_9xKp2Lm4nQ:trg_a1b2c3:18012345678901234", "automationId": "auto_9xKp2Lm4nQ", "triggerId": "trg_a1b2c3", "triggerType": "comment_keyword", "recipientId": "17841401234567890", "recipientUsername": "jane_doe", "eventId": "18012345678901234", "commentId": "18012345678901234", "platform": "instagram", "status": "sent", "actionResults": [ { "actionId": "act_d4e5f6", "type": "send_dm", "status": "sent", "errorDetails": null, "completedAt": "2026-05-12T09:14:48.000Z" } ], "keyword": "LINK", "commentText": "Send me the LINK please!", "created": "2026-05-12T09:14:22.000Z", "completedAt": "2026-05-12T09:14:48.000Z" }, { "id": "auto_9xKp2Lm4nQ:trg_a1b2c3:18012345678905555", "automationId": "auto_9xKp2Lm4nQ", "triggerId": "trg_a1b2c3", "triggerType": "comment_keyword", "recipientId": "17841405555555555", "recipientUsername": "late_commenter", "eventId": "18012345678905555", "commentId": "18012345678905555", "platform": "instagram", "status": "failed", "actionResults": [ { "actionId": "act_d4e5f6", "type": "send_dm", "status": "failed", "errorDetails": "Cannot send private reply: This comment is no longer eligible for a private reply.", "completedAt": "2026-05-12T09:12:03.000Z" } ], "keyword": "LINK", "commentText": "LINK please!", "created": "2026-05-12T09:12:01.000Z", "completedAt": "2026-05-12T09:12:03.000Z" }, { "id": "auto_9xKp2Lm4nQ:trg_a1b2c3:18012345678900000", "automationId": "auto_9xKp2Lm4nQ", "triggerId": "trg_a1b2c3", "triggerType": "comment_keyword", "recipientId": "17841409876543210", "recipientUsername": "repeat_user", "eventId": "18012345678900000", "commentId": "18012345678900000", "platform": "instagram", "status": "deduplicated", "actionResults": [], "keyword": "LINK", "commentText": "LINK again please", "created": "2026-05-12T09:00:11.000Z", "completedAt": "2026-05-12T09:00:34.000Z" } ], "meta": { "pagination": { "hasMore": true, "limit": 25, "next": "eyJ0aW1lIjoiMjAyNi0wNS0xMlQwOTowMDoxMS4wMDBaIiwiaWQiOiJhdXRvXzl4S3AyTG00blE6dHJnX2ExYjJjMzoxODAxMjM0NTY3ODkwMDAwMCJ9" } } } ``` ```json 400: Bad limit theme={"system"} { "status": "error", "message": "limit must be a positive integer" } ``` ```json 400: Backward pagination not supported theme={"system"} { "status": "error", "message": "'previous' pagination is not supported by this endpoint" } ``` ```json 404: Not found theme={"system"} { "action": "automation", "status": "error", "code": 469, "message": "Automation not found" } ``` # Get Automation Source: https://www.ayrshare.com/docs/apis/automations/get-automation GET /automations/:id Fetch one automation with its triggers and actions **Beta.** See the [Automations Overview](/docs/apis/automations/overview) for the full feature description. Returns one automation including every attached trigger and action. Soft-deleted automations return `469` so an attacker probing for IDs gets the same response as a legitimate "not found". ## Header Parameters ## Path Parameters The automation ID returned from `POST /automations`. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const id = "auto_9xKp2Lm4nQ"; fetch(`https://api.ayrshare.com/api/automations/${id}`, { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` }, }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {"Authorization": "Bearer API_KEY"} automation_id = "auto_9xKp2Lm4nQ" r = requests.get( f"https://api.ayrshare.com/api/automations/{automation_id}", headers=headers, ) print(r.json()) ``` ```php PHP theme={"system"} $id = "auto_9xKp2Lm4nQ"; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => ["Authorization: Bearer API_KEY"], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "id": "auto_9xKp2Lm4nQ", "platform": "instagram", "accountId": "17841400000000000", "name": "Spring promo", "description": "", "active": true, "stats": { "totalSent": 42, "totalFailed": 1, "lastTriggeredAt": "2026-05-12T09:14:22.000Z", "lastSentAt": "2026-05-12T09:14:48.000Z" }, "created": "2026-04-30T12:00:00.000Z", "updated": "2026-05-12T09:14:48.000Z", "triggers": [ { "id": "trg_a1b2c3", "type": "comment_keyword", "active": true, "config": { "postId": "17895695668004550", "keywords": ["INFO", "LINK"] } } ], "actions": [ { "id": "act_d4e5f6", "type": "send_dm", "active": true, "config": { "message": "Hey {{recipient_username}}, here is the link you wanted: https://example.com" } } ] } ``` ```json 404: Not found theme={"system"} { "action": "automation", "status": "error", "code": 469, "message": "Automation not found" } ``` # List Automations Source: https://www.ayrshare.com/docs/apis/automations/list-automations GET /automations List the automations you've created **Beta.** See the [Automations Overview](/docs/apis/automations/overview) for the full feature description. Returns every active and inactive automation for the caller. Soft-deleted automations are excluded. ## Header Parameters ## Query Parameters Optional. Filter to automations targeting this platform. Only `instagram` is currently supported. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET "https://api.ayrshare.com/api/automations?platform=instagram" ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/automations?platform=instagram", { method: "GET", headers: { "Authorization": `Bearer ${API_KEY}` }, }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {"Authorization": "Bearer API_KEY"} r = requests.get( "https://api.ayrshare.com/api/automations", params={"platform": "instagram"}, headers=headers, ) print(r.json()) ``` ```php PHP theme={"system"} $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.ayrshare.com/api/automations?platform=instagram", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => ["Authorization: Bearer API_KEY"], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "automations": [ { "id": "auto_9xKp2Lm4nQ", "platform": "instagram", "accountId": "17841400000000000", "name": "Spring promo", "description": "", "active": true, "stats": { "totalSent": 42, "totalFailed": 1, "lastTriggeredAt": "2026-05-12T09:14:22.000Z", "lastSentAt": "2026-05-12T09:14:48.000Z" }, "created": "2026-04-30T12:00:00.000Z", "updated": "2026-05-12T09:14:48.000Z" } ] } ``` ```json 403: Plan tier theme={"system"} { "action": "automation", "status": "error", "code": 468, "message": "Instagram DM automations require a Business or Enterprise plan" } ``` # Automations API Overview Source: https://www.ayrshare.com/docs/apis/automations/overview Engagement-triggered Instagram automations — fire a DM, webhook, or email when an end user comments, replies to a story, reacts to a DM, or sends a DM **Beta.** The Automations API is in beta and we are actively collecting feedback. Endpoints, payloads, and limits may change as we iterate. Please send feedback and bug reports to support so we can prioritize the right improvements. The Automations endpoints let you define rules that automatically react to incoming Instagram engagement. Each automation pairs one or more **triggers** (the event that fires the rule) with one or more **actions** (what happens when it fires). A single rule can listen for multiple triggers and dispatch multiple actions — fire a webhook into your analytics pipeline AND send a DM from the same engagement. The engine only reacts to engagement a user directs at you (a comment, story reply, DM, or reaction) — it never sends follow-triggered DMs, first-message DMs to strangers, or bulk outbound — and it inherits Ayrshare's per-account rate limits, per-recipient deduplication, and idempotent webhook ingestion. **`sent` means Meta accepted the message, not that the recipient received it.** Delivery is ultimately dictated by the recipient's Instagram **Message requests** setting: if they don't allow message requests from everyone, Meta returns a success response and silently drops the message, and this is invisible at every API layer. Even a delivered comment-triggered DM arrives as a **message request the recipient must accept** (unless a conversation already exists between the two accounts). See [Automation DM Sent but Not Delivered](/docs/help-center/technical-support/automation_dm_sent_but_not_delivered) for the full explanation. ## How it works `POST /automations` with the triggers and actions you want. The automation activates immediately. Someone comments on your post, replies to your story, sends a DM, or reacts to a DM. Meta delivers the webhook to Ayrshare. The engine looks up every rule matching the event, checks per-action deduplication and your daily DM cap, then runs each action. A 20–60 second jitter is applied to DM sends to stay inside Instagram's anti-spam heuristics. `GET /automations/:id/activity` returns the audit log — every dispatch attempt, the per-action results, and any errors. ## Triggers You can attach up to **50 triggers** to one automation. Each trigger is a discriminated union on the `type` field; type-specific fields live at the same level. All triggers are Instagram-only in v1. | Type | Fires when | Config | | ----------------- | ----------------------------------------------------- | ---------------------------------------------------- | | `comment_keyword` | A comment matching a keyword lands on a specific post | `postId` (required); `keywords` (required, ≥1 entry) | | `story_reply` | A user replies to a story via DM | `storyId` (optional) | | `dm_reaction` | A user reacts to one of your DMs with an emoji | `emoji` (optional — omit to fire on any emoji) | | `dm_keyword` | A user sends a DM whose text matches a keyword | `keywords` (required, ≥1 entry) | Keyword matching is **case-insensitive** and whole-word. An event satisfies a keyword-filtered trigger if it contains any one of the configured keywords. Omit `storyId` on a story trigger to fire on every story for the connected account. ## Actions You can attach up to **50 actions** to one automation. They run sequentially; each result is recorded on the activity row. | Type | Effect | Config | | -------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | `send_dm` | Sends an Instagram DM to the user who triggered the rule, using a [templated message](#template-variables). | `message` (required, templated) | | `fire_webhook` | POSTs the automation context to your account-level webhook URL (configure via [`POST /hook/webhook`](/docs/apis/webhooks/register)). | *(none — payload shape is fixed; see [below](#fire_webhook-payload))* | | `send_email` | Queues an email via the platform's mail pipeline. | `to` (required, email); `subject` (optional, templated); `message` (required, templated) | ### Per-action dedup window Every action — regardless of type — additionally accepts an optional top-level `dedupWindowMinutes` field that overrides the **default 7-day** per-recipient dedup window for that action only. * Set to `0` to **disable** dedup entirely for that action (typical for `fire_webhook` / `send_email` where the receiver expects every event). * Capped at `525600` (one year). ```json Action with a 24h dedup override theme={"system"} { "type": "send_dm", "message": "Thanks {{recipient_username}}!", "dedupWindowMinutes": 1440 } ``` ### `fire_webhook` payload When `fire_webhook` runs it POSTs a JSON body to your account-level webhook URL: ```json theme={"system"} { "automationId": "auto_9xKp2Lm4nQ", "triggerId": "trg_a1b2c3", "trigger": "comment_keyword", "platform": "instagram", "recipientId": "17841401234567890", "recipientUsername": "jane_doe", "keyword": "LINK", "timestamp": "2026-05-12T09:14:22.000Z" } ``` `recipientUsername` and `keyword` are `null` when the trigger doesn't populate them (e.g. `dm_keyword` doesn't carry a username on Meta's payload; `story_reply` doesn't have a keyword). ## Template variables `send_dm.message`, `send_email.subject`, and `send_email.message` support `{{placeholder}}` substitution. **Unknown placeholders are rejected at create/update time** (as a `473` validation error) so a typo never silently leaks the literal `{{foo}}` into a customer-facing message. | Placeholder | Resolves to | | ------------------------ | ------------------------------------------------------------------------- | | `{{recipient_username}}` | The engaging user's Instagram handle (when the webhook carries it) | | `{{recipient_id}}` | The engaging user's Instagram participant ID (IGSID) | | `{{recipient_name}}` | Reserved; resolves to empty until a future enrichment source populates it | | `{{sender_username}}` | Your linked Instagram username | | `{{sender_name}}` | Your linked Instagram display name | | `{{comment_text}}` | The text of the comment / DM / story reply that fired the trigger | | `{{comment_id}}` | The platform id of the comment / message that fired | | `{{comment_sent_at}}` | ISO 8601 timestamp of the event (when available) | | `{{matched_keyword}}` | The keyword that matched (or the emoji string for `dm_reaction`) | | `{{platform}}` | Platform identifier (e.g. `instagram`) | | `{{trigger_type}}` | Trigger type (e.g. `comment_keyword`) | **No `sender_email` / `recipient_email`.** These are deliberately not exposed — your billing email has no legitimate place in a DM to a stranger, and Meta does not provide the recipient's email on any IG webhook. Avoiding the placeholders prevents accidental disclosure. Example template: ``` Hey {{recipient_username}}, thanks for the comment "{{comment_text}}" — here is the link you wanted: https://example.com ``` ## Rate limits and caps | Plan | Active automations (per profile) | Daily DM cap (per account) | | ---------- | -------------------------------- | -------------------------- | | Business | 10 | 1,000 | | Enterprise | 50 | 5,000 | The active-automation cap is counted **per [User Profile](/docs/apis/profiles/overview)**, not per parent account. Each profile under your account gets its own Business 10 / Enterprise 50, so an account with many profiles can run that many automations on each. It counts active automations and is enforced on both `POST` (create) and `PUT` re-activation (`active: false → true`), each surfacing error code `470`. Need a higher per-profile limit? [Contact support](mailto:support@ayrshare.com) to have it raised for your account. The **daily DM cap** applies per parent Ayrshare account, shared across all your profiles, with a per-profile sub-cap so one busy profile cannot drain the whole account's quota. When a DM cap is hit, the activity row records status `rate_limited` and no DM is sent. Structural caps on a single automation: **1–50 triggers**, **1–50 actions**. Instagram itself caps DMs at roughly 200/hour per account. The engine paces dispatch with a 20–60 second jitter to stay safely under this. ## Activity statuses A row in `GET /automations/:id/activity` carries a top-level `status` plus a per-action `status` inside `actionResults[]`: | Status | Meaning | | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `pending` | Just written; the worker hasn't picked it up yet | | `in_flight` | Worker is currently dispatching | | `sent` | Every action was **accepted** by the platform. For `send_dm` this means Instagram accepted the message — **not** that the recipient received it (see the note below) | | `failed` | At least one action was rejected by the platform or could not run (and none hit an auth error). The reason is on `actionResults[].errorDetails` | | `auth_error` | The Instagram access token was invalid; the DM was not retried | | `rate_limited` | The daily DM cap (tier or per-profile) was hit; no DM was sent | | `deduplicated` | This action already fired to this recipient inside its dedup window | | `skipped` | The automation became inactive or was deleted between fan-out and dispatch | `pending` and `in_flight` are transient; everything else is terminal. **`sent` is a platform-acceptance receipt, not a delivery receipt.** Instagram does not expose message delivery to any API. A `send_dm` action is marked `sent` the moment Instagram accepts the message; whether the recipient actually receives it depends on their Instagram **Message requests** setting, which Ayrshare cannot read or influence. See [Automation DM Sent but Not Delivered](/docs/help-center/technical-support/automation_dm_sent_but_not_delivered). ## Error codes The API returns two shapes of error: * **Business-rule errors** carry a numbered automation `code` (e.g. `{ "action": "automation", "code": 469, ... }`). * **Validation errors** — any malformed request body (missing or invalid fields, unknown template variables, unrecognized keys) — are returned as a single **`473`** response with a `details` object that lists the offending fields. `details` is the validator's output (`formErrors` plus `fieldErrors`). Branch on `details`, not on a per-condition code. In `fieldErrors`, keys are the top-level request fields (`triggers`, `actions`): a problem inside a specific entry, such as a trigger missing its `keywords`, is reported under that field (e.g. `triggers`), while `formErrors` holds object-level issues such as unrecognized keys. | Code | HTTP | Meaning | | ---- | ---- | ----------------------------------------------------------------------- | | 468 | 403 | Business or Enterprise plan required | | 469 | 404 | Automation not found (also returned when the caller doesn't own it) | | 470 | 429 | Active automation cap reached for your plan tier | | 471 | 400 | No social account linked on the requested platform for this profile | | 472 | 403 | Feature not yet available on your account — contact us for early access | | 473 | 400 | Validation failed (malformed request body) — inspect `details` | ## What Meta does NOT allow A few commonly-requested capabilities are not supported because Meta doesn't permit them on the public Instagram API: * **Auto-DM on new followers.** Instagram does not publish a follow webhook. * **First-message DMs to strangers.** Meta requires the recipient to have engaged first (comment, reply, DM, reaction) before a business account can message them. Every supported trigger is anchored to such an engagement — but note that being *allowed* to send is not the same as the message being *delivered*: the recipient's Instagram **Message requests** setting can still cause Meta to accept and then silently drop the message (see [Automation DM Sent but Not Delivered](/docs/help-center/technical-support/automation_dm_sent_but_not_delivered)). * **Bulk outbound campaigns.** Hourly DM caps and anti-abuse heuristics apply at the platform level. ## Multi-profile usage The endpoints respect the `profileKey` header. Pass a child profile's key and the automation is created/managed under that profile. Rate limits split across profiles via a per-profile sub-cap so one chatty profile doesn't drain the parent account's quota. ## FAQ No. Instagram does not publish a follow webhook, and Meta does not allow third-party apps to send a DM to a user who has not engaged first. Every supported trigger (`comment_keyword`, `story_reply`, `dm_reaction`, `dm_keyword`) is anchored to such an engagement, which is what makes the send permissible. `sent` means Instagram **accepted** the message, not that it was delivered. Delivery depends on the recipient's Instagram **Message requests** setting — if they don't allow message requests from everyone, Meta returns a success response and silently drops the message, with no error, webhook, or other signal on any API surface. A successful comment-triggered DM also arrives as a **message request the recipient must accept** (unless a conversation already exists). This is a permanent Instagram platform limitation. See [Automation DM Sent but Not Delivered](/docs/help-center/technical-support/automation_dm_sent_but_not_delivered). The activity row records status `auth_error` and the DM is not retried. Relink the account, then the next matching engagement will fire normally. Each `send_dm` dispatch is scheduled 20–60 seconds after the engagement to look organic to Instagram's anti-spam systems. `fire_webhook` and `send_email` actions do NOT have jitter. The activity row's `created` timestamp is when the trigger matched; `completedAt` is when dispatch finished. Activity rows are retained indefinitely for trace and analytics. The `GET /automations/:id/activity` endpoint returns rows from the last 30 days for performance. (The dedup guard uses its own per-action window — defaulting to 7 days — which is unrelated to the activity lookback.) No. Delete is a soft-delete: the master row is flagged `deleted`, no new dispatches occur, but historical activity rows remain readable via the activity endpoint. ## Endpoints * [`POST /automations`](/docs/apis/automations/create-automation) — create a new automation * [`GET /automations`](/docs/apis/automations/list-automations) — list your automations * [`GET /automations/:id`](/docs/apis/automations/get-automation) — fetch one automation with its triggers and actions * [`PUT /automations/:id`](/docs/apis/automations/update-automation) — partial update; pause via `active: false` * [`DELETE /automations/:id`](/docs/apis/automations/delete-automation) — soft-delete * [`GET /automations/:id/activity`](/docs/apis/automations/get-activity) — cursor-paginated dispatch audit log # Update Automation Source: https://www.ayrshare.com/docs/apis/automations/update-automation PUT /automations/:id Update an existing automation **Beta.** See the [Automations Overview](/docs/apis/automations/overview) for the full feature description. Partial update. Only the listed fields are editable; sending anything else (e.g. `platform`, `accountId`) is rejected as a validation error. Sending `triggers` or `actions` **replaces** the existing children atomically: the old set is deleted and the new set is written in a single Firestore transaction. To change only one trigger, send the full new array. Re-activating a previously-inactive automation (`active: true`) re-checks the active-cap. If the cap is already at the limit, the update fails with code `470` and no changes are made. ## Header Parameters ## Path Parameters The automation ID returned from `POST /automations`. ## Body Parameters New name. New description. Toggle the automation on or off. Setting this from `false` to `true` re-checks the active automation cap. Full replacement set of triggers (1–50). Same shape as the create endpoint. Full replacement set of actions (1–50). Same shape as the create endpoint. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "name": "Spring promo (updated)", "active": true, "actions": [ { "type": "send_dm", "message": "Hey {{recipient_username}}! New link: https://example.com/spring" } ] }' \ -X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const id = "auto_9xKp2Lm4nQ"; fetch(`https://api.ayrshare.com/api/automations/${id}`, { method: "PUT", headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ name: "Spring promo (updated)", active: true, actions: [ { type: "send_dm", message: "Hey {{recipient_username}}! New link: https://example.com/spring", }, ], }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = { "Authorization": "Bearer API_KEY", "Content-Type": "application/json", } automation_id = "auto_9xKp2Lm4nQ" payload = { "name": "Spring promo (updated)", "active": True, "actions": [ { "type": "send_dm", "message": "Hey {{recipient_username}}! New link: https://example.com/spring", } ], } r = requests.put( f"https://api.ayrshare.com/api/automations/{automation_id}", json=payload, headers=headers, ) print(r.json()) ``` ```php PHP theme={"system"} $id = "auto_9xKp2Lm4nQ"; $data = [ "name" => "Spring promo (updated)", "active" => true, "actions" => [ [ "type" => "send_dm", "message" => "Hey {{recipient_username}}! New link: https://example.com/spring", ], ], ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => [ "Authorization: Bearer API_KEY", "Content-Type: application/json", ], ]); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "id": "auto_9xKp2Lm4nQ" } ``` ```json 400: Validation failed — editing platform is not allowed theme={"system"} { "action": "request", "status": "error", "code": 473, "message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction", "details": { "formErrors": ["Unrecognized key: \"platform\""], "fieldErrors": {} } } ``` ```json 404: Not found theme={"system"} { "action": "automation", "status": "error", "code": 469, "message": "Automation not found" } ``` ```json 429: Cap reached on reactivation theme={"system"} { "action": "automation", "status": "error", "code": 470, "message": "Active automation limit reached for your plan tier" } ``` # Brand API: Public Account & Competitor Data | Ayrshare Docs Source: https://www.ayrshare.com/docs/apis/brand/overview Use the Ayrshare Brand API to pull public profile, follower, and engagement data for any social account, to track your brand or benchmark competitors. **These endpoints have moved.** The Brand section has been reorganized under the new [Listening](/docs/apis/listen/overview) section. All existing Brand endpoints continue to work, but new features like [Keyword Search](/docs/apis/listen/keyword/search-tweets) are available only in the Listening section. # Delete Comments Source: https://www.ayrshare.com/docs/apis/comments/delete-comments DELETE /comments/:id Delete either a single comment or all comments under a post The delete endpoint allows you to either delete comments sent via Ayrshare or comments that were sent outside of Ayrshare. Please see the [Comments Overview](/docs/apis/comments/overview) for more information on the different ID types. ### Delete Comments Sent from Ayrshare Delete either a single comment or all comments under a post that were sent via Ayrshare. Please see the [Ayrshare Post ID](/docs/apis/comments/overview#comments-with-ayrshare-post-id) and [Ayrshare Comment ID](/docs/apis/comments/overview#comments-with-ayrshare-comment-id) for more information. Supported platforms: Bluesky, Facebook, Instagram, LinkedIn, Reddit, TikTok, X/Twitter, and YouTube. ### Delete Comments Sent Outside of Ayrshare Delete a comment that was not sent via Ayrshare by using the `commentId` returned for a particular social network. This is the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id) from the social networks, not the Ayrshare ID. Supported platforms: Facebook, Instagram, TikTok, X/Twitter, and YouTube. **TikTok — own-authored comments only.** On TikTok, `DELETE /comments` only succeeds for comments authored by the authenticated TikTok account itself (for example, replies you posted via Ayrshare's [reply endpoint](/docs/apis/comments/reply-to-comment) or directly inside the TikTok app). Attempting to delete a comment authored by another user — even one left on a video you own — returns Ayrshare `code: 328`. If you need to moderate third-party comments on your own TikTok videos, contact support so we can confirm what's available for your linked account type. For example, you get all the comments for a particular Instagram post using the [Get Comments](/docs/apis/comments/get-comments) endpoint with the `searchPlatformId` set to `true`. ```http theme={"system"} GET https://api.ayrshare.com/api/comments/18231730279304111?platform=instagram&searchPlatformId=true ``` The returned JSON will have a `commentId` for each comment, which you can use to delete the comment. Remember to set the `searchPlatformId` to `true`. ```json {5} theme={"system"} { "instagram": [ { "comment": "What an amazing comment", "commentId": "17969247335804735", "created": "2024-11-26T11:49:00Z", "from": { "id": "103038435208332", "username": "john_smith" }, "hidden": false, "likeCount": 3, "platform": "instagram", "postId": "18231730279304333", "username": "john_smith" } ] } ``` ## Header Parameters ## Path Parameters Delete a comments sent from Ayrshare:
  • Delete all comments sent via Ayrshare by providing the [Ayrshare Post ID](/docs/apis/comments/overview#comments-with-ayrshare-post-id).
  • Delete a single comment by providing the [Ayrshare Comment ID](/docs/apis/comments/overview#comments-with-ayrshare-comment-id).
Delete a comment sent outside of Ayrshare:
  • Delete a single comment by providing the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id) from the social network.
  • Must include the `searchPlatformId` set to `true`.
## Body Parameters Required if deleting comments sent via Ayrshare. The platforms to delete comments from. Supported platforms: `bluesky`, `facebook`, `instagram`, `linkedin`, `reddit`, `threads`, `tiktok`, `twitter`, `youtube`. ```json Deleting comments sent via Ayrshare theme={"system"} DELETE /comments/:id // Ayrshare Post ID or Ayrshare Comment ID { "platforms": ["bluesky", "facebook", "instagram", "linkedin", "reddit", "threads", "tiktok", "twitter", "youtube"] } ``` Required if deleting using the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id), which is the `commentId` from the social networks. Supported platforms: `bluesky`, `facebook`, `instagram`, `threads`, `tiktok`, `twitter`, `youtube`. Only one platform is supported at a time. Required if deleting using the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id), which is the `commentId` from the social networks, set to `true`. ```json Deleting comments with Social Comment ID theme={"system"} DELETE /comments/:id // Social Comment ID { "searchPlatformId": true, // bluesky, facebook, instagram, threads, tiktok, twitter, youtube "platform": "facebook" } ``` TikTok only. Set to `true`, together with `videoId`, to hide a TikTok comment from public viewers instead of deleting it. The success response returns `action: "hide"` and echoes the comment. Sending `hide=true` without `videoId` returns HTTP `400`. Hidden comments remain visible to the video owner in TikTok Studio. ```json Hiding a TikTok comment theme={"system"} DELETE /comments/:id // Social Comment ID { "searchPlatformId": true, "platform": "tiktok", "hide": true, "videoId": "7303719953248109358" } ``` Required when hiding a TikTok comment (`hide=true`). The TikTok video ID the comment belongs to. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X DELETE https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ", { method: "DELETE", headers: { Authorization: `Bearer ${API_KEY}`, }, }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.delete('https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} true, CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_HTTPHEADER => $headers ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; namespace CommentsDELETERequest_csharp { class CommentsDELETE { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); try { HttpResponseMessage response = await client.DeleteAsync(url); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```json 200: Success Single Comment theme={"system"} { "status": "success", "bluesky": { "action": "delete", "status": "success", "id": "at://did:plc:d/app.bsky.feed.post/3lez", // Bluesky Social Comment ID "comment": "This is a comment" }, "facebook": { "action": "delete", "status": "success", "id": "938010233_939392023", // Facebook Social Comment ID "comment": "This is a comment" }, "instagram": { "action": "delete", "status": "success", "id": "18010439663043269", // Instagram Social Comment ID "comment": "This is a comment" }, "linkedin": { "action": "delete", "status": "success", "id": "7133271664032669696", // LinkedIn Social Comment ID "comment": "This is a comment" }, "threads": { "action": "delete", "status": "success", "id": "18064102964006231" // Threads Social Comment ID }, "tiktok": { "action": "delete", "status": "success", "commentId": "7303719953248109358", // Deprecated December 1, 2023. Use the id field instead. "id": "7303719953248109358", // TikTok Social Comment ID "comment": "This is a comment" }, "twitter": { "action": "delete", "status": "success", "id": "1633128546494459904", // Twitter Social Comment ID "comment": "This is a comment" }, "youtube": { "action": "delete", "status": "success", "id": "Ugy2m5u-LS9M29Gn3hd4AaABAg", // YouTub Social Comment ID "comment": "This is a comment" } } ``` ```json 200: Sucesss Multiple Comments theme={"system"} { "status": "success", "linkedin": [ { "action": "delete", "status": "success", "id": "7090782997972410368", // LinkedIn Social Comment ID "comment": "This is a comment" }, { "action": "delete", "status": "success", "id": "7090783025164103680", // LinkedIn Social Comment ID "comment": "This is a comment" } ], "twitter": [ { "action": "delete", "posts": [ { "action": "delete", "status": "success", "id": "1685017310942134272", // Twitter Social Comment ID "comment": "This is a comment" } ] }, { "action": "delete", "posts": [ { "action": "delete", "status": "success", "id": "1685017338184146946", // Twitter Social Comment ID "comment": "This is a comment" } ] } ], "facebook": [ { "action": "delete", "status": "success", "id": "676770944469840_644047184361660", // Facebook Social Comment ID "comment": "This is a comment" }, { "action": "delete", "status": "success", "id": "676770944469840_983782432932944", // Facebook Social Comment ID "comment": "This is a comment" } ] } ``` ```json 200: Success Hide TikTok Comment theme={"system"} { "status": "success", "tiktok": { "action": "hide", "status": "success", "id": "7303719953248109358", // TikTok Social Comment ID "comment": "This is a comment" } } ``` ```json 400: Comment id not found theme={"system"} { "action": "comments", "status": "error", "code": 219, "message": "Error getting comments. Please verify the comments are still available." } ``` # Get Comments Source: https://www.ayrshare.com/docs/apis/comments/get-comments GET /comments/:id Fetch comments on a post by Ayrshare Post ID, Social Post ID, or Comment ID, with multiplatform partial-success responses across networks. Get comments for a post using the Ayrshare post ID, Social Post ID, Ayrshare Comment ID, or Social Comment ID with the Comment API. Please see the [Comments Overview](/docs/apis/comments/overview) for more information on the different ID types. If using the Ayrshare Post ID no query parameters are required. ## Additional Comment Details
  • Comment data is updated every 10 minutes for all platforms, with the exception of X. Due to restrictions imposed by the X API, the comment data for X is refreshed using an exponential backoff strategy, meaning the intervals between updates gradually increase over time.
  • In the Facebook response, comment replies to replies always have the same `parent.id`.
  • Retrieve LinkedIn replies to comments by setting the `"commentId": true` and `"searchPlatformId": true` query parameters and providing the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id) in the path parameter.
  • Facebook and Instagram return up to the most recent 1,000 comments on a post. Please contact us regarding higher limits on the Enterprise plan.
  • For a TikTok post still being processed (its `id` is `"pending"`), get-comments returns a clear "still processing" error ([`code: 288`](/docs/errors/errors-ayrshare#tiktok-comment-errors), HTTP `400`) rather than a generic failure. Retry once the [`tikTokPublished` webhook](/docs/apis/post/social-networks/tiktok#tiktok-processing) fires or [/history](/docs/apis/history/overview) shows the resolved video id.
## Multiplatform Reads & Partial Success When you request comments with the [Ayrshare Post ID](/docs/apis/overview#ayrshare-post-id), the post may span several platforms. Ayrshare fans out one request ("leg") per platform and returns a **partial success** if some legs succeed and others fail — the healthy platforms' comment data is always returned, and each failed leg is enumerated in a top-level `errors[]` array.
  • Some platforms succeed, some fail: the response is HTTP 200 with status: "partial". The healthy platform blocks are returned as usual, and a top-level errors\[] array lists every failed leg with its platform, status, code, message, and id.
  • Every platform fails: the response has status: "error" and the full errors\[] array. The HTTP status is mapped from the representative top-level error code. Code 485 maps to HTTP 404; other representative codes use their own mappings.
  • All platforms succeed: the response is unchanged — HTTP 200, status: "success", and no errors\[] key.
**Behavior change — inspect `errors[]`, don't branch on HTTP status.** Because a multiplatform read with a failing leg now returns HTTP `200` instead of collapsing the whole response to an error, integrators should always check for the presence of a top-level `errors[]` array to detect per-platform failures rather than relying on the HTTP status code alone. ### Expired or Unavailable Instagram / Facebook Story Comments An Instagram or Facebook Story comments leg that is expired or unavailable — so its comments cannot be retrieved — surfaces in `errors[]` with code [`485`](/docs/errors/errors-ayrshare#expired-or-unavailable-story-errors). A representative Instagram message is *"Instagram Story expired or unavailable — comments/insights cannot be retrieved."* If another platform succeeds, its comments are still returned and the overall response is **HTTP `200`**. For an all-fail response, representative code `485` maps to HTTP `404`; other representative codes use their own mappings. Match on the `code` (`485`), not the exact message text. #### Example: Partial Success Response ```json 200: Partial Success theme={"system"} { "facebook": [ { "comment": "What a great comment", "commentId": "806720068141593_1849585385469876", "created": "2026-07-14T19:55:28Z", "likeCount": 12, "platform": "facebook" } ], "status": "partial", "id": "Ut2fWU6XkqkMayHGnJZ7", "lastUpdated": "2026-07-14T22:30:13.035Z", "nextUpdate": "2026-07-14T22:41:13.035Z", "errors": [ { "platform": "instagram", "status": "error", "code": 485, "message": "Instagram Story expired or unavailable — comments/insights cannot be retrieved.", "id": "17895695668004550" } ] } ``` ## Header Parameters ## Path Parameters [Ayrshare Post ID](/docs/apis/comments/overview#comments-with-ayrshare-post-id), [Social Post ID](/docs/apis/comments/overview#comments-with-social-post-id), or [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id). ## Query Parameters If getting comments on a post published via Ayrshare and using the [Ayrshare Post ID](/docs/apis/comments/overview#comments-with-ayrshare-post-id), do not include this field - it defaults to `false`. If getting comments using the [Social Post ID](/docs/apis/comments/overview#comments-with-social-post-id) or [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id), which is the ID generated by the social networks, set to `true`. If getting comments using the [Social Comment ID](/docs/apis/overview#social-comment-id), which is the comment ID generated by the social networks, set to `true`. If getting comment using the Ayrshare Post ID or Social Post ID, do not include this field - it defaults to `false`. If using the `commentId` query parameter, you must also set `searchPlatformId` to `true`. Required if `searchPlatformId` or `commentId` is `true`. When to use:
  • If using the [Social Post ID](/docs/apis/comments/overview#comments-with-social-post-id) and `"searchPlatformId": true` field. Supported platforms: `bluesky`, `facebook`, `instagram`, `linkedin`, `threads`, `tiktok`, `twitter`, `youtube`.
  • If using the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id) and `"searchPlatformId": true` and `"commentId": true` fields. Supported platforms: `facebook`, `instagram`, `linkedin`.
  • If using the [Ayrshare Post ID](/docs/apis/comments/overview#comments-with-ayrshare-post-id), do not include this field - comments will be returned from all platforms where the original post was published.
## Comment GET Request Examples ```json With Ayrshare Post ID theme={"system"} // Ayrshare Post ID GET /comments/:id ``` ```json With Social Post ID theme={"system"} // Social Post ID // Platforms: facebook, instagram, linkedin, tiktok, twitter, youtube GET /comments/:id?searchPlatformId=true&platform=facebook ``` ```json With Social Comment ID theme={"system"} // Social Comment ID // Platforms: facebook, instagram, linkedin GET /comments/:id?commentId=true&searchPlatformId=true&platform=facebook ``` ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -X GET https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ", { method: "GET", headers: { Authorization: `Bearer ${API_KEY}`, }, }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests headers = {'Authorization': 'Bearer API_KEY'} r = requests.get('https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ', headers=headers) print(r.json()) ``` ```php PHP theme={"system"} true, CURLOPT_HTTPHEADER => $headers ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Threading.Tasks; namespace CommentsGETRequest_csharp { class CommentsGET { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); try { HttpResponseMessage response = await client.GetAsync(url); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```json 200: Success {2, 19, 60, 99, 141, 156, 194, 229, 280} theme={"system"} { "bluesky": [ { "comment": "Nice one this is", "commentId": "at://did:plc:62musrcyanhro2lydyhlw7ci/app.bsky.feed.post/3lf4b4j3dqy2i", "created": "2025-01-06T23:12:58.950Z", "displayName": "Ayrshare", "likeCount": 0, "platform": "bluesky", "profileImageUrl": "https://cdn.bsky.app/img/avatar/plain/did:plc:62musrcyanhro2lydyhlw7ci/bafkreiegtpqhpwgu6tww2ejsdil4ew3blmt6jh3wlq6zhanxo3wj2ib4du@jpeg", "quoteCount": 0, "replies": [], "replyCount": 0, "replyTo": "at://did:plc:n7atrjd22xgkmgwig6dzlhzd/app.bsky.feed.post/3lez7fwx45723", "repostCount": 0, "userName": "ayrshare.com" } ], "facebook": [ { // The most recent 1,000 comments retrieved. "comment": "What a great comment", "commentId": "806720068141593_1849585385469876", // Facebook Social Comment ID "commentCount": 1, // The number of replies to the comment "commentUrl": "https://www.facebook.com/106148652329/posts/184958538876/", // URL to the comment "created": "2024-02-27T19:55:28Z", "from": { // If available. Facebook determines availability based on the user's security profile and settings. "name": "John Smith", "id": "5075334022535844" }, "likeCount": 342, "platform": "facebook", "userLikes": false, "replies": [ // Facebook replies to replies have the same parent id regardless of nesting. { "comment": "Nice Comment 2", "commentId": "806720068141593_320599703877348", "commentCount": 0, "company": true, "created": "2024-02-27T19:55:40Z", "from": { "name": "Sue Me", "id": "5075334022535800" }, "likeCount": 3, "parent": { "createdTime": "2024-02-27T19:55:28+0000", "from": { "name": "John Smith", "id": "5075334022535844" }, "message": "What a great comment", "id": "806720068141593_1849585385469876" }, "platform": "facebook", "userLikes": false } ] } ], "instagram": [ { // The most recent 1,000 comments retrieved. "comment": "Love this post.", "commentId": "18030599567251077", // Instagram Social Comment ID "created": "2022-10-13T00:52:47Z", "from": { // If available. Instagram determines availability based on the user's security profile and settings. "name": "WondrousTimes", "id": "112775157855689" }, "hidden": false, // Is the comment hidden "likeCount": 1, "parentId": "17999860012861", // The Instagram Social Post ID of the parent post. Only returned when using get by ID on a reply. "platform": "instagram", "postId": "18011025266302661", // The Instagram top level post ID (original post). "replies": [ { "comment": "@ayrshare Thanks", "created": "2024-04-04T22:37:39Z", "from": { "id": "178414522127073334", "username": "ayrshare" }, "hidden": false, "id": "18023114651100610", // Instagram Social Comment Id "likeCount": 2, "parentId": "18030599567251077", "user": { "id": "17841452212702234" }, "username": "ayrshare" } ], "user": { // ID of Instagram user who created the comment. "id": "112775157855689" }, "userName": "ayrshare" // If available. Instagram determines availability based on the user's security profile and settings. } ], // Retrieve LinkedIn replies to comments by using the commentID with the Get Comments with Social Comment ID endpoint. "linkedin": [ { "comment": "New wonderful comment", "commentId": "6961077099692445688", // LinkedIn Social Comment ID "commentUrn": "urn:li:comment:(urn:li:activity:7141202289402236928,7141205176207503360)", // Social comment id from LinkedIn "created": "2022-08-04T21:55:11Z", "from": { "name": "Sue Smith", "id": "yb8P0Oq5l8", "url": "https://www.linkedin.com/in/suesmith", "description": "Co-Founder at Smiths" }, "likeCount": 34, "media": [ { "type": "image", "url": "https://media-exp1.licdn.com/dms/image/D4E2CAQH4RRMRaJSR" } ], "platform": "linkedin", "profileImageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQHORT70jVfK", "userName": "suesmith" }, { // Comment from a company "comment": "Love it", "commentId": "urn:li:comment:(urn:li:activity:71860989603258818,7186100659052515329)", "commentUrn": "urn:li:comment:(urn:li:activity:71860989603258818,7186100659052515329)", "created": "2024-04-16T20:38:28Z", "founded": 2020, "from": { "name": "Ayrshare", "id": 22327643, "url": "https://www.linkedin.com/company/22327643", "description": "Social Media API" }, "likeCount": 123, "organizationType": "PRIVATELY_HELD", "platform": "linkedin", "userName": "ayrshare", "website": "https://www.ayrshare.com" } ], "reddit": [ { "comment": "Nice comment", "commentId": "kaxeilk", "created": "2023-11-27T03:09:06.000Z", "from": { "name": "suppercomment", "id": "t2_3zaxa" }, "commentUrl": "/r/test/comments/184szm7/reddit_post_title/kaxeilk/", "subreddit": "test", "ups": 1, "isSubmitter": true } ], "threads": [ { "comment": "An amazing comment!", "commentId": "17890924860234841", "commentUrl": "https://www.threads.com/@ayrshare/post/DI4pRHAto1", "created": "2025-04-25T21:43:57+0000", "hasReplies": false, "isQuotePost": false, "isReply": true, "isReplyOwnedByMe": true, "mediaType": "text_post", "parentId": "17890643139123706", "platform": "threads", "postId": "17890643139123706", "replies": [ { "comment": "sweet", "commentId": "17961516995911683", "commentUrl": "https://www.threads.com/@ayrshare/post/DI4shgspzI1", "created": "2025-04-25T22:12:22+0000", "hasReplies": false, "isQuotePost": false, "isReply": true, "isReplyOwnedByMe": true, "mediaType": "text_post", "parentId": "17890924860234841", "platform": "threads", "postId": "17890643139123706", "replyAudience": "everyone", "shortcode": "DI4shgspzI1", "userName": "ayrshare" } ], "replyAudience": "everyone", "shortcode": "DI4pRHAtoVu", "userName": "ayrshare" } ], "tiktok": [ { "comment": "The best comment", "commentId": "7260964914699764523", // TikTok Social Comment ID "created": "2023-07-28T20:12:23Z", "displayName": "John Smith", "liked": false, // Whether the user who posted the video has liked the comment. "likeCount": 24, "owner": true, // Whether the user who posted the video made the comment. "pinned": false, // If the comment is pinned "platform": "tiktok", "profileImageUrl": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/f123c4b57", "replies": [ { "comment": "One reply", "commentId": "72776074297628920", // TikTok Social Comment ID "createTime": "2023-09-11 16:34:20", "liked": false, // Whether the user who posted the video has liked the comment reply. "likes": 0, "owner": false, // Whether the user who posted the video made the comment reply. "parentCommentId": "72776073973290774", // TikTok Parent Social Comment ID "profileImageUrl": "https://p16-sign.tiktokcdn-us.com/tos-useast5-avt-0068-tx/bcc6e6778x168.jpeg", "status": "PUBLIC", "userId": "51e0cb95a8b14f0f1020aa017", "username": "ayrshare", "videoId": "7260964048362310958" // TikTok Social Post ID } ], "status": "success", "userId": "fc904564301a6d383fd19bd4982ba2682404876533c04741a8c3f270376cd3dd", "username": "helmar1066", "videoId": "7260964048362310958", // TikTok Social Post ID "visibility": "public" } ], "twitter": [ { "bookmarkCount": 2, "comment": "@ayrshare Congrats on this", "commentId": "1505595871831891068", // Twitter Social Comment ID "created": "2022-05-14T21:56:14.000Z", "description": "Eat great!", "id": "1552209331030036480", // Twitter Social Post ID "impressionCount": 134, "likeCount": 341, "name": "waffles", "platform": "twitter", "profileImageUrl": "https://pbs.twimg.com/profile_images/119426890464/lvQZPpt4_normal.png", "publicMetrics": { // X public metrics of the user who posted the comment "followersCount": 56, "followingCount": 2242, "tweetCount": 32, "listedCount": 3, "likeCount": 459, "mediaCount": 244 }, "quoteCount": 2, "referencedTweets": [ // ID of the tweet that was replied to { "type": "replied_to", "id": "187203972440121733" } ], "replyCount": 3, "replyTo": { // Who the comment was in reply to "createdAt": "2012-01-18T21:13:15.000Z", "description": "Social Media API", "id": "467793290", "location": "New York City", "name": "Ayrshare", "profileImageUrl": "https://pbs.twimg.com/profile_images/1851502252/ayrshare_normal.gif", "publicMetrics": { // X public metrics of the user who the comment was in reply to "followersCount": 46, "followingCount": 1242, "tweetCount": 12, "listedCount": 2, "likeCount": 439, "mediaCount": 144 }, "url": "https://t.co/GQgCqytA", "username": "anotherone" }, "threadNumber": 1, // If thread, number in sequence "userName": "waffles" } ], "youtube": [ { "channelUrl": "http://www.youtube.com/channel/sp0CnxiNbUU0AJtuYKZwXQ", "comment": "Two comments", "commentId": "Ugx0tiPuoUpXfrY0qvV4AaABAg", // YouTube Social Comment ID "created": "2022-05-24T19:45:49Z", "isPublic": true, // This setting indicates whether the comment, including all of its comments and comment replies, is visible to all YouTube users. "likeCount": 34, "platform": "youtube", "profileImageUrl": "https://yt3.ggpht.com/ytc/AKedOLT2hOZirBUGodAg31-QXaGPd9DmrkxR48UXAw=s48-c-k-c0x00ffffff-no-rj", "replies": [ { "comment": "amazing reply", "commentId": "UgzJFjmrrRUr6nsRWi14AaABAg.9ssbUo6Es1n9ssbVwRn2iz", "created": "2023-08-01T15:59:16Z", "likeCount": 2, "platform": "youtube", "userName": "uman", "profileImageUrl": "https://yt3.ggpht.com/ytc/AOPcoUDV_W7h3ZSEcFYrcEuXUPxVCTuF4NTw=s48-c-k-c0x00ffffff-no-rj", "channelUrl": "http://www.youtube.com/channel/sp0CnxiNbUU0AJtuYKZwXQ", "parentId": "UgzJFjmrrRUr6nsRWi14AaABAg" } ], "userName": "ayrshare" }, { "channelUrl": "http://www.youtube.com/channel/sp0CnxiNbUU0AJtuYKZwXQ", "comment": "One comment", "commentId": "Ugx0tiPuoUpXfrY0qvV4AaABAa", // YouTube Social Comment ID "created": "2022-05-24T19:00:10Z", "isPublic": true, // This setting indicates whether the comment, including all of its comments and comment replies, is visible to all YouTube users. "likeCount": 123, "platform": "youtube", "profileImageUrl": "https://yt3.ggpht.com/ytc/AAKedOLT2hOZirBUGodAg31-QXaGPd9DmrkxR48UXAw=s48-c-k-c0x00ffffff-no-rj", "userName": "ayrshare" } ], "status": "success", "id": "Ut2fWU6XkqkMayHGnJZ7", "lastUpdated": "2023-03-26T22:30:13.035Z", "nextUpdate": "2023-03-26T22:41:13.035Z", } ``` ```javascript 404: Comments Not Found theme={"system"} { "action": "post", "status": "error", "code": 186, "message": "Post ID not found. Please verify the top level ID returned from the /post endpoint is being sent.", "id": "Ut2fWU6XkqkMayHGnJZ7" } ``` # Comments API Overview Source: https://www.ayrshare.com/docs/apis/comments/overview Post, reply, get, and delete comments on a social post The Comments endpoints allow your users to post, reply, retrieve, and delete comments on their posts. There are four types of comments IDs: Ayrshare Post ID, Social Post ID, Ayrshare Comment ID, and Social Comment ID. Each of these IDs are used for different purposes. ## Comment ID Types ### Comments with Ayrshare Post ID The typical flow is when you publish a post via Ayrshare, you get the Ayrshare Post ID. You can then use this [Ayrshare Post ID](/docs/apis/overview#ayrshare-post-id) to manage comments on that post. Supported platforms: Bluesky, Facebook Pages, Instagram, LinkedIn, Reddit, Threads, TikTok, Twitter, and YouTube. For example: Use the [/post](/docs/apis/post/post) endpoint to publish a post via Ayrshare, which can be sent to multiple social networks in a single call. In the return is the top level [Ayrshare Post ID](/docs/apis/overview#ayrshare-post-id). ```json {12} theme={"system"} { "status": "success", "errors": [], "postIds": [ { "status": "success", "id": "106638148652329_591370753547555", "postUrl": "https://www.facebook.com/106638148652329/posts/591370753547555", "platform": "facebook" } ], "id": "E4UdUr1yRbvI7qqCSlaq", // Ayrshare Post ID "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc055", "post": "What an amazing day", "validate": true } ``` Use the [/comments](/docs/apis/comments/post-comment) endpoint to post a comment with the Ayrshare Post ID. The comment will be automatically posted to every social network where the original post was published. For example, if you published the post to Facebook and Instagram, the comment will appear on both platforms. ```http theme={"system"} POST https://api.ayrshare.com/api/comments/:id ``` Use the [/comments](/docs/apis/comments/get-comments) endpoint to get the comments for the post with the Ayrshare Post ID. This will return all comments from every social network where the post was published. For example, if you posted to Facebook and Instagram, you'll get comments from both platforms. ```http theme={"system"} GET https://api.ayrshare.com/api/comments/:id ``` ### Comments with Social Post ID Sometimes you may want to manage comments on a post that were not published via Ayrshare. In this case you can use the [Social Post ID](/docs/apis/overview#social-post-id), which is the post ID assigned by the social network. If the post was published via Ayrshare, use [the Ayrshare Post ID](/docs/apis/comments/overview#comments-with-ayrshare-post-id). For example: Start by getting the Instagram posts published outside of Ayrshare with the [Get All Post History endpoint](/docs/apis/history/history-platform). The endpoint returns a list of posts with the social `id` of the post. ```json {13} theme={"system"} { "status": "success", "posts": [ { "mediaUrl": "https://scontent.cdninstagram.com/v/t51.2885-15/7531.jpg", "permalink": "https://www.instagram.com/p/B5OBT3ygpfg/", "commentsCount": 0, "created": "2022-05-20T17:26:03Z", "likeCount": 0, "mediaProductType": "FEED", "mediaType": "IMAGE", "username": "thegoodone", "id": "17833140557332933", // Instagram Social Post ID "thumbnailUrl": "https://scontent-lga3-2.cdninstagram.com/v/t51..jpg", "post": "The #Mandalorian is on tonight instead of Friday", "postUrl": "https://www.instagram.com/p/B5OBT3ygpfg/" }, ] } ``` The social post `id` is also returned in the `postIds` field of the [post endpoint](/docs/apis/post/post). Use the returned `id` to [get all the comments](/docs/apis/comments/get-comments) for a specific Instagram post using the social `id`, `searchPlatformId` set to `true`, and `platform` set to `instagram`. ```http theme={"system"} GET https://api.ayrshare.com/api/comments/17833140557332933?platform=instagram&searchPlatformId=true ``` The returned JSON from the previous step will have a `commentId` for each comment, which is the [social comment ID](/docs/apis/overview#social-comment-id). ```json {5} theme={"system"} { "instagram": [ { "comment": "What an amazing comment", "commentId": "17969247335804735", // Social Comment ID "created": "2024-11-26T11:49:00Z", "from": { "id": "103038435208332", "username": "john_smith" }, "hidden": false, "likeCount": 3, "platform": "instagram", "postId": "18231730279304333", "username": "john_smith" } ] } ``` ### Comments with Ayrshare Comment ID Manage comments on a post that were published via Ayrshare by using the [Ayrshare Comment ID](/docs/apis/overview#ayrshare-comment-id). The Ayrshare comment ID is the comment ID assigned from Ayrshare and can be found in the `commentId` field in the response when [posting a comment](/docs/apis/comments/post-comment). This is often used if you want to get details on a particular comment published via Ayrshare. ### Comments with Social Comment ID Manage comments on a post that were not published via Ayrshare by using the [Social Comment ID](/docs/apis/overview#social-comment-id). The social comment ID is the comment ID from the social network, not the Ayrshare ID, and can be found in the `commentId` field in the response when [getting comments](/docs/apis/comments/get-comments). ```http theme={"system"} GET https://api.ayrshare.com/api/comments/17969247335804735?platform=instagram&searchPlatformId=true&commentId=true ``` This is often used if you want to get details on a particular comment published outside of Ayrshare, such as LinkedIn replies to comments. ## Disable Comments You can disable comments when publishing a post using the `disableComments` field in the [/post endpoint](/docs/apis/post/post). Comments will only be disabled for Instagram, LinkedIn, and TikTok. You may also enable or disable comments on an already published post using the [update post](/docs/apis/post/update-post) endpoint and the `disableComments` field. ## Platform Limitations **TikTok — `DELETE /comments` is own-authored only.** [`DELETE /comments`](/docs/apis/comments/delete-comments) on TikTok only succeeds for comments authored by the authenticated TikTok account itself (your own replies). Attempting to delete a comment authored by another user returns Ayrshare `code: 328`. For moderation of third-party comments on your own TikTok videos, contact support so we can confirm what's available for your linked account type. ``` ``` # Post a Comment Source: https://www.ayrshare.com/docs/apis/comments/post-comment POST /comments Add a comment to a published post Add a comment to a post with an Ayrshare Post ID (posts sent via Ayrshare) or a Social Post ID (posts sent outside of Ayrshare) using the Comments API.
  • Comments added to an X Thread will be posted to the first Tweet.
  • Instagram Story comments are not yet supported by Meta.
  • See the `platforms` field below for supported platforms depending on the ID type.
Please see the [Comments Overview](/docs/apis/comments/overview) for more information on the different ID types. Supported platforms: Bluesky, Facebook, Instagram, LinkedIn, Reddit, TikTok, X, and YouTube. ## Header Parameters ## Body Parameters Ayrshare Post ID or Social Post ID from the [/post endpoint](/docs/apis/post/post). Text of the new comment to add to the post. Set to `true` if posting a comment using the [Social Post ID](/docs/apis/comments/overview#comments-with-social-post-id), which is the post `id` from the social networks. Specify the platforms to add comments. If using an [Ayrshare Post ID](/docs/apis/comments/overview#comments-with-ayrshare-post-id) the supported platforms are: `bluesky`, `facebook`, `instagram`, `linkedin`, `reddit`, `tiktok`, `twitter`, `youtube`. If no platforms are specified, the comment will be published to all connected platforms that support comments. ```json Post a Comment with the Ayrshare Post ID theme={"system"} { "id": "Ut1fWU6XkqkMayHGnJZ", // Ayrshare Post ID "comment": "An amazing comment!", // required "platforms": [ "bluesky", "facebook", "instagram", "linkedin", "reddit", "tiktok", "twitter", "youtube" ] } ``` If using a [Social Post ID](/docs/apis/comments/overview#comments-with-social-post-id) the supported platforms are -only one platform allowed at a time : `facebook`, `instagram`, `linkedin`, `tiktok`, `twitter`. ```json Post a Comment with the Social Post ID theme={"system"} { "id": "1288899996423983105", // Social Post ID "comment": "An amazing comment!", // required "searchPlatformId": true, // required // facebook, instagram, linkedin, tiktok, twitter "platforms": ["facebook"] // Only specify one platform } ``` Attach an image by providing the image URL for Facebook or X/Twitter. Only one image is supported in the `mediaUrls` field. Supported platforms are Facebook, LinkedIn, and X/Twitter. ```json Post a Comment with an Image theme={"system"} { "id": "Ut1fWU6XkqkMayHGnJZ", // Ayrshare Post ID "comment": "An amazing comment!", // required "platforms": ["facebook"], // Facebook, LinkedIn, or X/Twitter only "mediaUrls": ["https://img.ayrshare.com/gb.jpg"] } ``` ## @Mentions in Comments You can include @mentions directly in the `comment` text string. There is no separate parameter for mentions. Simply add `@handle` in your comment text. ```json Comment with @Mention theme={"system"} { "id": "Ut1fWU6XkqkMayHGnJZ", "comment": "Great post @CompanyName! Love this.", "platforms": ["linkedin", "twitter", "facebook"] } ``` **LinkedIn Mentions:** LinkedIn mentions are resolved server-side by Ayrshare. Use the [LinkedIn Search endpoint](/docs/apis/listen/search/linkedin-search) to look up the correct vanity name or member name. For organizations, use `@handle`. For members, use `@vanity_name` or `@[Full Name]`. For detailed mention syntax and limitations per platform, see: * [Bluesky mentions](/docs/apis/post/social-networks/bluesky#bluesky-mentions) * [Facebook mentions](/docs/apis/post/social-networks/facebook#facebook-page-mentions) * [Instagram mentions](/docs/apis/post/social-networks/instagram#instagram-mentions) * [LinkedIn mentions](/docs/apis/post/social-networks/linkedin#linkedin-mentions) * [Reddit mentions](/docs/apis/post/social-networks/reddit#reddit-mentions) * [Threads mentions](/docs/apis/post/social-networks/threads#threads-mentions) * [TikTok mentions](/docs/apis/post/social-networks/tiktok#tiktok-mentions) * [X/Twitter mentions](/docs/apis/post/social-networks/x-twitter#mentions) * [YouTube mentions](/docs/apis/post/social-networks/youtube#youtube-mentions) See [Post Verification](/docs/testing/post-verification) for the platform-by-platform mention rules and recommendations. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"id": "Ut1fWU6XkqkMayHGnJZ", "platforms": ["bluesky", "facebook", "instagram", "linkedin", "reddit", "tiktok", "twitter", "youtube"], "comment": "An amazing comment!"}' \ -X POST https://api.ayrshare.com/api/comments ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/comments", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}`, }, body: JSON.stringify({ id: "Ut1fWU6XkqkMayHGnJZ", // required platforms: ["bluesky", "facebook", "instagram", "linkedin", "reddit", "tiktok", "twitter", "youtube"], // required comment: "An amazing comment!", //required }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'id': 'Ut1fWU6XkqkMayHGnJZ', 'platforms': ['bluesky', 'facebook', 'instagram', 'linkedin', 'reddit', 'tiktok', 'twitter', 'youtube'], 'comment': 'An amazing comment!'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/comments', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} 'Ut1fWU6XkqkMayHGnJZ', // Replace with your actual post ID 'platforms' => ['bluesky', 'facebook', 'instagram', 'linkedin', 'reddit', 'tiktok', 'twitter', 'youtube'], 'comment' => 'An amazing comment!' ]); $curl = curl_init($apiUrl); curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $data ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```go Go theme={"system"} package main import ( "bytes" "encoding/json" "log" "net/http" ) func main() { message := map[string]interface{}{ "id": "Ut1fWU6XkqkMayHGnJZ", // required "platforms": []string{"bluesky", "facebook", "instagram", "linkedin", "reddit", "tiktok", "twitter", "youtube"}, // required "comment": []string{"An amazing comment!"} // required } bytesRepresentation, err := json.Marshal(message) if err != nil { log.Fatalln(err) } req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/comments", bytes.NewBuffer(bytesRepresentation)) req.Header.Add("Content-Type", "application/json; charset=UTF-8") req.Header.Add("Authorization", "Bearer API_KEY") res, err := http.DefaultClient.Do(req) if err != nil { log.Fatal("Error:", err) } res.Body.Close() } ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace CommentsPOSTRequest_csharp { class CommentsPOST { private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/comments"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); string json = "{\"id\": \"Ut1fWU6XkqkMayHGnJZ\"," + "\"platforms\": [\"bluesky\", \"facebook\", \"instagram\", \"linkedin\", \"reddit\", \"tiktok\", \"twitter\", \"youtube\"]," + "\"comment\": [\"An amazing comment!\"]}"; try { var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(url, content); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } ``` ```json 200: Success theme={"system"} { "status": "success", "commentID": "IUDSCfdYfFkw_dWhW9PLI", // Ayrshare Comment ID. Used for replying to a comment. "id": "Ut1fWU6XkqlMayHGnJZ", // Ayrshare Post ID "bluesky": { "status": "success", "commentId": "at://did:plc:62musrcyanhro2lydyhlw7ci/app.bsky.feed.post/3lf4b4j3dqy2i", "cid": "bafyreiaoivcafelkpzhbbjco23pguyqmy7wucuvfxaifgj34qoyp7nrhhy", "comment": "Nice one this is", "platform": "bluesky", "postUrl": "https://bsky.app/profile/ayrshare.com/post/3lf4b4j3dqy2i" }, "facebook": { "status": "success", "commentId": "358482752285927_363474831785719", // Facebook Social Comment ID "comment": "The best comment ever!", "platform": "facebook" }, "instagram": { "status": "success", "commentId": "17060111860440276", // Instagram Social Comment ID "comment": "The best comment ever!", "platform": "instagram" }, "linkedin": { "status": "success", "commentId": "urn:li:comment:(urn:li:activity:7141202289402236928,7141205176207503360)", // LinkedIn Social Comment ID "comment": "Someone's sitting in the shade today because someone planted a tree a long time ago. - Warren Buffett", "commentUrn": "urn:li:comment:(urn:li:activity:7141202289402236928,7141205176207503360)", // Social comment Id from LinkedIn "platform": "linkedin" }, "tiktok": { "status": "success", "commentId": "7260964914699764524", // TikTok Social Comment ID "comment": "The best comment ever!", "platform": "tiktok", "videoId": "7260964048362310959" }, "twitter": { "status": "success", "commentId": "1525632403262101648", // Twitter Social Comment ID "comment": "The best comment ever!", "postUrl": "https://twitter.com/ayrshare/status/1525632403262101648" }, "youtube": { "status": "success", "commentId": "UgzIEZsDQKXgHsEnwTR4AaABAa", // YouTube Social Comment ID "comment": "The best comment ever!", "platform": "youtube" }, } ``` ```json 404: Not Linked & Success theme={"system"} { "commentId": "5GizKtM9TFRFFWNDgBZ", "twitter": { "status": "success", "commentId": "1842266484032016", "comment": "Having a meeting on this", "platform": "twitter", "postUrl": "https://twitter.com/ayrshare/status/18422664840320" }, "action": "post", "status": "error", "code": 156, "message": "Instagram is not linked. Please confirm the linkage on the Social Accounts page in the dashboard.", "platform": "instagram", "id": "1w3QI6bU7KE9XyxrN0u", // Ayrshare Post ID "errors": [ { "action": "post", "status": "error", "code": 156, "message": "Facebook is not linked. Please confirm the linkage on the Social Accounts page in the dashboard.", "platform": "facebook" }, { "action": "post", "status": "error", "code": 156, "message": "Instagram is not linked. Please confirm the linkage on the Social Accounts page in the dashboard.", "platform": "instagram" } ] } ``` ```json 400: Duplicate comment theme={"system"} { "twitter": { "action": "post", "status": "error", "code": 134, "message": "The social network detected duplicate content and blocked this post. Please change the content and try again.", "post": "Having a meeting on this", "detail": "You are not allowed to create a Tweet with duplicate content." }, "code": 134, "status": "error", "id": "1w3QI6bU7KE9XyxrN", // Ayrshare Post ID "errors": [ { "action": "post", "status": "error", "code": 134, "message": "The social network detected duplicate content and blocked this post. Please change the content and try again.", "post": "Having a meeting on this", "detail": "You are not allowed to create a Tweet with duplicate content.", "id": "1w3QI6bU7KE9XyxrN", "platform": "twitter" } ] } ``` # Reply to a Comment Source: https://www.ayrshare.com/docs/apis/comments/reply-to-comment POST /comments/reply/:commentId Comment on a comment Reply to a comment, i.e. comment on a comment, on either an Ayrshare made comment, using the [Ayrshare Comment ID](/docs/apis/comments/overview#comments-with-ayrshare-comment-id), or a comment made outside of Ayrshare, using the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id). Most often, you will reply to a comment made through Ayrshare, but when you want to reply to a comment made outside of Ayrshare, you can use the Social Comment ID, which you get [GET /comment](/docs/apis/comments/get-comments) endpoint. Supported platforms: Bluesky, Facebook, Instagram, LinkedIn, TikTok, X, and YouTube. ## Header Parameters ## Path Parameters If replying to a comment made through Ayrshare, use the [Ayrshare Comment ID](/docs/apis/comments/overview#comments-with-ayrshare-comment-id) `commentId` returned from the [POST comment endpoint](/docs/apis/comments/post-comment). For example, the Ayrshare comment ID `commentId` returned from the [POST comment endpoint](/docs/apis/comments/post-comment) is: ```json Ayrshare Comment ID Returned from POST /comment theme={"system"} { "commentId": "Ut1fWU6XkqkMayHGnJZ" } ``` If replying to a comment made outside of Ayrshare, use the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id) `commentId` from the social network. For example, the social comment ID `commentId` returned from a Facebook [POST /comment](/docs/apis/comments/post-comment) or [GET /comment](/docs/apis/comments/get-comments) endpoint is: ```json Social Comment ID Returned from POST /comment theme={"system"} { "facebook": { "commentId": "8392829334_1234567890" } } ``` ## Body Parameters If replying to a comment made through Ayrshare using the [Ayrshare Comment ID](/docs/apis/comments/overview#comments-with-ayrshare-comment-id), specify the platforms to post the reply. Supported platforms: `bluesky`, `facebook`, `instagram`, `linkedin`, `tiktok`, `twitter`, `youtube`. If replying to a comment made outside of Ayrshare using the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id), specify the one platform to post the reply. Supported platforms: `facebook`, `instagram`, `linkedin`, `tiktok`, `twitter`. The reply to add to the comment. Attach an image by providing the image URL. Only one image is supported. Facebook and LinkedIn only. Set to `true` if replying to a comment using the [Social Comment ID](/docs/apis/comments/overview#comments-with-social-comment-id), which is the post `commentId` from the social networks. If replying to a LinkedIn comment with a Social Comment ID, you must also provide the full LinkedIn comment URN, which you get from the [POST /comment endpoint](/docs/apis/comments/post-comment) or [GET /comment endpoint](/docs/apis/comments/get-comments) as `commentUrn` — not the bare `commentId`. The URN has the form `urn:li:comment:(urn:li:activity:,)`. Only required for LinkedIn and `"searchPlatformId": true`. If replying to a TikTok comment with a Social Comment ID, you must also provide the TikTok video ID, which you get from the [POST /comment endpoint](/docs/apis/comments/post-comment) or [GET /comment endpoint](/docs/apis/comments/get-comments). Only required for TikTok and `"searchPlatformId": true`. Response as Object, otherwise as an Array. Default to `true`. ## @Mentions in Comments You can include @mentions directly in the `comment` text string. There is no separate parameter for mentions. Simply add `@handle` in your comment text. ```json Reply with @Mention theme={"system"} { "comment": "Thanks @CompanyName! Great insight.", "platforms": ["linkedin", "twitter", "facebook"] } ``` **LinkedIn Mentions:** LinkedIn mentions are resolved server-side by Ayrshare. Use the [LinkedIn Search endpoint](/docs/apis/listen/search/linkedin-search) to look up the correct vanity name or member name. For organizations, use `@handle`. For members, use `@vanity_name` or `@[Full Name]`. For detailed mention syntax and limitations per platform, see: * [Bluesky mentions](/docs/apis/post/social-networks/bluesky#bluesky-mentions) * [Facebook mentions](/docs/apis/post/social-networks/facebook#facebook-page-mentions) * [Instagram mentions](/docs/apis/post/social-networks/instagram#instagram-mentions) * [LinkedIn mentions](/docs/apis/post/social-networks/linkedin#linkedin-mentions) * [Threads mentions](/docs/apis/post/social-networks/threads#threads-mentions) * [TikTok mentions](/docs/apis/post/social-networks/tiktok#tiktok-mentions) * [X/Twitter mentions](/docs/apis/post/social-networks/x-twitter#mentions) * [YouTube mentions](/docs/apis/post/social-networks/youtube#youtube-mentions) Reply to comment is not supported on Reddit. See [Post Verification](/docs/testing/post-verification) for the platform-by-platform mention rules and recommendations. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"platforms": ["bluesky", "facebook", "instagram", "linkedin", "twitter", "youtube"], "comment": "An amazing reply!"}' \ -X POST https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}`, }, body: JSON.stringify({ platforms: ["bluesky", "facebook", "instagram", "linkedin", "twitter", "youtube"], // required comment: "An amazing comment!", //required }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'platforms': ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter', 'youtube'], 'comment': 'An amazing comment!'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter', 'youtube'], 'comment' => 'An amazing comment!' ]); $curl = curl_init($apiUrl); curl_setopt_array($curl, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $data ]); $response = curl_exec($curl); if ($response === false) { echo 'Curl error: ' . curl_error($curl); } else { echo json_encode(json_decode($response), JSON_PRETTY_PRINT); } curl_close($curl); ``` ```go Go theme={"system"} package main import ( "bytes" "encoding/json" "log" "net/http" ) func main() { message := map[string]interface{}{ "platforms": []string{"bluesky", "facebook", "instagram", "linkedin", "twitter", "youtube"}, // required "comment": []string{"An amazing comment!"} // required } bytesRepresentation, err := json.Marshal(message) if err != nil { log.Fatalln(err) } req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ", bytes.NewBuffer(bytesRepresentation)) req.Header.Add("Content-Type", "application/json; charset=UTF-8") req.Header.Add("Authorization", "Bearer API_KEY") res, err := http.DefaultClient.Do(req) if err != nil { log.Fatal("Error:", err) } res.Body.Close() } ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace CommentsReplyPOSTRequest_csharp { class CommentsReply { static async Task Main(string[] args) { string API_KEY = "API_KEY"; string url = "https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ"; using (var httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY); var json = @"{ ""platforms"": [""bluesky"", ""facebook"", ""instagram"", ""linkedin"", ""twitter"", ""youtube""], ""comment"": [""An amazing comment!""] }"; var content = new StringContent( json, Encoding.UTF8, "application/json" ); try { var response = await httpClient.PostAsync(url, content); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } } } } ``` ```json 200: Success theme={"system"} { "commentId": "Eh61xHheGHvAqXqGISGVa", "bluesky": { "status": "success", "commentId": "at://did:plc:62musrcyanhro2lydyhlw7ci/app.bsky.feed.post/3lf4bquqrxd2d", "cid": "bafyreie2jt5iw6rk2ekmiq6aljyiv7nj4sjucbpkamqc73tmggh5fmrqha", "comment": "Truth is ever to be found in simplicity.", "platform": "bluesky", "postUrl": "https://bsky.app/profile/ayrshare.com/post/3lf4bquqrxd2d", "sourceCommentId": "at://did:plc:62musrcyanhro2lydyhlw7ci/app.bsky.feed.post/3lf4b4j3dqy2i" }, "facebook": { "status": "success", "commentId": "729149842469573_696560159169326", "sourceCommentId": "729149842469573_738966840899770", "comment": "Truth is ever to be found in simplicity.", "platform": "facebook" }, "instagram": { "status": "success", "commentId": "18020060386920755", "sourceCommentId": "17998452434360734", "comment": "Truth is ever to be found in simplicity.", "platform": "instagram" }, "linkedin": { "status": "success", "commentId": "7140161360574713856", "sourceCommentId": "urn:li:ugcPost:7140160850354397187", "comment": "Truth is ever to be found in simplicity.", "platform": "linkedin" }, "tiktok": { "status": "success", "commentId": "7484295933044572922", "sourceCommentId": "7484407021429703422", "comment": "Truth is ever to be found in simplicity.", "platform": "tiktok", "videoId": "7484993689815715122" }, "twitter": { "status": "success", "commentId": "1734395672961441821", "sourceCommentId": "1734395509526155733", "comment": "Truth is ever to be found in simplicity.", "platform": "twitter", "postUrl": "https://twitter.com/ayrshare/status/1734395672961441821" }, "youtube": { "status": "success", "commentId": "UgxZ55j-FDri8lrTgVR4AaABAg.9yCaV71m1fo9yCaZvu7Hj4", "sourceCommentId": "UgxZ55j-FDri8lrTgVR4AaABAg", "comment": "Truth is ever to be found in simplicity.", "platform": "youtube" }, "status": "success", "id": "ytDgi5vyz36F2yshlJka" } ``` ```json 400: Unknown commentId theme={"system"} { "facebook": { "action": "post", "status": "error", "code": 215, "message": "Error posting comment. Please be sure you are posting a valid comment, the original post exists, the original post is publicly available." }, "code": 215, "status": "error", "errors": [ { "action": "post", "status": "error", "code": 215, "message": "Error posting comment. Please be sure you are posting a valid comment, the original post exists, the original post is publicly available.", "platform": "facebook" } ], "id": "5360106757501_178916202161" } ``` # Add RSS Feed Source: https://www.ayrshare.com/docs/apis/feeds/add-feed POST /feed Add a new RSS feed for automated posting of new articles Add a new RSS feed for automated posting of new articles. Posts will be automatically sent to your linked social accounts: Bluesky, Facebook, LinkedIn, Telegram, and Threads. Also Instagram and Pinterest if a valid image can be found in the article, and Snapchat if `useFirstImage` is `true` and an image is found — Snapchat cannot publish without media. Reddit, TikTok, YouTube, and Google Business Profile are not available for feeds — each needs a detail a feed entry can't supply, such as a subreddit, a video file, or a location. See [why only these networks](/docs/dashboard/automated-rss-feeds#why-only-these-networks). **X/Twitter is no longer supported for RSS feeds.** As of March 31, 2026, X requires your own API credentials for each request, which is incompatible with automated RSS posting. Passing `twitter` in `platforms` is ignored; if it is the only platform given, the request returns error `101`. Use [scheduled posts](/docs/apis/post/overview#schedule-posts) or direct API calls with your [BYO credentials](/docs/dashboard/connect-social-accounts/x-twitter-byo-keys) instead. ## Header Parameters ## Body Parameters URL of the RSS feed to add. Attempt to get the first or top image in the article and add it to the post. Automatically add up to 3 hashtags to the post text based on the most relevant keywords. Value: `rss`, `substack`, or `youtube`. Social network platforms to publish the article. If not provided, defaults to all connected platforms that are available for feeds. Available platforms: ```json theme={"system"} { "platforms": ["bluesky", "facebook", "instagram", "linkedin", "pinterest", "snapchat", "telegram", "threads"] } ``` ```javascript cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"url": "https://www.nytimes.com"}' \ -X POST https://api.ayrshare.com/api/feed ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const url = "https:///www.nytimes.com"; fetch("https://api.ayrshare.com/api/feed", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}` }, body: JSON.stringify({ url }) }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'url': 'https://www.nytimes.com'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/feed', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} $curl = curl_init(); $data = array ( 'url' => 'https://www.nytimes.com' ); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.ayrshare.com/api/feed', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer API_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "id": "4HZhptaD5", "title": "Pulte's Money and Life Thoughts", "websiteLink": "https://pulte.substack.com", "rssURL": "https://pulte.substack.com/feed" } ``` ```json 400: Feed Already Exists theme={"system"} { "action": "create", "status": "error", "code": 303, "message": "The feed https://ruthreichl.substack.com/feed already exists.", "id": "TDW3oMDoI" } ``` ```json 400: Invalid URL theme={"system"} { "action": "create", "status": "error", "code": 130, "message": "Something is wrong with the RSS feed URL. Please verify it." } ``` # Delete RSS Feed Source: https://www.ayrshare.com/docs/apis/feeds/delete-feed DELETE /feed Delete an RSS Feed that was previously added ## Header Parameters ## Body Parameters ID of the RSS Feed returned when adding. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"id": "4HZhptaD5"}' \ -X DELETE https://api.ayrshare.com/api/feed ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const id = "4HZhptaD5"; fetch("https://api.ayrshare.com/api/feed", { method: "DELETE", headers: { "Content-Type": "application/json", Authorization: `Bearer ${API_KEY}`, }, body: JSON.stringify({ id }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'id': '4HZhptaD5'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.delete('https://api.ayrshare.com/api/feed', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} $curl = curl_init(); $data = array ( 'id' => '_3yhtyd88' ); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.ayrshare.com/api/feed', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer API_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "id": "RDFbD_fl5" } ``` ```json 400: Can't Find RSS ID theme={"system"} { "action": "delete", "status": "error", "code": 131, "message": "Something is wrong deleting the RSS feed URL. Please try again and verify the id." } ``` # Get RSS Feeds Source: https://www.ayrshare.com/docs/apis/feeds/get-feeds GET /feed Get all registered RSS feeds ## Header Parameters ```json 200: Success theme={"system"} { "status": "success", "feeds": [ { "autoHashtag": false, "created": "2022-05-16T23:20:03.405Z", "description": "Social Media APIs that enable you to send social media posts effortlessly", "id": "_3yhtyd88", "image": { "height": "32", "link": "https://www.ayrshare.com", "title": "Ayrshare", "width": "32", "url": "https://www.ayrshare.com/wp-content/uploads/2020/07/cropped-ayr-icon-2FKLDFB-32x32.png" }, "link": "https://www.ayrshare.com", "title": "Ayrshare", "type": "rss", "updated": "2022-05-16T23:20:17.124Z", "url": "https://www.ayrshare.com/feed/", "useFirstImage": true } ] } ``` # RSS Feeds Overview Source: https://www.ayrshare.com/docs/apis/feeds/overview Add and delete RSS feeds for automated posting Manage RSS feeds for automated posting. Great for auto-posting your blog articles, YouTube videos, and podcasts. A [webhook is available to get notified](/docs/apis/webhooks/actions#feed-action) when a new RSS feed item is available. # Update RSS Feed Source: https://www.ayrshare.com/docs/apis/feeds/update-feed PUT /feed Update an RSS feed ## Header Parameters ## Body Parameters The RSS feed id returned from the RSS feed POST endpoint. Attempt to get the first or top image in the article and add it to the post. Automatically add up to 3 hashtags to the post text based on the most relevant keywords. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"id": "4HZhptaD5", "useFirstImage": true, "autoHashtag": true}' \ -X PUT https://api.ayrshare.com/api/feed ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; const id = "4HZhptaD5"; fetch("https://api.ayrshare.com/api/feed", { method: "PUT", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}` }, body: JSON.stringify({ id, "useFirstImage": true, "autoHashtag": true }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.err ``` ```python Python theme={"system"} import requests payload = {'id': '4HZhptaD5', 'useFirstImage': True, 'autoHashtag': True} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.put('https://api.ayrshare.com/api/feed', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} $curl = curl_init(); $data = array ( 'id' => '_3yhtyd88', 'useFirstImage' => false, 'autoHashtag' => true ); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.ayrshare.com/api/feed', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer API_KEY' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "id": "vVYX3cgJ7" } ``` ```json 400: RSS Feed not found theme={"system"} { "action": "update", "status": "error", "code": 304, "message": "The feed with id vVYX3cgJ does not exist." } ``` # Generate Alt Text Source: https://www.ayrshare.com/docs/apis/generate/image-alt-text POST /generate/altText Create AI-generated alt text for your images Create AI-generated alt text for your images. Choose the language to write the alt text and keywords to include in the alt text. ## Header Parameters ## Body Parameters Image URL of the image to create the alt text. Must start with `https://`. Supports JPEG, PNG, GIF, WEBP, and BMP. String array of keywords or phrases to be considered when generating the alt text. Typically only one or two of the keywords from the array will be used in the alt text. Language to output the alt text. Use one of the available [language codes](/docs/iso-codes/language). ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"url": "https://img.ayrshare.com/012/gb.jpg"}' \ -X POST https://api.ayrshare.com/api/generate/altText ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/generate/altText", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}` }, body: JSON.stringify({ url: "https://img.ayrshare.com/012/gb.jpg", // required }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'url': 'https://img.ayrshare.com/012/gb.jpg'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/generate/altText', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} $curl = curl_init(); $data = array ( "url" => "https://img.ayrshare.com/012/gb.jpg" ); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.ayrshare.com/api/generate/altText', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer API_KEY', 'Accept-Encoding: gzip' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; using System.Text.Json; class Program { // Replace 'YOUR_API_KEY' with your actual Ayrshare API key private const string API_KEY = "YOUR_API_KEY"; private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string imageUrl = "https://img.ayrshare.com/012/gb.jpg"; try { var result = await GenerateAltTextAsync(imageUrl); Console.WriteLine("Generated Alt Text:"); Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true })); } catch (Exception e) { Console.WriteLine($"An error occurred: {e.Message}"); } } static async Task GenerateAltTextAsync(string imageUrl) { var url = "https://api.ayrshare.com/api/generate/altText"; var requestData = new { url = imageUrl }; client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", $"Bearer {API_KEY}"); var json = JsonSerializer.Serialize(requestData); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); if (!response.IsSuccessStatusCode) { throw new HttpRequestException($"HTTP error! status: {response.StatusCode}"); } var responseBody = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(responseBody); } } ``` ```json 200: Alt Text Generated theme={"system"} { "status": "success", "altText": "A ghostbusters vehicle driving through a field.", "url": "https://img.ayrshare.com/012/gb.jpg" } ``` ```json 500: Error with the Image File theme={"system"} { "action": "upload", "status": "error", "code": 115, "message": "An error occurred uploading your file, such as a timeout at the social network. Please try your post again with the /retryPost endpoint." } ``` # Generate API Overview Source: https://www.ayrshare.com/docs/apis/generate/overview AI Utilities for various workflows We offer a set of AI utilities that help with creating social media posts. ## Token Limits For every API call made to AI endpoints, a certain number of "tokens" are used. These tokens are calculated based on the data you send and receive. Every month, your Max Pack and overall Ayrshare account are allocated a total of 300,000 tokens for Business plans, 100,000 for Premium Plus plans, and 50,000 for Premium plans. This allocation refreshes on the first day of each month. To see how many tokens a specific API call used, as well as your total usage for the month, please check the HTTP response. # Generate Post Text Source: https://www.ayrshare.com/docs/apis/generate/post-text POST /generate/post Generate a new social post using AI Generate a new social post using AI. You can either provide text or images to create the social media post. [Token limits](/docs/apis/generate/overview#token-limits) applicable. ## Header Parameters ## Body Parameters Description of what the post should be about. For example: "A shoe sale happening Monday with specials on red, blue, and yellow shoes". Not required if `mediaUrls` parameter is included. An array of image URLs to base the post text on. Required if `text` parameter not included. Add hashtags to the post. Add emojis to the post. Construct a post with 280 or few characters. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"text": "This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today."}' \ -X POST https://api.ayrshare.com/api/generate/post ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/generate/post", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}` }, body: JSON.stringify({ post: "This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today.", // required }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'post': 'This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today.'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/generate/post', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "This beautiful new shoe is on sale now. It comes in red, blue, or purple. Check it out today." ); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.ayrshare.com/api/generate/post', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer API_KEY', 'Accept-Encoding: gzip' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Text theme={"system"} { "status": "success", "post": "🎉🛍️ Introducing the stunning new shoes that's now on sale! You can choose from three different colors – red, blue, or purple – and trust us, they're all amazing! Don't miss out on this beauty and grab yours today! 🙌 #newshoe #onSale #fashionable #colormebeautiful 🌈", "usage": 98, // Tokens used for this call "totalMonthlyUsage": 733 // Total tokens used for the month } ``` ```json 200: Image theme={"system"} { "status": "success", "post": ["Ventured out on a serene walk today—a path less traveled but surrounded by the lush vibrancy of nature's finest. The perfect spot to reconnect with the earth and oneself. Where do your paths lead you?\n\n#NatureWalks #ExploreOutdoors #PeacefulPath"], "mediaUrls": ["https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"], "usage": 2295, "totalMonthlyUsage": 6987 } ``` ```json 400: Bad Request theme={"system"} { "action": "request", "status": "error", "code": 101, "message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints" } ``` # Rewrite Post Source: https://www.ayrshare.com/docs/apis/generate/rewrite-post POST /generate/rewrite Generate variations of a social media post using AI Generate variations of a social media post using AI. [Token limits](/docs/apis/generate/overview#token-limits) applicable. ## Header Parameters ## Body Parameters The post text to be rewritten. Add emojis to the post. Add hashtags to the post. Construct a post 280 or fewer characters. Number of rewrites. Min: 1 and Max: 5. ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"post": "Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife"}' \ -X POST https://api.ayrshare.com/api/generate/rewrite ``` ```javascript JavaScript theme={"system"} const API_KEY = "API_KEY"; fetch("https://api.ayrshare.com/api/generate/rewrite", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}` }, body: JSON.stringify({ post: "Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife", // required }), }) .then((res) => res.json()) .then((json) => console.log(json)) .catch(console.error); ``` ```python Python theme={"system"} import requests payload = {'post': 'Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife'} headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'} r = requests.post('https://api.ayrshare.com/api/generate/rewrite', json=payload, headers=headers) print(r.json()) ``` ```php PHP theme={"system"} "Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife" ); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.ayrshare.com/api/generate/rewrite', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer API_KEY', 'Accept-Encoding: gzip' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```json 200: Success theme={"system"} { "status": "success", "post": "Kali melts the heart, even when the rest of the day is freezing. Happy International Polar Bear Day to the largest land carnivore and the biggest, furriest part of the Zoo’s bear community! \nOur resident polar bear Kali (pronounced “Cully”) is a wild-born bear that was born off of the northwest coast of Alaska. He was named by the people of the Native Village of Point Lay, who rescued him. \"Kali\" is the Inupiaq name for Point Lay. Eventually, the U.S. Fish and Wildlife", "rewrites": [ "❄️🐻 Kali, the lovable polar bear, warms our hearts on this #InternationalPolarBearDay. Fun fact: he was named after Inupiaq village, Point Lay! #FurryZooCommunity 🐾", "Happy #InternationalPolarBearDay to Kali, the largest land carnivore of the Zoo community! Even on freezing days, Kali steals our hearts with his adorable antics. 🐻❤️", "Meet Kali, the wild-born polar bear with a heart-melting charm. 🐾❄️ Sending love on this #InternationalPolarBearDay to the Zoo's fluffiest resident. 🐻❤️", "On #InternationalPolarBearDay, we celebrate Kali, the furry wonder from the largest land carnivore family of the Zoo. 🐾🐻 He was named after an Inupiaq village, Point Lay!🌟", "Kali, the Zoo's beloved polar bear, steals our hearts with his playful spirit, as we celebrate #InternationalPolarBearDay. 🐻❤️ Born off the Alaskan coast, he's a true warrior! 💪🌟" ], "usage": 98, // Tokens used for this call "totalMonthlyUsage": 733 // Total tokens used for the month } ``` ```json 400: Missing parameters theme={"system"} { "action": "request", "status": "error", "code": 101, "message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints" } ``` # Sentiment Analysis Source: https://www.ayrshare.com/docs/apis/generate/sentiment POST /generate/sentiments Generate a sentiment analysis on a social media post or comment Generate a sentiment analysis on a social media post or comment to understand if the text is positive, negative, or neutral and recommendations on improving the text for a more positive reaction. ## Header Parameters ## Body Parameters The string of text to generate the sentiment analysis on. ### Request Examples ```bash cURL theme={"system"} curl \ -H "Authorization: Bearer API_KEY" \ -H 'Content-Type: application/json' \ -d '{"text": "These shoes aren't the best. The color has faded and they are uncomfortable to walk in."}' \ -X POST https://api.ayrshare.com/api/generate/sentiment ``` ```javascript JavaScript theme={"system"} const API_KEY = 'YOUR_API_KEY'; const analyzeTextSentiment = async (text) => { try { const response = await fetch('https://api.ayrshare.com/api/generate/sentiment', { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ text }) }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log('Sentiment Analysis Result:', data); return data; } catch (error) { console.error('Error analyzing sentiment:', error.message); throw error; } }; ``` ```python Python theme={"system"} import requests import json API_KEY = 'YOUR_API_KEY' def analyze_text_sentiment(text): url = 'https://api.ayrshare.com/api/generate/sentiment' headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json' } data = {'text': text} try: response = requests.post(url, headers=headers, json=data) response.raise_for_status() # Raises a HTTPError if the status is 4xx, 5xx result = response.json() print('Sentiment Analysis Result:', json.dumps(result, indent=2)) return result except requests.exceptions.RequestException as e: print('Error analyzing sentiment:', e) raise ``` ```php PHP theme={"system"} $text]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if (curl_errno($ch)) { echo 'Error analyzing sentiment: ' . curl_error($ch); return null; } curl_close($ch); if ($httpCode >= 200 && $httpCode < 300) { $result = json_decode($response, true); echo "Sentiment Analysis Result:\n"; print_r($result); return $result; } else { echo "HTTP Error: " . $httpCode . "\n"; echo "Response: " . $response . "\n"; return null; } } ``` ```csharp C# theme={"system"} using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; using System.Text.Json; class Program { private const string API_KEY = "YOUR_API_KEY"; private static readonly HttpClient client = new HttpClient(); static async Task Main(string[] args) { string textToAnalyze = "These shoes aren't the best. The color has faded and they are uncomfortable to walk in."; try { var result = await AnalyzeTextSentimentAsync(textToAnalyze); Console.WriteLine("Sentiment Analysis Result:"); Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true })); } catch (Exception e) { Console.WriteLine($"An error occurred: {e.Message}"); } } static async Task AnalyzeTextSentimentAsync(string text) { var url = "https://api.ayrshare.com/api/generate/sentiment"; var requestData = new { text = text }; client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", $"Bearer {API_KEY}"); var json = JsonSerializer.Serialize(requestData); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); if (!response.IsSuccessStatusCode) { throw new HttpRequestException($"HTTP error! status: {response.StatusCode}"); } var responseBody = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(responseBody); } } ``` ```json 200: Success theme={"system"} { "status": "success", "text": "These shoes aren't the best. The color has faded and they are uncomfortable to walk in.", "sentimentAnalysis": { "sentiment": "negative", // positive, negative, or neutral "opportunities": [ "Improve color durability", "Enhance comfort level" ], "recommendations": [ { "opportunity": "Improve color durability", "recommendation": "Investigate and use higher-quality dyes or materials to prevent fading over time." }, { "opportunity": "Enhance comfort level", "recommendation": "Review and possibly redesign the shoe's insole and cushioning to provide better support and comfort for walking." } ] } } ``` ```json 400: Error theme={"system"} { "action": "request", "status": "error", "code": 101, "message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints" } ``` # Transcribe a Video Source: https://www.ayrshare.com/docs/apis/generate/transcribe-video POST /generate/transcription Provide a transcription and title of a video file using AI Generate a transcription and title of a video file using AI. This transcription can then be used in the [/generate/post](/docs/apis/generate/post-text) to create a social media summary of the video. For [YouTube](/docs/apis/post/social-networks/youtube), which requires a title, the generated title can be used. The video must have been previously uploaded to Ayrshare with [/media](/docs/apis/media/overview). Videos not hosted by Ayrshare will be rejected. Maximum video file size is 500GB and maximum duration is 10 minutes. ### Transcribe Video Guide