Skip to main content
The FAII API provides RESTful endpoints for integrating search and AI intelligence monitoring directly into your applications, tools, and workflows.

Base URL

All API requests should be made to:
https://app.faii.ai/api
Note: For development and testing, you can use the local FAII backend API at http://127.0.0.1:8080/api

Authentication

FAII uses Bearer token authentication. Include your API token in the Authorization header of all requests:
curl https://app.faii.ai/api/supabase/dashboards \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Getting Your API Token

1

Sign In

Log into your FAII dashboard at app.faii.ai
2

Navigate to Settings

Click Settings → Integrations → API
3

Generate Token

Click “Create API Token” and copy the generated token
4

Store Securely

Store your token securely in your application (environment variables recommended)
Keep your API tokens secure! Never commit them to public repositories or share them publicly. Tokens provide full access to your FAII data.

API Architecture

Core Endpoints

The FAII API is organized around RESTful resources:
  • Campaigns - Create and manage monitoring campaigns
  • Intelligence Data - Access SERP and Chat intelligence results
  • Analytics - Historical data and trend analysis
  • Alerts - Configure and manage notification settings

Response Format

All API responses follow a consistent format:
{
  "success": true,
  "data": {
    // Response data
  },
  "message": "Operation completed successfully"
}
Error responses include error details:
{
  "success": false,
  "error": {
    "code": "INVALID_TOKEN",
    "message": "The provided API token is invalid or expired"
  }
}

Quick Start

Basic Usage Examples

// Using fetch (Node.js 18+)
const response = await fetch('https://app.faii.ai/api/supabase/dashboards', {
  headers: {
    'Authorization': `Bearer ${process.env.FAII_API_TOKEN}`,
    'Content-Type': 'application/json'
  }
});

const result = await response.json();
console.log(result.data);

Your First API Call

// List your campaigns
const campaigns = await faii.campaigns.list();

console.log(`You have ${campaigns.length} campaigns`);

Core Resources

Common Operations

Create a Campaign

const campaign = await faii.campaigns.create({
  name: 'Brand Monitoring',
  type: 'serp',
  keywords: ['your brand', 'your product'],
  frequency: 'daily',
  settings: {
    location: 'United States',
    device: 'desktop',
    search_engine: 'google'
  }
});

console.log(`Created campaign: ${campaign.id}`);

Get Ranking Data

const rankings = await faii.rankings.get({
  campaign_id: 'camp_123',
  start_date: '2025-10-01',
  end_date: '2025-10-18',
  keywords: ['specific keyword'] // optional filter
});

rankings.forEach(rank => {
  console.log(`${rank.keyword}: Position ${rank.position}`);
});

Monitor AI Mentions

const mentions = await faii.mentions.get({
  brand: 'YourBrand',
  platforms: ['chatgpt', 'claude', 'perplexity'],
  start_date: '2025-10-01'
});

console.log(`Found ${mentions.length} mentions`);

Generate a Report

const report = await faii.reports.create({
  campaign_id: 'camp_123',
  format: 'pdf',
  date_range: 'last_30_days',
  include: ['rankings', 'competitors', 'trends']
});

console.log(`Report URL: ${report.download_url}`);

Response Format

All API responses follow this structure:
{
  "success": true,
  "data": {
    // Resource data here
  },
  "meta": {
    "timestamp": "2025-10-18T10:00:00Z",
    "version": "1.0"
  }
}

Error Responses

{
  "success": false,
  "error": {
    "code": "invalid_request",
    "message": "Campaign ID is required",
    "details": {}
  }
}

Rate Limits

PlanRequests/HourRequests/Day
Starter1001,000
Professional1,00010,000
Enterprise10,000100,000
Rate limit info is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1634567890

Webhooks

Receive real-time notifications when events occur:
// Configure webhook endpoint
await faii.webhooks.create({
  url: 'https://your-app.com/webhooks/faii',
  events: [
    'campaign.completed',
    'ranking.changed',
    'mention.detected'
  ],
  secret: 'your_webhook_secret'
});
Learn more about webhooks →

Error Codes

CodeDescription
invalid_requestRequest is malformed or missing required fields
authentication_failedAPI key is invalid or missing
not_foundRequested resource doesn’t exist
rate_limit_exceededYou’ve hit your rate limit
server_errorSomething went wrong on our end

Best Practices

Pro Tip: Use webhooks instead of polling for real-time data. It’s faster, more efficient, and counts less towards your rate limit.

Performance Optimization

  • Cache responses when possible
  • Use pagination for large result sets
  • Filter requests to only get needed data
  • Batch operations when creating multiple resources
  • Use webhooks instead of polling

Security

  • Never expose API keys in client-side code
  • Use environment variables for API keys
  • Rotate keys regularly (every 90 days)
  • Implement webhook signature verification
  • Use HTTPS for all webhook endpoints

Error Handling

try {
  const campaign = await faii.campaigns.get('camp_123');
} catch (error) {
  if (error.code === 'not_found') {
    console.log('Campaign not found');
  } else if (error.code === 'rate_limit_exceeded') {
    // Wait and retry
    await sleep(60000);
    return retryRequest();
  } else {
    // Log and alert
    logger.error('FAII API Error:', error);
  }
}

SDKs & Libraries

Official SDKs available for: Community libraries:

API Endpoints

Core FAII Endpoints

Campaign Management:
  • GET /api/campaigns - List all campaigns
  • POST /api/campaigns - Create a new campaign
  • GET /api/campaigns/{id} - Get campaign details
  • PUT /api/campaigns/{id} - Update campaign
  • DELETE /api/campaigns/{id} - Delete campaign
Intelligence Data:
  • GET /api/supabase/dashboards - Get dashboard data
  • GET /api/supabase/dashboards/intelligence-overview - Get intelligence overview
  • GET /api/serp/rankings - Get SERP ranking data
  • GET /api/chat/mentions - Get Chat Intelligence mentions
Analytics & Reporting:
  • GET /api/analytics/campaign/{id} - Get campaign analytics
  • GET /api/reports/generate - Generate reports
  • GET /api/export/csv - Export data as CSV

Authentication Endpoints

  • POST /api/auth/login - User authentication
  • POST /api/auth/logout - User logout
  • GET /api/auth/me - Get current user info

Example API Calls

curl https://app.faii.ai/api/supabase/dashboards \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Support

Need help with the API?

Changelog

Stay updated with API changes:
  • v1.2.0 (2025-10-15): Added Chat Intelligence endpoints
  • v1.1.0 (2025-09-01): Webhook support added
  • v1.0.0 (2025-08-01): Initial API release
View full changelog →