> ## Documentation Index
> Fetch the complete documentation index at: https://docs.searchcompany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create AI Article

> Generate AI article content and files (no deployment)

Internal endpoint for the Cron service to generate an AI article's content and files.

<Warning>
  This endpoint **does NOT deploy** to Vercel. It generates content and files, saves to the database,
  and returns the files. Call `/api/cron/deploy-to-vercel` separately to deploy all files at once.
</Warning>

<Note>
  AI articles are generated from the **AI site content** (llms.txt, data.json,
  HTML), not the original business website.
</Note>

<Note>
  **Products use the business's AI site** - Products don't have their own AI websites.
  All AI articles (business and product) are deployed to the same business AI site.
</Note>

## Request Body

<ParamField body="business_id" type="string" required>
  Business identifier (org\_slug)
</ParamField>

<ParamField body="product_id" type="string">
  Optional product/item ID
</ParamField>

<ParamField body="backdate_to" type="string">
  Optional ISO date string to backdate created\_at (e.g. "2025-12-21")
</ParamField>

## Response

<ResponseField name="status" type="string">
  "success" or "error"
</ResponseField>

<ResponseField name="files" type="array">
  Array of files to deploy. Each file has `path` and `content`.
</ResponseField>

<ResponseField name="article_path" type="string">
  Path to the AI article (e.g. "/top-10-crm-tools-2025/")
</ResponseField>

<ResponseField name="title" type="string">
  AI article title (always a question for AI search optimization)
</ResponseField>

<ResponseField name="published_date" type="string">
  Publication date (ISO format)
</ResponseField>

<ResponseField name="project_name" type="string">
  Vercel project name for deployment
</ResponseField>

<ResponseField name="ai_site_url" type="string">
  AI site URL (e.g. "[https://nike.searchcompany.dev](https://nike.searchcompany.dev)")
</ResponseField>

<ResponseField name="existing_posts" type="array">
  List of existing AI articles (for index generation and deduplication)
</ResponseField>

<ResponseField name="faq_category" type="string">
  FAQ category for homepage integration: `"business_article"` or `"product_article"`
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://searchcompany-main.up.railway.app/api/cron/create-ai-article \
    -H "Content-Type: application/json" \
    -d '{"business_id": "nike"}'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "status": "success",
    "files": [
      {"path": "pages/top-10-sneaker-brands-2025.js", "content": "..."}
    ],
    "article_path": "/top-10-sneaker-brands-2025/",
    "title": "What are the top 10 sneaker brands in 2025?",
    "published_date": "2025-12-24",
    "project_name": "ai-nike",
    "ai_site_url": "https://nike.searchcompany.dev",
    "existing_posts": [
      {"title": "What is Nike?", "article_path": "/what-is-nike/"}
    ],
    "faq_category": "business_article"
  }
  ```
</ResponseExample>

## Topic Generation

AI articles use a sophisticated topic generation system designed to stay fresh even at 1000+ posts:

### Template System

49 SEO-optimized question templates with variable placeholders:

* `{industry}` - Inferred by Gemini from business content
* `{problem}` - Main problem the business solves
* `{city}` - 38 major cities worldwide
* `{audience}` - 17 target audiences (startups, enterprises, etc.)
* `{year}` - Current or next year
* `{list_size}` - 3, 5, 7, 10, 15, or 20

### Deduplication

The system:

1. Receives existing AI article titles from the database
2. Generates all possible template variations
3. Filters out any that match existing titles
4. Picks a random unused combination

This ensures **2,000+ unique titles** before any repetition.

### Example Titles

* "What are the top 10 CRM software solutions in 2025?"
* "What is the best project management platform in Singapore in 2025?"
* "How do startups solve team collaboration challenges?"
* "What do experts recommend for sales pipeline management in 2025?"

## Workflow

```
1. create-ai-article (×N) → Returns files + metadata (parallel, fast)
   └── Each returns: {files, title, article_path, published_date, existing_posts}

2. deploy-to-vercel → Deploys all files at once (single deployment)
   └── Receives all files + metadata, generates index/sitemap

3. submit-indexnow → Notifies search engines of new URLs
```
