ConnectHub API Documentation

Welcome to the ConnectHub REST API. This guide provides everything you need to integrate with our platform programmatically. Build integrations, automate workflows, and extend your social applications with our robust, developer-friendly endpoints.

๐ŸŒ Base URL: https://api.connecthub.com/v1

All requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Authentication

ConnectHub uses API keys to authenticate requests. You can view and manage your API keys in the ConnectHub Developer Dashboard. Your API keys carry many privileges, so be sure to keep them secure. Do not share your API keys in publicly accessible areas such as GitHub, client-side code, etc.

Authenticate your API requests by including the Authorization header with a valid Bearer token:

Authorization Header
Authorization: Bearer your_api_key_here

Include this header in every API request. If your API key is invalid or expired, you will receive a 401 Unauthorized response.

Endpoints

Below are the core endpoints available in the ConnectHub API. Each endpoint follows standard REST conventions and returns JSON responses.

GET /users/{user_id}

Retrieve a specific user's public profile information by their unique identifier.

ParameterTypeRequiredDescription
user_idstringYesUnique identifier of the user
Response (200 OK)
{
  "id": "usr_8f3a9c2d",
  "username": "sarah_design",
  "display_name": "Sarah Mitchell",
  "bio": "Digital artist & UI designer",
  "followers_count": 12450,
  "verified": true,
  "created_at": "2023-04-12T18:30:00Z"
}
POST /posts

Create a new post on behalf of an authenticated user.

ParameterTypeRequiredDescription
contentstringYesPost text content (max 5000 chars)
media_urlsarrayNoList of image/video URLs
visibilitystringNopublic, followers, private
Request Body
{
  "content": "Just launched my new portfolio! ๐ŸŽจโœจ",
  "media_urls": ["https://cdn.connecthub.com/img/123.jpg"],
  "visibility": "public"
}
Response (201 Created)
{
  "id": "post_9x2m4n7p",
  "status": "published",
  "created_at": "2025-01-15T10:22:00Z",
  "engagement": {
    "likes": 0,
    "comments": 0,
    "shares": 0
  }
}
GET /feeds/{feed_type}

Retrieve paginated feed items based on type. Supports cursor-based pagination.

ParameterTypeRequiredDescription
feed_typestringYeshome, trending, followers
limitintegerNoItems per page (default: 20, max: 50)
cursorstringNoPagination cursor from previous response
Response (200 OK)
{
  "items": [
    {
      "id": "post_abc123",
      "author": { "id": "usr_xyz", "username": "dev_jay" },
      "content": "Building in public ๐Ÿš€",
      "created_at": "2025-01-14T09:15:00Z"
    }
  ],
  "next_cursor": "eyJpZCI6MTIzfQ==",
  "has_more": true
}

Error Handling

ConnectHub uses standard HTTP status codes to indicate success or failure. Codes in the 2xx range indicate success, 4xx indicate client errors, and 5xx indicate server errors.

CodeMeaningResolution
400Bad RequestCheck request body and parameters
401UnauthorizedVerify your API key and authentication header
403ForbiddenYou lack permissions for this action
404Not FoundEndpoint or resource does not exist
429Too Many RequestsRate limit exceeded. Check X-RateLimit-Reset header
500Internal Server ErrorConnectHub issue. Retry after a few seconds

All error responses follow this JSON structure:

Error Response
{
  "error": {
    "code": "invalid_api_key",
    "message": "The provided API key is invalid or expired.",
    "status": 401,
    "request_id": "req_8f3a9c2d"
  }
}

Rate Limits

API requests are rate-limited to ensure fair usage and platform stability. Limits vary by subscription tier. Headers in every response indicate your current usage.

HeaderDescription
X-RateLimit-LimitMax requests allowed per window
X-RateLimit-RemainingRequests left in current window
X-RateLimit-ResetUNIX timestamp when the window resets
PlanRequests/HourBurst LimitWebhook Events
Free1,00020/min100/day
Pro Creator10,000100/min10,000/day
Enterprise100,000+CustomUnlimited

Implement exponential backoff for 429 responses. Never block on rate limits.

Official SDKs & Tools

Accelerate development with our officially maintained client libraries and integrations.

JavaScript / Node.js

npm install @connecthub/sdk

Python

pip install connecthub-py

cURL Examples

curl -X GET https://api.connecthub.com/v1/users/me -H "Authorization: Bearer $TOKEN"