Skip to main content
POST
https://searchcompany-main.up.railway.app
/
api
/
cron
/
store-visibility-score
curl -X POST https://searchcompany-main.up.railway.app/api/cron/store-visibility-score \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": "nike",
    "results": [
      {
        "prompt": "What are the best running shoes?",
        "chatgpt": true,
        "claude": true,
        "gemini": false,
        "perplexity": true,
        "copilot": false,
        "deepseek": true,
        "grok": false,
        "google_ai": true
      }
    ]
  }'
{
  "status": "success",
  "overall_score": 48,
  "prompts_analyzed": 100,
  "total_true": 384,
  "platform_scores": {
    "chatgpt_score": 52,
    "claude_score": 48,
    "gemini_score": 51,
    "perplexity_score": 45,
    "copilot_score": 49,
    "deepseek_score": 47,
    "grok_score": 46,
    "google_ai_score": 50
  }
}
Internal endpoint for the Cron service to store visibility results after analyzing all 100 prompts. Called ONCE per entity after all prompts have been checked.

What It Does

  1. Receives all 100 prompt results from Cron
  2. Calculates overall score: total_true / (num_prompts * 8) * 100
  3. Updates THREE database tables:
    • visibility_tracker - Per-prompt visibility results
    • visibility_scores - Current aggregated score
    • visibility_scores_history - Historical data for charts

Score Algorithm

score = (total_true_values / (num_prompts * 8)) * 100
Where total_true_values is the count of True across all 800 checks (100 prompts × 8 platforms). Example: If 400 out of 800 are True → score = 50

Request Body

business_id
string
required
Business identifier (org_slug)
item_id
string
Optional product/item ID
results
array
required
Array of 100 prompt results. Each item contains: - prompt (string): The prompt text - chatgpt (boolean): Visibility on ChatGPT - claude (boolean): Visibility on Claude - gemini (boolean): Visibility on Gemini - perplexity (boolean): Visibility on Perplexity - copilot (boolean): Visibility on Copilot - deepseek (boolean): Visibility on DeepSeek - grok (boolean): Visibility on Grok - google_ai (boolean): Visibility on Google AI

Response

status
string
"success" or "error"
overall_score
integer
Calculated visibility score (0-100)
prompts_analyzed
integer
Number of prompts processed
total_true
integer
Total number of True values across all platforms
platform_scores
object
Per-platform scores (0-100 each)
curl -X POST https://searchcompany-main.up.railway.app/api/cron/store-visibility-score \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": "nike",
    "results": [
      {
        "prompt": "What are the best running shoes?",
        "chatgpt": true,
        "claude": true,
        "gemini": false,
        "perplexity": true,
        "copilot": false,
        "deepseek": true,
        "grok": false,
        "google_ai": true
      }
    ]
  }'
{
  "status": "success",
  "overall_score": 48,
  "prompts_analyzed": 100,
  "total_true": 384,
  "platform_scores": {
    "chatgpt_score": 52,
    "claude_score": 48,
    "gemini_score": 51,
    "perplexity_score": 45,
    "copilot_score": 49,
    "deepseek_score": 47,
    "grok_score": 46,
    "google_ai_score": 50
  }
}

Notes

  • Called by Cron ONCE per entity after all 100 prompts are analyzed
  • Historical data enables the “Visibility Over Time” chart on the dashboard
  • Updates current score for the dashboard card display