API documentation
One API for Facebook Pages, Instagram, Threads and TikTok. Base URL https://social.hubsz.com
1. Authentication
Create an API key on the Developer page. Send it on every request:
Authorization: Bearer sh_xxxxxxxx
To act for one of your end-users, add X-Profile-Id: prof_xxx (or your own ref). Without it you act on your own accounts.
2. Profiles & connecting accounts
POST https://social.hubsz.com/v1/profiles {"ref":"user_123","name":"Kedai Ali"}
GET https://social.hubsz.com/v1/profiles
DELETE https://social.hubsz.com/v1/profiles/{id} (deletes all its accounts and data)
GET https://social.hubsz.com/v1/connect/tiktok?profile_id=user_123&return_to=https://yourapp.com/done
→ {"url":"https://www.tiktok.com/v2/auth/authorize/?..."} redirect your user there
After authorizing, the user returns to return_to?status=connected&platform=tiktok&profile_id=prof_…&accounts=1 (or status=error&error=…). return_to origins must be allowed on the Developer page.
3. Posting
GET https://social.hubsz.com/v1/accounts (X-Profile-Id: user_123)
POST https://social.hubsz.com/v1/posts
{
"account_ids": ["acc_..."],
"text": "Hello!",
"media": [{"url": "https://.../video.mp4"}],
"schedule_at": "2026-11-01T21:00:00+08:00",
"options": {
"instagram": {"type": "reel"},
"tiktok": {"mode": "direct", "privacy_level": "PUBLIC_TO_EVERYONE",
"allow_comment": true, "allow_duet": false, "allow_stitch": false,
"commercial": false, "is_aigc": false}
}
}
GET https://social.hubsz.com/v1/posts/{id}
TikTok compliance (required): before posting to TikTok, your UI must call tiktok_creator_info, show the creator's nickname/avatar, let the user pick privacy from privacy_level_options with no default, keep comment/duet/stitch off by default, offer commercial-content disclosure (Your brand / Branded content), and show TikTok's Music Usage Confirmation. Direct posts without a user-chosen privacy_level are rejected — use "mode":"draft" to send to the user's TikTok inbox instead.
4. Any tool via REST
POST https://social.hubsz.com/api/tools/{tool_name} body = tool arguments (JSON)
GET https://social.hubsz.com/api/tools list of tools with JSON schemas5. Webhooks
Set your URL on the Developer page. We send POST JSON {"id","type","created_at","data"} with header X-SocialHub-Signature: sha256=HMAC_SHA256(secret, raw_body).
Events: post.published, post.failed, account.connected, account.reauth_required, message.received, comment.received.
6. MCP (AI agents)
https://social.hubsz.com/mcp + Authorization: Bearer sh_… [+ X-Profile-Id]
https://social.hubsz.com/mcp/{key} for clients that cannot send headers
https://social.hubsz.com/mcp/{key}/{profile}Every tool below is exposed. agent_run gives a natural-language task to the AI agent team; each specialist agent can only use the tools of its own permission area.
7. Errors & limits
401 bad key · 402 plan limit reached · 403 missing platform permission or not allowed · 404 not found · 429 rate limit · 502 platform error. Body: {"error":"message"}.
| Free | Starter Most popular | Pro | Business | |
|---|---|---|---|---|
| Price | RM0 | RM49 / month | RM199 / month | Contact us |
| Posts / month | 30 | 1,500 | 10,000 | 100,000 |
| Profiles (end-users) | 3 | 50 | 500 | 10,000 |
| Connected accounts | 5 | 100 | 1,000 | 20,000 |
| AI agent runs / month | 20 | 300 | 2,000 | 20,000 |
| API requests / minute | 30 | 120 | 300 | 1,000 |
Tools
Developer (owner only)
create_profile write | Create a profile (sub-tenant) for one end-user of your SaaS. Accounts, posts and events are isolated per profile.ref Your own user id for this end-user (unique) · name Display name |
list_profiles | List your profiles (end-users) with how many accounts each has connected.limit Default 100 |
delete_profile write | Delete a profile and ALL its connected accounts, tokens, posts and events.profile_id* Profile id or your ref |
get_connect_url | Create a hosted connect link. Send your end-user to this URL; after they authorize they return to return_to with ?status=connected&platform=..&profile_id=..platform* facebook | instagram | threads | tiktok · profile_id Profile id or ref (omit for your own accounts) · return_to Full URL on an allowed origin |
get_usage | Your plan, limits and usage for this month. |
Accounts
list_accounts | List connected social accounts (id, platform, name, granted scopes, status).platform Optional filter: facebook | instagram | threads | tiktok | meta_ads | tiktok_ads, or "social" / "ads" |
get_profile | Get live profile details of a connected account (bio, followers, verification).account_id* Connected account id (from list_accounts)Scopes: facebook: pages_show_list · instagram: instagram_business_basic · threads: threads_basic · tiktok: user.info.basic |
resync_pages write | Re-sync the Facebook Pages (incl. Business Manager pages) available to a connected Facebook account.account_id* Any connected Facebook Page account idScopes: facebook: pages_show_list / business_management |
disconnect_account write | Disconnect an account and delete its stored tokens and events.account_id* Connected account id (from list_accounts) |
tiktok_creator_info | TikTok creator info required before posting: nickname, avatar, allowed privacy levels, disabled interactions, max video duration.account_id* Connected account id (from list_accounts)Scopes: tiktok: video.publish / video.upload |
Publishing
upload_media_from_url write | Copy an image/video from any URL (e.g. Google Flow output) into storage and return a public URL usable for posting.url* Source media URL |
publish_post write | Publish or schedule a post to one or more accounts. Media must be public URLs. TikTok direct posts REQUIRE options.tiktok.privacy_level chosen by the user (see tiktok_creator_info).account_ids* Account ids to post to · text Caption / post text · media Images or videos · schedule_at Optional ISO datetime to schedule, e.g. 2026-11-01T09:00:00+08:00 · options objectScopes: facebook: pages_manage_posts · instagram: instagram_business_content_publish · threads: threads_content_publish · tiktok: video.publish / video.upload |
get_post | Get status/URL of a post created through this service.post_id* Post id |
list_posts | List posts created through this service (newest first).status scheduled | processing | published | failed | cancelled · limit Max rows, default 30 |
cancel_post write | Cancel a scheduled post that has not been published yet.post_id* Post id |
threads_location_search | Search Threads locations to tag in a post (returns location ids).account_id* Connected account id (from list_accounts) · q* Place nameScopes: threads: threads_location_tagging |
Comments
list_recent_content | List recent posts/videos of an account (ids are used for comments & insights).account_id* Connected account id (from list_accounts) · limit Default 10Scopes: facebook: pages_read_engagement · instagram: instagram_business_basic · threads: threads_basic · tiktok: video.list |
list_comments | List comments/replies on a post.account_id* Connected account id (from list_accounts) · content_id* Post / media idScopes: facebook: pages_read_engagement / pages_read_user_content · instagram: instagram_business_manage_comments · threads: threads_read_replies |
reply_comment write | Reply publicly to a comment or reply.account_id* Connected account id (from list_accounts) · comment_id* Comment/reply id · text* Reply textScopes: facebook: pages_manage_engagement · instagram: instagram_business_manage_comments · threads: threads_manage_replies |
hide_comment write | Hide or unhide a comment/reply.account_id* Connected account id (from list_accounts) · comment_id* Comment id · hide true to hide, false to unhideScopes: facebook: pages_manage_engagement · instagram: instagram_business_manage_comments · threads: threads_manage_replies |
delete_comment write | Delete a comment on your own post.account_id* Connected account id (from list_accounts) · comment_id* Comment idScopes: facebook: pages_manage_engagement · instagram: instagram_business_manage_comments |
delete_post write | Delete one of your own posts.account_id* Connected account id (from list_accounts) · content_id* Post idScopes: facebook: pages_manage_posts · threads: threads_delete |
Inbox & webhooks
list_conversations | List recent DM conversations (Facebook Messenger / Instagram Direct).account_id* Connected account id (from list_accounts)Scopes: facebook: pages_messaging · instagram: instagram_business_manage_messages |
get_conversation | Read messages of one conversation.account_id* Connected account id (from list_accounts) · conversation_id* Conversation idScopes: facebook: pages_messaging · instagram: instagram_business_manage_messages |
send_dm write | Send a direct message reply to a user who messaged the account (within the 24h messaging window).account_id* Connected account id (from list_accounts) · recipient_id* Sender id (PSID / IGSID) from the conversation · text* Message textScopes: facebook: pages_messaging · instagram: instagram_business_manage_messages |
subscribe_webhooks write | Subscribe the account to real-time webhooks (new DMs, new comments) so agents can auto-reply.account_id* Connected account id (from list_accounts)Scopes: facebook: pages_manage_metadata · instagram: instagram_business_manage_messages / instagram_business_manage_comments |
list_events | List incoming webhook events (DMs and comments) and what the agents did with them.account_id Optional account filter · limit Default 30 |
set_auto_reply write | Set AI auto-reply mode for an account: off, draft (AI writes reply, human approves), auto (AI replies). Optional rules/instructions.account_id* Connected account id (from list_accounts) · mode* off | draft | auto · rules Instructions for the agents, e.g. tone, FAQ, prices |
Analytics
account_insights | Account-level analytics for the last N days (views, reach, engagement, followers).account_id* Connected account id (from list_accounts) · days Default 7, max 30 · metrics Optional comma list to override default metricsScopes: facebook: read_insights · instagram: instagram_business_manage_insights · threads: threads_manage_insights · tiktok: user.info.stats |
content_insights | Analytics for a single post / video.account_id* Connected account id (from list_accounts) · content_id* Post / media / video id · metrics Optional comma listScopes: facebook: read_insights · instagram: instagram_business_manage_insights · threads: threads_manage_insights · tiktok: video.list |
Discovery
threads_keyword_search | Search public Threads posts by keyword or #topic (trend & lead research).account_id* Connected account id (from list_accounts) · q* Keyword · search_type TOP | RECENT · limit Default 15Scopes: threads: threads_keyword_search |
threads_profile_lookup | Look up a public Threads profile (followers, bio, stats).account_id* Connected account id (from list_accounts) · username* Threads username without @Scopes: threads: threads_profile_discovery |
threads_profile_posts | Read recent public posts of a Threads profile.account_id* Connected account id (from list_accounts) · username* Threads username · limit Default 10Scopes: threads: threads_profile_discovery |
page_visitor_posts | Read posts that visitors/customers published on your Facebook Page.account_id* Connected account id (from list_accounts)Scopes: facebook: pages_read_user_content |
Ads (Meta and TikTok)
ads_overview | Ad account summary for a period: total spend, impressions, clicks, results, and every campaign with its status, daily budget and performance.account_id* Ad account id (Meta Ads or TikTok Ads) · date_preset today | yesterday | last_7d | last_30d | this_monthScopes: meta_ads: ads_read · tiktok_ads: |
ads_list | List campaigns, ad sets (TikTok: ad groups) or ads, optionally inside a parent campaign/ad set.account_id* Ad account id · level* campaign | adset | ad · parent_id Optional parent campaign / ad set idScopes: meta_ads: ads_read · tiktok_ads: |
ads_insights | Performance rows (spend, impressions, clicks, CTR, CPC, CPM, results, cost per result) by account, campaign, ad set or ad.account_id* Ad account id · level account | campaign | adset | ad · date_preset today | yesterday | last_7d | last_30d | this_month · object_id Optional: only this campaign/ad set/adScopes: meta_ads: ads_read · tiktok_ads: |
ads_search_targeting | Meta: search interests or locations to target (returns ids to use in ads_create_campaign).account_id* Meta ad account id · type interest | city | region · q* Search text, e.g. kopi, Kuala LumpurScopes: meta_ads: ads_read |
ads_pause write | Pause a campaign, ad set or ad immediately (always allowed — it only stops spend).account_id* Ad account id · object_id* Campaign / ad set / ad id · level campaign | adset | adScopes: meta_ads: ads_management · tiktok_ads: |
ads_enable write | Turn a paused campaign, ad set or ad back on. Checked against spend limits; AI requests need human approval unless the account is in auto mode.account_id* Ad account id · object_id* Campaign / ad set / ad id · level campaign | adset | adScopes: meta_ads: ads_management · tiktok_ads: |
ads_set_budget write | Change the daily budget (in account currency, e.g. 25 = RM25/day) of a campaign or ad set. Lowering is immediate; raising is checked against limits and needs approval for AI.account_id* Ad account id · object_id* Campaign / ad set id · level campaign | adset · daily_budget* New daily budget in account currencyScopes: meta_ads: ads_management · tiktok_ads: |
ads_create_campaign write | Create an ad. Meta: boosts an existing Facebook post or Instagram post, or makes a link ad, with campaign + ad set + ad in one step. TikTok: creates a paused campaign shell. Checked against limits; AI requests need human approval unless auto mode.account_id* Ad account id · name* Campaign name · objective engagement | traffic | awareness (TikTok also: video_views) · daily_budget* Daily budget in account currency · duration_days How many days to run (1-90, default 7) · start_time Optional ISO start time · activate Start delivering right away (default true) · targeting object · source objectScopes: meta_ads: ads_management · tiktok_ads: |
ads_get_guard | Read the AI mode, daily/monthly spend limits and auto-pause rules of an ad account.account_id* Ad account id |
ads_set_guard write | Set AI mode (report | suggest | auto), hard daily and monthly spend limits, and auto-pause rules. Human only. Auto mode requires both limits.account_id* Ad account id · mode report | suggest | auto · daily_cap Max total active daily budget (account currency) · monthly_cap Max spend per calendar month · rules Auto-pause rules |
ads_list_proposals | Actions waiting for human approval (and past decisions).status pending | executed | rejected | failed · limit Default 30 |
ads_approve_proposal write | Approve and execute a pending ads proposal. Human only. Spend limits still apply.proposal_id* Proposal id |
ads_reject_proposal write | Reject a pending ads proposal. Human only.proposal_id* Proposal id · reason Optional reason |
ads_log | Audit log of every ads change (who, what, when), including automatic pauses.account_id Optional ad account id · limit Default 40 |
ads_list_pages | Meta: Facebook Pages (and linked Instagram accounts) available to this ad connection.account_id* Meta ad account idScopes: meta_ads: pages_show_list |
ads_list_lead_forms | Meta: lead forms of a Facebook Page with lead counts.account_id* Meta ad account id · page_id* Facebook Page idScopes: meta_ads: leads_retrieval |
ads_get_leads | Meta: leads submitted to a lead form (name, phone, email and other answers).account_id* Meta ad account id · page_id* Facebook Page id · form_id* Lead form id · limit Default 50Scopes: meta_ads: leads_retrieval |
ads_subscribe_leads write | Meta: receive new leads in real time for a Page (webhook lead.received).account_id* Meta ad account id · page_id* Facebook Page idScopes: meta_ads: leads_retrieval |
AI agents
agent_run write | Give a natural-language task to the AI agent team (e.g. "post this video to all accounts tonight 9pm", "reply to new comments politely", "weekly performance report"). agent=auto lets the Orchestrator delegate.task* What to do · agent auto | account | publisher | community | inbox | analyst | scout · execute false = draft mode (no write actions executed) · account_id Optional: use this account's reply rules |
list_agents | List AI agents, their tools and the platform permission scopes each one uses. |
list_agent_runs | History of agent runs.limit Default 20 |