REST API به اسکریپتها و اپهای شما اجازه میدهد همان کارهایی را بکنند که شما در داشبورد میکنید: پست فوری، زمانبندی، آپلود تصویر و بررسی آنچه منتشر شده. با JSON روی HTTPS کار میکند و یک کلید API لازم دارد.
یک کلید API بگیرید
وارد شوید و در داشبورد بخش تنظیمات ← کلیدهای API را باز کنید.
یک نام به کلید بدهید، مثلاً «اسکریپت انتشار»، و آن را بسازید.
کلید را همان لحظه کپی کنید. با smcp_ شروع میشود و فقط یک بار نشان داده میشود.
کلید را مثل رمز عبور مخفی نگه دارید: هر کسی آن را داشته باشد میتواند در حسابهای شما پست بگذارد. آن را در یک متغیر محیطی یا secretهای CI نگه دارید، هرگز در کد. اگر کلیدی لو رفت، از همانجا حذفش کنید و یک کلید تازه بسازید.
اول حسابهای خود (X و LinkedIn) را در داشبورد وصل کنید. API در حسابهایی پست میگذارد که وصل کردهاید.
اولین درخواست شما
کلید را با هر درخواست در هدر Authorization بفرستید:
این درخواست حسابها، تنظیمات و پلن شما را برمیگرداند. برای پست فوری:
curl https://getsocialmcp.com/api/v1/posts \
-H "Authorization: Bearer $SOCIALMCP_KEY" \
-H "Content-Type: application/json" \
-d '{ "text": "v2.4 is live: faster search and dark mode.", "networks": ["x", "linkedin"] }'
برای زمانبندی آن، یک زمان با اختلاف منطقهٔ زمانی اضافه کنید، مثلاً "scheduledAt": "2026-12-01T09:00:00+01:00". پاسخ، پست و نتیجهٔ آن را در هر شبکه نشان میدهد.
خوب است بدانید
زمانها: زمانها را به شکل ISO 8601 با اختلاف ساعت یا Z بفرستید. پاسخها از UTC استفاده میکنند.
رشتهپست در X: به جای text، parts را بفرستید، یک آیتم برای هر پست رشته. LinkedIn بخشها را به شکل یک پست ترکیبی میگیرد، یا فقط بخش اول را، بسته به تنظیمات شما.
نسخهٔ متفاوت برای هر شبکه: از overrides استفاده کنید، مثلاً یک متن بلندتر برای LinkedIn و یک رشتهپست کوتاه برای X در همان درخواست.
تصویرها: با POST /media آپلود کنید (یک فایل، یا یک لینک https)، سپس شناسهٔ برگشتی را در mediaIds بفرستید.
زمانهای انتشار: با "postingTime": "next" پست در اولین جای خالی از زمانهای انتشاری که در داشبورد تنظیم کردهاید قرار میگیرد.
بدون پست تکراری: یک idempotencyKey بفرستید. اگر اسکریپت شما با همان کلید دوباره تلاش کند، همان پست اول را پس میگیرید و هیچ چیز دو بار منتشر نمیشود.
صفحههای نتیجه:GET /posts مقدار nextCursor را برمیگرداند. آن را به شکل cursor بفرستید تا صفحهٔ بعد را بگیرید.
تأییدها: پستهایی که با کلید API خودتان ساخته میشوند طبق برنامه منتشر میشوند. تنظیم «اول اینجا منتظر تأیید من بمانند» فقط برای ایجنتهای هوش مصنوعی است.
خطاها
همهٔ خطاها یک شکل دارند. منطق خود را بر اساس code بنویسید؛ message برای آدمها نوشته شده و ممکن است تغییر کند.
{
"error": {
"code": "too_long",
"message": "Part 1 is 312 characters on X; the limit is 280.",
"details": { }
}
}
کدهای رایج:
invalid_api_key (401): کلید اشتباه است یا حذف شده.
invalid_request یا too_long (422): درخواست جور درنمیآید. پیام میگوید چه چیزی را تغییر دهید.
daily_limit، posting_gap یا monthly_limit (429): پلن شما در آن زمان جا ندارد. برای روزی که پر است یا پستی که خیلی نزدیک است، details نزدیکترین زمانِ دارای جا را پیشنهاد میکند.
plan_no_images و کدهای دیگر plan_ (403): پلن شما این را ندارد. پیام میگوید کدام پلن دارد.
dashboard_only (403): این کار فقط در داشبورد انجام میشود، مثلاً ساختن کلیدهای API.
پستی که پذیرفته شده هنوز ممکن است بعداً در یک شبکه ناموفق شود، مثلاً وقتی یک شبکه اتصال SocialMCP را قطع میکند. این روی خود پست نمایش داده میشود: هر مورد در targets یک status دارد و اگر ناموفق بوده، یک error مثل reconnect_needed. با GET /posts/<id> آن را بررسی کنید.
محدودیتها
API از همان پلن و محدودیتهایی استفاده میکند که بقیهٔ SocialMCP: پست در روز و در ماه، لینک در X، تصویرها و یک فاصلهٔ کوتاه بین پستها در یک حساب. GET /me محدودیتها و مقدار استفادهٔ شما را نشان میدهد.
مشخصات قابلخواندن برای ماشین
مشخصات کامل OpenAPI 3.1 در https://getsocialmcp.com/api/v1/openapi.json است. از آن برای ساختن کلاینت به زبان برنامهنویسی خودتان یا وارد کردن API به ابزارهایی مثل Postman استفاده کنید.
همهٔ endpointهایی که میتوانید با یک کلید API صدا بزنید، ساختهشده از خود API. نام endpointها، فیلدها و توضیحاتشان به انگلیسی است.
نشانی پایه: https://getsocialmcp.com/api/v1
Networks
GET/networks
Networks you can post to
Without an API key: the networks open to everyone on SocialMCP. With a key: the networks you can connect and post to, which can include ones still in testing.
پاسخها
200Networksobject
401Not signed in, or the API key is wrong
Account
GET/me
Who you are, your settings, connected accounts, and your plan with what you’ve used
422Invalid request (e.g. too long for the network)
POST/login-links
Get a link that opens the dashboard already signed in
Single-use, valid 10 minutes. path is where it opens: /app (calendar), /app?post={id} or /app/settings. Approving agent posts, API keys and agents still need an email sign-in.
403This network is not available (network_unavailable)
Posting times
PUT/posting-times
Set when you usually post
Saves posting times on the given accounts (all connected accounts when none are given). An empty list turns them off. Upcoming posts placed in a time that no longer exists move to the first open posting time from the start of their day (moved); posts left with no posting time keep their time (kept).
409Conflicts with the current state (e.g. account not connected)
422Invalid request (e.g. too long for the network)
GET/posting-times/open
Open posting times in a range
Upcoming posting times that have no post yet, each with the accounts it is open on. Up to about two months at a time.
پارامترها
fromstring (date-time)(query)الزامی
tostring (date-time)(query)الزامی
پاسخها
200Open posting timesobject
401Not signed in, or the API key is wrong
422Invalid request (e.g. too long for the network)
GET/posting-times/next
Where a new post would go
The next open posting time of each account, as POST /posts with postingTime next would use them. Nothing is saved.
پارامترها
accountsstring(query)الزامی
Comma-separated account ids.
unitsinteger(query)
Number of thread parts, on networks that take threads. Default 1.
پاسخها
200Next posting timesobject
401Not signed in, or the API key is wrong
404Not found
409Conflicts with the current state (e.g. account not connected)
Posts
POST/posts
Post now or schedule
Checks length and limits for every network before accepting. Each network’s result appears in targets. With postingTime next, accounts whose next open times differ get a post each: the others are in alsoCreated.
One item per post in a thread, on networks that take threads. Other networks get a single post.
networks("x" | "linkedin")[]
Defaults to your default networks (Settings).
accountsstring[]
Specific account ids, instead of networks.
scheduledAtstring (date-time)
ISO 8601 time. Omit to post now. e.g. 2026-11-21T09:00:00Z
postingTime"next" | string (date-time)
Put the post in your posting times: next for each account’s next open one (accounts whose next times differ get a post each), or one open posting time from GET /posting-times/open. e.g. next
overridesobject
A network’s own version of the post. LinkedIn takes a single part.
idempotencyKeystring
Sending the same key again returns the first post instead of posting twice.
پاسخها
200Already created with this idempotencyKeyPost + object
One item per post in a thread, on networks that take threads. Other networks get a single post.
networks("x" | "linkedin")[]
Defaults to your default networks (Settings).
accountsstring[]
Specific account ids, instead of networks.
scheduledAtstring (date-time)
ISO 8601 time. Omit to post now. e.g. 2026-11-21T09:00:00Z
postingTime"next" | string (date-time)
Put the post in your posting times: next for each account’s next open one (accounts whose next times differ get a post each), or one open posting time from GET /posting-times/open. e.g. next
overridesobject
A network’s own version of the post. LinkedIn takes a single part.
idempotencyKeystring
Sending the same key again returns the first post instead of posting twice.
PostingTime
timestringالزامی
Time of day, 24-hour, in your timezone. e.g. 09:00