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.

Connect Your Social Media Accounts

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.
Linking YouTube

Get Your API Key

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.
1
"Authorization": "Bearer API_KEY",
2
"Content-Type": "application/json"
Copied!

Send Your First Post via the API

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.
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"post": "Today is a great day!", "platforms": ["twitter", "facebook", "instagram", "linkedin"], "mediaUrls": ["https://images.ayrshare.com/imgs/GhostBusters.jpg"]}' \
5
-X POST https://app.ayrshare.com/api/post
Copied!
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.

Diving a Little Deeper...

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.
More code examples can be accessed here: https://docs.ayrshare.com/rest-api/endpoints/post

Before You Go, Some Best Practices

Read the Docs

We maintain extensive and up-to-date documentation, and sometimes it even is a fun read.

Error Codes Are Important

You need to handle them so your user have a great experience.

Keep Your API Key Secure

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.

Use Postman to Test Your Calls

Postman is an amazing tool for testing API calls. You can even generate code in over a dozen languages.

Common Troubleshooting

Sometimes things don't go right, so here is a little help.

Reach Out To Us for Help

We are here to help, so please contact us.
Last modified 1mo ago