Workflows
Most integrations are one of these sequences. Projects and connected social accounts are set up once in the app; the API does the repeating part.
01A URL to scheduled posts
Pick a project, generate (0.6 credits per platform), poll, schedule (free).
- Pick a projectGET /projects
- Generate the postsPOST /social/generate
- Poll the jobGET /social/content/{id}
- Schedule the postsPOST /social/publish
const BASE = 'https://www.brainpercent.app/api/v1';
const headers = {
Authorization: `Bearer ${process.env.BP_KEY}`,
'Content-Type': 'application/json',
};
const call = (path, init) => fetch(BASE + path, { headers, ...init }).then((r) => r.json());
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
export async function urlToScheduledPosts(url, platforms, whenIso) {
const { data: projects } = await call('/projects?limit=1');
if (!projects.length) throw new Error('Create a project in the app first');
const job = await call('/social/generate', {
method: 'POST',
body: JSON.stringify({ source_url: url, platforms, project_id: projects[0].id }),
});
if (!job.success) throw new Error(`${job.error.code}: ${job.error.message}`);
let item;
do {
await sleep(10_000);
item = (await call(`/social/content/${job.data.content_id}`)).data;
} while (item.status === 'generating' || item.status === 'queued');
if (item.status === 'failed') throw new Error(item.error_message || 'generation failed');
return call('/social/publish', {
method: 'POST',
body: JSON.stringify({ content_id: item.id, scheduled_at: whenIso }),
});
}02A weekly article
POST /articles/generate with a topic and project (1.5 credits), then poll /articles/{id}/status until is_complete. Read the finished article with GET /articles/{id}. To put it on your website, publish it in the app; if the site is connected as a webhook or site feed, it receives the article (see Webhooks). Once it is live, send its address to /social/generate to promote it.
- Your codeGenerate and poll1.5 credits. Wait for is_complete.
- You, in the appPublish the articleThe API has no publish route.
- Your websiteReceives itIf it is connected as a webhook or site feed.
- Your codePromote itSend its address to /social/generate.
03From Claude
With the MCP connector, the same sequence is a conversation: research a keyword, write posts from it, check them, schedule them. See Use Brainpercent from Claude.