Instagram automation API for agencies and platforms

Put a "Connect Instagram" button on your own website. Your clients approve access on Instagram and their account lands in your Repli workspace, ready for Comment-to-DM, DM keyword replies and AI chat — they never create a Repli account.

Is there an Instagram automation API agencies can use for their clients?

Yes. Repli’s Partner Onboarding API lets an approved agency or platform create a one-time onboarding link for each client from its own server. The client opens the link, approves access through Instagram’s official login, and the Instagram account is added to the agency’s Repli workspace. The agency then manages Comment-to-DM and other Instagram automations for that client. Clients need an Instagram Business or Creator account and never create a Repli account.

How to connect client Instagram accounts through the API

  1. Buy API access and client seats: In your Repli workspace open API access, pay the one-time ₹1,999 (US$20) access pack, buy client seats at ₹249 per client per month, then create your partner API key (starts with rpk_) and add your https return sites.
  2. Client clicks "Connect Instagram": The button lives on your own website or client dashboard. Your client never signs up for Repli.
  3. Your server creates a session: Your server calls the API with action "create_session", your client's ID and a return URL. Links expire after 24 hours, so create a new one on every click.
  4. Client approves on Instagram: Redirect the client (full page, not an iframe or popup) to the returned onboarding_url. They agree and approve permissions on Instagram — no passwords are shared.
  5. Confirm and automate: Repli sends the client back with repli_status and repli_session_id. Your server calls "get_session" to confirm status "connected", then you manage the account’s Comment-to-DM and other automations from your Repli workspace.

Need the full reference? Read the Partner Onboarding API docs.

Sources

Related guides

Why teams choose Repli

What you get

One API call per client

Your server calls create_session and redirects the client to the onboarding link. Links expire after 24 hours.

Your workspace, your clients

Every connected account is tagged with your partner ID and your external customer ID, so you can see which client is which.

All Instagram automations

Run Comment-to-DM, DM keyword replies, follow-gated replies, lead collection and AI chat on client accounts, subject to your plan.

Server-only partner keys

Authenticate with the x-repli-partner-key header from your server. Keys are stored hashed and can be rotated or disabled by Repli.

Approved return sites

Clients are only sent back to https addresses on your approved list, and your server confirms the result with get_session.

Works with AI website builders

Paste the ready-made prompt below into Lovable or a similar builder to add the button and confirmation page.

Use cases

Social media agencies

Onboard every client’s Instagram from your client portal and run their Comment-to-DM campaigns from one workspace.

Website and page builders

Offer "Enable Comment-to-DM" as a feature inside your own product, without sending customers to another sign-up.

Creator and influencer platforms

Let creators connect Instagram once and receive automated DMs for their Reels and posts.

Freelancers and consultants

Keep client accounts separated by external customer ID while you manage automations for them.

API reference

Endpoint: POST https://zwawkzzkpxnexynhzpdx.supabase.co/functions/v1/partner-onboarding. Headers: Content-Type: application/json and x-repli-partner-key: rpk_… (your partner key).

Create a session: { "action": "create_session", "external_customer_id": "client_123", "external_customer_name": "Asha's Bakery", "return_url": "https://yoursite.com/instagram/done" }. The response includes session_id, status, onboarding_url and expires_at.

Check a session: { "action": "get_session", "session_id": "…" }. Status is pending, started, connected or expired; when connected the response includes instagram_username.

Errors: 401 — invalid or disabled partner key. 402 ACCESS_REQUIRED — the API access pack is not active for your workspace. 409 PARTNER_LIMIT or WORKSPACE_CAPACITY — all paid client seats are in use; buy more client seats. 400 — invalid input, such as a non-https or unapproved return_url.

Rules for partners

Keep the partner API key on your server only — never in browser code. If it leaks, ask Repli to rotate it.

return_url must use https and be on one of your approved return sites.

The client needs an Instagram Business or Creator account and must approve permissions on Instagram.

Open the onboarding link in a normal browser tab, not an iframe or in-app browser.

Each connected client uses one paid client seat (₹249 per month).

Tell clients that you will manage automated replies on their account and how they can ask you to disconnect.

Prompt for an AI website builder

Copy this prompt into Lovable or a similar AI website builder, and store your partner key as a secret named REPLI_PARTNER_KEY:

Add a "Connect Instagram" button to the client dashboard. When clicked, call a server function (never the browser) that POSTs to https://zwawkzzkpxnexynhzpdx.supabase.co/functions/v1/partner-onboarding with header x-repli-partner-key read from a secret named REPLI_PARTNER_KEY and JSON body { "action": "create_session", "external_customer_id": <logged-in client's id>, "external_customer_name": <business name>, "return_url": "https://<my-site>/instagram/done" }. Redirect the browser (full page, not an iframe or popup) to the onboarding_url in the response. Show friendly errors for 409 (no slots available) and 401 (integration disabled). Create a /instagram/done page that reads repli_session_id from the URL, calls the same server function with { "action": "get_session", "session_id": ... }, and if status is connected saves the session id and instagram_username against the client and shows "Instagram connected"; otherwise shows "Not connected yet" with a retry button. Store per client: Repli session id, status, Instagram username, connected date.

How this differs from a white-label chatbot

Most white-label chatbot platforms resell a builder under your brand. Repli’s partner API solves a narrower job: getting a client’s Instagram account connected to your workspace from your own site, using Instagram’s official login, so you can run the automations for them.

Automations still follow Instagram rules, including the 24-hour messaging window. Repli does not send messages from client accounts until you set up and enable automations.

Pricing

API access pack: ₹1,999 or US$20, paid once. It is not a monthly charge.

Client accounts: ₹249 (US$3) per connected client account, per month, billed as a recurring Razorpay subscription. Buy as many client seats as you need.

Client seats are separate from your own workspace Instagram slots, so client accounts never use up your own accounts.

AI replies on client accounts use the AI credits you recharge in your own Repli workspace. Clients are never billed by Repli.

Frequently asked questions

Do my clients need a Repli account?

No. Clients approve access on Instagram and their account is added to your Repli workspace. Only you log in to Repli.

Do clients share their Instagram password?

No. They approve permissions through Instagram’s official login. Repli never asks for passwords.

Which Instagram accounts can connect?

Instagram Business or Creator accounts. Personal accounts must be switched to a professional account first.

Can I embed the onboarding in an iframe?

No. Open the onboarding link in a normal browser tab with a full-page redirect, not an iframe, popup or in-app browser.

How long is an onboarding link valid?

24 hours. Create a new session each time a client clicks Connect.

How do I know a client connected?

Repli returns the client to your return_url with repli_session_id. Your server calls get_session and checks that status is connected.

How much does the API cost?

A one-time ₹1,999 (US$20) access pack, plus ₹249 (US$3) per connected client account per month. AI replies use the AI credits you recharge in your own workspace.

What happens when I run out of client seats?

create_session returns 409 WORKSPACE_CAPACITY. Buy more client seats from API access in your workspace.

How do I get a partner API key?

Sign in to Repli, open API access, buy the access pack and client seats, then create your key and add your return sites. Repli can disable a key that breaks the rules.

Pricing · All features · How it works · Blog