Guides
Delivery status and retries
Follow each account’s delivery until it finishes, find failed deliveries and retry them safely.
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 "https://api.flenvio.com/v1/posts/b0570000-0000-4000-8000-000000000001" \
-H "x-api-key: $FLENVIO_API_KEY"{
"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. |
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.
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 ?? '');
}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 "https://api.flenvio.com/v1/posts?statuses=FAILED&limit=20" \
-H "x-api-key: $FLENVIO_API_KEY"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 -X POST "https://api.flenvio.com/v1/posts/jobs/de11e000-0000-4000-8000-000000000002/retry" \
-H "x-api-key: $FLENVIO_API_KEY"{
"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
FAILEDdeliveries can be retried; anything else returns400Only FAILED jobs can be retried. - If the platform already received the post (
platformPostIdis set), retrying returns409, 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. |
{
"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"
}
]
}