تتيح REST API لسكربتاتك وتطبيقاتك أن تفعل ما تفعله أنت في لوحة التحكم: النشر الآن، والجدولة، ورفع الصور، والتحقق مما نُشر. تعمل بـ JSON عبر HTTPS وتستخدم مفتاح API واحدًا.
احصل على مفتاح API
سجّل الدخول وافتح الإعدادات ← مفاتيح API في لوحة التحكم.
أعطِ المفتاح اسمًا، مثل «سكربت الإصدار»، ثم أنشئه.
انسخ المفتاح فورًا. يبدأ بـ smcp_ ولا يظهر إلا مرة واحدة.
احفظ المفتاح سرًا مثل كلمة المرور: أي شخص يملكه يستطيع النشر على حساباتك. خزّنه في متغير بيئة أو في أسرار CI، ولا تضعه أبدًا في الكود. إذا تسرّب مفتاح، فاحذفه من المكان نفسه وأنشئ مفتاحًا جديدًا.
اربط حساباتك (X وLinkedIn) من لوحة التحكم أولًا. تنشر API على الحسابات التي ربطتها.
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: أرسل parts بدلًا من text، عنصرًا لكل منشور في السلسلة. يحصل 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 حدودك وما استخدمته منها.
كل نقاط النهاية التي يمكنك استدعاؤها بمفتاح API، مولّدة من API نفسها. أسماء نقاط النهاية والحقول وأوصافها باللغة الإنجليزية.
الرابط الأساسي: 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