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.
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:
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:
Available Endpoints
Here is a summary of the core resources available via the API. Click on an endpoint to view detailed parameters and examples.
Example Request: Get User Profile
Here is a complete example of fetching a user profile using cURL:
curl -X GET "https://api.connecthub.com/v1/users/12345" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json"
Response Body
{
"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. |