BrainstormRouter is a personal research project by Justin Jilg. It is not a commercial product, has no SLA and is not intended for production use.

Publishing

Let an agent post to your social accounts through the vendor you connected, held for your approval by default, with every post recorded in the outcome ledger.

Publishing

Publishing lets an agent post to your social accounts through a publishing vendor you connect with your own account there. The first vendor is Ayrshare.

This feature is off unless the operator sets BR_PUBLISHING_ENABLED=1. With it off every endpoint below answers 404 with code publishing_disabled, and the MCP tools return the same error.

The Ayrshare adapter was written from Ayrshare's public documentation and has never been run against the real Ayrshare API. It is tested against stubbed responses only. Expect to find differences on the first real run; see What is unverified.

How it works

  1. You connect the vendor. You give BrainstormRouter your own Ayrshare API

key. It is checked against Ayrshare once, stored encrypted with the same key envelope as your provider keys, and never returned. BrainstormRouter has no Ayrshare key of its own: with nothing connected, posting answers not_connected.

  1. An agent asks to publish. One platform, the text, optional media and an

optional schedule time.

  1. You decide. By default (publish_approval = required) the post is held

and nothing is sent. It appears with your other pending approvals in the dashboard. You approve it, edit and approve it, or reject it.

  1. It is recorded. The post is an action in the outcome ledger.

Your decision becomes approved, edited or rejected on that action; going live becomes published; comments reported by the vendor become comment.

Who can do what

ActionWho
List accounts, request a post, read status, withdrawAny key with tool.execute (OAuth scope tools)
Connect or disconnect the vendorA key with config.write (admin or operator), or the dashboard
Approve or reject a postA tenant owner or admin signed in to the dashboard. No key.
Change publish_approvalA tenant owner or admin signed in to the dashboard. No key.
Delete a post that is already liveUnder required: the dashboard owner or admin. Under auto: any key with tool.execute

No API key can approve a post or switch approval off, whatever its role. The existing approval endpoints (POST /v1/approvals/{id}/approve, the br_approve_request tool) answer 403 owner_decision_required for a post, and there is no /v1 endpoint for the setting. No OAuth scope gained a permission for this feature.

Endpoints

StepRESTMCP toolSDK
Connected accountsGET /v1/publishing/accountsbr_publish_accountsclient.publishing.accounts
Publish / schedulePOST /v1/publishing/postsbr_publish_postclient.publishing.publish
One post's statusGET /v1/publishing/posts/{id}br_publish_statusclient.publishing.get
List postsGET /v1/publishing/postsbr_publish_listclient.publishing.list
Withdraw / cancelDELETE /v1/publishing/posts/{id}br_publish_cancelclient.publishing.cancel
Connection stateGET /v1/publishing/connection—client.publishing.connection
ConnectPUT /v1/publishing/connection—client.publishing.connect
DisconnectDELETE /v1/publishing/connection/{vendor}—client.publishing.disconnect
Vendor webhookPOST /v1/inbound/{vendor}/{tenantHookId}——

