Guides
Publish to several accounts
Send one post to many accounts across platforms, use groups as shortcuts without duplicates, and fit every platform’s rules.
One POST /v1/posts can target up to 50 accounts on any mix of platforms. Each account gets its own delivery, published independently.
1. Choose the accounts
- List your accounts with
GET /v1/accountsand keep the ones withconnectionStatus: "ACTIVE". - To use groups, list them with
GET /v1/account-groups. Each group has amembersarray of accounts. - Combine everything into one list of ids and remove duplicates. An account in two of your groups must appear once: a repeated id is rejected with
400.
2. Fit every platform’s rules
Flenvio checks the post against the rules of every platform you target before accepting it, and rejects the whole request if any of them is broken. The tightest rule wins. For example:
- Threads allows 500 characters of text, so a post that includes a Threads account must be 500 characters or fewer.
- Instagram, YouTube and TikTok need media; Facebook and Threads also accept text only.
- YouTube takes exactly one video, so a post to YouTube can’t be a photo or a carousel.
- A post to TikTok needs
tiktokOptions.privacyLevel.
The full list is in Platform rules and limits. If your content doesn’t suit every platform, send separate posts.
3. Send the post
curl -X POST "https://api.flenvio.com/v1/posts" \
-H "x-api-key: $FLENVIO_API_KEY" \
-H 'Idempotency-Key: 6a1f9d52-0000-4000-8000-000000000001' \
-H 'Content-Type: application/json' \
-d '{
"accountIds": [
"acc1a000-0000-4000-8000-000000000001",
"acc1a000-0000-4000-8000-000000000002",
"acc1a000-0000-4000-8000-000000000005"
],
"caption": "New single origin from Huila just landed. Bright, juicy, a little floral.",
"mediaUrls": [
"https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg"
]
}'{
"postId": "b0570000-0000-4000-8000-000000000001",
"status": "queued"
}If a rule is broken, nothing is created and the response lists every problem, each starting with the platform name:
{
"message": "Instagram: add at least one image or video. Threads: the text can be at most 500 characters (this one has 742).",
"error": "Bad Request",
"statusCode": 400
}Complete example: groups plus one more account
const BASE_URL = 'https://api.flenvio.com';
const headers = { 'x-api-key': process.env.FLENVIO_API_KEY };
async function get(path) {
const res = await fetch(BASE_URL + path, { headers });
if (!res.ok) throw new Error(`${res.status} on ${path}`);
return res.json();
}
const [accounts, groups] = await Promise.all([get('/v1/accounts'), get('/v1/account-groups')]);
// Every member of the chosen groups, plus any single accounts you want.
const chosenGroups = groups.filter((g) => ['Lumen Coffee', 'Short-form'].includes(g.name));
const ids = new Set([
...chosenGroups.flatMap((g) => g.members.map((m) => m.id)),
'acc1a000-0000-4000-8000-000000000005',
]);
// Skip accounts that need reconnecting: a post that includes one is refused (409).
const active = new Set(accounts.filter((a) => a.connectionStatus === 'ACTIVE').map((a) => a.id));
const accountIds = [...ids].filter((id) => active.has(id)); // a Set never repeats an id
const res = await fetch(`${BASE_URL}/v1/posts`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json', 'Idempotency-Key': crypto.randomUUID() },
body: JSON.stringify({
accountIds,
caption: 'New single origin from Huila just landed. Bright, juicy, a little floral.',
mediaUrls: ['https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg'],
}),
});
console.log(res.status, await res.json());Posting to TikTok
TikTok requires you to choose who can see each post. Fetch the account’s options with GET /v1/tiktok/accounts/{accountId}/creator-info and pass one of its privacyLevelOptions as tiktokOptions.privacyLevel:
curl -X POST "https://api.flenvio.com/v1/posts" \
-H "x-api-key: $FLENVIO_API_KEY" \
-H 'Idempotency-Key: 6a1f9d52-0000-4000-8000-000000000002' \
-H 'Content-Type: application/json' \
-d '{
"accountIds": [
"acc1a000-0000-4000-8000-000000000003",
"acc1a000-0000-4000-8000-000000000001"
],
"caption": "Pour-over in 60 seconds",
"mediaUrls": [
"https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000003.mp4"
],
"tiktokOptions": {
"privacyLevel": "PUBLIC_TO_EVERYONE",
"disableComment": false,
"disableDuet": true,
"disableStitch": true
}
}'tiktokOptions only applies to TikTok accounts; other platforms ignore it. If the chosen audience isn’t offered by that TikTok account, its delivery fails with a message saying which audiences it offers.