curl "https://searchcompany-main.up.railway.app/api/cron/ai-articles-quota?org_slug=nike" \
-H "X-API-Key: search-company"
{
"org_slug": "nike",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 0,
"articles_remaining": 1000,
"total_products": 50,
"products": [
{
"id": "uuid-1",
"name": "Air Max",
"daily_quota": 20,
"total_articles": 0
},
{
"id": "uuid-2",
"name": "Air Force 1",
"daily_quota": 20,
"total_articles": 0
}
],
"total_daily_quota": 1000,
"message": "First run - creating full weekly burst",
"architecture": "one-time-burst"
}
{
"org_slug": "nike",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 1000,
"products": [],
"total_daily_quota": 0,
"message": "Weekly burst already completed",
"architecture": "one-time-burst"
}
{
"org_slug": "acme-corp",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 0,
"products": [],
"total_daily_quota": 0,
"message": "No products found - add products to generate articles"
}
π’ GET - AI Articles Quota
Get AI Articles Quota
Calculate AI articles quota for one-time burst creation
GET
/
api
/
cron
/
ai-articles-quota
curl "https://searchcompany-main.up.railway.app/api/cron/ai-articles-quota?org_slug=nike" \
-H "X-API-Key: search-company"
{
"org_slug": "nike",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 0,
"articles_remaining": 1000,
"total_products": 50,
"products": [
{
"id": "uuid-1",
"name": "Air Max",
"daily_quota": 20,
"total_articles": 0
},
{
"id": "uuid-2",
"name": "Air Force 1",
"daily_quota": 20,
"total_articles": 0
}
],
"total_daily_quota": 1000,
"message": "First run - creating full weekly burst",
"architecture": "one-time-burst"
}
{
"org_slug": "nike",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 1000,
"products": [],
"total_daily_quota": 0,
"message": "Weekly burst already completed",
"architecture": "one-time-burst"
}
{
"org_slug": "acme-corp",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 0,
"products": [],
"total_daily_quota": 0,
"message": "No products found - add products to generate articles"
}
Calculates how many AI articles the cron job should create. Uses a one-time burst architecture that creates all 1,000 articles on the first cron run after signup.
Authentication: Requires internal API key (
This ensures new customers get their full content library immediately after signup.
X-API-Key header).
How It Works
The system uses a one-time burst model:- First cron run after signup: Creates all 1,000 articles in one batch
- Subsequent runs: Returns 0 quota (already completed for the week)
Cron (Job 4: Create AI Articles)
β
βββ For each business:
β
βββ GET /ai-articles-quota?org_slug={business_id}
β βββ Returns: 1000 articles (first run) or 0 (already done)
β
βββ Create articles for each product (round-robin distribution)
Products only - AI articles are created for products, not the business
entity itself. All articles are deployed to the businessβs AI site.
One-Time Burst Architecture
Unlike a daily distribution model, this architecture front-loads all content creation:| Scenario | Quota Returned |
|---|---|
| First run of the week (no articles yet) | 1,000 articles |
| Any subsequent run (articles exist) | 0 articles |
Product Distribution (Round-Robin)
The 1,000 articles are distributed across products using round-robin:- Products are ordered by
article_count(ascending) - Products with fewest articles get priority
- Articles are distributed evenly across all products
- Each product gets 20 articles (1000 Γ· 50)
- Products with fewer existing articles are prioritized
- Each product gets 5 articles (1000 Γ· 200)
- All products get coverage in a single burst
Query Parameters
string
required
The organization slug (business_id)
Response
string
The organization slug
string
Start of current week (Monday) in YYYY-MM-DD format
string
End of current week (Sunday) in YYYY-MM-DD format
integer
Total weekly target (1000)
integer
Articles already created this week
integer
Total number of products for this organization
array
integer
Total articles to create (1000 or 0)
string
Always βone-time-burstβ
string
Human-readable status message
curl "https://searchcompany-main.up.railway.app/api/cron/ai-articles-quota?org_slug=nike" \
-H "X-API-Key: search-company"
{
"org_slug": "nike",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 0,
"articles_remaining": 1000,
"total_products": 50,
"products": [
{
"id": "uuid-1",
"name": "Air Max",
"daily_quota": 20,
"total_articles": 0
},
{
"id": "uuid-2",
"name": "Air Force 1",
"daily_quota": 20,
"total_articles": 0
}
],
"total_daily_quota": 1000,
"message": "First run - creating full weekly burst",
"architecture": "one-time-burst"
}
{
"org_slug": "nike",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 1000,
"products": [],
"total_daily_quota": 0,
"message": "Weekly burst already completed",
"architecture": "one-time-burst"
}
{
"org_slug": "acme-corp",
"week_start": "2026-01-06",
"week_end": "2026-01-12",
"weekly_target": 1000,
"articles_this_week": 0,
"products": [],
"total_daily_quota": 0,
"message": "No products found - add products to generate articles"
}
Integration with Cron
The cron job uses this quota API to determine article creation:- Calls this API to get the quota
- If
total_daily_quota > 0: Creates articles for each product in parallel - All articles are deployed to the businessβs AI site
- Subsequent cron runs return 0 quota until next week
- New customers: Get all 1,000 articles immediately
- Existing customers: No redundant work on subsequent runs
- Weekly reset: Quota resets each Monday for ongoing content freshness