InsightIQ Authenticated APIs: Onboarding Guide
Welcome to InsightIQ. This guide walks your engineering team through integrating our Authenticated APIs,from creating your dashboard account to going live in Production. Authenticated APIs give you data that creators share with you directly: their profile, audience demographics, content and engagement, and comments. Because the creator logs in and grants consent, this data comes straight from the platform and is more complete than anything available publicly.
We'd like to see you integrated within a few weeks, and we're here to help along the way. If you get stuck at any point, reach out to us at [email protected].
1. How the integration fits together
There are three pieces to build, and they work in a loop.
Connect SDK - Your creator opens the SDK in your web or mobile app, picks a platform, logs in and grants consent.
Webhooks - Once the account is connected, we sync the creator's data and notify your server as each part becomes available, and again whenever it changes.
API - Your backend calls our API to fetch the data named in each webhook.
Webhooks are what keep this efficient. Instead of polling us for changes, you wait to be told something is new and then fetch only that.
How the data is organised
Every record you receive sits somewhere in this hierarchy. It helps to model your own database the same way.
Level | What it represents | Identified by |
|---|---|---|
User | A creator on your platform. You create one user per creator. |
|
Account | One social account the user has connected, such as their Instagram. A user can have several. Holds the connection status and sync details. |
|
Profile | The creator's identity on that platform: picture, bio, follower and following counts. |
|
Content | A single post, reel or video, with its engagement metrics. | content |
Content group | A post made up of several items, such as an Instagram carousel or a YouTube playlist. | content group |
So a creator who connects Instagram and YouTube is one user with two accounts, and each account has its own profile and content.
2. Setting up on the dashboard
Your API keys, webhooks and a test version of the SDK all live in the InsightIQ dashboard.
Create your account
Sign up from insightiq.ai or go straight to the registration page. Use your work email. If several people on your team will need access, we recommend signing up with a shared team address rather than one person's email.
Choose an environment
The dropdown at the top of the left-hand menu switches between three environments. Each has its own API keys, webhooks and data, so nothing you do in one affects the others.
Environment | Data | What it's for |
|---|---|---|
Sandbox | Dummy data | Building your first flow without touching real accounts |
Staging | Real accounts and live data, up to 25 connected accounts | Testing end to end before launch |
Production | Real accounts and live data, as per your order form | Your live product |
We suggest working through them in that order. The 25 Staging accounts are a one-time allowance and don't reset, so save them for real end-to-end tests.
Get your API keys
Open API keys in the menu. You'll see a Client ID and a Secret for the environment you've selected.
Keep the Secret on your server and never ship it in frontend or mobile code. If you ever need a new one, click Rotate. The old Secret keeps working for about a week, which gives you time to switch over without downtime
Register a webhook
Open Webhooks and click Create webhook. Give it a name, enter the HTTPS URL where you want to receive events and pick the events you need. IP addresses and localhost URLs aren't accepted. You can register up to three webhooks.
Section 5 covers which events to pick and how to handle them.
Try the SDK in the Playground
Before writing any code, you can see the whole connection flow in the Playground. Go to Products, find Connect & authenticated APIs and click Playground.
Click Simulate step 1 to create a test user and SDK token, then launch the SDK and connect an account. Accounts you connect here count toward your usage, just like any other connection.
3. Moving to Production
Production is switched on once your invoice has been paid. Send us the email address you use to log in to the dashboard and we'll enable Production for that account.
Until then, Production appears in the environment dropdown with a Request access button
When it's active, select Production in the environment dropdown to find your Production keys and the usage portal. Remember to register your Production webhooks too, since they're separate from Staging.
4. Connecting creators with Connect SDK
Connecting a creator takes two calls from your backend and one step in your frontend
Step 1: Create a user
When a creator signs up on your platform, create a matching user with POST /v1/users. Pass their name and your own unique ID for them as external_id
We return a user_id . Save it against the creator in your database, because you'll need it for every token and data request.
Create each creator only once. If the same person comes back to connect another platform, reuse their existing user_id rather than creating a new user. Checking your own records for a saved user_id before calling POST /v1/users is the simplest way to avoid duplicates.
Step 2: Create an SDK token
Call POST /v1/sdk-tokens with the user_id and the list of products you want the creator to grant.
The products decide which permissions the creator is asked for, so request only what you'll use. Fewer permissions make for a quicker, friendlier consent screen.
Product | What you get |
|---|---|
| Profile details: picture, bio, follower and following counts, category, content count |
| Audience demographics such as country, city, age and gender |
| Content, content groups and their engagement metrics |
| Comments on the creator's content |
| Permission to post on the creator's behalf (see section 7) |
An SDK token is valid for one week, but it only needs to live for the length of the connection session. Create a fresh one each time a creator opens the SDK.
Step 3: Open Connect SDK
Pass the token to the SDK in your app. Here's the web version:
Step 3 in a mobile app
For mobile apps, use our native or hybrid SDKs rather than the web SDK in a WebView. The steps are the same on every platform: add the SDK, build a config with the token, initialise, then call open().
SDK | Minimum version | How to install |
|---|---|---|
iOS | iOS 12 | CocoaPods: pod 'PhylloConnect', then pod install --repo-update |
Android | Android API level 21, Java 8 | Maven Central: implementation "com.getphyllo:phyllo-connect:0.3.2" |
Flutter | iOS 12, Android API level 21 | pubspec.yaml: phyllo_connect: >=0.3.3 |
React Native | iOS 12, Android API level 21 | npm install react-native-phyllo-connect, then cd ios && pod install |
The config takes the same options everywhere: clientDisplayName, environment (staging or production), userId, token, and optionally singleAccount and workPlatformId. On iOS you also set a delegate, and on Android a callback, to receive the SDK events described below.
iOS
Android
Flutter
React Native
Each SDK has a sample app on GitHub, linked from its integration page in our docs: iOS, Android, Flutter and React Native.
What your creator sees
The creator reads the consent screen, picks a platform, logs in and approves the permissions you requested. You can walk through this flow yourself in the Playground under Products > Connect & authenticated APIs (see section 2).
Some platforms have their own requirements. Instagram, for example, connects through Facebook, so the creator needs an Instagram Creator or Business account linked to a Facebook page, and has to select that page when they log in.
When everything is approved, the creator sees a confirmation and can close the SDK or connect another account.
Listening to SDK events
The SDK tells your frontend what happened through callbacks. The one you'll always need is accountConnected: pass the IDs it gives you to your backend.
Event | You receive | When it fires |
|---|---|---|
accountConnected | accountId, workplatformId, userId | An account was connected |
accountDisconnected | accountId, workplatformId, userId | An account was disconnected |
tokenExpired | userId | The SDK token expired. The SDK closes, so offer the creator a way to try again with a new token. |
exit | reason, userId | The creator closed the SDK |
connectionFailure | reason, workplatformId, userId | A connection attempt failed (optional) |
The exit event tells you why the creator left:
Reason | What happened |
|---|---|
| They pressed Done, usually after a successful connection |
| They pressed back |
| They closed the SDK on the platform list |
| They closed it on a platform's details screen |
| They closed it on the connection error screen |
And connectionFailure tells you why a connection didn't go through:
Reason | What happened |
|---|---|
| The creator abandoned the connection |
| They connected the wrong type of account, for example a personal Instagram account |
| They didn't grant all the permissions needed |
Making it look like your product
You can set your logo, your brand name (clientDisplayName on web, client_display_name elsewhere), an accent colour and the language. The layout and fonts stay the same for everyone, because the platforms require a consistent consent experience.
Popup or redirect on the web
On the web, the SDK can run in one of two ways. We recommend the popup flow wherever you can use it.
Popup flow. The creator stays on your page. The SDK opens in a full-screen modal on top of it, and the platform's login opens in a popup window. Results come back to your page through the JavaScript events described above.
Redirect flow. The creator is sent to the SDK, then to the platform, and finally back to a URL you choose. The results arrive as query parameters on that URL.
To use redirect, set redirect: true and a redirectURL in the config. When the creator comes back, read these query parameters:
Parameter | Contains |
|---|---|
| The user who went through the SDK |
| The accounts connected, each with its account ID and work platform ID |
| The accounts disconnected |
| Why the SDK closed (the same reasons as the exit event, plus TOKEN_EXPIRED) |
Why we recommend popup:
The creator never leaves your URL, which builds trust.
Your page stays open in the background, so you don't have to rebuild your app's state after the connection.
Creators can connect several accounts and retry a failed connection in the same session.
You get events as they happen, including failures with a reason. With redirect, you only find out what happened once the creator lands back on your URL.
Fewer page loads and network calls, so fewer things can go wrong.
It doesn't depend on cookies or browser storage. Redirect does, although platform logins may still need cookies in either flow.
When to use redirect instead: popups are blocked in most in-app browsers and WebView (for example SafariViewController or Chrome Custom Tabs). If your creators will open your web page inside another app, use redirect there, or better, use one of our native mobile SDKs. We don't support WebView integrations, since some platforms block logins from them. A common setup is popup by default with redirect as a fallback.
You're likely to run into in-app browsing if:
your mobile app is your web app wrapped in a WebView
creators open your link from inside another app, such as Instagram, Facebook, LinkedIn, X or Gmail, which opens it in its own browser
you're using a hybrid framework like React Native, Flutter or Ionic (Cordova) and reusing the web integration instead of our framework-specific SDK
For more background, see our page on mobile in-app browsing.
Popup has been tested on current versions of Chrome, Firefox, Edge and Brave, on desktop and mobile. For the full comparison, see our guide to web flows.
Skipping the platform list
If your creator has already chosen a platform in your app, pass its work_platform_id when you initialise the SDK and they'll go straight to that platform's login. You can look up IDs with the Retrieve all work platforms API.
By default, a creator can connect several accounts in one session. Set singleAccount to true to allow just one.
5. Webhooks
Webhooks tell your server when a creator connects, when their data is ready and when anything changes. We strongly recommend building on them rather than polling the API.
Handling a webhook
When a webhook arrives:
Verify the
Webhook-Signaturesheader against the raw request body and your webhook secret.Return
200 OKstraight away. We wait 5 seconds for a response.Process the event in the background, for example by putting it on a queue.
If we don't get a 200 in time, we retry after 60 seconds, then 5 minutes, then 6 hours. That means an event can arrive more than once, and events won't always arrive in order. Use the event id to ignore duplicates.
What a webhook looks like
event tells you what happened and data tells you what to fetch. When an update touches a lot of records, the IDs are split across several webhooks of up to 100 IDs each.
Which events to subscribe to
Subscribe to the groups that match the products in your SDK token.
Group | Events | What to do next |
|---|---|---|
| CONNECTED, DISCONNECTED, UPDATED, REMOVED | Fetch the account by |
| EXPIRED | Ask the creator to reconnect |
| ADDED, UPDATED, REMOVED | Fetch the profile by |
| ADDED, UPDATED, REMOVED | Fetch audience data by |
| ADDED, UPDATED | Fetch the listed content IDs |
| ADDED, UPDATED, REMOVED | Fetch comments for the listed content |
| ADDED, UPDATED, REMOVED | Fetch the listed content groups |
| ADDED, UPDATED, REMOVED | Fetch comments for the listed content groups |
If you use Publish, also subscribe to CONTENTS.PUBLISH_READY, CONTENTS.PUBLISH_SUCCESS and CONTENTS.PUBLISH_FAILURE.
When a creator's session expires
Each platform gives us an access token when the creator connects. If that token expires or is revoked, we send SESSION.EXPIRED and pause syncing for the account until the creator reconnects through Connect SDK. Make sure you're subscribed to it and have a way to bring the creator back.
Platform | Access token validity | Refresh token |
|---|---|---|
YouTube | 60 minutes | Yes |
Twitch | 4 hours | Yes |
TikTok | 24 hours | Yes |
60 days | No | |
IG Direct | 60 days | No |
60 days | No | |
2 months | Yes | |
Twitter / X | Not specified; usually doesn't expire | No |
On any platform, the token can also be invalidated early, for example if the creator changes their password, removes permissions or disconnects your app from the platform's settings.
6. Fetching data with the API
All API calls come from your backend, using your Client ID and Secret.
Base URLs
Environment | Base URL |
|---|---|
Sandbox | |
Staging | |
Production |
Authentication
We use HTTP Basic authentication. Your Client ID is the username and your Secret is the password:
The SDK token from section 4 is only for opening the SDK. It isn't used for API calls.
Work platform IDs
Every platform has a fixed work_platform_id. You'll see it in webhooks and API responses, and you can pass it to the SDK to preselect a platform. Instagram, for instance, is 9bb8913b-ddd9-430b-a66a-d74d846e6c66. The Retrieve all work platforms API returns the full list.
Users and accounts
You can retrieve any user or account you've created. The account record tells you what has been synced and its status: CONNECTED, NOT_CONNECTED or SESSION_EXPIRED.
When a creator no longer wants to share their data, or leaves your platform, disconnect their account with the Disconnect account API. We stop syncing, send ACCOUNTS.DISCONNECTED and the account no longer counts toward your usage.
The response returns the account with status set to NOT_CONNECTED
Profile and audience
The Profile API returns the creator's identity on the platform: picture, name, bio, follower and following counts, category and content count. The Audience API returns demographics such as country, city, age and gender, where the platform provides them.
A profile response looks like this (shortened):
Fields a platform doesn't provide come back as null , so check for that before displaying them.
And an audience response:
Each value is a percentage of the creator's audience.
Content and content groups
Which endpoint you call depends on the kind of post.
Post type | Examples | Use |
|---|---|---|
Single item | One reel, video or image post | Content endpoints |
Multiple items in one post | Instagram carousel, YouTube playlist | Content group endpoints |
To get | Content items | Content groups |
|---|---|---|
One record | ||
All records for an account |
When a CONTENTS or CONTENT-GROUPS webhook arrives, fetch the IDs it lists. To page through everything for an account, use the list endpoints with limit (1 to 100, default 10) and offset.
Each content item includes its engagement: likes, comments, views, saves, shares and so on, plus the title, format, type, URL and publish date. A content group also has a type of ALBUM or PLAYLIST and an item_count.
How much history you get
When an account connects, we sync the content published in the last 90 days. To go further back, call one of our fetch historic endpoints, such as Fetch historic content items, with a start date. We collect everything created or published on or after that date, send the usual webhooks when it's done, and you fetch it as normal. There's no extra charge for this, since Authenticated API usage is billed per connected account.
The list endpoints for content items and content groups both take from_date and to_date (YYYY-MM-DD), so you can also narrow any request to a date range
A few things to keep in mind:
A historic fetch is a one-off. It doesn't change the regular schedule, so after it finishes we carry on refreshing only the last 90 days, and older posts keep the stats they had when fetched.
It's available for content and income data. Profile and audience data don't have a history, so they can't be fetched this way.
You get old posts, not old numbers. Stats show today's values, and you can't retrieve what a creator's follower count was on a past date.
How often data refreshes
Every account starts on our standard refresh schedule. You don't need to do anything to get it, just make sure you're subscribed to the webhooks so you hear about each update.
Data | On connection | After that |
|---|---|---|
Profile | Current profile | At least every 24 hours |
Audience | Current demographics | Weekly |
Content and content groups | Published in the last 90 days | At least every 24 hours, on a rolling 90-day window |
Comments | On content from the last 90 days | At least every 24 hours |
We guarantee at least one update every 24 hours for daily data. Depending on platform quotas and load, you may see more. Short-lived content such as Instagram Stories, which disappears after a day, is synced at intervals suited to it.
The 90-day window rolls forward each day. For an account connected on 10 October, we sync content published on or after 12 July. The next day the window starts at 13 July: content from 12 July stays available, but its stats are no longer refreshed.
Profile and audience data are a snapshot of right now. Each refresh replaces the previous values, so if you want to track follower growth over time, store the numbers on your side each time they change.
Refreshing on demand
If you need fresh data before the next scheduled update, call one of our refresh endpoints, such as Refresh a profile. Each product has its own, so you only refresh what you need. The refresh runs in the background and we send a webhook when it's done. It uses the same windows as the standard schedule.
Teams use this to let creators update their stats with a button, sometimes as a premium feature, or to run their own schedule, such as a weekly refresh for a particular data set. Monitoring type is set per Client ID. With On Demand monitoring, data only refreshes when you call these endpoints. More detail is in our data refresh guide.
Rate limits
Staging | Production | |
|---|---|---|
Authenticated APIs | 4 requests per second | 20 requests per second |
If you go over the limit you'll get HTTP 429. Wait for the time in the Retry-After header before trying again, and try not to run at the limit all the time. Our rate limits guide has more detail.
Errors
We use standard HTTP status codes. When something fails, log the error_code, message, http_status_code and request_id from the response. If you contact us about an error, including the request_id lets us find it quickly.
7. Publishing content
Publish lets you post content to a creator's account on their behalf. It's available for TikTok and YouTube.
Add
PUBLISH.CONTENTto the products when you create the SDK token, so the creator grants posting permission.Create a publish request with POST content publish.
Check its progress with GET content publish, or listen for the
CONTENTS.PUBLISH_READY,CONTENTS.PUBLISH_SUCCESSandCONTENTS.PUBLISH_FAILUREwebhooks.
A publish request needs the account_id, a type (such as VIDEO, REELS or SHORTS) and a media list with each item's media_type and a public source_media_url. You can also set a title, description, visibility (PUBLIC, PRIVATE or UNLISTED) and whether to retry on a technical failure. We reply with 202 and the request's status: READY, IN_PROGRESS, SUCCESS or FAILURE.
8. Testing your integration
Try requests from the docs
Every endpoint in our developer docs has a request panel, so you can call the API without writing any code.
Open the endpoint you want to try.
Enter your Client ID as the username and your Secret as the password.
Fill in any parameters.
Choose the server (Sandbox, Staging or Production) and click Send API Request.
The response appears underneath, and the cURL sample updates so you can copy it into your own code.
If you prefer Postman, import our Postman collection.
Send yourself a test webhook
To check your webhook handler before real data arrives, ask us to send a mock notification to your registered URL:
Set event to whichever event you want to test, including SESSION.EXPIRED .
9. Usage and Billing
Authenticated APIs are billed by the number of connected accounts, not by the number of API calls.
Each platform account a creator connects counts once. A creator who connects Instagram and YouTube counts as two.
Disconnected accounts don't count.
In Staging you can connect up to 25 accounts in total. This allowance is one-time and doesn't reset.
In Production, every connected account counts toward the limit in your order form. That includes accounts connected through the Playground.
Once Production is enabled, the usage portal shows your credit balance and any unpaid invoices. View credit block detail breaks your balance down, and Invoice history lists past invoices.
10. Before you go live
Run through this list in Staging first, then again in Production.
☐ Creators are created once, and their user_id is saved and reused
☐ SDK tokens are created on your backend with only the products you need
☐ Connect SDK opens and connects an account on each platform you support
☐ You handle accountConnected, tokenExpired and exit in your frontend
☐ Webhooks are registered in both Staging and Production
☐ Your webhook handler verifies the signature, replies within 5 seconds and ignores duplicates
☐ Profile, audience, content and comments are fetched after the matching webhooks
☐ SESSION.EXPIRED prompts the creator to reconnect
☐ 429 responses are retried after Retry-After
☐ Production keys are stored securely and your base URL points to https://api.insightiq.ai
Getting help
Email us at [email protected]. If it's about an API error, please include the request_id and leave out your Secret or any credentials. During onboarding we can also set up a shared Slack channel with your team. You can subscribe to our status page from API status in the dashboard to hear about incidents as they happen.