Welcome to ConnectHub Docs
ConnectHub provides a robust, scalable API for building social media experiences, managing communities, and engaging users in real-time. This documentation covers everything from authentication to advanced WebSocket integrations.
Quick Start
Initialize a client instance and make your first API request. All requests are authenticated via OAuth 2.0 or API keys.
import { ConnectHub } from '@connecthub/sdk';
const hub = new ConnectHub({
apiKey: process.env.CH_API_KEY,
environment: 'sandbox'
});
// Create your first post
const post = await hub.posts.create({
content: 'Hello from ConnectHub! 🚀',
visibility: 'public',
tags: ['getting-started', 'api']
});
console.log(post.id); // => 'pst_8x9k2m4p'
Authentication
ConnectHub uses Bearer tokens for all authenticated requests. Generate tokens via the dashboard or programmatically through the OAuth flow.
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/token |
Exchange credentials for access/refresh tokens |
| POST | /auth/refresh |
Refresh an expired access token |
| POST | /auth/revoke |
Invalidate a token immediately |
secret_key in client-side code. Use environment variables and secure backend proxies.Rate Limits
To ensure platform stability, ConnectHub enforces tier-based rate limiting. Limits reset per minute using a sliding window algorithm.
- Free Tier: 100 requests/min, 10k requests/day
- Pro Tier: 1,000 requests/min, unlimited daily
- Enterprise: Custom limits with dedicated throughput
Rate limit headers are included in every response:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 842
X-RateLimit-Reset: 1715423999
Error Handling
ConnectHub uses standard HTTP status codes and returns consistent JSON error payloads.
{
"error": {
"code": "invalid_token",
"message": "The access token provided has expired.",
"details": {
"token_expiry": "2024-01-15T10:30:00Z"
},
"documentation_url": "https://docs.connecthub.io/errors/invalid_token"
}
}