Guides

Headless connect

Let your users connect their Facebook Pages, Instagram accounts, YouTube channels and more from inside your product. They never see Publishing Studio, and the social-network tokens never reach your servers.

The flow

1Your serverstarts the connection
2Your userapproves on the network
3Your appgets a connect token
4Your serverlists and finishes

All three API calls need the accounts:connect scope, and all must use the same API key — a connect token works only with the key that started it.

Step by step

  1. Start the connection

    Call POST/connect/{platform}/headless with the URL your user should come back to (https://, or http://localhost while developing). For Mastodon-family networks, pass the user's server as instance. Pass the ecosystemId the account belongs to — required on Pro, where every account lives in an ecosystem; on Unlimited you may leave it out to connect many accounts at once.

    Request
    curl -X POST "https://dashboard.lifebliss.app/api/v1/connect/facebook/headless" \
      -H "Authorization: Bearer $PS_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "redirectUrl": "https://app.example.org/connected" }'
    
    # 201 → { "authUrl": "https://www.facebook.com/…", "state": "…", "expiresInSeconds": 900 }
  2. Send your user to authUrl

    Redirect the user to authUrl within 15 minutes. They sign in to the network and approve access there.

  3. Receive the connect token

    The user lands back on your redirectUrl with a connect_token — or an error if they cancelled or the network refused. The token is valid for 15 minutes.

    Redirect
    https://app.example.org/connected
      ?connect_token=…
      &platform=facebook
      &step=select_account
  4. Show what they can publish to

    One login can manage many pages or channels. GET/connect/select lists them, paginated, with an optional search; matchedIds holds every match across pages so a “select all” is one call. Render the choices in your own UI.

    Request
    curl "https://dashboard.lifebliss.app/api/v1/connect/select?token=$CONNECT_TOKEN&search=evening" \
      -H "Authorization: Bearer $PS_API_KEY"
    Response · 200
    {
      "platform": "facebook",
      "total": 14,
      "matched": 2,
      "page": 1,
      "hasMore": false,
      "accounts": [
        { "platformAccountId": "1029…", "displayName": "Evening Sessions", "username": null, "avatarUrl": "…" }
      ],
      "matchedIds": ["1029…", "4471…"]
    }
  5. Finish

    Send the chosen platformAccountIds (or one platformAccountId) toPOST/connect/select. Put them in an existing group with groupId, or a new one with newGroupName. The accounts are now ready to publish to.

    Request
    curl -X POST "https://dashboard.lifebliss.app/api/v1/connect/select" \
      -H "Authorization: Bearer $PS_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "token": "CONNECT_TOKEN",
        "platformAccountIds": ["1029…", "4471…"],
        "newGroupName": "Evening pages"
      }'
    
    # 201 → { "connected": 2, "accounts": [ … ], "group": { … }, "unavailable": [], "warnings": [] }

Rules and errors

StatusWhen
400Invalid redirect URL or instance, a network that doesn't use OAuth — or, when finishing, a group-limited key without groupId.
402No active plan or trial; on Pro, a connection without an ecosystemId or with more than one account (bulk connect is on Unlimited); or X before the plan is paid.
409The chosen accounts are no longer offered by the network.
410The connect token expired. Start again.
424The user's server (Mastodon-family) refused app registration.