Overview
Ayrshare’s Social API NPM Package allows you to integrate the Ayrshare API into your Node.js app.Installation
Install the Social API NPM Package if you use Node on the server-side. The package simplifies the calls by wrapping the RESTful calls.Obtain your secret API Key in the Ayrshare Dashboard.
General Usage
Examples of Post, History, and Delete:Posting to X/Twitter? As of March 31, 2026, X/Twitter operations through Ayrshare require your own X Developer App credentials — Ayrshare enforces this on every X-bound call. Add the 2 BYO headers to your request. See the setup guide for details.
setTwitterByo(apiKey, apiSecret) helper that attaches the two required X-Twitter-OAuth1-* headers to every subsequent request:
clearTwitterByo() to drop the headers — useful when reusing one SDK instance across tenants:
Video Overview of the Social Media API NPM Package
Profile Key
You may specify the Profile Key for User Profile in the body of a POST or query of a GET with theprofileKey field.
Social API Demo
For a sample Node.js integration (using the RESTful API calls), see the GitHub repository:Social API Demo Code
The Social API Demo is a web application that allows users to compose, schedule, and post content
to multiple social media platforms simultaneously.
