Post Lifecycle

Understand how posts move through Outstand's lifecycle, including status fields, timing expectations, and where to find errors.

Understanding how posts move through different states in Outstand is crucial for building robust integrations. This guide explains the post lifecycle, status fields, timing expectations, and where to find error information.

Post States

Every post in Outstand goes through a lifecycle from creation to publication. The state is tracked both at the post level and at the per-account level.

Post-Level Status

At the post level, the publishedAt field indicates whether any account has successfully published:

FieldTypeDescription
publishedAtdatetime | nullSet when the first social account successfully publishes. null if no accounts have published yet.
scheduledAtdatetime | nullWhen the post is scheduled to publish. null for immediate publishing.

Per-Account Status

Each social account attached to a post has its own publishing status:

FieldTypeDescription
status'pending' | 'published' | 'failed'Current publishing state for this account.
errorstring | nullError message if publishing failed. null otherwise.
platformPostIdstring | nullThe platform-specific post ID after successful publish.
publishedAtdatetime | nullWhen this account successfully published.

State Transitions

pending

When a post is created and scheduled, each social account starts in the pending state. The publishing worker will attempt to publish to each account when the scheduled time arrives (or immediately if no scheduledAt is specified).

published

When publishing succeeds for a social account:

  • status is set to published
  • platformPostId is populated with the platform-specific ID (e.g., Twitter post ID, Instagram media ID)
  • publishedAt is set to the current timestamp
  • error is set to null

failed

When publishing fails for a social account:

  • status is set to failed
  • error contains the error message from the platform
  • platformPostId remains null
  • publishedAt remains null

Retrying a Failed Post

Once a publishing attempt has finished, call POST /v1/posts/{id}/retry to re-run publishing immediately for the post's failed accounts. Send no body to retry every failed account, or { "accounts": ["<social account id>"] } as application/json to retry only some of them. The retried accounts go back to pending, accounts that already published are never republished, and scheduledAt is not changed. The 202 response lists them in retriedAccounts; it usually includes the updated post too, but can omit it, so fetch the post if you need its state.

  • Fix the cause first, for example by reconnecting the social account.
  • A non-empty body sent without Content-Type: application/json is rejected with 415, and keys other than accounts are rejected with 400.
  • If no account has published yet, rescheduling or un-drafting the post with PATCH /v1/posts/{id} also re-attempts its failed accounts at the new time.
  • Retry returns 409 while any account is still pending (including scheduled posts that have not run yet) and for drafts.
  • TikTok Business destinations cannot be retried.
  • The result arrives through the usual post.published / post.error webhooks, which list only the accounts attempted in that run.
  • A failure that may have actually gone live on the platform (for example a timeout) can produce a duplicate if retried.

Timing Expectations

ScenarioExpected Timing
Post creationImmediate response with post ID
Immediate publish (no scheduledAt)Publishing starts within seconds
Scheduled publishPublishing starts at the scheduled time (±30 seconds)
Status visibility via APIAvailable immediately after publishing completes
Webhook deliverySent within seconds of publishing completion

Note: Publishing to a social account typically takes 1-10 seconds depending on the platform and whether media upload is required. For posts with multiple accounts, each account is processed sequentially.

Where to Find Errors

Outstand provides two ways to get error information:

1. API Response (Polling)

Use GET /v1/posts/{id} to check the status of a post. Each social account in the response includes status, error, platformPostId, and publishedAt fields:

{
  "success": true,
  "post": {
    "id": "9dyJS",
    "publishedAt": "2025-01-15T10:30:00Z",
    "socialAccounts": [
      {
        "id": "abc123",
        "network": "facebook",
        "username": "MyPage",
        "status": "failed",
        "error": "Failed to upload Facebook photo from buffer: 400 - (#100) Invalid image",
        "platformPostId": null,
        "publishedAt": null
      },
      {
        "id": "def456",
        "network": "x",
        "username": "myaccount",
        "status": "published",
        "error": null,
        "platformPostId": "1234567890123456789",
        "publishedAt": "2025-01-15T10:30:02Z"
      }
    ]
  }
}

2. Webhooks (Push)

post.deleted also reports posts removed on Facebook after publishing through Outstand. It identifies the affected destination with socialAccountId. This event is currently Facebook only and does not fire for Outstand API deletions. See webhook events for the payload.

If you've configured webhooks, you'll receive real-time notifications when publishing completes:

post.published - Sent when at least one account succeeds:

{
  "event": "post.published",
  "timestamp": "2025-01-15T10:30:05Z",
  "data": {
    "postId": "9dyJS",
    "socialAccounts": [
      {
        "network": "x",
        "username": "myaccount",
        "platformPostId": "1234567890123456789"
      },
      {
        "network": "facebook",
        "username": "MyPage",
        "error": "Failed to upload..."
      }
    ]
  }
}

post.error - Sent when ALL accounts fail:

{
  "event": "post.error",
  "timestamp": "2025-01-15T10:30:05Z",
  "data": {
    "postId": "9dyJS",
    "socialAccounts": [
      {
        "network": "facebook",
        "username": "MyPage",
        "error": "Access token has expired"
      }
    ]
  }
}

See the Webhooks documentation for setup instructions.

Best Practices

  1. Use webhooks for real-time updates: Instead of polling, configure webhooks to receive immediate notifications when publishing completes or fails.

  2. Check per-account status: A post can partially succeed - some accounts may publish while others fail. Always check the status field for each social account.

  3. Handle retries: If publishing fails due to a transient error (rate limit, temporary outage), retry the failed accounts with POST /v1/posts/{id}/retry.

  4. Store platform IDs: After successful publishing, store the platformPostId returned for each account. You'll need this for analytics, comments, and other platform-specific operations.

  5. Monitor for token expiration: Common errors like "Access token has expired" indicate the need to reconnect the social account.