Cabinhub News API v1.0.0

Docs / Quickstart

Quickstart

Prove the path, authenticate, and pull your first items in five minutes. Every command below was run against the application; the responses shown are the ones it answered.

Five minutes, four calls

  1. GET /v1/health - no key, prove the network path.
  2. Ask us for a key bound to your account and monthly quota.
  3. GET /v1/meta - proves the key, and gives you the locales and categories.
  4. GET /v1/feed/en - your first items, with an ETag to poll with.

If step 1 answers 200 and step 4 returns items, you have a working integration. The rest of this page is the walkthrough from docs/INTEGRATION.md, in order.

The first call, with its real answer

With a key in NEWS_KEY, this is the whole loop: prove the path without a key, prove the key, then read one feed and its ETag. Three commands, one screen, no dependency.

Everything you need, in order
Shell
# 1. reachability - no key, expect 200 and "status":"ok"
curl -sS https://vg.tempproject.online/v1/health

# 2. your key works, and here are the locales and categories
export NEWS_KEY='cbn_...'
curl -sS https://vg.tempproject.online/v1/meta -H "Authorization: Bearer $NEWS_KEY"

# 3. the first page of items, and the ETag to revalidate with
curl -sS -D /tmp/h.txt -o /tmp/feed.json https://vg.tempproject.online/v1/feed/en \
  -H "Authorization: Bearer $NEWS_KEY"
grep -i '^etag:' /tmp/h.txt

# 4. the same poll again: 304, no body, no billable items
curl -sS -o /dev/null -w '%{http_code}\n' https://vg.tempproject.online/v1/feed/en \
  -H "Authorization: Bearer $NEWS_KEY" -H "If-None-Match: $(grep -i '^etag:' /tmp/h.txt | cut -d' ' -f2-)"

Step 1 is captured below. Steps 2-4 are the documented contract in docs/API.md §3, §4 and §7 - run them against your own key.

Health check, no key
Shell
curl -sS https://vg.tempproject.online/v1/health
200, captured from the running app
JSON
{"status":"ok","version":"1.0.0","items":7,"last_run_at":"2026-11-04T21:35:54.830168Z","last_published_at":"2026-11-04T22:03:50.658376Z","reason":null}

Source: docs/API.md §12.

Check reachability

Source: docs/INTEGRATION.md §1.

Shell
curl -s https://vg.tempproject.online/v1/health

Expected: 200 and

JSON
{"status":"ok","version":"1.0.0","items":7,"last_run_at":"2026-11-04T21:35:54.830168Z","last_published_at":"2026-11-04T22:03:50.658376Z","reason":null}

/v1/health needs no key. Read status and reason, not just the HTTP code: a degraded pipeline still answers 200 so that uptime probes do not flap.

ResultMeaningNext step
DNS / TLS errorNetwork or DNS on your sideCheck your egress; the domain resolves publicly
200 with "status":"degraded"Our pipeline is not publishing; the process is aliveContact us; do not retry in a tight loop
503 with "status":"degraded"Our storage is unavailableContact us; do not retry in a tight loop
Redirect (301/302/307/308)You are not on the canonical URLUse https://vg.tempproject.online exactly
404 on another pathWrong pathRe-check docs/API.md §2

Use GET. HEAD is 405 on every route.

Get a key

Source: docs/INTEGRATION.md §2.

One command issues the key and writes the customer's onboarding note:

Shell
cd /root/data/disk/vg-news
NEWS_DB_PATH=/root/data/disk/vg-news/var/news.db \
  venv/bin/python backend/scripts/onboard_customer.py create --customer "vg" --plan starter

It prints the key once on stdout. The note (base URL, quota, placeholder key, this guide and the support contact) lands in var/onboarding/vg.md; it never contains the real key. --plan starter implies the documented 45,000-item monthly quota; any other plan needs an explicit --quota N (0 = unlimited). The low-level equivalent, if you only want a key, is scripts/keys.py create --customer "vg" --plan starter --quota 45000.

The key is stored only as a SHA-256 hash; a lost key cannot be recovered, only replaced with

Shell
python3 scripts/keys.py list                     # fingerprints, to identify a key
python3 scripts/keys.py revoke --key cbn_...     # revoke a leaked key

Deliver the key over a channel you already trust. Do not put it in a repo, a URL, a screenshot or a log line.

If you lose the key — the recovery path

There is no password on this product, and nothing to reset. Sign-in is a six-digit code mailed to the address provisioned on the account; that one-time code is the recovery mechanism. A customer who has lost every key can therefore still act:

  1. Open the console at /console and sign in with your email address. You are sent a code; enter it. No key is needed to sign in — the console is a cookie session, not a key session.
  2. The console lists every key on the account by its 16-hex prefix, with its plan, quota and status (Active, Expired, Revoked). That prefix is the same handle the operator reads off keys.py list, so you can name the key you lost without ever having kept it.
  3. Ask us to issue a replacement and revoke the lost one, quoting that prefix. This is the one step a customer cannot do alone — issuing and revoking are operator routes on purpose, so a stolen console cookie cannot mint itself a new credential.
  4. Sign in again and confirm the replacement appears as Active and the old one as Revoked.

Three properties of that path are worth knowing, because they are what it relies on:

There is deliberately no "change password", "forgot password" or "reset password" route: with no password, each would be a second, weaker way into the same account. If your address changes, ask us to re-provision it (POST /v1/admin/accounts) — the address is the account's key, and re-pointing it is an audited operator action.

Authenticate

Source: docs/INTEGRATION.md §3.