The owner's side is on the dashboard API (signed-in session, owner or admin): GET /auth/publishing, PUT /auth/publishing/settings, PUT /auth/publishing/connection, DELETE /auth/publishing/connection/{vendor}, POST /auth/publishing/posts/{id}/approve, .../reject, .../delete. The dashboard's existing approvals list (/auth/approvals/*) also shows held posts, with the full text and media URLs in the summary line, and its Approve and Reject buttons decide them. There is no dedicated publishing screen in the dashboard yet: connecting a vendor, changing the setting and editing a post before approving are API calls for now.

Connect

curl -X PUT https://api.brainstormrouter.com/v1/publishing/connection \
  -H "Authorization: Bearer $BR_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "vendor": "ayrshare", "api_key": "YOUR-AYRSHARE-API-KEY" }'
{
  "connection": {
    "vendor": "ayrshare",
    "connected": true,
    "key_preview": "…9XQ2",
    "has_profile_key": false
  },
  "accounts": [{ "platform": "linkedin", "display_name": "Acme", "username": "acme" }],
  "inbound": {
    "url": "https://api.brainstormrouter.com/v1/inbound/ayrshare/<hook id>",
    "secret": "<signing secret>",
    "note": "Shown once. …"
  }
}

profile_key is optional, for Ayrshare accounts with more than one User Profile. The inbound block is shown once; see Inbound events. Connecting again replaces the key, the hook URL and the secret.

Publish

curl -X POST https://api.brainstormrouter.com/v1/publishing/posts \
  -H "Authorization: Bearer $BR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "linkedin",
    "text": "We rebuilt onboarding. Setup now takes four minutes.",
    "idempotency_key": "launch-post-1",
    "request_ids": ["req_0193…"],
    "campaign": "q4-launch"
  }'
FieldNotes
platformOne platform from GET /v1/publishing/accounts. One post goes to one platform.
textUp to 3,000 characters.
media_urlsUp to 10 public https:// URLs.
schedule_atISO-8601 UTC, at least a minute ahead. Omit to publish now.
idempotency_keyRequired. The same key returns the same post and never sends twice.
request_idsBrainstormRouter request ids that wrote the post; the model is looked up from your usage records.
campaign, task_typeLabels carried into the outcome ledger.

Responses:

  • 202 with held_for_approval: true and approval_id: the post is

waiting for the owner. Nothing has been sent. Poll the post's status.

  • 201 (only under publish_approval = auto): sent. post.status is

published, scheduled or submitted.

  • 200 with replayed: true: this idempotency key was seen before.

A held post that nobody decides expires after 72 hours, unsent.

Post statuses

StatusMeaning
pending_approvalWaiting for the owner. Nothing sent.
rejectedThe owner said no. Nothing sent.
expiredNobody decided in 72 hours. Nothing sent.
cancelledWithdrawn before it went out.
sendingClaimed for sending; the vendor call is in flight.
submittedThe vendor accepted it and has not reported a final state.
scheduledThe vendor holds it for a future time.
publishedThe vendor reports it is live; post_url is set when known.
failedThe vendor refused it or reported a failure; see error.
deletedIt was live and was removed through the vendor.

A post is handed to the vendor once. If the send fails it becomes failed; it is not retried, and repeating the request with the same key does not resend it. Use a new idempotency_key to try again. A post left in sending (the process stopped mid-call) is not resent automatically either.

Approve, edit, reject

In the dashboard, held posts are listed with the other pending approvals. Approving sends the post. Over the dashboard API:

# Approve, changing the text first
curl -X POST https://api.brainstormrouter.com/auth/publishing/posts/$POST_ID/approve \
  -H "Authorization: Bearer $DASHBOARD_SESSION_JWT" \
  -H "Content-Type: application/json" \
  -d '{ "text": "We rebuilt onboarding. Setup takes four minutes." }'

schedule_at can be changed in the same call; null means publish as soon as it is approved. If the scheduled time has already passed, approval is refused with schedule_time_passed until you pick one of those.

To let agents publish without waiting:

curl -X PUT https://api.brainstormrouter.com/auth/publishing/settings \
  -H "Authorization: Bearer $DASHBOARD_SESSION_JWT" \
  -H "Content-Type: application/json" \
  -d '{ "publish_approval": "auto" }'

What reaches the outcome ledger

What happenedOutcome eventChanges routing?
Owner approved as writtenapprovedYes, reward 1.0
Owner edited, then approvededited (ratio) + approvedYes, reward 1 − edit ratio
Owner rejectedrejectedYes, reward 0.0
Vendor reports the post livepublishedNo
Vendor reports a comment on the postcommentNo
Withdrawn, expired, failed—No
Sent under autopublished onlyNo: nobody judged the copy

The edit ratio is the character edit distance between the requested text and the approved text, divided by the longer length. Rewards are applied by the outcome ledger, once per post and model, only when request_ids resolve to your usage records. post.outcome_action_id is the action; you can report more against it (replies, meetings, revenue) with POST /v1/outcomes/actions/{actionId}/events.

Inbound events

Register the inbound.url from the connect response at Ayrshare as a webhook (POST /hook/webhook, or their dashboard), with inbound.secret as its secret. Useful actions: scheduled, comments.

The receiver:

  • has no API key; it is authenticated by the unguessable hook id in the URL

and the vendor's X-Authorization-Content-SHA256 signature (HMAC-SHA256 of the body with your secret), compared in constant time;

  • accepts bodies up to 64 KB, is rate limited per IP and per hook, and ignores

an event it has already stored (it answers 200 again);

  • for a post BrainstormRouter published: marks a scheduled post published or

failed, and counts comments in the outcome ledger;

  • stores and ignores everything else (direct messages, account events, events

about posts it did not publish). It keeps the event kind, platform and ids. It does not keep message or comment text, and no endpoint returns inbound content to an agent;

  • never calls a model and never triggers an outbound action.

What is unverified

From Ayrshare's documentation as read on 2026-11-10; none of it has been exercised against the live service:

  • Whether the webhook signature is hex or base64 (both are accepted), and

whether it covers exactly the raw body. If Ayrshare signs anything else, every delivery is answered 401 and inbound events are lost. Publishing is unaffected, and status still updates when you read a scheduled post.

  • Whether every webhook carries an event id. When one does not, the event is

de-duplicated on a hash of its body.

  • The response to a delete that only partly succeeds. Ayrshare documents that

Instagram and TikTok posts cannot be deleted through its API.

  • Rate limits. A 429 from the vendor is reported as vendor_rate_limited

and nothing is retried.

Posting to X is not offered: since 2026-03-31 Ayrshare requires your own X developer app credentials on each request, which this adapter does not send.

Not built yet

  • A publishing screen in the dashboard (held posts do appear in the existing

approvals page).

  • Posting one request to several platforms.
  • Reading inbound comments or messages back.
  • Editing a post after it is scheduled or live.
  • A second vendor.