Sample Prompts
curl --request GET \
--url https://searchcompany-main.up.railway.app/api/cron/sample-promptsimport requests
url = "https://searchcompany-main.up.railway.app/api/cron/sample-prompts"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://searchcompany-main.up.railway.app/api/cron/sample-prompts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://searchcompany-main.up.railway.app/api/cron/sample-prompts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://searchcompany-main.up.railway.app/api/cron/sample-prompts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://searchcompany-main.up.railway.app/api/cron/sample-prompts")
.asString();require 'uri'
require 'net/http'
url = URI("https://searchcompany-main.up.railway.app/api/cron/sample-prompts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "<string>",
"org_slug": "<string>",
"total_prompts": 123,
"untested_count": 123,
"sample_size": 123,
"prompts": [
{}
]
}π’ GET - Sample Prompts
Sample Prompts
Sample prompts for daily visibility check, prioritizing untested prompts.
GET
/
api
/
cron
/
sample-prompts
Sample Prompts
curl --request GET \
--url https://searchcompany-main.up.railway.app/api/cron/sample-promptsimport requests
url = "https://searchcompany-main.up.railway.app/api/cron/sample-prompts"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://searchcompany-main.up.railway.app/api/cron/sample-prompts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://searchcompany-main.up.railway.app/api/cron/sample-prompts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://searchcompany-main.up.railway.app/api/cron/sample-prompts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://searchcompany-main.up.railway.app/api/cron/sample-prompts")
.asString();require 'uri'
require 'net/http'
url = URI("https://searchcompany-main.up.railway.app/api/cron/sample-prompts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "<string>",
"org_slug": "<string>",
"total_prompts": 123,
"untested_count": 123,
"sample_size": 123,
"prompts": [
{}
]
}Overview
This endpoint samples prompts from the total prompt pool (business + products) for an organization. Itβs used by the cron job to check a subset of prompts each day instead of all prompts (cost optimization). Sampling Algorithm:- First, select prompts that have never been tested (
last_tested_at IS NULL) - If we need more to reach
sample_size, randomly select from already-tested prompts
This is an internal API used by the Cron service. Requires API key authentication.
Query Parameters
string
required
Organization slug (clerk_org_id)
integer
default:"10"
Number of prompts to sample
Response
string
"success" or "error"string
The organization slug
integer
Total number of prompts available for this organization
integer
Number of prompts that have never been tested
integer
Actual number of prompts sampled (may be less than requested if fewer prompts exist)
array
Array of sampled prompts with metadata:
id: Prompt ID (integer)prompt: The prompt text (string)entity_id: Entity UUID (string)entity_name: Entity name (string)entity_type:"business"or"product"(string)
Example Response
{
"status": "success",
"org_slug": "acme-corp",
"total_prompts": 150,
"untested_count": 45,
"sample_size": 10,
"prompts": [
{
"id": 42,
"prompt": "best project management software for small teams",
"entity_id": "550e8400-e29b-41d4-a716-446655440000",
"entity_name": "Acme Corp",
"entity_type": "business"
},
{
"id": 87,
"prompt": "acme widget pro vs competitor",
"entity_id": "550e8400-e29b-41d4-a716-446655440001",
"entity_name": "Widget Pro",
"entity_type": "product"
}
]
}
Use Case
The visibility cron job calls this endpoint once per customer per day:- Sample 10 prompts (prioritizing untested ones)
- Analyze each prompt across 8 AI platforms (pass/fail)
- Update
entity_prompts_trackerwith results andlast_tested_at - Store daily report in
visibility_reportstable
- Reduces API costs by ~50% compared to checking all prompts daily
- Ensures all prompts eventually get tested
- Prioritizes new prompts so users see results quickly after onboarding