API Reference

SoshFlow API

One unified API to connect and manage YouTube, Instagram, and TikTok accounts. Authenticate users, fetch profiles, and receive real-time webhooks.

Base URL

api.soshflow.com

Auth

OAuth 2.0 + API Keys

Format

JSON REST

Quick Start

  1. Redirect user to OAuth — Send users to /api/auth/[provider]
  2. Receive callback — User returns with ?code=... parameter
  3. Exchange code — POST to /connect to get tokens + profile
  4. Store tokens — Save tokens securely for API calls
Example: Connect a YouTube account
// 1. User clicks "Connect YouTube" → redirects to Google OAuth
// 2. After auth, user returns to your callback URL with ?code=...

// 3. Exchange the code for tokens
const response = await fetch("https://api.soshflow.com/connect", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    provider: "youtube",
    code: "4/0AX4XfWh...",
    redirectUri: "https://your-app.com/callback"
  })
});

const { tokens, profile } = await response.json();
// tokens.access_token → Use for YouTube API calls
// tokens.refresh_token → Store securely for token refresh
// profile → User's channel info

Endpoints

Supported Platforms

YouTube

Features

  • Channel data
  • Video analytics
  • Upload videos
  • Manage playlists

Scopes

youtubeyoutube.force-sslyoutube.channel-memberships.creator

Instagram

Features

  • Profile data
  • Post content
  • Read insights
  • Manage comments

Scopes

instagram_business_basicinstagram_business_manage_messagesinstagram_business_content_publish

TikTok

Features

  • User profile
  • Video stats
  • Publish videos

Scopes

user.info.basicuser.info.statsvideo.publish

Error Handling

All errors return a JSON object with an error field.

Error Response
{
  "error": "Missing provider or access_token/code"
}

// Common errors:
// 400 - Missing or invalid parameters
// 500 - Token exchange failed or missing env config