● v1.2.0

API Authentication

ConnectHub uses Bearer token and API Key authentication to authorize access to protected resources. All API requests must include valid credentials in the header.

â„šī¸
Dashboard Access: You can generate your API keys from the Developer Dashboard under the "API Keys" section.

Overview

The ConnectHub API supports two primary authentication methods depending on your use case:

  • â€ĸ API Keys: Used for server-to-server communication. Keep these secret and never expose them in client-side code.
  • â€ĸ OAuth 2.0: Used for user authorization flows when building third-party applications that access user data on their behalf.

Request Headers

To authenticate your request, include the following header in your API calls:

Header cURL
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
X-API-Key: YOUR_API_KEY (Optional for certain endpoints)

Base URL

All API requests to ConnectHub should be made to the following base URL:

GET https://api.connecthub.com/v1/

Available Endpoints

Here is a summary of the core resources available via the API. Click on an endpoint to view detailed parameters and examples.

GET
/users/{id}
Retrieve user profile by ID
POST
/users/search
Search for users by username or email
GET
/posts
List public posts with pagination
POST
/posts
Create a new post (image/text/video)
POST
/posts/{id}/like
Like a specific post
GET
/stories/{user_id}
Retrieve active stories for a user

Example Request: Get User Profile

Here is a complete example of fetching a user profile using cURL:

cURL JSON Response
curl -X GET "https://api.connecthub.com/v1/users/12345" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json"

Response Body

JSON (200 OK)
{
  "id": "12345",
  "username": "@sarah_design",
  "display_name": "Sarah Mitchell",
  "avatar_url": "https://cdn.connecthub.com/avatars/12345.jpg",
  "bio": "Digital Artist & Illustrator 🎨 | NYC",
  "verified: true,
  "stats: {
    "followers: 850432,
    "following: 342,
    "posts: 1205
  }
}

Request Parameters

The following parameters can be passed to the /posts endpoint:

Parameter Type Description
content Required string The text content of the post. Max 280 characters.
media_url string Optional URL pointing to an image or video asset.
tags array List of hashtags to associate with the post.
visibility enum One of: public, private, friends.