SoftwareHubSoftware Hub

Ingest API

A small, token-authenticated HTTP API the sourcing bot calls to upload warranty products and stock. Server-to-server only — the token never reaches a browser.

Authentication

Send the shared secret in the X-Ingest-Token header (or as Authorization: Bearer …). The secret is the server's INGEST_TOKEN environment variable. Rotate it by changing the variable and restarting.

GET https://softwarehub.tech/api/ingest/health
X-Ingest-Token: <secret>

→ { "ok": true, "configured": true, "authenticated": true, "database": "ok" }

Upsert a product

Create-or-update by source_ref (your id for the product; preferred) or slug. Never duplicates. Products without a parsable warranty_duration are rejected with 400 — this mirrors the bot's own rule as a safety net.

POST https://softwarehub.tech/api/ingest/products
X-Ingest-Token: <secret>
Content-Type: application/json

{
  "name": "Cursor Pro · 1 Year",
  "category": "AI Tools",
  "vendor": "Cursor",                 // optional
  "description": "…",                 // optional
  "price_paise": 249900,              // integer paise (₹2,499.00)
  "currency": "INR",                  // optional, default INR
  "warranty_duration": "30d",         // "10m" | "2h" | "7d" | "6mo" | "1y" | "lifetime"
  "warranty_terms": "Replacement or refund if revoked within 30 days.",
  "stability": "stable",              // free text the bot reports
  "source_ref": "tg:channel/1234",    // your id — used for upserts
  "logo_url": "https://…",            // optional
  "is_active": true,                  // optional, default true
  "codes": ["KEY-1", "KEY-2"]         // optional stock to add now (max 2000)
}

→ 201 { "ok": true, "product_id": "…", "slug": "cursor-pro-1-year",
        "created": true, "added_codes": 2, "skipped_duplicates": 0 }
→ 200 (same shape, "created": false) when the product already existed
→ 400 { "ok": false, "error": "warranty_duration: …" }

Add stock

POST https://softwarehub.tech/api/ingest/stock
{ "source_ref": "tg:channel/1234", "codes": ["KEY-3", "KEY-4"] }

→ { "ok": true, "product_id": "…", "added_codes": 2, "skipped_duplicates": 0 }

Codes are encrypted at rest and de-duplicated against every code ever stored (a hash index). Adding stock also delivers any paid orders that were waiting for inventory.

Deactivate

POST https://softwarehub.tech/api/ingest/deactivate
{ "source_ref": "tg:channel/1234", "reason": "seller unreliable" }

→ { "ok": true, "product_id": "…" }

The product disappears from the storefront immediately. Existing orders and their warranties are untouched. Upserting it again with is_active: true brings it back.

Warranty duration format

InputMeaning
10m, 10 mins10 minutes
2h2 hours
7d, 7 days7 days
2w2 weeks
6mo, 18Mmonths (capital M = month)
1y1 year
lifetimenever expires

Public read API

No token needed: GET https://softwarehub.tech/api/catalog?q=cursor&category=AI%20Tools returns the same ranked results the storefront shows. Stock codes are never included.