Skip to main content
POST
https://searchcompany-main.up.railway.app
/
api
/
manual-trigger
/
regenerate-prompts
Regenerate Prompts
curl --request POST \
  --url https://searchcompany-main.up.railway.app/api/manual-trigger/regenerate-prompts \
  --header 'Content-Type: application/json' \
  --data '
{
  "business_id": "<string>",
  "url": "<string>",
  "product_id": "<string>",
  "prompt_count": 123
}
'
{
  "status": "<string>",
  "prompts_generated": 123,
  "prompts_saved": 123,
  "skipped_reason": "<string>",
  "error": "<string>"
}
Manual Trigger Endpoint - This endpoint is for debugging and manual intervention only. It is NOT called by the daily cron job.Prompts are normally generated:
  • During onboarding via /api/onboarding/generate-all
  • When new products are discovered via /api/cron/discover-products-from-changes

Overview

Manually regenerates the AI visibility prompts for a business or product. This endpoint scrapes the website fresh and generates new prompts using Gemini. Use cases:
  • Debugging prompt generation issues
  • Refreshing prompts after significant website content changes
  • Testing prompt generation for a specific entity
This endpoint requires API key authentication (X-API-Key header).

Prompt Limits

Entity TypePromptsNotes
Business5010 via Exa (onboarding only) + 40 via Gemini
Products10 eachUnlimited products
This endpoint regenerates prompts via Gemini only. The 10 pre-tested Exa prompts are only generated during onboarding.

Request Body

business_id
string
required
Business identifier (clerk org slug)
url
string
required
Website URL to scrape for prompt generation
product_id
string
Optional product ID for product-specific prompts
prompt_count
integer
default:"50"
Number of prompts to generate (default: 50 for business, 10 for product)

Response

status
string
success, skipped, or error
prompts_generated
integer
Number of prompts generated by Gemini
prompts_saved
integer
Number of prompts saved to database
skipped_reason
string
Reason for skipping (if status is skipped)
error
string
Error message if status is error

Example

curl -X POST "https://searchcompany-main.up.railway.app/api/manual-trigger/regenerate-prompts" \
  -H "X-API-Key: search-company" \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": "acme-corp-123456",
    "url": "https://www.acme.com",
    "prompt_count": 50
  }'

Internal Process

This endpoint calls the generate_prompts service which:
  1. Scrapes the website using Firecrawl (up to 5000 pages)
  2. Generates prompts using Gemini 3 Flash
  3. Saves prompts to the entity_prompts_tracker table
The prompts are questions that AI platforms might use when recommending businesses. They are checked via daily sampling (10 prompts/day) against 8 AI platforms to calculate visibility scores.

Notes

  • Prompts should NOT contain the business name (we test if AI recommends them organically)
  • Regenerating prompts does NOT delete existing prompts - it adds new ones
  • Visibility results for new prompts will be null until tested by the daily cron job
  • Pre-tested Exa prompts (from onboarding) are not affected by regeneration