BlogNetwork Pro

API Usage Guide

API Usage Guide

This guide explains how to configure and use third-party APIs and integrations in Multi-Domain AutoBlogger. All API keys are configured through environment variables or the admin panel.

Required API Keys

1. Anthropic Claude API (Required)

Purpose: AI-powered content generation (blog posts, FAQs, CTAs)

Getting Your API Key

  1. Visit console.anthropic.com
  2. Sign up or log in to your account
  3. Navigate to API Keys section
  4. Click "Create Key"
  5. Copy the API key (starts with sk-ant-api03-)

Configuring the API Key

  1. Open your .env.local file
  2. Add or update:
    ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
  3. Save the file
  4. Restart your development server

Usage & Costs

  • Uses Claude Haiku model (fast and cost-effective)
  • Token usage is tracked per generation
  • Costs vary based on content length
  • Check your Anthropic dashboard for usage and billing
Note: The API key is required for AI content generation. Without it, you can still create posts manually, but AI generation features will not work.

Optional API Integrations

2. GoHighLevel API (Optional)

Purpose: Email capture and CRM integration

Getting Your Credentials

  1. Log in to your GoHighLevel account
  2. Go to Settings > Private Integrations
  3. Click "New Private Integration"
  4. Give the integration a name
  5. Select the following scopes:
    • View Contacts
    • Edit Contacts
    • View Locations
  6. Click "Create"
  7. Copy the API Key
  8. Note your Location ID (found in Location settings)

Configuring in Admin Panel

  1. Go to Admin > Plugins
  2. Find "GoHighLevel Marketing Provider"
  3. Click "Configure"
  4. Select a domain or configure default settings
  5. Enter:
    • Location ID - Your GoHighLevel location ID
    • API Key - Your private integration API key
  6. Click "Save Configuration"

Alternative: Domain-Level Configuration

  1. Go to Admin > Domains
  2. Click on a domain
  3. Go to the Marketing tab (if plugin is enabled)
  4. Enter Location ID and API Key
  5. Save the domain
Note: GoHighLevel integration enables email capture forms on blog posts. Contacts are automatically added to your GoHighLevel CRM when users submit the form.

3. Google Analytics 4 (Optional)

Purpose: Website analytics and tracking

Getting Your Measurement ID

  1. Visit analytics.google.com
  2. Sign in with your Google account
  3. Create a new GA4 property or select an existing one
  4. Go to Admin > Data Streams
  5. Click on your web stream
  6. Copy the Measurement ID (format: G-XXXXXXXXXX)

Configuring in Admin Panel

  1. Go to Admin > Domains
  2. Click on a domain
  3. Go to the Analytics tab (if GA4 plugin is enabled)
  4. Enter your GA4 Property ID (Measurement ID)
  5. Save the domain

Alternative: Domain Settings

You can also configure GA4 directly in domain settings:

  1. Edit a domain (Admin > Domains > Click domain)
  2. In the Basic Settings tab, find GA4 Property ID
  3. Enter your Measurement ID
  4. Save the domain
Note: GA4 tracking code is automatically injected into all pages for the configured domain. Each domain can have its own GA4 property ID.

Environment Variables for APIs

Some API configurations are stored in environment variables. Here's a complete reference:

Variable Required Purpose Where to Get It
ANTHROPIC_API_KEY Yes Claude AI for content generation console.anthropic.com
DATABASE_URL Yes PostgreSQL database connection Your database provider (Neon, Vercel, etc.)
NEXTAUTH_SECRET Yes Session encryption Generate with: openssl rand -base64 32
CRON_SECRET Yes Cron job authentication Generate with: openssl rand -base64 16
ADMIN_PASSWORD No Default admin password Your choice (defaults to "admin123")
PLUGINS_JSON_URL No Third-party plugins feed URL to your plugins JSON feed

Configuring API Keys in Production

Vercel Deployment

When deploying to Vercel:

  1. Go to your Vercel project dashboard
  2. Navigate to Settings > Environment Variables
  3. Add each environment variable:
    • Variable name (e.g., ANTHROPIC_API_KEY)
    • Variable value (your actual key)
    • Environment (Production, Preview, Development)
  4. Click "Save"
  5. Redeploy your application for changes to take effect

Other Hosting Providers

For other hosting providers:

API Usage Best Practices

Security

Cost Management

Error Handling

Troubleshooting API Issues

Anthropic API Issues

Problem: AI generation fails with authentication error
Solution:
  • Verify ANTHROPIC_API_KEY is correct in .env.local
  • Ensure the key starts with sk-ant-api03-
  • Check your Anthropic account has sufficient credits
  • Verify the key hasn't been revoked
Problem: Generation works but is slow
Solution:
  • This is normal - AI generation takes 30-60 seconds
  • Check job status in the admin panel
  • Longer posts take more time to generate

GoHighLevel API Issues

Problem: Email capture forms don't submit contacts
Solution:
  • Verify Location ID and API Key are correct
  • Check the integration has required scopes
  • Ensure the integration is active in GoHighLevel
  • Check browser console for error messages

Google Analytics Issues

Problem: GA4 tracking not working
Solution:
  • Verify Measurement ID format is correct (G-XXXXXXXXXX)
  • Check the GA4 plugin is enabled
  • Verify the property ID is configured for the domain
  • Use browser dev tools to check if the GA4 script is loaded

Testing API Integrations

Testing Anthropic API

  1. Go to Admin > Posts
  2. Click "New Post"
  3. Fill in generation parameters
  4. Click "Generate with AI"
  5. Check the job status - it should show "processing" then "completed"
  6. If it fails, check the error message

Testing GoHighLevel Integration

  1. Ensure domain has Location ID and API Key configured
  2. Visit a blog post on that domain
  3. Wait 3 seconds for email capture form to appear
  4. Submit the form with test data
  5. Check your GoHighLevel contacts to verify the contact was created

Testing Google Analytics

  1. Configure GA4 Property ID for a domain
  2. Visit the domain in a browser
  3. Open browser dev tools (F12)
  4. Go to Network tab and filter for "gtag" or "analytics"
  5. You should see requests to Google Analytics
  6. Check GA4 Real-Time reports to see your visit

Next Steps

Now that you've configured your APIs: