Links

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 REST 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 and Groups, Twitter, LinkedIn, Instagram, YouTube, Google My Business (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

  • Authorized access based on your secret API Key (obtained at ayrshare.com).
  • Publish posts immediately or scheduled future posts on linked social networks.
  • Send posts on a predetermined automated schedule.
  • Post images and videos, including Reels.
  • Delete posts on linked social networks.
  • Analytics on post engagement, likes, shares, and more.
  • Analytics on the social account, such as followers and demographics.
  • Get and add comments to posts.
  • Auto shorten links in posts or shorten specific links.
  • TweetStorms for longer Tweets using Twitter Threads.
  • Add specific Unsplash images or randomly select an Unsplash image based on a search term.
  • Automatically add hashtags to your posts based on the most relevant key words.
  • Get history of posts and their status, even post that didn't go through Ayrshare.
  • Add or delete an RSS feeds for automated posts.
  • Upload media (photos and videos) to media gallery to be used in posts.

Business Plan

As a Business Plan member, you can manage multiple user and client profiles from your platform.
  • Allow your users to connect their social media accounts.
  • Post to multiple user profiles with one API call.
  • Create and delete user profiles via the API.
  • Advanced User Analytics and Webhooks.
Learn more about the Business Plan.

Watch How to Use the API

If you're building in Node.js, check out this video on how to connect and post to Twitter and Facebook.

Authorization

Ayrshare authenticates API requests via an Authorization token passed in the HTTP header. Please be sure to send Bearer with the API Key.
HTTP Header Format: Authorization: Bearer API_KEY replacing API_KEY with your primary API Key.
cURL
Node.js
Python
PHP
Go
curl -H "Authorization: Bearer API_KEY" https://app.ayrshare.com
headers: {"Authorization": "Bearer API_KEY"}
headers = {'Authorization': 'Bearer API_KEY'}
'headers' => ['Authorization' => 'Bearer API_KEY']
req.Header.Add("Authorization", "Bearer API_KEY")
Obtain your secret API key in the web interface 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, returned when creating a User Profile or found in the Dashboard, in the header.
HTTP Header Format: Profile-Key: PROFILE_KEY replacing PROFILE_KEY with the User's Profile Key.
cURL
Node.js
Python
PHP
Go
curl -H "Profile-Key: PROFILE_KEY" https://app.ayrshare.com
headers: {"Profile-Key": "PROFILE_KEY"}
headers = {'Profile-Key': 'PROFILE_KEY'}
'headers' => ['Profile-Key' => 'PROFILE_KEY']
req.Header.Add("Profile-Key", "PROFILE_KEY")

Content-Type

Data should always be passed as Content-Type: "application/json"
cURL
Node.js
Python
PHP
Go
curl -H "Content-Type: application/json" https://app.ayrshare.com
headers: {"Content-Type": "application/json"}
headers = {'Content-Type': 'application/json'}
'headers' => ['Content-Type' => 'application/json']
req.Header.Add("Content-Type", "application/json")

Accept-Encoding

Optional: Add an Accept-Encoding header to compress the response with Accept-Encoding: "deflate, gzip". Please be sure you can properly uncompress the response.
cURL
Node.js
Python
PHP
Go
curl -H "Accept-Encoding: deflate, gzip" https://app.ayrshare.com
headers: {"Accept-Encoding": "deflate, gzip"}
headers = {'Accept-Encoding': 'deflate, gzip'}
'headers' => ['Accept-Encoding' => 'deflate, gzip']
req.Header.Add("Accept-Encoding", "deflate, gzip")

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:

Postman

You can use Postman to test your REST API calls.

Packages

We have both Node.js & Python packages and Bubble.io and Airtable guides available to make the RESTful calls easier.