# Flenvio API documentation (full text) > Flenvio publishes and schedules posts to Facebook Pages, Instagram, Threads, YouTube and TikTok from one composer. Its HTTP API lets your own code and AI agents list connected accounts, upload media, publish or schedule one post to many accounts, follow each account’s delivery, retry failures, manage groups and work with comments and direct messages, using an API key. API base URL: https://api.flenvio.com Authentication: send your API key in the `x-api-key` header on every request. Safety rule for agents: ask the human before publishing, scheduling, rescheduling, canceling, retrying, replying, messaging, hiding, deleting or disconnecting anything. --- # Flenvio API > Publish and schedule to Facebook, Instagram, Threads, YouTube and TikTok from your own code, automations and AI agents, with an API key. Source: http://flenvio.com/docs The Flenvio API does from code what you do in the dashboard: see your connected accounts, upload images and videos, publish or schedule one post to many accounts at once, follow what happened on each account, and retry the ones that failed. It also lets you manage groups and read your comments inbox. > **Early access:** The API is in early access. Endpoints and response fields may change; we’ll note changes in the [changelog](http://flenvio.com/docs/changelog). ## Who it’s for - **Your own tools.** A script that posts every new blog article, a spreadsheet of scheduled posts, an internal content calendar. - **Automations.** Cron jobs, CI pipelines, no-code tools that can make HTTP requests. - **AI agents.** Claude Code, Cursor, ChatGPT and other agents can draft and schedule posts for you, with your confirmation. See [For AI agents](http://flenvio.com/docs/ai-agents). ## What you can do | Task | Endpoints | | --- | --- | | List connected accounts | `GET /v1/accounts` | | Upload images and videos | `POST /v1/media/uploads` → upload → `POST /v1/media/uploads/{id}/complete` | | Publish now or schedule | `POST /v1/posts` | | Follow each account’s delivery | `GET /v1/posts/{id}`, `GET /v1/posts` | | Retry a failed delivery | `POST /v1/posts/jobs/{deliveryId}/retry` | | Reschedule, cancel, archive | `POST /v1/posts/{id}/reschedule`, `/cancel`, `/archive` | | Manage groups | `GET`, `POST`, `PATCH`, `DELETE /v1/account-groups` | | Read and answer comments | `GET /v1/comments` and the per-platform comment endpoints | | Read and send direct messages | Instagram and Facebook conversation endpoints | ## What the API can’t do (yet) Some things only work in the dashboard, and a few don’t exist anywhere yet: - **Connect or reconnect accounts.** Connecting goes through each platform’s sign-in, which needs a person in a browser. Do it in the dashboard under Accounts. - **Create, list or revoke API keys.** Only in the dashboard, under [Settings → Developer](http://flenvio.com/dashboard/settings/developer). - **Edit or delete a post.** A post’s text, media and accounts are fixed once created, and nothing is deleted from the platforms. A scheduled post can be rescheduled or canceled; to change it, cancel it and create a new one. - **Drafts.** There are no saved drafts on the server. - **Retry a whole post in one call.** Retry each failed delivery on its own. - **Per-platform options** other than TikTok’s (for example a YouTube title, privacy or playlist). YouTube videos are published as public, titled from the first line of the text. - **Search posts by text, or filter by scheduled time.** The posts list filters by account, group, platform, status and creation date. - **TikTok comments, and direct messages on Threads, YouTube and TikTok.** The platforms don’t offer them to Flenvio. - **Webhooks.** Flenvio doesn’t call your server when a delivery finishes; check the post’s status instead. - **Account, profile and workspace management.** No profile, team or billing endpoints. ## Start here - [Quickstart](http://flenvio.com/docs/quickstart): Create a key, list your accounts and publish your first post in five minutes. - [Authentication](http://flenvio.com/docs/authentication): How API keys work, how to keep them safe and what they can’t do. - [For AI agents](http://flenvio.com/docs/ai-agents): Give an agent access safely, with a ready-made setup prompt. - [API reference](http://flenvio.com/docs/reference): Every endpoint with parameters, examples, errors and limits. --- # Quickstart > Create an API key, list your connected accounts and publish your first post, with copy-paste examples in curl, JavaScript and Python. Source: http://flenvio.com/docs/quickstart You need a Flenvio account with at least one connected account. A Facebook Page or Threads profile is easiest for a first test because they accept text-only posts; Instagram, YouTube and TikTok need an image or video (see [Upload media](http://flenvio.com/docs/guides/upload-media)). ## 1. Create an API key 1. In the dashboard, open [Settings → Developer](http://flenvio.com/dashboard/settings/developer). 2. Under **API keys**, enter a name you’ll recognize later (for example “Blog autoposter”), keep **Full access** (this guide publishes a post), pick an expiry and select **Create key**. 3. Copy the key now. It starts with `flv_` and is shown only once. Keep the key out of your code. The examples below read it from the `FLENVIO_API_KEY` environment variable: ```bash export FLENVIO_API_KEY="flv_…your key…" ``` > **Note:** The JavaScript examples use `fetch` and top-level `await`: run them with Node.js 18 or later as an ES module (a `.mjs` file). The Python examples need `pip install requests`. ## 2. List your accounts Every request sends the key in the `x-api-key` header. Start by listing the accounts you can publish to: curl: ```bash curl "https://api.flenvio.com/v1/accounts" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/accounts', { headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.get( "https://api.flenvio.com/v1/accounts", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Response (`200`): ```json [ { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee", "avatarUrl": "https://media.flenvio.example/avatars/lumen-ig.png", "platformAccountId": "17841400000000001", "createdAt": "2026-09-02T14:05:11.000Z", "connectionStatus": "ACTIVE" }, { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters", "avatarUrl": "https://media.flenvio.example/avatars/lumen-fb.png", "platformAccountId": "100000000000001", "createdAt": "2026-09-02T14:03:40.000Z", "connectionStatus": "ACTIVE" } ] ``` Note the `id` of the account you want to post to. Only use accounts whose `connectionStatus` is `ACTIVE`: an account marked `REAUTH_REQUIRED` needs to be reconnected in the dashboard first, and posts to it are refused with `409` (`code: "account_reconnect_required"`). ## 3. Publish a post Send the text and the account ids. Add an `Idempotency-Key` header with a unique value: if your request times out and you send it again with the same key, Flenvio returns the first post instead of publishing twice. curl: ```bash curl -X POST "https://api.flenvio.com/v1/posts" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Idempotency-Key: quickstart-2026-10-12-001' \ -H 'Content-Type: application/json' \ -d '{ "accountIds": [ "acc1a000-0000-4000-8000-000000000002" ], "caption": "New single origin from Huila just landed. Bright, juicy, a little floral." }' ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, 'Idempotency-Key': 'quickstart-2026-10-12-001', 'Content-Type': 'application/json', }, body: JSON.stringify({ accountIds: ['acc1a000-0000-4000-8000-000000000002'], caption: 'New single origin from Huila just landed. Bright, juicy, a little floral.', }), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts", headers={ "x-api-key": os.environ["FLENVIO_API_KEY"], "Idempotency-Key": "quickstart-2026-10-12-001", }, json={ "accountIds": ["acc1a000-0000-4000-8000-000000000002"], "caption": "New single origin from Huila just landed. Bright, juicy, a little floral.", }, ) res.raise_for_status() print(res.json()) ``` Response (`201`): ```json { "postId": "b0570000-0000-4000-8000-000000000001", "status": "queued" } ``` `queued` means Flenvio accepted the post and is publishing it now. Nothing was rejected: if the text or media broke a platform’s rules you’d get a `400` with the reason instead. ## 4. Check that it published Each account gets its own delivery. Fetch the post to see how each one went: curl: ```bash curl "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001', { headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.get( "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Response (`200`): ```json { "id": "b0570000-0000-4000-8000-000000000001", "caption": "New single origin from Huila just landed. Bright, juicy, a little floral.", "mediaUrl": null, "mediaUrls": [], "scheduledAt": null, "createdAt": "2026-10-12T09:30:00.512Z", "logs": [ { "id": "de11e000-0000-4000-8000-000000000001", "status": "COMPLETED", "errorMessage": null, "platformPostId": "18000000000000001", "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:04.211Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ], "mediaPreviews": [] } ``` A delivery with `status: "COMPLETED"` is live, and `platformPostId` is the post’s id on the platform. Most posts finish within seconds; videos can take a few minutes. If a delivery shows `FAILED`, `errorMessage` says why. See [Delivery status and retries](http://flenvio.com/docs/guides/delivery-status-and-retry). ## Next steps - [Upload media](http://flenvio.com/docs/guides/upload-media): Images, videos and carousels for Instagram, YouTube and TikTok. - [Publish to several accounts](http://flenvio.com/docs/guides/publish-to-several-accounts): Use groups, skip duplicates and fit every platform’s rules. - [Schedule and cancel](http://flenvio.com/docs/guides/schedule-and-cancel): Publish later, move the time, or call it off. - [For AI agents](http://flenvio.com/docs/ai-agents): Hand this to an agent with a ready-made prompt. --- # Authentication > Authenticate with an API key in the x-api-key header. How keys are scoped, how to revoke them, how to keep them secret and what they can’t do. Source: http://flenvio.com/docs/authentication The Flenvio API uses API keys. Send yours in the `x-api-key` header on every request: curl: ```bash curl "https://api.flenvio.com/v1/accounts" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/accounts', { headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.get( "https://api.flenvio.com/v1/accounts", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Keys look like `flv_` followed by 64 hexadecimal characters. Requests without a valid key get `401 Unauthorized`. ## Create a key Create keys in the dashboard under [Settings → Developer → API keys](http://flenvio.com/dashboard/settings/developer). Give each key a name and choose when it expires: in 30 days, 90 days, 1 year, or never. The key is shown once; Flenvio stores only a hash of it, so a lost key can’t be recovered. Create a new one instead. - You can have up to 10 active keys. - Choose its access: **Full access** or **Read only** (see below). - The key list shows each key’s access, when it was created, when it was last used (updated at most about once a minute) and when it expires. - Use one key per tool or agent, so you can revoke one without breaking the others. ## What a key can access Each key has one of two scopes, chosen when you create it (`scope` in the key list). Neither is limited to some accounts: a key covers your whole Flenvio account, so treat every key like your password. | Scope | Dashboard label | What it can do | | --- | --- | --- | | `full` | Full access | Everything the API allows: read your accounts, groups, posts and comments, publish and schedule, cancel and retry, change groups, upload media, reply to and moderate comments, send direct messages, and disconnect accounts. Keys created before scopes existed have full access. | | `read_only` | Read only | Only `GET` requests: list and read accounts, groups, posts, deliveries, comments and messages, and TikTok creator info. Any other request answers `403` with `code: "api_key_read_only"`, and nothing is changed. Good for dashboards, reporting and agents that only need to look. | A read-only key trying to publish (`403`): ```json { "statusCode": 403, "error": "Forbidden", "code": "api_key_read_only", "message": "This API key is read-only. Use a key with full access to make changes." } ``` ## What a key can’t do These actions need you, signed in to the dashboard. With an API key they answer `401 Unauthorized`: - Create, list or revoke API keys. - Connect or reconnect accounts (each platform’s sign-in needs a browser). - Delete your Flenvio account, or sign out your dashboard sessions. ## Revoke a key In [Settings → Developer](http://flenvio.com/dashboard/settings/developer), select **Revoke** next to the key. It stops working immediately: the next request with it gets `401` with the message `Invalid API key`. Expired keys behave the same way. Revoking can’t be undone; create a new key if you need access again. > **Important:** “Sign out everywhere” in Settings → Security signs out every dashboard session. API keys keep working unless you also tick **Also revoke all API keys** in its confirmation, which revokes every key at once. Tick it if someone else may have used your account: anyone signed in could have created a key. ## Keep your key secret - Call the API from a server, script or agent you control. Never put a key in a website’s JavaScript, a mobile app or anything you ship to other people. - Store it in an environment variable or a secret manager, not in source code. Don’t commit it to Git or paste it into issues, chats or screenshots. - Give automations and agents their own key with an expiry, and revoke it when the job is done. - If a key may have leaked, revoke it right away and create a new one. ## Authentication errors | Response | Meaning | | --- | --- | | `401` `{"message":"Invalid API key"}` | The key is wrong, revoked or expired, or your Flenvio account is being deleted. | | `401` `{"message":"Unauthorized"}` | No `x-api-key` header was sent, or the endpoint needs a dashboard session (see above). | | `403` `{"code":"api_key_read_only"}` | The key is read-only and the request would change something. Use a full-access key. | --- # Core concepts > Accounts and platforms, groups, posts and deliveries, statuses, scheduling and idempotency in the Flenvio API. Source: http://flenvio.com/docs/concepts ## Accounts and platforms An **account** is one place you publish to: a Facebook Page, an Instagram professional account, a Threads profile, a YouTube channel or a TikTok account. Each has an `id` (use it everywhere in the API), a `platform` (`FACEBOOK`, `INSTAGRAM`, `THREADS`, `YOUTUBE` or `TIKTOK`) and a `connectionStatus`: | connectionStatus | Meaning | | --- | --- | | `ACTIVE` | Ready to publish. | | `REAUTH_REQUIRED` | The platform stopped accepting Flenvio’s access (for example the password changed or access expired). Reconnect it in the dashboard. Until then, a post that targets it is refused with `409` and `code: "account_reconnect_required"` (nothing is created; `accountIds` in the error lists the accounts to reconnect), so skip these accounts. Deliveries scheduled before the account lapsed stay scheduled: if it’s reconnected in time they publish normally, otherwise they end `FAILED` with an error message asking you to reconnect, and can be retried once it is. | Disconnected accounts don’t appear in the API at all. Accounts are connected in the dashboard, never through the API. ## Groups Groups are shortcuts for selecting several accounts at once, for example “Client: Lumen Coffee” or “Short-form video”. An account can be in many groups. Two groups can’t share a name, or contain exactly the same set of accounts. A post doesn’t take a group directly: `POST /v1/posts` takes `accountIds`. To post to a group, read its `members`, combine them with any other groups or accounts you want, and remove duplicates so each account appears once (a repeated id is counted once, never published twice). That’s how an account that’s in two of your groups still receives the post once. The group you used isn’t recorded on the post. See [Publish to several accounts](http://flenvio.com/docs/guides/publish-to-several-accounts). ## Posts and deliveries A **post** is what you create: the text (`caption`), optional media and the accounts to publish to. Its content is fixed once created. Each target account gets its own **delivery**, listed in the post’s `logs` array. A delivery has its own `id` (the delivery id you retry with), `status`, `errorMessage` and `platformPostId`. One post to three accounts has three deliveries, and they can end differently: two published and one failed is normal. ## Delivery statuses | status | Dashboard label | Meaning | | --- | --- | --- | | `SCHEDULED` | Scheduled | Waiting for its `scheduledAt` time. | | `PENDING` | Queued | Accepted and waiting to start (also briefly when an account is posting a lot and Flenvio spaces its posts out). | | `PROCESSING` | Publishing | Being sent to the platform. With a `platformPostId` already set, the platform accepted it and is still processing (common for YouTube and TikTok videos). | | `COMPLETED` | Published | Live on the platform. `platformPostId` is its id there. If `remoteDeletedAt` is set, it was later deleted on the platform. | | `FAILED` | Failed | `errorMessage` says why. Flenvio retries automatically a few times first (see below), then you can retry it. | | `CANCELED` | Canceled | A scheduled delivery you canceled. Nothing was published. | There is no post-level status field. To summarize a post, look at its deliveries: all `COMPLETED` is published; some `COMPLETED` and some `FAILED` is partially published; any `SCHEDULED`, `PENDING` or `PROCESSING` means it isn’t finished. ### Automatic retries When a delivery fails, Flenvio tries again on its own, up to 3 attempts in total, waiting 5 seconds and then longer between them. Between attempts the delivery shows `FAILED`, so a failure can still turn into `PROCESSING` and `COMPLETED` within about a minute. After that, retry it yourself once you’ve fixed the cause. Flenvio refuses to retry a delivery the platform already received (`409`), because that could post it twice. ## Scheduling Add `scheduledAt` (an ISO 8601 timestamp, like `2026-10-20T16:00:00Z` or `2026-10-20T18:00:00+02:00`) to publish later. It must be in the future and at most 365 days ahead. Times less than 5 seconds away publish immediately. Flenvio stores and returns times in UTC; there is no account time zone setting, so always include `Z` or an offset. Scheduled posts can be rescheduled or canceled until they start publishing. See [Schedule and cancel](http://flenvio.com/docs/guides/schedule-and-cancel). ## Idempotency Networks fail. If you send `POST /v1/posts` and don’t get an answer, you can’t tell whether the post was created. Send an `Idempotency-Key` header with a value that’s unique to that post (a UUID works well). Sending the same key again returns the original post with `status: "duplicate"` instead of publishing a second time. - Keys are per Flenvio account and never expire. - The key is tied to the request body. Resending the same key with the same body returns the original post (the order of `accountIds` and repeated ids don’t count as differences). The same key with a different body is refused with `422` and `code: "idempotency_key_reused"`, and nothing is created. Use a **new** key for every new post, and the **same** key only when resending the same request. - Only `POST /v1/posts` takes an idempotency key. Other actions are safe to repeat or tell you when there’s nothing left to do. A repeated request (`201`): ```json { "postId": "b0570000-0000-4000-8000-000000000001", "status": "duplicate" } ``` ## Media Posts can only use files you uploaded to Flenvio: upload first, then put the returned `url` in `mediaUrls`. Links to files elsewhere on the web are rejected. See [Upload media](http://flenvio.com/docs/guides/upload-media). --- # Publish to several accounts > Send one post to many accounts across platforms, use groups as shortcuts without duplicates, and fit every platform’s rules. Source: http://flenvio.com/docs/guides/publish-to-several-accounts 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/accounts` and keep the ones with `connectionStatus: "ACTIVE"`. - To use groups, list them with `GET /v1/account-groups`. Each group has a `members` array 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](http://flenvio.com/docs/guides/platform-rules). If your content doesn’t suit every platform, send separate posts. ## 3. Send the post curl: ```bash 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" ] }' ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, 'Idempotency-Key': '6a1f9d52-0000-4000-8000-000000000001', 'Content-Type': 'application/json', }, body: JSON.stringify({ 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', ], }), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts", headers={ "x-api-key": os.environ["FLENVIO_API_KEY"], "Idempotency-Key": "6a1f9d52-0000-4000-8000-000000000001", }, json={ "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", ], }, ) res.raise_for_status() print(res.json()) ``` Response (`201`): ```json { "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: Response (`400`): ```json { "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 JavaScript: ```js 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()); ``` Python: ```python import os import uuid import requests BASE_URL = "https://api.flenvio.com" HEADERS = {"x-api-key": os.environ["FLENVIO_API_KEY"]} accounts = requests.get(f"{BASE_URL}/v1/accounts", headers=HEADERS).json() groups = requests.get(f"{BASE_URL}/v1/account-groups", headers=HEADERS).json() # Every member of the chosen groups, plus any single accounts you want. ids = {m["id"] for g in groups if g["name"] in ("Lumen Coffee", "Short-form") for m in g["members"]} ids.add("acc1a000-0000-4000-8000-000000000005") # Skip accounts that need reconnecting: a post that includes one is refused (409). active = {a["id"] for a in accounts if a["connectionStatus"] == "ACTIVE"} account_ids = sorted(ids & active) # a set never repeats an id res = requests.post( f"{BASE_URL}/v1/posts", headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())}, json={ "accountIds": account_ids, "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"], }, ) print(res.status_code, 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: ```bash 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 } }' ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, 'Idempotency-Key': '6a1f9d52-0000-4000-8000-000000000002', 'Content-Type': 'application/json', }, body: JSON.stringify({ 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, }, }), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts", headers={ "x-api-key": os.environ["FLENVIO_API_KEY"], "Idempotency-Key": "6a1f9d52-0000-4000-8000-000000000002", }, json={ "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, }, }, ) res.raise_for_status() print(res.json()) ``` `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. --- # Upload media > Upload images and videos with a direct upload URL, then attach them to posts as single media or carousels. Source: http://flenvio.com/docs/guides/upload-media Posts can only attach files you uploaded to Flenvio. Uploading has three steps: ask for an upload URL, send the file there, then ask Flenvio to check it. You get back a `url` to put in a post’s `mediaUrls`. | | Limit | | --- | --- | | File types | JPEG, PNG, GIF and WebP images; MP4 and MOV videos | | Image size | Up to 10 MB | | Video size | Up to 1 GB | | Uploads per day | 200 in any 24 hours | | Storage | 10 GB in total, including unfinished uploads | | Starting uploads | 30 per minute | ## 1. Ask for an upload URL Send the file’s type and exact size in bytes: curl: ```bash curl -X POST "https://api.flenvio.com/v1/media/uploads" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "contentType": "image/jpeg", "sizeBytes": 482113 }' ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/media/uploads', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ contentType: 'image/jpeg', sizeBytes: 482113, }), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/media/uploads", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, json={ "contentType": "image/jpeg", "sizeBytes": 482113, }, ) res.raise_for_status() print(res.json()) ``` Response (`201`): ```json { "assetId": "a55e7000-0000-4000-8000-000000000001", "uploadUrl": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost&X-Amz-Signature=…", "method": "PUT", "headers": { "Content-Type": "image/jpeg" } } ``` ## 2. Send the file `PUT` the raw bytes to `uploadUrl` with the `headers` from the response, and without your API key (the URL carries its own permission). The body must be exactly `sizeBytes` long. The URL works for one hour. ```bash curl -X PUT "$UPLOAD_URL" \ -H 'Content-Type: image/jpeg' \ --data-binary @photo.jpg ``` ## 3. Complete the upload Flenvio reads the stored file, checks that it really is the type and size you declared, and records its dimensions and duration. Only completed uploads can be attached to posts. curl: ```bash curl -X POST "https://api.flenvio.com/v1/media/uploads/a55e7000-0000-4000-8000-000000000001/complete" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/media/uploads/a55e7000-0000-4000-8000-000000000001/complete', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/media/uploads/a55e7000-0000-4000-8000-000000000001/complete", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Response (`200`): ```json { "id": "a55e7000-0000-4000-8000-000000000001", "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "key": "uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "meta": { "kind": "image", "width": 1080, "height": 1350, "format": "jpeg" } } ``` - Completing twice is safe: it returns the same result. - Completing before the file arrived returns `400` (`The file has not been uploaded yet.`); send the file, then try again. - A file that isn’t what you declared is deleted and returns `400`. Start over with the right type and size. - Uploads never completed are removed after 6 hours. Completed files that no post uses are removed after 48 hours, so upload shortly before you post. Files attached to a post are kept. ## All three steps JavaScript: ```js import { readFile } from 'node:fs/promises'; const BASE_URL = 'https://api.flenvio.com'; const API_KEY = process.env.FLENVIO_API_KEY; async function call(path, body) { const res = await fetch(BASE_URL + path, { method: 'POST', headers: body ? { 'x-api-key': API_KEY, 'Content-Type': 'application/json' } : { 'x-api-key': API_KEY }, body: body ? JSON.stringify(body) : undefined, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); return data; } export async function uploadFile(path, contentType) { const bytes = await readFile(path); // 1. Ask for an upload URL for this exact type and size. const upload = await call('/v1/media/uploads', { contentType, sizeBytes: bytes.length }); // 2. Send the bytes to that URL with exactly the returned headers. const put = await fetch(upload.uploadUrl, { method: upload.method, headers: upload.headers, body: bytes }); if (!put.ok) throw new Error(`Upload failed with ${put.status}`); // 3. Ask Flenvio to check the file. The result's url goes in a post. return call(`/v1/media/uploads/${upload.assetId}/complete`); } const photo = await uploadFile('photo.jpg', 'image/jpeg'); console.log(photo.url, photo.meta); ``` Python: ```python import os import requests BASE_URL = "https://api.flenvio.com" HEADERS = {"x-api-key": os.environ["FLENVIO_API_KEY"]} def upload_file(path, content_type): with open(path, "rb") as f: data = f.read() # 1. Ask for an upload URL for this exact type and size. r = requests.post( f"{BASE_URL}/v1/media/uploads", headers=HEADERS, json={"contentType": content_type, "sizeBytes": len(data)}, ) r.raise_for_status() upload = r.json() # 2. Send the bytes to that URL with exactly the returned headers. put = requests.put(upload["uploadUrl"], headers=upload["headers"], data=data) put.raise_for_status() # 3. Ask Flenvio to check the file. The result's url goes in a post. r = requests.post(f"{BASE_URL}/v1/media/uploads/{upload['assetId']}/complete", headers=HEADERS) r.raise_for_status() return r.json() photo = upload_file("photo.jpg", "image/jpeg") print(photo["url"], photo["meta"]) ``` curl: ```bash # Needs curl and jq. FILE=photo.jpg TYPE=image/jpeg SIZE=$(wc -c < "$FILE" | tr -d ' ') # 1. Ask for an upload URL for this exact type and size. UPLOAD=$(curl -s -X POST "https://api.flenvio.com/v1/media/uploads" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d "{\"contentType\":\"$TYPE\",\"sizeBytes\":$SIZE}") ASSET_ID=$(echo "$UPLOAD" | jq -r .assetId) UPLOAD_URL=$(echo "$UPLOAD" | jq -r .uploadUrl) # 2. Send the bytes to that URL. curl -s -X PUT "$UPLOAD_URL" -H "Content-Type: $TYPE" --data-binary @"$FILE" # 3. Ask Flenvio to check the file. The result's url goes in a post. curl -s -X POST "https://api.flenvio.com/v1/media/uploads/$ASSET_ID/complete" \ -H "x-api-key: $FLENVIO_API_KEY" ``` ## Small files in one request Files up to 10 MB can instead be sent as `multipart/form-data` in a single request. The type is detected from the file itself. It returns the same result as completing an upload. curl: ```bash curl -X POST "https://api.flenvio.com/v1/media/upload" \ -H "x-api-key: $FLENVIO_API_KEY" \ -F 'file=@photo.jpg;type=image/jpeg' ``` JavaScript: ```js import { readFile } from 'node:fs/promises'; const form = new FormData(); form.append('file', new Blob([await readFile('photo.jpg')], { type: 'image/jpeg' }), 'photo.jpg'); const res = await fetch('https://api.flenvio.com/v1/media/upload', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, body: form, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/media/upload", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, files={"file": ("photo.jpg", open("photo.jpg", "rb"), "image/jpeg")}, ) res.raise_for_status() print(res.json()) ``` ## Attach media to a post Put the `url` values in `mediaUrls`, in the order they should appear. One item is a single image or video; several make a carousel where the platform supports it. A two-image carousel: curl: ```bash curl -X POST "https://api.flenvio.com/v1/posts" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Idempotency-Key: 6a1f9d52-0000-4000-8000-000000000003' \ -H 'Content-Type: application/json' \ -d '{ "accountIds": [ "acc1a000-0000-4000-8000-000000000001" ], "caption": "Two roasts, side by side.", "mediaUrls": [ "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000002.jpg" ] }' ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, 'Idempotency-Key': '6a1f9d52-0000-4000-8000-000000000003', 'Content-Type': 'application/json', }, body: JSON.stringify({ accountIds: ['acc1a000-0000-4000-8000-000000000001'], caption: 'Two roasts, side by side.', mediaUrls: [ 'https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg', 'https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000002.jpg', ], }), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts", headers={ "x-api-key": os.environ["FLENVIO_API_KEY"], "Idempotency-Key": "6a1f9d52-0000-4000-8000-000000000003", }, json={ "accountIds": ["acc1a000-0000-4000-8000-000000000001"], "caption": "Two roasts, side by side.", "mediaUrls": [ "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000002.jpg", ], }, ) res.raise_for_status() print(res.json()) ``` - Instagram: up to 10 items; images and videos can be mixed. A single video is published as a Reel. - Threads: up to 20 items, mixed allowed. - Facebook: several items must all be images; a video goes on its own. - YouTube: exactly one video. - TikTok: one video, or up to 35 photos. > **Note:** The `url` you attach is a reference, not a public link: the files are private. Post responses include short-lived `mediaPreviews` links (valid for about 15 minutes) if you need to display them. ## Upload errors | Status | Message | What to do | | --- | --- | --- | | `400` | `Only JPEG, PNG, GIF, WebP, MP4 and MOV files can be uploaded.` | Convert the file to a supported type. | | `413` | `Images can be at most 10MB.` / `Videos can be at most 1024MB.` | Compress or shorten the file. | | `400` | `You've reached the limit of 200 uploads per day. Try again tomorrow.` | Wait, or reuse files you already uploaded. | | `400` | `This upload would exceed your media storage limit…` | Unused uploads are cleared after 48 hours. | | `400` | `This upload expired. Upload the file again.` | Start a new upload. | | `400` on `POST /v1/posts` | `One or more media items were not uploaded by you, or have not finished uploading.` | Use the `url` from a completed upload, unchanged. | | `429` | `ThrottlerException: Too Many Requests` | More than 30 uploads started in a minute; wait for `Retry-After` seconds. | --- # Schedule and cancel > Schedule a post for later, move it to another time, cancel it, and hide old posts from your list. Source: http://flenvio.com/docs/guides/schedule-and-cancel ## Schedule a post Add `scheduledAt` to `POST /v1/posts`. Use ISO 8601 with `Z` or an offset. It must be in the future and within 365 days. curl: ```bash curl -X POST "https://api.flenvio.com/v1/posts" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Idempotency-Key: 6a1f9d52-0000-4000-8000-000000000004' \ -H 'Content-Type: application/json' \ -d '{ "accountIds": [ "acc1a000-0000-4000-8000-000000000001", "acc1a000-0000-4000-8000-000000000002" ], "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" ], "scheduledAt": "2026-10-20T16:00:00Z" }' ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, 'Idempotency-Key': '6a1f9d52-0000-4000-8000-000000000004', 'Content-Type': 'application/json', }, body: JSON.stringify({ accountIds: [ 'acc1a000-0000-4000-8000-000000000001', 'acc1a000-0000-4000-8000-000000000002', ], 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', ], scheduledAt: '2026-10-20T16:00:00Z', }), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts", headers={ "x-api-key": os.environ["FLENVIO_API_KEY"], "Idempotency-Key": "6a1f9d52-0000-4000-8000-000000000004", }, json={ "accountIds": [ "acc1a000-0000-4000-8000-000000000001", "acc1a000-0000-4000-8000-000000000002", ], "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", ], "scheduledAt": "2026-10-20T16:00:00Z", }, ) res.raise_for_status() print(res.json()) ``` Response (`201`): ```json { "postId": "b0570000-0000-4000-8000-000000000001", "status": "scheduled" } ``` The post’s deliveries now show `SCHEDULED`. The platform rules, media and accounts are checked when you schedule, so a scheduled post isn’t rejected later for breaking them. A delivery can still fail when it publishes, for example if the account needs reconnecting by then or TikTok no longer offers the chosen audience. `GET /v1/posts/{id}` (`200`): ```json { "id": "b0570000-0000-4000-8000-000000000001", "caption": "New single origin from Huila just landed. Bright, juicy, a little floral.", "mediaUrl": null, "mediaUrls": [ "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg" ], "scheduledAt": "2026-10-20T16:00:00.000Z", "createdAt": "2026-10-12T09:30:00.512Z", "logs": [ { "id": "de11e000-0000-4000-8000-000000000001", "status": "SCHEDULED", "errorMessage": null, "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:00.514Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee" } }, { "id": "de11e000-0000-4000-8000-000000000002", "status": "SCHEDULED", "errorMessage": null, "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:00.514Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ], "mediaPreviews": [ { "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=…", "kind": "image" } ] } ``` ## Move it to another time curl: ```bash curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/reschedule" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "scheduledAt": "2026-10-21T08:30:00Z" }' ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/reschedule', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ scheduledAt: '2026-10-21T08:30:00Z', }), }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/reschedule", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, json={ "scheduledAt": "2026-10-21T08:30:00Z", }, ) res.raise_for_status() print(res.json()) ``` Response (`200`): ```json { "rescheduled": 2, "scheduledAt": "2026-10-21T08:30:00.000Z" } ``` Only deliveries still `SCHEDULED` move; `rescheduled` says how many. If none are left (they already published, or the post was canceled) you get `400` `This post has no scheduled deliveries left to reschedule.` ## Cancel it curl: ```bash curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/cancel" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/cancel', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/cancel", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Response (`200`): ```json { "canceled": 2, "alreadyPublishing": 0 } ``` - `canceled`: deliveries that were scheduled and now won’t publish (`CANCELED`). - `alreadyPublishing`: deliveries that had already started and can’t be stopped. They’ll finish as usual. - Calling it again returns `400` `This post has no scheduled deliveries left to cancel.` - Canceling is final. To publish the same content later, create a new post. ## Change the text or media Posts can’t be edited. Cancel the scheduled post and create a new one with the changes (and a new idempotency key). ## Hide old posts from your list Archiving hides a post from `GET /v1/posts` (and from Posts in the dashboard). Nothing is deleted from the platforms, and the post is still available by id. A post with scheduled deliveries must be canceled first. curl: ```bash curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/archive" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/archive', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/archive", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Response (`201`): ```json { "archived": true } ``` Archiving a scheduled post (`409`): ```json { "message": "This post is still scheduled. Cancel it first; archiving only hides posts from the list.", "error": "Conflict", "statusCode": 409 } ``` --- # Delivery status and retries > Follow each account’s delivery until it finishes, find failed deliveries and retry them safely. Source: http://flenvio.com/docs/guides/delivery-status-and-retry Publishing happens in the background. `POST /v1/posts` answers as soon as the post is accepted; then each account’s delivery moves through `PENDING` → `PROCESSING` → `COMPLETED` or `FAILED` (scheduled ones start at `SCHEDULED`). Flenvio doesn’t call you back, so check the post. ## Check a post curl: ```bash curl "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001', { headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.get( "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Response (`200`): ```json { "id": "b0570000-0000-4000-8000-000000000001", "caption": "New single origin from Huila just landed. Bright, juicy, a little floral.", "mediaUrl": null, "mediaUrls": [ "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg" ], "scheduledAt": null, "createdAt": "2026-10-12T09:30:00.512Z", "logs": [ { "id": "de11e000-0000-4000-8000-000000000001", "status": "COMPLETED", "errorMessage": null, "platformPostId": "18000000000000001", "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:04.211Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee" } }, { "id": "de11e000-0000-4000-8000-000000000002", "status": "FAILED", "errorMessage": "Meta Graph error (400): (#324) Requires upload file", "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:21.870Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ], "mediaPreviews": [ { "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=…", "kind": "image" } ] } ``` | Field | Meaning | | --- | --- | | `logs[].id` | The delivery id. Use it to retry. | | `logs[].status` | `SCHEDULED`, `PENDING`, `PROCESSING`, `COMPLETED`, `FAILED` or `CANCELED`. See [Core concepts](http://flenvio.com/docs/concepts#statuses). | | `logs[].errorMessage` | Why it failed, usually the platform’s own message. `null` otherwise. | | `logs[].platformPostId` | The post’s id on the platform once it accepted it. | | `logs[].remoteDeletedAt` | Set when the platform reports the post was deleted there. | | `logs[].connectedAccount` | Which account this delivery is for (`id`, `platform`, `accountName`). | ## Wait until it finishes Poll with a growing delay. Most deliveries finish within seconds; YouTube and TikTok videos can stay `PROCESSING` for several minutes while the platform processes them. Don’t wait on `SCHEDULED` deliveries; check them after their time. JavaScript: ```js const BASE_URL = 'https://api.flenvio.com'; const headers = { 'x-api-key': process.env.FLENVIO_API_KEY }; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); // Unfinished: queued or publishing, or failed less than a minute ago // (Flenvio may still be retrying it automatically). function unfinished(d) { if (d.status === 'PENDING' || d.status === 'PROCESSING') return true; return d.status === 'FAILED' && Date.now() - Date.parse(d.updatedAt) < 60_000; } export async function waitForPost(postId, timeoutMs = 10 * 60_000) { const started = Date.now(); let delay = 2_000; for (;;) { const res = await fetch(`${BASE_URL}/v1/posts/${postId}`, { headers }); if (!res.ok) throw new Error(`${res.status}`); const post = await res.json(); if (!post.logs.some(unfinished) || Date.now() - started > timeoutMs) return post; await sleep(delay); delay = Math.min(delay * 2, 30_000); } } const post = await waitForPost('b0570000-0000-4000-8000-000000000001'); for (const d of post.logs) { console.log(d.connectedAccount.platform, d.connectedAccount.accountName, d.status, d.errorMessage ?? ''); } ``` Python: ```python import os import time from datetime import datetime, timezone import requests BASE_URL = "https://api.flenvio.com" HEADERS = {"x-api-key": os.environ["FLENVIO_API_KEY"]} def unfinished(d): """Queued or publishing, or failed less than a minute ago (may still be retried automatically).""" if d["status"] in ("PENDING", "PROCESSING"): return True if d["status"] == "FAILED": updated = datetime.fromisoformat(d["updatedAt"].replace("Z", "+00:00")) return (datetime.now(timezone.utc) - updated).total_seconds() < 60 return False def wait_for_post(post_id, timeout=600): started, delay = time.monotonic(), 2 while True: r = requests.get(f"{BASE_URL}/v1/posts/{post_id}", headers=HEADERS) r.raise_for_status() post = r.json() if not any(unfinished(d) for d in post["logs"]) or time.monotonic() - started > timeout: return post time.sleep(delay) delay = min(delay * 2, 30) post = wait_for_post("b0570000-0000-4000-8000-000000000001") for d in post["logs"]: print(d["connectedAccount"]["platform"], d["connectedAccount"]["accountName"], d["status"], d["errorMessage"] or "") ``` ## Find failed deliveries `statuses=FAILED` returns posts that have at least one failed delivery (their other deliveries are included too). Combine it with `platforms`, `accountIds`, `groupId`, `dateFrom` and `dateTo`. curl: ```bash curl "https://api.flenvio.com/v1/posts?statuses=FAILED&limit=20" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts?statuses=FAILED&limit=20', { headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.get( "https://api.flenvio.com/v1/posts", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, params={ "statuses": "FAILED", "limit": "20", }, ) res.raise_for_status() print(res.json()) ``` ## Retry a failed delivery Flenvio already retries each delivery automatically (3 attempts in total). When a delivery is still `FAILED` after that, fix the cause first, then retry that one delivery: curl: ```bash curl -X POST "https://api.flenvio.com/v1/posts/jobs/de11e000-0000-4000-8000-000000000002/retry" \ -H "x-api-key: $FLENVIO_API_KEY" ``` JavaScript: ```js const res = await fetch('https://api.flenvio.com/v1/posts/jobs/de11e000-0000-4000-8000-000000000002/retry', { method: 'POST', headers: { 'x-api-key': process.env.FLENVIO_API_KEY, }, }); const data = await res.json(); if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(data.message)}`); console.log(data); ``` Python: ```python import os import requests res = requests.post( "https://api.flenvio.com/v1/posts/jobs/de11e000-0000-4000-8000-000000000002/retry", headers={"x-api-key": os.environ["FLENVIO_API_KEY"]}, ) res.raise_for_status() print(res.json()) ``` Response (`201`): ```json { "id": "de11e000-0000-4000-8000-000000000002", "status": "PENDING", "errorMessage": null, "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:41:02.118Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ``` - Only `FAILED` deliveries can be retried; anything else returns `400` `Only FAILED jobs can be retried.` - If the platform already received the post (`platformPostId` is set), retrying returns `409`, because it would likely publish twice. Check the post on the platform instead. - Retry publishes exactly the original text, media and TikTok options. - There’s no “retry whole post”: retry each failed delivery. ## Common causes | What you see | What to do | | --- | --- | | An access or token error, and the account now shows `REAUTH_REQUIRED` | Reconnect the account in the dashboard, then retry. | | The platform rejected the media (aspect ratio, duration, format) | Each platform has rules Flenvio doesn’t check in advance. Create a new post with suitable media. | | Rate or quota limits (for example YouTube `quotaExceeded`) | Retry later. | | A timeout or network error | Retry. | > **Note:** A `PROCESSING` delivery that already has a `platformPostId` was accepted by the platform and is waiting for it to finish. If the platform never confirms within a day, Flenvio marks it `FAILED` with an explanation; check the post on the platform before doing anything else. A post with one published and one failed delivery (`200`): ```json { "id": "b0570000-0000-4000-8000-000000000001", "caption": "New single origin from Huila just landed. Bright, juicy, a little floral.", "mediaUrl": null, "mediaUrls": [ "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg" ], "scheduledAt": null, "createdAt": "2026-10-12T09:30:00.512Z", "logs": [ { "id": "de11e000-0000-4000-8000-000000000001", "status": "COMPLETED", "errorMessage": null, "platformPostId": "18000000000000001", "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:04.211Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee" } }, { "id": "de11e000-0000-4000-8000-000000000002", "status": "FAILED", "errorMessage": "Meta Graph error (400): (#324) Requires upload file", "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:21.870Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ], "mediaPreviews": [ { "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=…", "kind": "image" } ] } ``` --- # Platform rules and limits > Text length, media counts and types, sizes and video rules for Facebook, Instagram, Threads, YouTube and TikTok, generated from the rules the API enforces. Source: http://flenvio.com/docs/guides/platform-rules Before accepting a post, Flenvio checks it against the rules of every platform it targets, using the size, dimensions and duration it read from your uploaded files. Breaking any of them returns `400` with one message per problem, each starting with the platform’s name. The tables below are generated from the same rules the API runs. ## By platform | Platform | Text | Media | | --- | --- | --- | | **Facebook** | Up to 2,200 characters | Optional. Up to 20 images or videos. | | **Instagram** | Up to 2,200 characters | **Required.** 1 to 10 images or videos (several make a carousel). | | **Threads** | Up to 500 characters | Optional. Up to 20 images or videos (several make a carousel). | | **YouTube** | Up to 2,200 characters | **Required.** Exactly one video. | | **TikTok** | Up to 2,200 characters | **Required.** One video, or 1 to 35 photos (not both). | Every post needs text (at least one character, at most 2,200), and can carry at most 20 media items. Characters are counted the way people see them: an emoji counts once. ## More rules per platform ### Facebook - A post with several items can contain images only; post a video on its own. ### Instagram - At most 30 hashtags. - At most 20 @mentions. ### YouTube - The text becomes the video title (first line, cut to 100 characters) and description. - The description can be at most 5,000 bytes (UTF-8). - The text can’t contain < or >. ### TikTok - `tiktokOptions.privacyLevel` is required (who can view the post). - A paid partnership (`brandContentToggle`) can’t be visible to “Only you” (`SELF_ONLY`). - Videos must be 360–4,096 px on each side. - Photos can be at most 1,080 px on each side. ## Upload limits (all platforms) | | Limit | | --- | --- | | File types | `image/jpeg`, `image/png`, `image/gif`, `image/webp`, `video/mp4`, `video/quicktime` | | Images | Up to 10 MB each | | Videos | Up to 1 GB each | | Uploads | 200 per 24 hours; 10 GB stored in total | ## Checked by the platforms, not in advance Some limits are enforced by the platforms themselves when Flenvio publishes, so a post can be accepted and its delivery can still fail. Flenvio doesn’t check these in advance: - Aspect ratios and minimum resolutions (for example Instagram’s supported image shapes). - Video duration limits, except TikTok’s per-account maximum, which is checked right before publishing. - Which image formats each platform accepts (for example TikTok and Instagram may refuse PNG, GIF or WebP even though Flenvio accepts the upload). - Daily posting limits and quotas on the platform side (for example YouTube’s upload quota). When that happens the delivery shows `FAILED` with the platform’s message. Flenvio also spaces out posts to the same account (at most 10 a minute); extra ones wait as `PENDING` rather than fail. --- # API reference > Base URL, conventions and every Flenvio API endpoint you can call with an API key. Source: http://flenvio.com/docs/reference ## Base URL ```text https://api.flenvio.com ``` All paths start with `/v1`. Send your key in the `x-api-key` header ([Authentication](http://flenvio.com/docs/authentication)). ## Conventions - Request and response bodies are JSON (`Content-Type: application/json`), except file uploads. - Ids are UUID strings. Timestamps are ISO 8601 in UTC (`2026-10-12T09:30:00.000Z`). - Unknown body fields are rejected with `400`. - Lists that can grow large (`GET /v1/posts`, `GET /v1/comments`) return `{ items, nextCursor }`. Pass `nextCursor` back as `cursor` for the next page; `null` means there are no more. Other lists return a plain array. - Array query parameters are comma-separated: `?platforms=INSTAGRAM,TIKTOK`. - Errors are JSON with `statusCode` and `message`. See [Errors and rate limits](http://flenvio.com/docs/errors). ## Endpoints | Method | Path | Auth | | --- | --- | --- | | `GET` | [`/v1/accounts`](http://flenvio.com/docs/reference/accounts#list-accounts) | API key | | `DELETE` | [`/v1/accounts/{id}`](http://flenvio.com/docs/reference/accounts#disconnect-account) | API key | | `GET` | [`/v1/account-groups`](http://flenvio.com/docs/reference/groups#list-groups) | API key | | `POST` | [`/v1/account-groups`](http://flenvio.com/docs/reference/groups#create-group) | API key | | `PATCH` | [`/v1/account-groups/{id}`](http://flenvio.com/docs/reference/groups#update-group) | API key | | `DELETE` | [`/v1/account-groups/{id}`](http://flenvio.com/docs/reference/groups#delete-group) | API key | | `POST` | [`/v1/posts`](http://flenvio.com/docs/reference/posts#create-post) | API key | | `GET` | [`/v1/posts`](http://flenvio.com/docs/reference/posts#list-posts) | API key | | `GET` | [`/v1/posts/{id}`](http://flenvio.com/docs/reference/posts#get-post) | API key | | `POST` | [`/v1/posts/jobs/{deliveryId}/retry`](http://flenvio.com/docs/reference/posts#retry-delivery) | API key | | `POST` | [`/v1/posts/{id}/reschedule`](http://flenvio.com/docs/reference/posts#reschedule-post) | API key | | `POST` | [`/v1/posts/{id}/cancel`](http://flenvio.com/docs/reference/posts#cancel-post) | API key | | `POST` | [`/v1/posts/{id}/archive`](http://flenvio.com/docs/reference/posts#archive-post) | API key | | `POST` | [`/v1/media/uploads`](http://flenvio.com/docs/reference/media#create-upload) | API key | | `POST` | [`/v1/media/uploads/{id}/complete`](http://flenvio.com/docs/reference/media#complete-upload) | API key | | `POST` | [`/v1/media/upload`](http://flenvio.com/docs/reference/media#upload-small) | API key | | `GET` | [`/v1/comments`](http://flenvio.com/docs/reference/comments#list-comments) | API key | | `GET` | [`/v1/{platform}/accounts/{accountId}/comments`](http://flenvio.com/docs/reference/comments#list-account-comments) | API key | | `POST` | [`/v1/{platform}/comments/{commentId}/replies`](http://flenvio.com/docs/reference/comments#reply-comment) | API key | | `POST` | [`/v1/{platform}/comments/{commentId}/hide · /unhide`](http://flenvio.com/docs/reference/comments#hide-comment) | API key | | `DELETE` | [`/v1/{platform}/comments/{commentId}`](http://flenvio.com/docs/reference/comments#delete-comment) | API key | | `GET` | [`/v1/inbox/conversations`](http://flenvio.com/docs/reference/comments#list-inbox) | API key | | `GET` | [`/v1/inbox/unread`](http://flenvio.com/docs/reference/comments#inbox-unread) | API key | | `POST` | [`/v1/inbox/conversations/{conversationId}/read`](http://flenvio.com/docs/reference/comments#mark-read) | API key | | `GET` | [`/v1/{instagram\|facebook}/accounts/{accountId}/conversations`](http://flenvio.com/docs/reference/comments#list-conversations) | API key | | `GET` | [`/v1/{instagram\|facebook}/conversations/{conversationId}/messages`](http://flenvio.com/docs/reference/comments#list-messages) | API key | | `POST` | [`/v1/{instagram\|facebook}/conversations/{conversationId}/messages`](http://flenvio.com/docs/reference/comments#send-message) | API key | | `GET` | [`/v1/tiktok/accounts/{accountId}/creator-info`](http://flenvio.com/docs/reference/tiktok#creator-info) | API key | ## Dashboard-only endpoints The API also serves the Flenvio dashboard. These endpoints exist but reject API keys (`401`), so they aren’t documented here: sign-in and sign-out, creating and revoking API keys (`/v1/auth/api-keys`), connecting accounts (`/v1/auth/{platform}/start` and its callbacks), and deleting your Flenvio account (`DELETE /v1/account`). --- # Accounts > List the accounts you can publish to and disconnect accounts. Connecting accounts happens in the dashboard. Source: http://flenvio.com/docs/reference/accounts Accounts are connected in the dashboard (each platform’s sign-in needs a browser). The API lists them and can disconnect them. ### List accounts `GET /v1/accounts` The accounts you can publish to, newest first. Disconnected accounts are left out. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute Each item has `id`, `platform` (`FACEBOOK`, `INSTAGRAM`, `THREADS`, `YOUTUBE`, `TIKTOK`), `accountName`, `avatarUrl` (may be `null`), `platformAccountId` (the platform’s own id), `createdAt` and `connectionStatus` (`ACTIVE` or `REAUTH_REQUIRED`). Not paginated. Example request: ```bash curl "https://api.flenvio.com/v1/accounts" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json [ { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee", "avatarUrl": "https://media.flenvio.example/avatars/lumen-ig.png", "platformAccountId": "17841400000000001", "createdAt": "2026-09-02T14:05:11.000Z", "connectionStatus": "ACTIVE" }, { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters", "avatarUrl": "https://media.flenvio.example/avatars/lumen-fb.png", "platformAccountId": "100000000000001", "createdAt": "2026-09-02T14:03:40.000Z", "connectionStatus": "ACTIVE" }, { "id": "acc1a000-0000-4000-8000-000000000003", "platform": "TIKTOK", "accountName": "lumencoffee", "avatarUrl": null, "platformAccountId": "-000AbCdEfExample", "createdAt": "2026-09-01T09:12:00.000Z", "connectionStatus": "REAUTH_REQUIRED" } ] ``` | Status | When | | --- | --- | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Disconnect an account `DELETE /v1/accounts/{id}` Disconnects an account from Flenvio: its access is revoked where the platform allows it, and comments and messages synced from it are deleted. Your post history is kept. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute > **Caution:** Reconnecting needs a person to sign in to the platform again in the dashboard. Scheduled deliveries to this account will fail. Agents should never call this without explicit confirmation. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string | yes | Account id. | Example request: ```bash curl -X DELETE "https://api.flenvio.com/v1/accounts/acc1a000-0000-4000-8000-000000000003" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "id": "acc1a000-0000-4000-8000-000000000003", "status": "disconnected" } ``` | Status | When | | --- | --- | | 404 | `Account not found.`: not one of your accounts. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | --- # Groups > List, create, update and delete groups: named shortcuts for selecting several accounts at once. Source: http://flenvio.com/docs/reference/groups Groups are shortcuts for selecting several accounts. Posts don’t take a group: expand it into `accountIds` yourself and remove duplicates (see [Publish to several accounts](http://flenvio.com/docs/guides/publish-to-several-accounts)). The posts and comments lists accept `groupId` as a filter. ### List groups `GET /v1/account-groups` Your groups, newest first, each with its `members` (shaped like accounts). Not paginated. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute `membersHash` and `userId` are internal and can be ignored. Example request: ```bash curl "https://api.flenvio.com/v1/account-groups" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json [ { "id": "96a0b000-0000-4000-8000-000000000001", "userId": "05e10000-0000-4000-8000-000000000001", "name": "Lumen Coffee", "membersHash": "9f2c…", "createdAt": "2026-09-03T10:00:00.000Z", "updatedAt": "2026-09-03T10:00:00.000Z", "members": [ { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee", "avatarUrl": null, "connectionStatus": "ACTIVE" }, { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters", "avatarUrl": null, "connectionStatus": "ACTIVE" } ] } ] ``` | Status | When | | --- | --- | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Create a group `POST /v1/account-groups` Creates a group. You can have up to 50. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `name` | body | string, 1–80 characters | yes | Unique among your groups. | | `accountIds` | body | string[] | yes | At least one of your account ids. Duplicates are ignored. No other group may have exactly the same set. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/account-groups" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "name": "Lumen Coffee", "accountIds": [ "acc1a000-0000-4000-8000-000000000001", "acc1a000-0000-4000-8000-000000000002" ] }' ``` Response `201` ```json { "id": "96a0b000-0000-4000-8000-000000000001", "userId": "05e10000-0000-4000-8000-000000000001", "name": "Lumen Coffee", "membersHash": "9f2c…", "createdAt": "2026-09-03T10:00:00.000Z", "updatedAt": "2026-09-03T10:00:00.000Z", "members": [ { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee", "avatarUrl": null, "connectionStatus": "ACTIVE" }, { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters", "avatarUrl": null, "connectionStatus": "ACTIVE" } ] } ``` | Status | When | | --- | --- | | 400 | Validation failed, an account id isn’t yours (`Unknown or unauthorized account(s): …`), or you already have the maximum number of groups. | | 409 | `A group with this name already exists.` or `A group with this exact set of accounts already exists.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Update a group `PATCH /v1/account-groups/{id}` Renames the group, replaces its members, or both. Omitted fields stay as they are. `accountIds` replaces the whole member list. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string | yes | Group id. | | `name` | body | string, 1–80 characters | no | Unique among your groups. | | `accountIds` | body | string[] | no | At least one of your account ids. Duplicates are ignored. No other group may have exactly the same set. | Example request: ```bash curl -X PATCH "https://api.flenvio.com/v1/account-groups/96a0b000-0000-4000-8000-000000000001" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "name": "Lumen Coffee (all)", "accountIds": [ "acc1a000-0000-4000-8000-000000000001", "acc1a000-0000-4000-8000-000000000002", "acc1a000-0000-4000-8000-000000000003" ] }' ``` Response `200`: The updated group, same shape as above. | Status | When | | --- | --- | | 400 | Validation failed or an account id isn’t yours. | | 404 | `Group not found.` | | 409 | `A group with this name already exists.` or `A group with this exact set of accounts already exists.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Delete a group `DELETE /v1/account-groups/{id}` Deletes the group. The accounts and posts aren’t affected. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string | yes | Group id. | Example request: ```bash curl -X DELETE "https://api.flenvio.com/v1/account-groups/96a0b000-0000-4000-8000-000000000001" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "id": "96a0b000-0000-4000-8000-000000000001", "status": "deleted" } ``` | Status | When | | --- | --- | | 404 | `Group not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | --- # Posts > Create, list and fetch posts; reschedule, cancel and archive them; retry failed deliveries. Source: http://flenvio.com/docs/reference/posts A post holds the text, media and target accounts; each target account gets a delivery in `logs`. See [Core concepts](http://flenvio.com/docs/concepts#posts-and-deliveries). ### The post object | Field | Type | Description | | --- | --- | --- | | `id` | string | Post id. | | `caption` | string | The text. | | `mediaUrls` | string[] | Attached uploads, in order. | | `mediaUrl` | string \\| null | Older single-media field; `null` for posts created with `mediaUrls`. | | `scheduledAt` | string \\| null | When it’s (or was) scheduled to publish, UTC. | | `createdAt` | string | When the post was created, UTC. | | `logs` | Delivery[] | One per target account: `id`, `status`, `errorMessage`, `platformPostId`, `remoteDeletedAt`, `updatedAt`, `connectedAccount` (`id`, `platform`, `accountName`). | | `mediaPreviews` | {url, kind}[] | Temporary links to view the media (about 15 minutes). `kind` is `image`, `video` or `unknown`. | ### Create a post `POST /v1/posts` Publishes now, or at `scheduledAt`, to every account in `accountIds`. Each account gets its own delivery. The post is checked against every target platform’s rules first; if anything is wrong, nothing is created. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute; 200 posts per 24 hours per Flenvio account (scheduled ones included) Unknown fields are rejected (for example sending `groupIds` returns `400` `property groupIds should not exist`). The older single `mediaUrl` field is still accepted; prefer `mediaUrls`. `mediaMeta` is accepted and ignored. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `Idempotency-Key` | header | string | no | A unique value per post. Repeating it with the same body returns the original post with `status: "duplicate"`; with a different body it answers `422` `idempotency_key_reused`. Strongly recommended. | | `accountIds` | body | string[] | yes | 1–50 of your account ids. Each must be `ACTIVE` (see `connectionStatus`); a repeated id counts once. | | `caption` | body | string | yes | The post text, 1–2,200 characters (less for some platforms). Used as the YouTube title (first line) and description. | | `mediaUrls` | body | string[] | no | Up to 20 `url`s of your completed uploads, in display order. Several items make a carousel where supported. | | `scheduledAt` | body | string (ISO 8601) | no | Publish later. Future, within 365 days. Omit to publish now. | | `tiktokOptions` | body | object | no | Required when targeting TikTok. See below. | | `tiktokOptions.privacyLevel` | body | string | no | `PUBLIC_TO_EVERYONE`, `MUTUAL_FOLLOW_FRIENDS`, `FOLLOWER_OF_CREATOR` or `SELF_ONLY`; must be one the account offers (see [creator info](http://flenvio.com/docs/reference/tiktok)). | | `tiktokOptions.disableComment / disableDuet / disableStitch` | body | boolean | no | Turn interactions off for this post. Leave unset to use the account’s own settings. | | `tiktokOptions.brandContentToggle` | body | boolean | no | Paid partnership disclosure. Not allowed with `SELF_ONLY`. | | `tiktokOptions.brandOrganicToggle` | body | boolean | no | “Promotes my own business” disclosure. | | `tiktokOptions.isAigc` | body | boolean | no | Label the content as AI-generated. | | `youtubeOptions` | body | object | no | Optional YouTube upload settings; other platforms ignore it. | | `youtubeOptions.title` | body | string | no | Video title, 1–100 characters, no `<` or `>`. Defaults to the caption’s first line. | | `youtubeOptions.description` | body | string | no | Video description, up to 5,000 characters, no `<` or `>`. Defaults to the caption. | | `youtubeOptions.privacyStatus` | body | string | no | `public`, `unlisted` or `private`. Defaults to `public`. Until the app passes YouTube’s audit, YouTube keeps every upload private. | Example request: ```bash 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" ], "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" ] }' ``` Response `201`: `status` is `queued` (publishing now), `scheduled`, or `duplicate` (an earlier request with the same key; `postId` is that post). ```json { "postId": "b0570000-0000-4000-8000-000000000001", "status": "queued" } ``` | Status | When | | --- | --- | | 400 | Validation failed (`message` is a list), a platform rule is broken (one sentence per problem, e.g. `Instagram: add at least one image or video.`), an account id isn’t yours (`Unknown or unauthorized account(s): …`), media isn’t one of your completed uploads, `scheduledAt` is in the past or too far ahead, or you reached the daily post limit. | | 403 | `This account is being deleted.` | | 422 | `code: "idempotency_key_reused"`: this `Idempotency-Key` was already used with a different body. Nothing is created; use a new key for a new post. | | 409 | `code: "account_reconnect_required"`: one or more accounts need reconnecting in the dashboard. `accountIds` lists them and `accounts` gives each one’s `connectionStatus`. Nothing is created. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### List posts `GET /v1/posts` Your posts, newest first, each with its deliveries. Archived posts are left out. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute Account, platform and status filters apply to the same delivery: `groupId=…&statuses=FAILED` means “posts with a failed delivery to a member of the group”. `nextCursor` is `null` on the last page. Dates filter on creation time, not scheduled time. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `limit` | query | integer | no | 1–50, default 20. | | `cursor` | query | string | no | The `nextCursor` from the previous page. | | `accountIds` | query | comma-separated ids | no | Posts that targeted any of these accounts. | | `groupId` | query | string | no | Posts that targeted any member of this group (combined with `accountIds` if both are given). | | `platforms` | query | comma-separated | no | For example `INSTAGRAM,TIKTOK`. | | `statuses` | query | comma-separated | no | Posts with at least one delivery in these statuses, e.g. `FAILED`. | | `dateFrom` | query | ISO 8601 | no | Created at or after (inclusive). | | `dateTo` | query | ISO 8601 | no | Created at or before (inclusive). | Example request: ```bash curl "https://api.flenvio.com/v1/posts?limit=20&statuses=FAILED&platforms=INSTAGRAM%2CFACEBOOK" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "items": [ { "id": "b0570000-0000-4000-8000-000000000001", "caption": "New single origin from Huila just landed. Bright, juicy, a little floral.", "mediaUrl": null, "mediaUrls": [ "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg" ], "scheduledAt": null, "createdAt": "2026-10-12T09:30:00.512Z", "logs": [ { "id": "de11e000-0000-4000-8000-000000000001", "status": "COMPLETED", "errorMessage": null, "platformPostId": "18000000000000001", "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:04.211Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee" } }, { "id": "de11e000-0000-4000-8000-000000000002", "status": "FAILED", "errorMessage": "Meta Graph error (400): (#324) Requires upload file", "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:21.870Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ], "mediaPreviews": [ { "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=…", "kind": "image" } ] } ], "nextCursor": "b0570000-0000-4000-8000-000000000001" } ``` | Status | When | | --- | --- | | 400 | Invalid filter (for example an unknown status, `limit` over 50, or `dateFrom is not a valid ISO date.`). | | 404 | `Group not found.` for an unknown `groupId`. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Get a post `GET /v1/posts/{id}` One post with all its deliveries. Works for archived posts too. Poll this to follow publishing. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string | yes | Post id. | Example request: ```bash curl "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "id": "b0570000-0000-4000-8000-000000000001", "caption": "New single origin from Huila just landed. Bright, juicy, a little floral.", "mediaUrl": null, "mediaUrls": [ "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg" ], "scheduledAt": null, "createdAt": "2026-10-12T09:30:00.512Z", "logs": [ { "id": "de11e000-0000-4000-8000-000000000001", "status": "COMPLETED", "errorMessage": null, "platformPostId": "18000000000000001", "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:04.211Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee" } }, { "id": "de11e000-0000-4000-8000-000000000002", "status": "FAILED", "errorMessage": "Meta Graph error (400): (#324) Requires upload file", "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:21.870Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ], "mediaPreviews": [ { "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=…", "kind": "image" } ] } ``` | Status | When | | --- | --- | | 404 | `Post not found` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Retry a failed delivery `POST /v1/posts/jobs/{deliveryId}/retry` Publishes one `FAILED` delivery again with the post’s original content. Returns the delivery, now `PENDING`. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `deliveryId` | path | string | yes | The delivery’s `id` from the post’s `logs`. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/posts/jobs/de11e000-0000-4000-8000-000000000002/retry" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `201` ```json { "id": "de11e000-0000-4000-8000-000000000002", "status": "PENDING", "errorMessage": null, "platformPostId": null, "remoteDeletedAt": null, "updatedAt": "2026-10-12T09:30:21.870Z", "connectedAccount": { "id": "acc1a000-0000-4000-8000-000000000002", "platform": "FACEBOOK", "accountName": "Lumen Coffee Roasters" } } ``` | Status | When | | --- | --- | | 400 | `Only FAILED jobs can be retried.` | | 404 | `Job not found` | | 409 | The platform already received this post (`platformPostId` is set); retrying would likely duplicate it. Or `code: "account_reconnect_required"`: reconnect the account in the dashboard first. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Reschedule a post `POST /v1/posts/{id}/reschedule` Moves the post’s still-scheduled deliveries to a new time. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string | yes | Post id. | | `scheduledAt` | body | string (ISO 8601) | yes | At least a few seconds in the future, within 365 days. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/reschedule" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "scheduledAt": "2026-10-21T08:30:00Z" }' ``` Response `200` ```json { "rescheduled": 2, "scheduledAt": "2026-10-21T08:30:00.000Z" } ``` | Status | When | | --- | --- | | 400 | Invalid or past time, or `This post has no scheduled deliveries left to reschedule.` | | 404 | `Post not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Cancel a scheduled post `POST /v1/posts/{id}/cancel` Cancels every still-scheduled delivery. `alreadyPublishing` counts deliveries that had started and will finish anyway. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute > **Caution:** Canceling can’t be undone. To publish later, create a new post. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string | yes | Post id. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/cancel" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "canceled": 2, "alreadyPublishing": 0 } ``` | Status | When | | --- | --- | | 400 | `This post has no scheduled deliveries left to cancel.` | | 404 | `Post not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Archive a post `POST /v1/posts/{id}/archive` Hides the post from the posts list. Nothing is deleted on the platforms and it can still be fetched by id. Repeating it is harmless. There is no unarchive. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string | yes | Post id. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/archive" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `201` ```json { "archived": true } ``` | Status | When | | --- | --- | | 404 | `Post not found.` | | 409 | The post still has scheduled deliveries; cancel it first. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | --- # Media > Upload images and videos for posts: direct uploads with a presigned URL, or a single multipart request for small files. Source: http://flenvio.com/docs/reference/media Walkthrough and complete code: [Upload media](http://flenvio.com/docs/guides/upload-media). ### Start an upload `POST /v1/media/uploads` Reserves space for one file and returns a URL to `PUT` it to, valid for one hour. - **Auth:** API key (`x-api-key`) - **Rate limit:** 30/minute; 200 uploads per 24 hours; 10 GB stored Then `PUT` the bytes to `uploadUrl` with exactly the returned `headers` and no API key, and call complete. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `contentType` | body | string | yes | `image/jpeg`, `image/png`, `image/gif`, `image/webp`, `video/mp4`, `video/quicktime` | | `sizeBytes` | body | integer | yes | Exact file size. Images up to 10 MB, videos up to 1 GB. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/media/uploads" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "contentType": "image/jpeg", "sizeBytes": 482113 }' ``` Response `201` ```json { "assetId": "a55e7000-0000-4000-8000-000000000001", "uploadUrl": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600&X-Amz-SignedHeaders=content-length%3Bcontent-type%3Bhost&X-Amz-Signature=…", "method": "PUT", "headers": { "Content-Type": "image/jpeg" } } ``` | Status | When | | --- | --- | | 400 | Unsupported type, daily upload limit or storage limit reached. | | 403 | `This account is being deleted.` | | 413 | File larger than the limit for its type. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Complete an upload `POST /v1/media/uploads/{id}/complete` Checks the stored file against what you declared and makes it attachable. Returns the `url` to use in posts. Safe to repeat. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `id` | path | string (UUID) | yes | The `assetId` from starting the upload. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/media/uploads/a55e7000-0000-4000-8000-000000000001/complete" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200`: `meta` has `kind`, and when readable `width`, `height`, `durationSec` (videos) and `format`. ```json { "id": "a55e7000-0000-4000-8000-000000000001", "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "key": "uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "meta": { "kind": "image", "width": 1080, "height": 1350, "format": "jpeg" } } ``` | Status | When | | --- | --- | | 400 | `The file has not been uploaded yet.`, the file doesn’t match what was declared (it is deleted), `This upload expired. Upload the file again.`, or the id isn’t a UUID. | | 404 | `Upload not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Upload a small file `POST /v1/media/upload` One-step upload for files up to 10 MB, as `multipart/form-data` with a `file` field. The type is detected from the content. - **Auth:** API key (`x-api-key`) - **Rate limit:** 30/minute (shared limits as above) | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `file` | body | file | yes | The image or video. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/media/upload" \ -H "x-api-key: $FLENVIO_API_KEY" \ -F 'file=@photo.jpg;type=image/jpeg' ``` Response `201` ```json { "id": "a55e7000-0000-4000-8000-000000000001", "url": "https://media.flenvio.example/uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "key": "uploads/5c1f0e2a-0000-4000-8000-000000000001.jpg", "meta": { "kind": "image", "width": 1080, "height": 1350, "format": "jpeg" } } ``` | Status | When | | --- | --- | | 400 | Unsupported type, or limits reached. | | 413 | Larger than 10 MB. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | --- # Comments and messages > Read your comments inbox, reply to, hide and delete comments, and read and send Instagram and Facebook direct messages. Source: http://flenvio.com/docs/reference/comments Comments and messages are collected by Flenvio as they arrive (YouTube comments are checked every 5 minutes), so lists show what Flenvio has received, not a live view of the platform. TikTok comments aren’t available. > **These actions are public:** Replies and direct messages are sent as your account and are visible to other people; hiding and deleting act on the platform. Agents should show you the exact text and ask before calling any of them. | Platform | List and reply | Hide | Delete | Direct messages | | --- | --- | --- | --- | --- | | Instagram | Yes | Yes | Yes | Yes | | Facebook | Yes | Yes | Yes | Yes | | Threads | Yes | Yes | Only replies your own account wrote | No | | YouTube | Yes | Yes (rejects the comment) | Yes | No | ### List comments (all platforms) `GET /v1/comments` One feed of comments across your Instagram, Facebook, Threads and YouTube accounts, newest first. Deleted comments are left out. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute Use an item’s `id` and `platform` with the actions below. `parentProviderId` is set on replies. `mediaRef` is the platform’s id of the post the comment is on (not a Flenvio post id). | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `limit` | query | integer | no | 1–50, default 25. | | `cursor` | query | string | no | The `nextCursor` from the previous page. | | `accountIds` | query | comma-separated ids | no | Only these accounts. | | `groupId` | query | string | no | Only members of this group. With `accountIds` too, only accounts in both. | | `platforms` | query | comma-separated | no | `INSTAGRAM`, `FACEBOOK`, `THREADS`, `YOUTUBE`. | | `hidden` | query | `true` \| `false` | no | Only hidden, or only visible, comments. | | `dateFrom` | query | ISO 8601 | no | Posted at or after. | | `dateTo` | query | ISO 8601 | no | Posted at or before. | Example request: ```bash curl "https://api.flenvio.com/v1/comments?limit=25&platforms=INSTAGRAM%2CYOUTUBE&hidden=false" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "items": [ { "id": "c0111e17-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "providerCommentId": "17900000000000001", "parentProviderId": null, "author": "jen.ceramics", "text": "Is the Huila available as whole beans?", "hidden": false, "providerCreatedAt": "2026-10-12T08:14:00.000Z", "account": { "id": "acc1a000-0000-4000-8000-000000000001", "platform": "INSTAGRAM", "accountName": "lumen.coffee", "avatarUrl": null }, "mediaRef": "18000000000000001" } ], "nextCursor": "MjAyNi0xMC0xMlQwODoxNDowMC4wMDBafGMwMTExZTE3…" } ``` | Status | When | | --- | --- | | 400 | Invalid filter (for example `TIKTOK` in `platforms`) or `Invalid cursor.` | | 404 | `Group not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### List one account’s comments `GET /v1/{platform}/accounts/{accountId}/comments` Up to the 100 most recent comments Flenvio has for one account. Not paginated; prefer `GET /v1/comments` for new code. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute Fields differ slightly by platform: the author is `authorUsername` (Instagram, Threads), `authorName` (Facebook) or `authorDisplayName` (YouTube), and YouTube has `moderationStatus` instead of `hidden`. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `{platform}` | path | string | yes | `instagram`, `facebook`, `threads` or `youtube` (the comment’s platform). | | `accountId` | path | string | yes | Account id. | Example request: ```bash curl "https://api.flenvio.com/v1/instagram/accounts/acc1a000-0000-4000-8000-000000000001/comments" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json [ { "id": "c0111e17-0000-4000-8000-000000000001", "text": "Is the Huila available as whole beans?", "authorUsername": "jen.ceramics", "parentProviderId": null, "hidden": false, "instagramMediaId": "f00d0000-0000-4000-8000-000000000001", "providerCreatedAt": "2026-10-12T08:14:00.000Z", "createdAt": "2026-10-12T08:14:03.000Z" } ] ``` | Status | When | | --- | --- | | 404 | `Account not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Reply to a comment `POST /v1/{platform}/comments/{commentId}/replies` Posts a public reply as your account. The reply shows up in the comment lists once the platform reports it back. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute > **Caution:** Visible to everyone. Can’t be edited through Flenvio. On YouTube, replying to a reply attaches it to the top-level comment. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `{platform}` | path | string | yes | `instagram`, `facebook`, `threads` or `youtube` (the comment’s platform). | | `commentId` | path | string | yes | The comment’s Flenvio `id`. | | `message` | body | string | yes | 1–2,200 characters. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/instagram/comments/c0111e17-0000-4000-8000-000000000001/replies" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "message": "Yes! Whole beans or ground, your choice." }' ``` Response `201`: `id` is the reply’s id on the platform. ```json { "id": "17900000000000002", "status": "sent" } ``` | Status | When | | --- | --- | | 400 | Empty or too long `message`. | | 404 | `Comment not found.` | | 500 | The platform refused or couldn’t be reached. The response doesn’t include the platform’s reason; check the account’s connection and try again later. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Hide or unhide a comment `POST /v1/{platform}/comments/{commentId}/hide` Hides the comment from the public (or shows it again with `/unhide`). On YouTube this rejects the comment (`moderationStatus: "rejected"`), and unhide publishes it. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `{platform}` | path | string | yes | `instagram`, `facebook`, `threads` or `youtube` (the comment’s platform). | | `commentId` | path | string | yes | The comment’s Flenvio `id`. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/instagram/comments/c0111e17-0000-4000-8000-000000000001/hide" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `201`: Instagram, Facebook, Threads: ```json { "id": "c0111e17-0000-4000-8000-000000000001", "hidden": true } ``` Response `201`: YouTube: ```json { "id": "c0111e17-0000-4000-8000-000000000001", "moderationStatus": "rejected" } ``` | Status | When | | --- | --- | | 404 | `Comment not found.` | | 500 | The platform refused or couldn’t be reached. The response doesn’t include the platform’s reason; check the account’s connection and try again later. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### Delete a comment `DELETE /v1/{platform}/comments/{commentId}` Deletes the comment on the platform. On Threads only replies written by your own account can be deleted; hide others instead. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute > **Caution:** Permanent on the platform. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `{platform}` | path | string | yes | `instagram`, `facebook`, `threads` or `youtube` (the comment’s platform). | | `commentId` | path | string | yes | The comment’s Flenvio `id`. | Example request: ```bash curl -X DELETE "https://api.flenvio.com/v1/instagram/comments/c0111e17-0000-4000-8000-000000000001" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "id": "c0111e17-0000-4000-8000-000000000001", "deleted": true } ``` | Status | When | | --- | --- | | 400 | Threads: `Threads only allows deleting replies authored by your own account. Use hide instead.` | | 404 | `Comment not found.` | | 500 | The platform refused or couldn’t be reached. The response doesn’t include the platform’s reason; check the account’s connection and try again later. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### List conversations `GET /v1/{instagram|facebook}/accounts/{accountId}/conversations` Direct-message conversations for an Instagram or Facebook account, most recent first (up to 100). - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `accountId` | path | string | yes | Account id. | Example request: ```bash curl "https://api.flenvio.com/v1/instagram/accounts/acc1a000-0000-4000-8000-000000000001/conversations" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json [ { "id": "c0a7e000-0000-4000-8000-000000000001", "providerConversationId": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6example", "participantName": "jen.ceramics", "lastMessageAt": "2026-10-12T08:20:00.000Z", "createdAt": "2026-10-10T17:02:00.000Z" } ] ``` | Status | When | | --- | --- | | 404 | `Account not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### List the inbox `GET /v1/inbox/conversations` Conversations from every connected Facebook Page and Instagram account, most recent first (up to 200), each with its account, last message and unread count. Narrow it to one account or one group. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute `unreadCount` is the number of messages received since the conversation was last opened in Flenvio or marked read. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `accountId` | query | string | no | Only this account’s conversations. | | `groupId` | query | string | no | Only the conversations of this group’s Facebook and Instagram accounts. | Example request: ```bash curl "https://api.flenvio.com/v1/inbox/conversations" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json [ { "id": "c0a7e000-0000-4000-8000-000000000001", "providerConversationId": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6example", "participantName": "@jen.ceramics", "lastMessageAt": "2026-10-12T08:20:00.000Z", "createdAt": "2026-10-10T17:02:00.000Z", "unreadCount": 2, "account": { "id": "acc1a000-0000-4000-8000-000000000001", "accountName": "lumen.coffee", "platform": "INSTAGRAM", "avatarUrl": null }, "lastMessage": { "text": "Do you ship to Canada?", "direction": "INBOUND" } } ] ``` | Status | When | | --- | --- | | 400 | `accountId` or `groupId` isn’t a valid id. | | 404 | `Group not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Count unread conversations `GET /v1/inbox/unread` How many conversations have unread messages, in total and per account. Accounts with none are left out. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute Example request: ```bash curl "https://api.flenvio.com/v1/inbox/unread" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "total": 3, "accounts": [ { "accountId": "acc1a000-0000-4000-8000-000000000001", "conversations": 2 }, { "accountId": "acc1a000-0000-4000-8000-000000000002", "conversations": 1 } ] } ``` | Status | When | | --- | --- | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Mark a conversation read `POST /v1/inbox/conversations/{conversationId}/read` Clears a conversation’s unread count. Sending a message in it does the same. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `conversationId` | path | string | yes | Conversation id. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/inbox/conversations/c0a7e000-0000-4000-8000-000000000001/read" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "read": true } ``` | Status | When | | --- | --- | | 404 | `Conversation not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | ### List messages `GET /v1/{instagram|facebook}/conversations/{conversationId}/messages` Messages in a conversation, oldest first (up to 200). `direction` is `INBOUND` or `OUTBOUND`. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `conversationId` | path | string | yes | Conversation id. | Example request: ```bash curl "https://api.flenvio.com/v1/instagram/conversations/c0a7e000-0000-4000-8000-000000000001/messages" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json [ { "id": "e5500000-0000-4000-8000-000000000001", "direction": "INBOUND", "senderId": "17840000000000009", "text": "Do you ship to Canada?", "providerCreatedAt": "2026-10-12T08:19:00.000Z", "createdAt": "2026-10-12T08:19:02.000Z" } ] ``` | Status | When | | --- | --- | | 404 | `Conversation not found.` | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | ### Send a message `POST /v1/{instagram|facebook}/conversations/{conversationId}/messages` Sends a text message in an existing conversation, as your account. You can’t start new conversations. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute > **Caution:** Delivered to a real person immediately. The platform may refuse a message (for example outside its messaging window); that shows up as an error. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `conversationId` | path | string | yes | Conversation id. | | `text` | body | string | yes | 1–1,000 characters. | Example request: ```bash curl -X POST "https://api.flenvio.com/v1/instagram/conversations/c0a7e000-0000-4000-8000-000000000001/messages" \ -H "x-api-key: $FLENVIO_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "text": "We do! Shipping to Canada takes 4–6 days." }' ``` Response `201` ```json { "id": "aWdfZAG1faXRlbToxOklHTWVzc2FnZAexample", "status": "sent" } ``` | Status | When | | --- | --- | | 400 | Empty or too long `text`. | | 404 | `Conversation not found.` | | 500 | The platform refused or couldn’t be reached. The response doesn’t include the platform’s reason; check the account’s connection and try again later. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | | 403 | `code: "api_key_read_only"`: the API key is read-only, and this request changes something. | --- # TikTok creator info > Fetch which audiences and interaction settings a TikTok account allows before posting to it. Source: http://flenvio.com/docs/reference/tiktok TikTok requires you to choose an audience for every post, from the options that account allows. Read them here and pass one as `tiktokOptions.privacyLevel` when creating the post. ### Get creator info `GET /v1/tiktok/accounts/{accountId}/creator-info` The account’s nickname, allowed audiences (`privacyLevelOptions`) and whether comments, Duet and Stitch are turned off in the TikTok app. - **Auth:** API key (`x-api-key`) - **Rate limit:** 120/minute If `commentDisabled`, `duetDisabled` or `stitchDisabled` is `true`, don’t set the matching `disable…` option to `false`. `maxVideoPostDurationSec`, when present, is the longest video the account may post. | Parameter | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `accountId` | path | string | yes | A TikTok account id. | Example request: ```bash curl "https://api.flenvio.com/v1/tiktok/accounts/acc1a000-0000-4000-8000-000000000003/creator-info" \ -H "x-api-key: $FLENVIO_API_KEY" ``` Response `200` ```json { "creatorNickname": "lumencoffee", "privacyLevelOptions": [ "PUBLIC_TO_EVERYONE", "MUTUAL_FOLLOW_FRIENDS", "SELF_ONLY" ], "commentDisabled": false, "duetDisabled": false, "stitchDisabled": true, "maxVideoPostDurationSec": 600 } ``` | Status | When | | --- | --- | | 400 | `Unknown or unauthorized account(s): …`: not one of your accounts. | | 404 | `TikTok account not found.`: the account isn’t a TikTok account. | | 401 | Missing, invalid, revoked or expired API key. | | 429 | Too many requests to this endpoint; wait `Retry-After` seconds. | --- # Errors and rate limits > The error format, what each status code means, request rate limits, usage limits and how to retry safely. Source: http://flenvio.com/docs/errors ## Error format Errors are JSON with the HTTP status in `statusCode`, a human-readable `message` and usually an `error` name. `message` is a string, or a list of strings when several request fields failed validation. Some errors also carry a machine-readable `code` (see [Error codes](#error-codes)) and extra fields. A rule or state problem (`400`): ```json { "message": "TikTok: choose who can view the post.", "error": "Bad Request", "statusCode": 400 } ``` Request validation (`400`): ```json { "message": [ "caption must be longer than or equal to 1 characters", "property groupIds should not exist" ], "error": "Bad Request", "statusCode": 400 } ``` Messages are written for people and are safe to show to your users. Don’t parse their wording; it may change. Branch on the status code, and on `code` when there is one. ### Error codes | Status | `code` | Meaning | | --- | --- | --- | | `403` | `api_key_read_only` | The API key is read-only and the request isn’t a `GET`. Nothing was changed. Use a key with full access. | | `409` | `account_reconnect_required` | A post (or a retry) targets accounts that are disconnected or need re-authorization. `accountIds` lists them; `accounts` gives each `id` with its `connectionStatus`. Reconnect them in the dashboard, or leave them out. | | `422` | `idempotency_key_reused` | The `Idempotency-Key` on `POST /v1/posts` was already used with a different body. Nothing was created. Use a new key for a new post; reuse a key only to resend the identical request. | An account needs reconnecting (`409`): ```json { "statusCode": 409, "error": "Conflict", "code": "account_reconnect_required", "message": "One of the selected accounts needs to be reconnected before you can post to it.", "accountIds": [ "acc1a000-0000-4000-8000-000000000003" ], "accounts": [ { "id": "acc1a000-0000-4000-8000-000000000003", "connectionStatus": "REAUTH_REQUIRED" } ] } ``` ## Status codes | Status | Meaning | Retry? | | --- | --- | --- | | `200` / `201` | Success. Most `POST` requests answer `201`; the reference gives the exact code for each endpoint. | — | | `400` | The request can’t be done as sent: invalid fields, a broken platform rule, an id that isn’t yours, a usage limit, or nothing left to cancel or reschedule. | Not as is. Fix the request. | | `401` | Missing, invalid, revoked or expired API key, or an endpoint that needs the dashboard. | No. Check the key. | | `403` | Your Flenvio account is being deleted, or a read-only API key tried to change something (`code: "api_key_read_only"`). | No. | | `404` | Not found, or not yours (Flenvio doesn’t say which). | No. | | `409` | Conflict with the current state: a duplicate group name or member set, archiving a scheduled post, retrying a delivery the platform already received, or posting to an account that needs reconnecting. | No. Read the message. | | `413` | Upload larger than allowed. | No. | | `422` | An `Idempotency-Key` was reused with a different request body (`code: "idempotency_key_reused"`). | No. Use a new key. | | `429` | Rate limited. | Yes, after `Retry-After` seconds. | | `500` | Something went wrong on Flenvio’s side, or a platform refused a comment or message action. | Yes, with backoff, a few times. | ## Rate limits Each endpoint allows 120 requests per minute from the same IP address (counted per endpoint, so polling one post doesn’t slow down uploads). Starting an upload is limited to 30 per minute. Every response includes the current window: | Header | Meaning | | --- | --- | | `X-RateLimit-Limit` | Requests allowed per window for this endpoint. | | `X-RateLimit-Remaining` | Requests left in the current window. | | `X-RateLimit-Reset` | Seconds until the window resets. | | `Retry-After` | On `429` only: seconds to wait. | Rate limited (`429`): ```json { "statusCode": 429, "message": "ThrottlerException: Too Many Requests" } ``` > **Note:** Limits are counted per IP address, not per key. Several scripts behind the same address share them. ## Usage limits Per Flenvio account. Going over one answers `400` with a message naming the limit. | Limit | Value | | --- | --- | | Posts created | 200 per 24 hours (scheduled ones included) | | Accounts per post | 50 | | Groups | 50 | | Connected accounts | 50 | | Active API keys | 10 | | Uploads | 200 per 24 hours | | Media storage | 10 GB | | Scheduling horizon | 365 days | ## Retrying safely - Retry `429` after `Retry-After`, and `500`, `502`, `503`, `504` and network errors with exponential backoff (for example 1, 2, 4, 8 seconds) and a cap. - Always send an `Idempotency-Key` on `POST /v1/posts`, and reuse it when retrying that request, so a retry can never publish twice. - Don’t retry other `4xx` errors unchanged. They’ll fail the same way. - A failed delivery is different from a failed request: see [Delivery status and retries](http://flenvio.com/docs/guides/delivery-status-and-retry). --- # For AI agents > Give an AI agent like Claude Code, Cursor or ChatGPT safe access to Flenvio, with a copyable setup prompt and machine-readable docs. Source: http://flenvio.com/docs/ai-agents An agent can draft posts, upload media, schedule them across your accounts and report back on how they did. Because posts go out publicly under your name, set it up so the agent always asks you before it publishes. ## Give an agent access safely 1. **Create a dedicated key** in [Settings → Developer](http://flenvio.com/dashboard/settings/developer), named after the agent (for example “Claude Code – October campaign”), with the shortest expiry that fits the job. 2. **Give it to the agent as an environment variable** (`FLENVIO_API_KEY`), not in the chat or in a file the agent might commit or share. 3. **Paste the setup prompt below** into the agent’s instructions (a project rules file, custom instructions or the first message). 4. **Review before you confirm.** The agent should show you the exact post, accounts and time, and wait for your yes. 5. **Revoke the key when you’re done.** Revoking takes effect immediately. > **A key is full access:** Keys can’t be limited to reading, or to some accounts. An agent with your key can publish, cancel, reply to comments and disconnect accounts. Only give keys to agents you trust, and keep a person in the loop for anything public. ## Agent setup prompt Copy this into your agent. It includes your API base URL, the endpoints it needs and the rule to ask before publishing. Agent setup prompt: ```text You can use the Flenvio API to publish and schedule social media posts for me. Base URL: https://api.flenvio.com Auth: send the header "x-api-key" with the value of the FLENVIO_API_KEY environment variable on every request. Never print, log or repeat the key. Full documentation (markdown): http://flenvio.com/llms-full.txt Key endpoints: - GET /v1/accounts: accounts I can publish to. Only use ones with connectionStatus "ACTIVE" (others are refused with 409 account_reconnect_required). - GET /v1/account-groups: my groups. Expand a group's members into accountIds and remove duplicates. - Media: POST /v1/media/uploads {contentType, sizeBytes} -> PUT the file to uploadUrl with the returned headers -> POST /v1/media/uploads/{assetId}/complete -> put the returned url in mediaUrls. - POST /v1/posts {accountIds, caption, mediaUrls?, scheduledAt?, tiktokOptions?} with an "Idempotency-Key" header (a new UUID per post; reuse it only when resending the same request). - GET /v1/posts/{id}: each account's delivery is in logs[] with status and errorMessage. - POST /v1/posts/{id}/reschedule {scheduledAt} and POST /v1/posts/{id}/cancel for scheduled posts. - POST /v1/posts/jobs/{deliveryId}/retry: retry one FAILED delivery. Rules: 1. Ask before acting. Before you publish, schedule, reschedule, cancel or retry anything, show me the exact text, the media, the accounts (name and platform) and the time with its time zone, and wait for my explicit yes. Do the same before replying to comments, sending messages, or hiding or deleting comments. 2. Never disconnect accounts (DELETE /v1/accounts/{id}) or delete or change groups unless I ask for exactly that. 3. Check platform rules first: Instagram, YouTube and TikTok need media; Threads allows at most 500 characters; YouTube takes exactly one video; TikTok needs tiktokOptions.privacyLevel chosen from GET /v1/tiktok/accounts/{accountId}/creator-info. If the API answers 400, read the message, fix the request and ask me again. Don't guess. 4. Times are ISO 8601. Convert my local time to UTC (or include the offset) and confirm it with me. 5. After creating a post, poll GET /v1/posts/{id} every few seconds, slowing down, until no delivery is PENDING or PROCESSING. Then report per account: published, scheduled, or failed with its errorMessage. A FAILED delivery may still be retried automatically for about a minute. 6. Never retry a delivery whose platformPostId is set; tell me instead. On 429, wait Retry-After seconds. Don't loop on errors: stop and tell me. ``` ## Where to put it | Agent | Where | | --- | --- | | Claude Code | A `CLAUDE.md` file in your project, or the start of the conversation. Set `FLENVIO_API_KEY` in the shell you start it from. | | Cursor | A project rule (`.cursor/rules`), with the key in your environment. | | ChatGPT and other chat agents | Custom instructions or the first message. Only use agents that can make HTTP requests with a secret you provide, and never paste the key into the chat itself. | ## Docs for agents - [`/llms.txt`](http://flenvio.com/llms.txt): a short index of these docs, following the llms.txt convention. - [`/llms-full.txt`](http://flenvio.com/llms-full.txt): every page as plain markdown in one file, so an agent can read the whole documentation in one request. ## A good agent workflow 1. List accounts and groups, and confirm with you which ones to use. 2. Draft the text and check it against [platform rules](http://flenvio.com/docs/guides/platform-rules). 3. Upload media and show you what it will attach. 4. Show the final post, accounts and time; wait for your yes. 5. Create the post with a fresh `Idempotency-Key`. 6. Poll until each delivery finishes, then report results and any `errorMessage`. --- # Changelog > Changes to the Flenvio API. The API is in early access and endpoints may change. Source: http://flenvio.com/docs/changelog > **Early access:** The Flenvio API is in early access. Endpoints, fields and limits may change, and some may be added or removed. We’ll list changes here. Build defensively: ignore fields you don’t know, and branch on status codes rather than message text. ## 23 October 2026 - Inbox across accounts: `GET /v1/inbox/conversations` (filter by `accountId` or `groupId`), `GET /v1/inbox/unread` and `POST /v1/inbox/conversations/{conversationId}/read`. - Posts: optional `youtubeOptions` (title, description, visibility) for YouTube uploads. ## 12 October 2026 - Public API documentation published, with `/llms.txt` and `/llms-full.txt` for AI agents. - API v1: accounts, groups, posts, media uploads, comments and direct messages, TikTok creator info.