L
LimbuAI API
← Dashboard

API Docs

Ye backend kisi bhi dusre project ke frontend se use kar sakte ho — CORS open hai (*), sab endpoints JSON dete hain. Interactive Swagger UI: /docs · OpenAPI schema: /openapi.json

Base URL

Apne deployed backend ka URL (Vercel URL), jaise https://your-app.vercel.app

const BASE = "https://your-app.vercel.app";

async function api(path, options = {}) {
  const res = await fetch(BASE + path, {
    headers: { "Content-Type": "application/json" },
    ...options,
  });
  if (!res.ok) throw new Error((await res.json()).detail || res.statusText);
  return res.json();
}

// examples
const profile  = await api("/api/profile");
const media    = await api("/api/media?limit=12");
await api("/api/comments/COMMENT_ID/reply", { method: "POST", body: JSON.stringify({ message: "Thanks!" }) });
Auth: API me alag se API-key nahi hai — backend apne Instagram token (env var ya Login flow se connected account) se kaam karta hai. Ye API sirf apne trusted frontends ke liye use karo; public site pe kholna ho to pehle apna auth layer lagana.

Account & Login

GET/api/auth/status
Connected hai ya nahi, username, token expiry (din), required scopes, redirect URI.
GET/auth/login
Browser ko Instagram ki permission screen pe redirect karta hai. Isko link/button (window.location) se kholo, fetch se nahi.
GET/auth/callback
Instagram yahin wapas bhejta hai (code exchange + 60-day token save). Manually call nahi karna.
POST/api/auth/refresh
Long-lived token ko 60 din aur extend karta hai.
POST/api/auth/logout
Connected account disconnect.

Profile, Posts & Insights

GET/api/profileinstagram_business_basic
Returns id, username, account_type, media_count.
GET/api/media?limit=12instagram_business_basic
Recent posts: id, caption, media_type, media_url, thumbnail_url, permalink, timestamp, like_count, comments_count.
GET/api/media/{media_id}/insightsinstagram_business_manage_insights
reach, likes, comments, shares, saved (unsupported types pe sirf reach).

Comments

GET/api/media/{media_id}/commentsinstagram_business_manage_comments
Post ke comments: id, text, username, timestamp, like_count.
POST/api/comments/{comment_id}/replyinstagram_business_manage_comments
Body: {"message": "text"}
POST/api/comments/{comment_id}/hideinstagram_business_manage_comments
Body: {"hide": true} (false = unhide)
DELETE/api/comments/{comment_id}instagram_business_manage_comments
Comment permanently delete.

Auto-reply rules

GET/api/rules/comments /api/rules/dms
POST/api/rules/comments /api/rules/dms
Body: {"keyword":"price","reply_text":"DM us!","match_type":"contains"} — match_type: contains ya exact.
DELETE/api/rules/comments/{id} /api/rules/dms/{id}
GET/api/activity?limit=50
Activity log (manual + auto replies, publish, login).

Publishing

POST/api/publishinstagram_business_content_publish
Body: {"image_url":"https://public-image.jpg","caption":"text"}. Image URL public honi chahiye (JPEG/PNG). Returns {"status":"published","media_id":"..."}.
GET/api/publish/limit
Publishing quota (24h me kitne post ho sakte hain).
POST/api/upload
multipart file (JPEG/PNG, max 8 MB) → {"image_url": ...}. Vercel pe kaam nahi karega (filesystem persist nahi hota) — wahan pehle se hosted image URL hi /api/publish me do.

Webhook (Meta ke liye)

GETPOST/webhook
Meta App Dashboard → Webhooks me Callback URL: https://your-app.vercel.app/webhook, Verify token: VERIFY_TOKEN env var. Subscribe: comments, messages. Signature APP_SECRET se verify hoti hai.
GET/healthz
Health check → {"status":"ok"}