Skip to main content
Generate /llms/{product-slug}.txt files for products and deploy to Vercel. This is the third step in the product pipeline:
  1. discover-products - Extract products from content
  2. generate-product-prompts - Generate visibility prompts
  3. generate-product-llms-txt (this endpoint) - Generate llms files

Use Cases

  • Generate llms files for newly discovered products
  • Regenerate product llms after content updates
  • Manual trigger to refresh product llms content

Request Body

FieldTypeRequiredDescription
business_idstringYesClerk org ID
product_idsarrayNoSpecific product IDs to generate for. If omitted, generates for ALL products.

Response

{
  "status": "success",
  "products_processed": 5,
  "files_generated": 5,
  "files_deployed": 5,
  "products": ["Product A", "Product B", "Product C", "Product D", "Product E"]
}

How It Works

1. Fetch business entity and AI site project_name
2. Fetch products (all or filtered by product_ids)
3. For each product:
   - Get source_urls from entities.product_source_urls
   - Generate /llms/{slug}.txt content using Gemini
4. Deploy all generated files to Vercel (single deployment)
5. Return summary

Shared Service

This endpoint uses the shared generate_product_llms_txt service:
src/app/shared/products/generate_llms_txt.py
The same service is used by:
  • Onboarding (GROUP 3b)
  • Cron (discover-products)

Product LLMs Architecture

FileLocationPurpose
Root llms.txt/llms.txtBusiness overview, key details, FAQs
Product llms/llms/{product-slug}.txtDetailed product info, features, pricing
This architecture scales to thousands of products:
  • Root llms.txt stays small (~3KB)
  • Each product gets its own file (~1-2KB)
  • Product files are fetched on-demand for boosted page generation

Example Request

# Generate for all products
curl -X POST https://searchcompany-main.up.railway.app/api/cron/generate-product-llms-txt \
  -H "Content-Type: application/json" \
  -H "X-API-Key: search-company" \
  -d '{"business_id": "my-business-123"}'

# Generate for specific products
curl -X POST https://searchcompany-main.up.railway.app/api/cron/generate-product-llms-txt \
  -H "Content-Type: application/json" \
  -H "X-API-Key: search-company" \
  -d '{"business_id": "my-business-123", "product_ids": ["uuid-1", "uuid-2"]}'

Code Location

src/app/apis/cron/generate_product_llms_txt/
├── __init__.py
└── routes.py