API Overview
Powerful Social APIs that enable you to send social media posts and get analytics effortlessly. For developers and businesses of all sizes.
Ayrshare's Social Media API
The Social Media REST API allows programmatic access to the functionality of Ayrshare, such as posting and deleting status updates, getting analytics, adding comments, and more to multiple social. Current social networks supported are Facebook Pages, X/Twitter, LinkedIn, Instagram, YouTube, Google Business Profile, Pinterest, Reddit, TikTok, and Telegram.
If you are on the Business or Enterprise Plan and manage multiple users, see the Business Plan Overview and /profiles API endpoint.
Key Functionality
Secure API access using your unique API key (obtainable from ayrshare.com).
Instant or scheduled posting to connected social media platforms.
Automated posting based on predefined schedules.
Support for image and video content, including Reels and Stories.
Post removal capability across linked social networks.
Comprehensive post engagement analytics (likes, shares, etc.).
Social account metrics, including follower count and demographic data.
Comment management: view, add, and delete post comments.
Built-in link shortening for all or specific URLs in posts.
Twitter Thread support for longer content (TweetStorms).
Unsplash integration: add specific images or randomly select based on keywords.
Automatic hashtag generation using relevant keywords.
Post history tracking, including non-Ayrshare posts.
Review management: retrieve, reply to, and delete review responses.
RSS feed integration for automated content posting.
Review interaction: view and respond to user reviews.
Media library: upload and store photos and videos for use in posts.
Business Plan
Business Plan features for managing multiple users and clients:
Enable users to link their own social media accounts to your platform.
Post content to multiple user profiles simultaneously with a single API request.
Create and remove user profiles programmatically through the API.
Access advanced user analytics and receive real-time updates via webhooks.
Learn more about the Business Plan.
Messages
A unified messaging API to engage users in conversations across the major social media channels: Facebook, Instagram, and X.
Sending text, image, and video messages.
Retrieving complete conversation histories.
Setting up automated message responses.
Receiving real-time updates via webhooks for messages received, message reactions, read receipts.
This API simplifies user engagement by centralizing messaging operations for multiple social media channels. Learn more...
Max Pack
Get even more capabilities with the Max Pack add-on:
Watch How to Use the Social API
If you're building in Node.js, check out this video on how to connect and post to Twitter and Facebook.
Social API Demo
If you use Node.js see the social API demo code to get started building your own social API integration.
Authorization
Ayrshare authenticates API requests via an Authorization token passed in the HTTP header. Please be sure to send Bearer
with the API Key. The API Key can be found in the Ayrshare Dashboard by switching to your Primary Profile in the User Profile page and going to the API Key page found in the left navigation panel.
HTTP Header Format: Authorization: Bearer API_KEY
replacing API_KEY with your primary API Key.
Obtain your secret API key in the Ayrshare dashboard under API Key.
For example, if your API Key is 2MPXPKQ-S03M5LS-GR5RX5G-AZCK8EA
Your header should include:
Authorization: Bearer 2MPXPKQ-S03M5LS-GR5RX5G-AZCK8EA
Profile Key
You may specify a User Profile by adding the Profile Key in the header. The Profile Key is returned when creating a User Profile or in the Dashboard by switching to a User Profile in the User Profiles page and going to the Profile Key page found in the left navigation panel.
HTTP Header Format: Profile-Key: PROFILE_KEY
replacing PROFILE_KEY with the User's Profile Key.
Content-Type
Data should always be passed as Content-Type: "application/json"
Compression
Add an Accept-Encoding
header to compress the response with Accept-Encoding: "deflate, gzip".
This is recommended for calling larger responses like the /history endpoint. Please be sure you can properly uncompress the response.
Ayrshare Post ID vs Social ID
There are primarily two types of IDs used throughout call:
Ayrshare Post ID: This ID is generated by Ayrshare and returned from the /post endpoint in the
id
field. This ID makes it easy to get analytics on the post across social networks, add comments to the post, delete the post, etc. This is the ID you will use most often.Social ID: Each social network assigns their own unique ID to posts and comments. These IDs are returned in the
postIds
field of the /post or /comments endpoints. You can use these IDs, or ones you get directly from the social networks, to retrieve data, such as with the analytics social ID.
Error Codes
Errors will return with standard HTTP status codes.
For more information:
Detailed Errors are in the REST API response specific for each type of call.
For more information:
Timestamp Format
We utilize Zulu Time, also known as UTC (Coordinated Universal Time) or an ISO 8601 formatted date string, for a precise and unambiguous time references across different time zones.
For example: 2024-01-21T00:46:49.238Z
You can convert the UTC format to you local time in the programming language of your choice. For example in JavaScript:
Postman
You can use Postman to test your REST API calls.
Random Posts, Images, and Videos
Check out out quick start guide on how to send random posts, images, or videos when testing.
Packages
We have both Node.js & Python packages and Bubble.io and Airtable guides available to make the RESTful calls easier.
Last updated