API reference
Posts
Create, list and fetch posts; reschedule, cancel and archive them; retry failed deliveries.
A post holds the text, media and target accounts; each target account gets a delivery in logs. See Core concepts.
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
/v1/postsPublishes 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.
Parameters
Idempotency-Keyheader · stringA unique value per post. Repeating it with the same body returns the original post with
status: "duplicate"; with a different body it answers422idempotency_key_reused. Strongly recommended.accountIdsrequiredbody · string[]1–50 of your account ids. Each must be
ACTIVE(seeconnectionStatus); a repeated id counts once.captionrequiredbody · stringThe post text, 1–2,200 characters (less for some platforms). Used as the YouTube title (first line) and description.
mediaUrlsbody · string[]Up to 20
urls of your completed uploads, in display order. Several items make a carousel where supported.scheduledAtbody · string (ISO 8601)Publish later. Future, within 365 days. Omit to publish now.
tiktokOptionsbody · objectRequired when targeting TikTok. See below.
tiktokOptions.privacyLevelbody · stringPUBLIC_TO_EVERYONE,MUTUAL_FOLLOW_FRIENDS,FOLLOWER_OF_CREATORorSELF_ONLY; must be one the account offers (see creator info).tiktokOptions.disableComment / disableDuet / disableStitchbody · booleanTurn interactions off for this post. Leave unset to use the account’s own settings.
tiktokOptions.brandContentTogglebody · booleanPaid partnership disclosure. Not allowed with
SELF_ONLY.tiktokOptions.brandOrganicTogglebody · boolean“Promotes my own business” disclosure.
tiktokOptions.isAigcbody · booleanLabel the content as AI-generated.
youtubeOptionsbody · objectOptional YouTube upload settings; other platforms ignore it.
youtubeOptions.titlebody · stringVideo title, 1–100 characters, no
<or>. Defaults to the caption’s first line.youtubeOptions.descriptionbody · stringVideo description, up to 5,000 characters, no
<or>. Defaults to the caption.youtubeOptions.privacyStatusbody · stringpublic,unlistedorprivate. Defaults topublic. Until the app passes YouTube’s audit, YouTube keeps every upload private.
Example request
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).
{
"postId": "b0570000-0000-4000-8000-000000000001",
"status": "queued"
}Errors
| 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
/v1/postsYour 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.
Parameters
limitquery · integer1–50, default 20.
cursorquery · stringThe
nextCursorfrom the previous page.accountIdsquery · comma-separated idsPosts that targeted any of these accounts.
groupIdquery · stringPosts that targeted any member of this group (combined with
accountIdsif both are given).platformsquery · comma-separatedFor example
INSTAGRAM,TIKTOK.statusesquery · comma-separatedPosts with at least one delivery in these statuses, e.g.
FAILED.dateFromquery · ISO 8601Created at or after (inclusive).
dateToquery · ISO 8601Created at or before (inclusive).
Example request
curl "https://api.flenvio.com/v1/posts?limit=20&statuses=FAILED&platforms=INSTAGRAM%2CFACEBOOK" \
-H "x-api-key: $FLENVIO_API_KEY"Response 200
{
"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"
}Errors
| 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
/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
Parameters
idrequiredpath · stringPost id.
Example request
curl "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001" \
-H "x-api-key: $FLENVIO_API_KEY"Response 200
{
"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"
}
]
}Errors
| 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
/v1/posts/jobs/{deliveryId}/retryPublishes 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
Parameters
deliveryIdrequiredpath · stringThe delivery’s
idfrom the post’slogs.
Example request
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
{
"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"
}
}Errors
| 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
/v1/posts/{id}/rescheduleMoves the post’s still-scheduled deliveries to a new time.
- Auth
- API key
x-api-key - Rate limit
- 120/minute
Parameters
idrequiredpath · stringPost id.
scheduledAtrequiredbody · string (ISO 8601)At least a few seconds in the future, within 365 days.
Example request
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
{
"rescheduled": 2,
"scheduledAt": "2026-10-21T08:30:00.000Z"
}Errors
| 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
/v1/posts/{id}/cancelCancels every still-scheduled delivery. alreadyPublishing counts deliveries that had started and will finish anyway.
- Auth
- API key
x-api-key - Rate limit
- 120/minute
Parameters
idrequiredpath · stringPost id.
Example request
curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/cancel" \
-H "x-api-key: $FLENVIO_API_KEY"Response 200
{
"canceled": 2,
"alreadyPublishing": 0
}Errors
| 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
/v1/posts/{id}/archiveHides 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
Parameters
idrequiredpath · stringPost id.
Example request
curl -X POST "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001/archive" \
-H "x-api-key: $FLENVIO_API_KEY"Response 201
{
"archived": true
}Errors
| 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. |