
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 Statesca- Canadamx- Mexico
Europe
uk- United Kingdomde- Germanyfr- Francees- Spainit- Italynl- Netherlands
Asia Pacific
cn- Chinajp- Japankr- South Koreaau- Australiasg- Singaporein- India
Other Regions
br- Brazilae- UAEsa- Saudi Arabiaza- South Africa
Start Analysis
/api/external/client-analysis/startStart a new client analysis. Returns an analysis ID for tracking.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | UUID | No | Custom analysis ID (UUID v4 format). If not provided, a UUID will be generated automatically. |
website_url | string | Yes | The client's website URL to analyze |
primary_region | string | Yes | Primary target region code (e.g., "us", "cn", "uk", "de") |
secondary_region | string | No | Secondary target region code |
competitors | array | No | List of competitors (max 5). Each with name and domain |
core_goals | string | Yes | Business goals and objectives for the analysis |
current_seo_geo_status | string | No | Current SEO/GEO status description |
output_language | string | No | Report language: "en" (default) or "zh" |
email | string | No | Email 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
/api/external/client-analysis/statusCheck the status of an analysis. Returns status and PDF URL when completed.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Analysis 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
| Status | Description |
|---|---|
pending | Analysis is in progress |
succeeded | Analysis completed, PDF ready |
failed | Analysis failed with error |
Download Report
/api/external/client-analysis/report/{id}Download the PDF report for a completed analysis.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | UUID | Analysis 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
- Start Analysis: POST to
/startwith website details andemail. Save the returnedid. - Wait for Callback: We will call your callback endpoint when the analysis completes. Alternatively, you can poll
/statusevery 30-60 seconds. - Download Report: Use the
fileUrlfrom 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 Code | Description |
|---|---|
400 | Bad Request - Missing or invalid parameters |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Analysis ID not found or report not ready |
409 | Conflict - Analysis with this ID already exists (when using custom ID) |
429 | Rate Limit Exceeded - Max 10 requests per minute |
503 | Service Unavailable - Backend services not configured |
500 | Internal Server Error |