Every route except /v1/health requires:

Text
Authorization: Bearer <key>
Shell
export NEWS_KEY='cbn_...'
curl -s https://vg.tempproject.online/v1/meta -H "Authorization: Bearer $NEWS_KEY"

Expected: 200 and

JSON
{
  "schema_version": 1,
  "api_version": "1.0.0",
  "locales": ["en", "zh-Hans"],
  "categories": ["markets","macro","commodities","fx","crypto","central_banks","corporate","energy"],
  "policy_version": "2026-11-12.1",
  "default_locale": "en",
  "limits": {"max_page_size": 200}
}

Read locales, categories, limits.max_page_size and policy_version from this response. Do not hard-code them; policy can add a locale without a code change on your side. /v1/meta is cacheable for 3600 s and carries an ETag, so poll it rarely and conditionally.

Auth failure modes:

StatusBodyMeaning
401{"detail":"invalid or missing bearer token"}Missing or wrong key
401{"detail":"this api key has been revoked"}Key revoked; request a replacement
429object with error: quota_exceededMonthly billable-item quota exhausted; see §8
503{"detail":"..."}Server misconfiguration, not your key

Pull the feed

Source: docs/INTEGRATION.md §4.

Shell
curl -s "https://vg.tempproject.online/v1/feed/en" -H "Authorization: Bearer $NEWS_KEY"

Response envelope:

JSON
{
  "locale": "en",
  "generated_at": "2026-11-04T21:35:54.830168Z",
  "disclaimer": "This content is provided for information purposes only. ...",
  "items": [
    {
      "id": "11111111-1111-5111-9111-111111111111",
      "schema_version": 1,
      "locale": "en",
      "title": "Fed holds policy rate as core inflation cools to 2.4%",
      "summary": "Officials left the target range unchanged ...",
      "body": "The Federal Reserve kept its target range ...",
      "bullets": ["Bullet one", "Bullet two"],
      "category": "central_banks",
      "importance": 0.94,
      "published_at": "2026-11-03T18:00:00Z",
      "updated_at": "2026-11-03T18:07:00Z",
      "source": {"name": "Federal Reserve — Monetary Policy", "url": "https://...", "canonical_url": "https://...", "retrieved_at": "..."},
      "claims": [{"text": "...", "source_span": "...", "confidence": 0.92}],
      "entities": {"instruments": ["USD"], "countries": ["US"], "organizations": ["Federal Reserve"]},
      "market_data": {"symbol": "DXY", "price": 104.12, "change_pct": -0.21, "as_of": "..."},
      "compliance": {"status": "clean", "risk_score": 0.0, "reason_codes": ["CLEAN"], "policy_version": "2026-11-12.1"},
      "assets": {"title_image_prompt": "...", "title_image_aspect": "16:9", "title_image_url": "/v1/images/img-...", "title_image_ai_generated": true}
    }
  ]
}

Field-by-field rendering:

FieldTypeRender how
idstringStable key for your list; use for de-duplication and as a DOM key
titlestringHeadline
summarystringStandfirst / card body
bodystringArticle body; markdown-lite. Escape, or sanitise if you render markdown
bulletsstring[]Key-point list; may be empty
categorystringOne of the categories listed by /v1/meta
importancefloat 0..1Sort weight, not a percentage
published_at / updated_atRFC3339 UTCDisplay in the reader's timezone
source.name / source.urlstringAttribution and the "read the original" link
claimsobject[]Optional provenance block; source_span is an exact substring of the source
entitiesobjectOptional tags (instruments, countries, organisations)
market_dataobjectShow only when symbol is non-null; price: 0.0 means "none attached"
compliance.statusclean \withheldwithheld must never render — see §5
authorstringFixed byline: By Ember (EN) / Ember 撰稿 (ZH). Render it — it is part of the AI disclosure
ai_generatedtrueMachine-readable AI flag. Always true for items from this pipeline
ai_labelstringThe explicit notice to show next to the copy: AI-generated content / 人工智能生成内容
translationsobject{locale: item_id} for the same story. See "Language switch" below
assets.title_image_promptstringPrompt text for your image generator, if you generate one
assets.title_image_urlstring, optionalRoot-relative path; join with the base URL
assets.title_image_ai_generatedtrue, optionalPresent exactly with the URL. The image is model-generated: render a small caption label (China AI-labelling Measures). The bytes also carry IPTC DigitalSourceType metadata

Disclosure is not optional. author, ai_generated and ai_label are system fields the server writes on every served item; no model generates them and the style gate cannot remove them. China's Measures for Labelling AI-Generated Synthetic Content (in force 2025-09-01) require a clearly perceivable notice on AI-generated text, so a renderer that shows the copy without the byline and ai_label is non-compliant. Show author and ai_label adjacent to the article body, not only in a footer.

Language switch on an open article. translations maps a locale tag to that same story's item id in that locale. The item's own locale is always a key (mapping to its own id); another locale appears only when a clean item exists there, so following one never lands on a 404. Resolve translations[newLocale] and navigate to that id — do not go back to the feed, and do not construct an id. If the target locale is absent, the story has no item in that language yet: stay on the current one and say so.

JavaScript
// The SDKs ship this as twin(item, locale) / item.twin(locale).
const twinId = item.translations?.["zh-Hans"] ?? null;
if (twinId) location.assign(`/article/${twinId}?lang=zh-Hans`);

disclaimer (envelope) must be rendered verbatim alongside the items, in the locale of the items. It is not part of each item on feed and list responses.

Where to go next