Skip to main content
POST
/
api
/
composio
/
sync
Sync Reddit Connection Status
curl --request POST \
  --url https://app.puffle.ai/api/composio/sync \
  --header 'Authorization: Bearer <token>'
{
  "synced": [
    {
      "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "status": "connected"
    }
  ]
}
CLI:
puffle composio sync

Overview

Reconciles any unsettled accounts rows for the caller against the live Reddit connection state. Used after POST /api/composio/connect; completion is detected by polling this endpoint. For each unsettled row this endpoint:
  • Reads the connection status from the provider (ACTIVEconnected, INITIATED/PENDING → stays pending, REVOKED/INACTIVEdisconnected, FAILED/EXPIREDerror).
  • When the row flips to connected, fetches the Reddit username and avatar (best-effort) and writes them to display_name, profile_url, and avatar_url.
  • Idempotent: rows that are already fully settled (connected with a display name) are skipped.

AI agent notes

Polling cadence. Poll every 3–5 seconds for up to ~2 minutes after the human opens the redirectUrl from POST /api/composio/connect. Beyond that, fall back to slower polls (every 30 s) — most users finish within 30 seconds, the long tail is users who got distracted.Detecting completion. The response always returns 200, even when nothing changed. Either:
  • Inspect synced[] for an entry with status: "connected", or
  • Re-fetch GET /api/senders?type=reddit and look for a row whose status is connected and display_name is non-null.
Disconnected rows. If the provider reports the connection as missing or revoked, this endpoint writes status: "disconnected" to the row. The UI shows it as disconnected; the row sticks around for audit. Remove it from the dashboard if the human wants the disconnected row cleaned up entirely.No-op safety. Calling this when nothing is pending returns { "synced": [] }. It is safe to call on every tick of a long-poll loop.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Response

Returns one entry per unsettled accounts row that was inspected. An empty synced array means nothing was pending. The same shape is returned whether or not any rows actually changed status — diff against GET /api/senders?type=reddit to detect new completions.

synced
object[]
required

One entry per accounts row that was inspected. Rows that are already settled (connected with a display name) are not returned.