Quick Start Guide
Link your social accounts and send your first post in a few minutes.
The guide is for setting up a single company. For Business and Enterprise Plan members with multiple users, a personalize integration guide is provided.
Log in or sign up for an Ayrshare account. On the Social Account Linkage page, click the social networks you want to connect. Please be sure to grant all permissions.
.jpg?alt=media&token=e32b38d5-53a5-47c6-882f-09098b277c94)
Linking YouTube Example
API access is based on your secret API Key. You can obtain your API key in the API Key page in the Developer Dashboard.
Every API call must include the API Key in the Header using a Bearer Token. Also include the
Content-Type
of application/json
."Authorization": "Bearer API_KEY",
"Content-Type": "application/json"
The cURL example is listed below, but you can use any language and we have examples and SDK packages.
Include a post body, the platform destinations, and a media URL if you are posting an image or video. The HTTP POST endpoint is /post.
Here is the sample code. Remember to only include the platforms you have linked.
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"post": "Today is a great day!", "platforms": ["twitter", "facebook", "instagram", "linkedin"], "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"]}' \
-X POST https://app.ayrshare.com/api/post
Congrats! You just sent your first post.
A response of
status
of “success” will be received. Check your social media pages to ensure that the post was successfully processed and is live.See more code examples of calling the social media api in Node.js, Python, PHP, Golang, C#, and Ruby:
Let's look at what happened.
- Sent the Header Authorization bearer token (API Key) and content type of json.
- Created a body object with a:
post
containing the text "Today is a great day!".- Social network
platforms
of Twitter, Facebook, Instagram, and LinkedIn. Note, only include the platforms you linked in the Social Linkage Page (see above). - Added an image in the
mediaUrls
.
- Sent everything as an HTTP POST to the /post endpoint.
We maintain extensive and up-to-date documentation, and sometimes it even is a fun read.
You need to handle them so your user have a great experience.
We take security very seriously, and so should you. You have full control over the connection between Ayrshare and your social media accounts. Once the accounts are connected, the Ayrshare API key becomes the way you authenticate. Please keep this key secret and secure.
The social networks are very particular on sending duplicate content. If you want to test with unique content, the
randomPost
parameter of the /post endpoint will generate a random quote. If you use the randomPost
, the post
parameter is not required."randomPost": true,
"randomMediaUrl": true
For example, making a cURL call to post a random quote.
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"randomPost": true, "platforms": ["twitter", "facebook", "instagram", "linkedin"], "randomMediaUrl": true}' \
-X POST https://app.ayrshare.com/api/post
Postman is an amazing tool for testing API calls. You can even generate code in over a dozen languages.
Sometimes things don't go right, so here is a little help.
Last modified 5mo ago