⚡ Quick Setup

Integrate ConnectHub's social APIs in under 5 minutes. Install the official SDK, configure your environment, and make your first authenticated request.

bash
# Install via npm npm install @connecthub/sdk # Or via pnpm / yarn pnpm add @connecthub/sdk yarn add @connecthub/sdk
javascript
import { ConnectHub } from '@connecthub/sdk'; const client = new ConnectHub({ clientId: process.env.CH_CLIENT_ID, clientSecret: process.env.CH_CLIENT_SECRET, environment: 'production' // or 'sandbox' }); const me = await client.users.me(); console.log(`Logged in as: ${me.username}`);

🔐 Authentication Flow

ConnectHub uses OAuth 2.0 with PKCE for public clients and JWT-based session management. All API requests require a valid `Authorization` header.

1

Register App

Create a developer app in the Dashboard to receive your Client ID & Secret.

2

Token Exchange

Redirect users to `/oauth/authorize` and exchange the code for an access token.

3

API Requests

Attach `Bearer {access_token}` to requests. Refresh tokens last 30 days.

http
# Exchange authorization code POST /oauth/token HTTP/1.1 Host: api.connecthub.com Content-Type: application/x-www-form-urlencoded grant_type=authorization_code &code=AUTH_CODE_HERE &client_id=YOUR_CLIENT_ID &client_secret=YOUR_CLIENT_SECRET &redirect_uri=https://your-app.com/callback

👤 Users & Profiles

Manage user accounts, retrieve public profiles, and update preferences.

GET Retrieve Current User

/v2/users/me

Returns the authenticated user's public profile, subscription tier, and basic engagement stats.

ParameterTypeRequiredDescription
fieldsstringNoComma-separated list of fields to return (`id,username,avatar,bio`)
expandstringNoInclude related resources (`stats,followers`)

POST Update Profile

/v2/users/me

Update public-facing profile information. Changes propagate to the CDN within 200ms.

ParameterTypeRequiredDescription
display_namestringNoNew display name (max 30 chars)
biostringNoProfile biography (max 280 chars, markdown supported)
avatar_urlurlNoDirect link to square image (min 400x400)

📝 Posts & Media

Create, query, and moderate content across the platform. Supports text, images, video, and rich embeds.

POST Create Post

/v2/posts
json
{ "content": "Just shipped the new ConnectHub SDK! 🚀", "media": [ { "type": "image", "url": "https://cdn.ch.dev/launch.jpg" } ], "visibility": "public", "tags": ["dev", "connecthub", "sdk"], "scheduled_for": "2025-08-15T14:00:00Z" // optional }

📊 Rate Limits & Quotas

API limits are enforced per application and per authenticated user. Exceeding limits returns `429 Too Many Requests` with a `Retry-After` header.

Authentication100 / min
Read (GET)1,000 / min
Write (POST/PUT)100 / min
Media Upload50 / min • 5GB/hr
Search Index300 / min
Webhook Delivery2,500 / min

💡 Need higher limits? Upgrade to Enterprise or contact our developer success team.