Mint a connect link
POST /connect-links returns a URL and nothing else. No row is written yet. A
connection is created by the callback, once Instagram returns a code, so links
that are generated and never clicked leave nothing behind.
The response carries an
id, the url, and expires_at. A link is valid for
10 minutes. Mint it at the moment the user is about to click it, and keep the
id with that user’s session.
Read the result
When the flow ends, the user lands on yourredirect_uri with three query
parameters: status, username and connect_id. Use them for display only.
Anyone can type them into a URL.
To act on the result, for example to sign the user in, check that connect_id
is the id you stored, then read the result with your API key:
status from GET /connect-links/{id}
message is set only on external_user_id_mismatch. It is null for every
other status. Branch on status, not on message.
status on the redirect
The redirect’s status query parameter carries the same values, with three
differences:
username is sent only when the status is connected, or on a repeat of a
connected callback. It is never sent for external_user_id_mismatch.
One connection per account in each workspace
A connection is unique for each workspace and Instagram account. The rules that follow from that:- Same workspace, same
external_user_id. This is a reconnect. The existing connection gets the new authorization and keeps its history. - Same workspace, different
external_user_id. This is a mismatch. The connect returnsexternal_user_id_mismatchand changes nothing, so one of your users can never take another user’s tracked media. - Different workspace. The connect succeeds. Each workspace gets its own connection and its own authorization.
external_user_id can hold more than one Instagram account.
Resolve a mismatch
A mismatch means the account already belongs to another of your users.- If it is the same person, sign them in as the user in
account.external_user_id. - If it is a different person, handle it in your own support process.
external_user_id to another.
Use the handle as your user id
If your app has no user id of its own, omitexternal_user_id. The account is
connected under its Instagram handle, and account.external_user_id returns
it. When the same person connects again, the connection is refreshed, not
duplicated.
When to set force_reauth
Instagram authorizes whichever account the browser is already signed in to. For
someone who granted the scopes before, it does that without stopping to ask.
On a first connect the flag changes nothing. On a second one it decides whether
your user picks the account or Instagram picks for them.
The connection belongs to the workspace
A connect link is minted with a workspace key, and the connection it creates is reachable from every project in that workspace. Projects separate tracked media, not people.List connected accounts
connection_status
While a connection is not
active, POST /submissions and the audience and
insights reads for that account return 409 conflict.
tracking_status
Tracking follows submissions. You never start or stop an account directly.
Accepting the first eligible media enrolls the account. Pausing or stopping the
last one ends collection. There is no account start, pause, or resume endpoint.
Keeping a connection active
ClipStake keeps each connection’s authorization current automatically. You do not need to do anything while the connection isactive.
An authorization that expires, or that Instagram rejects, moves the connection
to needs_reauth. Only a reconnect repairs it.
Reconnecting
To reconnect an account, mint a new connect link with the sameexternal_user_id as the existing connection. Pass force_reauth: true so the
user picks the right account on Instagram.
active, and
keeps its history. A different external_user_id returns
external_user_id_mismatch instead.
What happens to tracked media
Media that wasparked because the connection needed a reconnect goes back on
the schedule automatically. Each media reads at its next scheduled slot. This
applies in every non-archived project of the workspace.
Two limits apply:
- Automatic resume respects your submission capacity. Media that does not fit
stays
parked. Resume it after you raise the plan. - Media that was
parkedbecause its reads kept failing is not resumed by a reconnect. Resume it yourself. See Tracking media.