Social API Contract
Purpose
Use this reference when the skill needs exact production route names, auth headers, attach-media payloads, rewrite payloads, or the apply-plan JSON shape.
This reference assumes zero repo access.
- Use the deployed API only.
- Use the bundled
scripts/manage_social_campaign.pyhelper for automation. - Do not depend on local Prompthon source files, local package scripts, or repo-relative assets.
Production Base URL
Default production origin:
text
https://agents.prompthon.ioAll social-manager routes are organization-scoped:
text
/api/organizations/:orgId/social/:pathExamples:
/api/organizations/<orgId>/social/channels/api/organizations/<orgId>/social/campaigns/api/organizations/<orgId>/social/posts/api/organizations/<orgId>/social/media/search
Auth Modes
Protected production API token
Header:
text
x-prompthon-local-bridge-token: <token>Production bootstrap flow:
- Open the signed-in Social Media Manager page in Local mode.
- Prefer requesting a short handoff code through the browser-side handoff event so the signed-in page can resolve it in the background.
- Fallback: use the short handoff code visible in the page header when the event path is unavailable.
- Exchange the code:
POST /api/agents/local-bridge/exchange - Use returned
access_tokeninx-prompthon-local-bridge-token.
Important boundary:
- Do not call
GET /api/agents/local-bridge/handoff/activeorPOST /api/agents/local-bridge/handoffdirectly from the terminal. - Those are authenticated page-owned routes. The signed-in browser page must call them and then return the resolved short code through the browser event contract.
Example handoff exchange body:
json
{
"code": "TLLMJW",
"bridgeOrigin": "http://127.0.0.1:4319"
}Local testing bypass
This remains available for non-production testing only. It is not the default for this skill.
Header:
text
x-prompthon-local-auth-bypass: 1Optional browser cookie for Clerk-reading client surfaces:
text
prompthon_local_auth_bypass=1Route Map
Read routes
GET channelsGET campaignsGET postsGET posts/:postIdGET account-settings/summaryGET calendarGET analytics/summary
Campaign routes
POST campaignsPATCH campaigns/:campaignIdDELETE campaigns/:campaignId
Media routes
POST media/searchPOST posts/:postId/media
Post routes
POST postsPATCH posts/:postIdDELETE posts/:postIdPOST posts/:postId/variantsPOST posts/:postId/ai-rewritePOST posts/:postId/publishPOST posts/:postId/schedule
Schedule routes
POST schedules/processPOST schedules/:scheduleId/executePATCH schedules/:scheduleIdDELETE schedules/:scheduleId
Media Search Payload
Example:
json
{
"query": "new energy control room ai visualization",
"limit": 12,
"perProvider": 6,
"orientation": "landscape",
"providers": ["unsplash", "pexels"]
}Attach-Media Payload
Use this route for post media instead of trying to seed only settings.media during draft creation.
Accepted input patterns:
querywith provider search- explicit
mediaUrls - explicit
candidates generatedMedia
Example with search:
json
{
"query": "solar battery digital twin",
"providers": ["unsplash", "pexels"],
"maxImages": 1,
"replaceExisting": true,
"altText": "AI model monitoring a solar battery network"
}Example with explicit remote URL:
json
{
"mediaUrls": [
"https://images.example.com/solar-grid.jpg"
],
"replaceExisting": true
}Example with generated image payload:
json
{
"generatedMedia": {
"title": "Generated social image",
"contentType": "image/png",