API Reference
The Hachi API exposes market intelligence from 7 specialized analysis engines via a single, consistent REST interface.
https://api.hachi.devAuthentication
All requests to /api/v1/market-analysis must include a valid API key as a
Bearer token in the Authorization header.
Authorization: Bearer hk_live_<your_key>
Get your key from the Dashboard. Free accounts receive 100 requests/month.
Errors
All errors return a JSON body with error (machine code) and message (human text).
| HTTP Status | error code | Meaning |
|---|---|---|
| 401 | missing_api_key | No Authorization header provided. |
| 401 | invalid_api_key | Key not found or has been revoked. |
| 429 | quota_exceeded | Monthly request limit reached. |
| 429 | demo_limit_reached | Free demo already used today. |
| 400 | invalid_engines | Unknown engine identifiers provided. |
| 500 | analysis_failed | Internal engine error. |
POST /api/v1/market-analysis
Run a full market analysis across one or more Hachi engines. Returns engine signals and the latest synthesized trends from the database.
Request
curl -X POST https://api.hachi.dev/api/v1/market-analysis \
-H "Authorization: Bearer hk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"topic":"AI chip shortage","engines":["labor","geopolitical"],"depth":"full"}'| Body field | Type | Required | Description |
|---|---|---|---|
topic | string | No | Context hint for the analysis (max 200 chars). |
engines | string[] | No | Engine subset. Omit to use all engines. See Engine IDs. |
depth | string | No | "summary" (default) or "full". Summary returns 3 trends;
full returns 8. |
Response
{
"success": true,
"requestedAt": "2026-02-20T14:32:00.000Z",
"topic": "AI chip shortage",
"engines": ["labor", "geopolitical"],
"depth": "summary",
"usage": {
"requestsThisMonth": 12,
"limit": 100,
"plan": "free"
},
"results": {
"engineSignals": {
"labor": { ... },
"geopolitical": { ... }
},
"trends": [
{
"name": "Semiconductor Labor Crunch",
"description": "...",
"term": "short"
}
]
}
}POST /api/v1/market-analysis/demo
Run one free analysis per IP address per 24 hours. No API key required — used by the Playground on the home page. Requires a Cloudflare Turnstile captcha token.
curl -X POST https://api.hachi.dev/api/v1/market-analysis/demo \
-H "Content-Type: application/json" \
-d '{"topic":"remote work trends","captchaToken":"<turnstile_token>"}'GET /api/v1/keys
List all API keys for the authenticated owner. Requires a valid session cookie (set after magic-link sign-in). Never returns the key hash or plaintext.
{
"success": true,
"count": 2,
"keys": [
{
"prefix": "hk_live_a1b2",
"label": "Production",
"plan": "free",
"limit": 100,
"usageCount": 42,
"monthlyUsage": 12,
"active": true,
"lastUsedAt": "2026-02-20T10:00:00.000Z",
"createdAt": "2026-01-15T08:00:00.000Z"
}
]
}POST /api/v1/keys
Generate a new API key. The full key is returned once in the response body — it is never stored in plaintext and cannot be retrieved again.
{ "label": "My production key" }{
"success": true,
"message": "API key created. Copy the key now — it will not be shown again.",
"key": "hk_live_a1b2c3d4e5f6...",
"prefix": "hk_live_a1b2",
"label": "My production key",
"plan": "free",
"limit": 100
}DELETE /api/v1/keys/:prefix
Revoke an API key immediately. All subsequent requests with that key will return 401 invalid_api_key.
curl -X DELETE https://api.hachi.dev/api/v1/keys/hk_live_a1b2 \ -H "Cookie: hachi_session=your_session_token"
Engine IDs
Pass any subset of these identifiers in the engines array. Omit to run all.
| ID | Description |
|---|---|
labor | Job postings, skills demand, wage trends via Arbeitnow & Upwork |
geopolitical | Sanctions, risk events, news signals via NewsAPI & OpenSanctions |
consumer | Consumer sentiment, trending topics via Hacker News |
cultural | Pop culture, entertainment signals via TMDB & Ticketmaster |
environmental | Air quality, climate data via OpenAQ |
technological | GitHub trending, arXiv papers, patent filings |
Trend Object
Each trend in the results.trends array conforms to this schema:
interface Trend {
name: string; // Short title
description: string; // 2-3 sentence summary
extendedDescription?: string; // Full detail (depth: "full" only)
term: "short" | "medium" | "long"; // Time horizon
influenced?: Array<{ // Adjacent sectors affected
name: string;
description: string;
}>;
sources?: Array<{ // Supporting references
title: string;
url: string;
type: string;
}>;
charts?: ChartData[]; // Visualization data
}