Enception Logo
REST APIExternal Service

Client Analysis API

External API for programmatic client analysis. Start comprehensive SEO and market analysis, check processing status, and download PDF reports.

Overview

The Client Analysis API allows external services to trigger comprehensive client analysis programmatically. The analysis includes:

  • Background market research
  • SEO competitor analysis
  • SEO diagnosis and recommendations
  • Keyword clustering
  • Query strategies
  • AI visibility assessment
  • Opportunity and feasibility summary

Processing Time: Analysis typically takes 3-10 minutes depending on the complexity of the website and number of competitors.

Authentication

All endpoints require authentication via the X-API-Key header:

curl -X POST https://www.enception.ai/api/external/client-analysis/start \
  -H "X-API-Key: $CLIENT_ANALYSIS_SERVICE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"website_url": "https://example.com", ...}'

Rate Limit: Maximum 10 requests per minute. Contact the Enception team to obtain your API key.

Supported Region Codes

North America

  • us - United States
  • ca - Canada
  • mx - Mexico

Europe

  • uk - United Kingdom
  • de - Germany
  • fr - France
  • es - Spain
  • it - Italy
  • nl - Netherlands

Asia Pacific

  • cn - China
  • jp - Japan
  • kr - South Korea
  • au - Australia
  • sg - Singapore
  • in - India

Other Regions

  • br - Brazil
  • ae - UAE
  • sa - Saudi Arabia
  • za - South Africa

Start Analysis

POST/api/external/client-analysis/start

Start a new client analysis. Returns an analysis ID for tracking.

Request Body

FieldTypeRequiredDescription
idUUIDNoCustom analysis ID (UUID v4 format). If not provided, a UUID will be generated automatically.
website_urlstringYesThe client's website URL to analyze
primary_regionstringYesPrimary target region code (e.g., "us", "cn", "uk", "de")
secondary_regionstringNoSecondary target region code
competitorsarrayNoList of competitors (max 5). Each with name and domain
core_goalsstringYesBusiness goals and objectives for the analysis
current_seo_geo_statusstringNoCurrent SEO/GEO status description
output_languagestringNoReport language: "en" (default) or "zh"
emailstringNoEmail for callback notification when analysis completes

Example Request

curl -X POST https://www.enception.ai/api/external/client-analysis/start \
  -H "X-API-Key: $CLIENT_ANALYSIS_SERVICE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "website_url": "https://example.com",
    "primary_region": "us",
    "secondary_region": "ca",
    "competitors": [
      {"name": "Competitor A", "domain": "competitor-a.com"},
      {"name": "Competitor B", "domain": "competitor-b.com"}
    ],
    "core_goals": "Increase organic traffic and AI visibility for B2B SaaS keywords",
    "output_language": "en",
    "email": "user@example.com"
  }'

Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "message": "Analysis started successfully"
}

Check Status

POST/api/external/client-analysis/status

Check the status of an analysis. Returns status and PDF URL when completed.

Request Body

FieldTypeRequiredDescription
idUUIDYesAnalysis ID returned from the start endpoint

Example Request

curl -X POST https://www.enception.ai/api/external/client-analysis/status \
  -H "X-API-Key: $CLIENT_ANALYSIS_SERVICE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id": "550e8400-e29b-41d4-a716-446655440000"}'

Response (Pending)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "pending",
  "progress_percent": 45
}

Response (Succeeded)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "succeeded",
  "pdf_url": "https://www.enception.ai/api/external/client-analysis/report/550e8400-e29b-41d4-a716-446655440000"
}

Response (Failed)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "failed",
  "error_message": "Failed to fetch website content"
}

Status Values

StatusDescription
pendingAnalysis is in progress
succeededAnalysis completed, PDF ready
failedAnalysis failed with error

Download Report

GET/api/external/client-analysis/report/{id}

Download the PDF report for a completed analysis.

Path Parameters

ParameterTypeDescription
idUUIDAnalysis ID

Example Request

curl -H "X-API-Key: $CLIENT_ANALYSIS_SERVICE_TOKEN" \
  -o report.pdf \
  "https://www.enception.ai/api/external/client-analysis/report/550e8400-e29b-41d4-a716-446655440000"

Response

Returns the PDF file with appropriate headers:

Content-Type: application/pdf
Content-Disposition: attachment; filename="client-analysis-report.pdf"

Note: The report endpoint returns 400 if the analysis is not yet completed (with current status and progress). Returns 404 if the analysis ID is not found. Always check status first before downloading.

Completion Callback

We support callback notifications when analysis completes. For callback integration details, please contact us at quanlai@enception.ai.

Note: You can also use the /status endpoint to poll for progress if you prefer not to use callbacks.

Typical Workflow

  1. Start Analysis: POST to /start with website details and email. Save the returned id.
  2. Wait for Callback: We will call your callback endpoint when the analysis completes. Alternatively, you can poll /status every 30-60 seconds.
  3. Download Report: Use the fileUrl from the callback, or GET the PDF from /report/{id}.

Example Integration (Node.js)

const API_KEY = process.env.CLIENT_ANALYSIS_SERVICE_TOKEN;
const BASE_URL = 'https://www.enception.ai/api/external/client-analysis';

// Start analysis with callback email
async function startAnalysis(params) {
  const startRes = await fetch(`${BASE_URL}/start`, {
    method: 'POST',
    headers: {
      'X-API-Key': API_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      ...params,
      email: 'user@example.com', // We'll call your callback when done
    }),
  });
  const { id } = await startRes.json();
  console.log(`Analysis started: ${id}`);
  return id;
}

// Your callback handler (receives POST when analysis completes)
// POST /api/agent/callback with: email, id, fileUrl
async function handleCallback(req) {
  const { email, id, fileUrl } = req.body;

  // Download the PDF report
  const pdfRes = await fetch(fileUrl, {
    headers: { 'X-API-Key': API_KEY },
  });
  const pdfBuffer = await pdfRes.arrayBuffer();
  // Save or process the PDF...
}

// Alternative: Poll for status (if not using callback)
async function pollStatus(id) {
  const statusRes = await fetch(`${BASE_URL}/status`, {
    method: 'POST',
    headers: {
      'X-API-Key': API_KEY,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ id }),
  });
  return await statusRes.json();
}

Error Responses

Status CodeDescription
400Bad Request - Missing or invalid parameters
401Unauthorized - Invalid or missing API key
404Not Found - Analysis ID not found or report not ready
409Conflict - Analysis with this ID already exists (when using custom ID)
429Rate Limit Exceeded - Max 10 requests per minute
503Service Unavailable - Backend services not configured
500Internal Server Error