Authentication

The SocialHub API uses API Keys for authentication. Each API Key is tied to your user account and provides access to your connected social media accounts.

How Authentication Works

Every API request must include your API Key in the request headers. We support two authentication methods:

X-API-Key Header

X-API-Key: your_api_key_here

Authorization Bearer

Authorization: Bearer your_api_key_here

Generating an API Key

Follow these steps to generate your API Key:

  1. Log in to SocialHub

    Access your SocialHub account at your dashboard URL

  2. Navigate to Settings

    Click on your profile icon and select "Settings" from the menu

  3. Access API Keys Section

    Go to the "API Keys" tab in the settings page

  4. Generate New Key

    Click "Generate New API Key" button

  5. Copy and Store Securely

    Copy the generated key immediately - it won't be shown again!

Important

Store your API Key securely. If you lose it, you'll need to generate a new one. Anyone with your API Key can access your account's API endpoints.

Testing Your API Key

Once you have your API Key, test it using the validation endpoint:

Validate API Keybash
curl -X POST https://your-domain.com/api/agents/v1/auth/validate \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json"

Successful response:

{
  "valid": true,
  "user": {
    "id": "user-uuid",
    "email": "user@example.com"
  }
}

Security Best Practices

Never Hardcode API Keys

Store API Keys in environment variables or secure secret management systems

Use HTTPS Only

Always make API requests over HTTPS to prevent key interception

Rotate Keys Periodically

Generate new keys regularly and revoke old ones to minimize risk

Monitor API Usage

Regularly check your API usage logs for suspicious activity

Rate Limits

To ensure service quality for all users, the following rate limits apply:

  • Authentication Endpoint: 10 requests per minute
  • Publishing Endpoints: 60 requests per hour
  • Media Preparation: 30 requests per hour
  • Scheduled Content: 100 requests per hour

When you exceed rate limits, you'll receive a 429 Too Many Requests response. Wait for the specified time in the Retry-After header before making additional requests.

Ready to make requests?

Continue to the Quick Start section to make your first API request.