2026-08-09 22:47:43 +02:00
import { docsAuthHref , docsOperationHref , docsOverviewHref , docsTagHref , endpoint } from "./hrefs" ;
import type { DocsGuideTree } from "./types" ;
import { validateDocsGuideTree } from "./resolve" ;
/**
* Decision-tree CONTENT for the no-LLM docs Ask guide.
* Source of truth for routes: `mountV1` in apps/api/internal/httpapi/v1.go
* and OpenAPI in apps/api/internal/httpapi/v1_openapi.go.
*
* UI agent: import DOCS_GUIDE_TREE / helpers from `$lib/docs-guide`.
* Deep links must match RapiDoc ids (`{id}` → `-id-`); use href helpers.
*/
const AUTH_NOTE =
"Company API key (prefix dk_…). Prefer Authorization: Bearer; X-API-Key also works. Create keys in Settings → API keys. On /docs when logged in, use Use my API key for RapiDoc Try-it. Do not use dashboard session cookies on /api/v1." ;
const TRY_IT_TIP =
"In RapiDoc: open Authorize (/docs#auth), paste Bearer dk_… (or X-API-Key), then expand an operation and use TRY. Prefer the server that matches your environment." ;
export const DOCS_GUIDE_TREE : DocsGuideTree = {
version : 2 ,
disclaimer :
"This is a guided router for the public API docs — not a chat bot and not an AI. Pick options to land on the right endpoints." ,
rootId : "root" ,
escapeLinks : [
{ label : "Browse API reference" , href : "/docs#overview" , kind : "docs" },
{ label : "OpenAPI YAML" , href : "/api/v1/openapi.yaml" , kind : "openapi" },
{ label : "Contact support" , href : "/support/new" , kind : "support" }
],
nodes : {
root : {
kind : "question" ,
id : "root" ,
pathKey : "start" ,
title : "What are you trying to do?" ,
body : "I’ ll route you to the right Descrybe public API docs (/api/v1). Pick one option — no free-text needed." ,
choices : [
{
id : "first" ,
label : "First API call / Try-it" ,
description : "API key, Authorize, health, Try" ,
nextId : "answer.first-win"
},
{
id : "specific" ,
label : "Something specific" ,
description : "Feeds, process, export, catalog…" ,
nextId : "q.intent"
},
{
id : "stuck" ,
label : "Error / stuck" ,
description : "401, 429, empty catalog, wrong process API" ,
nextId : "q.troubleshoot"
}
]
},
"q.intent" : {
kind : "question" ,
id : "q.intent" ,
pathKey : "intent" ,
title : "Which job?" ,
body : "Think in pipeline steps, not resource names." ,
choices : [
{
id : "pipeline" ,
label : "Feeds → process → export" ,
description : "Ingest, enrich, or outbound feeds" ,
nextId : "q.pipeline"
},
{
id : "catalog" ,
label : "Catalog & taxonomy" ,
description : "Categories, attributes, products" ,
nextId : "q.catalog"
},
{
id : "other" ,
label : "Marketing or billing" ,
description : "Calendar / campaigns, plan limits" ,
nextId : "q.other"
}
]
},
"q.pipeline" : {
kind : "question" ,
id : "q.pipeline" ,
pathKey : "pipeline" ,
title : "Where in the pipeline?" ,
choices : [
{
id : "feeds" ,
label : "Connect or sync a feed" ,
description : "Create, map, sync, sample" ,
nextId : "q.feeds"
},
{
id : "process" ,
label : "Process / enrich products" ,
description : "Two contracts — choose carefully" ,
nextId : "q.process"
},
{
id : "export" ,
label : "Export a channel feed" ,
description : "Templates, generate, selected SKUs" ,
nextId : "q.export"
}
]
},
"q.feeds" : {
kind : "question" ,
id : "q.feeds" ,
pathKey : "feeds" ,
synonyms : [ "supplier feed" , "import csv" , "sync feed" ],
title : "Feeds — what do you need?" ,
choices : [
{
id : "create" ,
label : "Create or manage a feed" ,
nextId : "answer.feeds.crud"
},
{
id : "map" ,
label : "Map fields / extract schema" ,
nextId : "answer.feeds.mapping"
},
{
id : "sync" ,
label : "Sync or sample-process" ,
nextId : "answer.feeds.sync"
}
]
},
"q.process" : {
kind : "question" ,
id : "q.process" ,
pathKey : "process" ,
synonyms : [ "enrich" , "generate descriptions" , "ai process" ],
title : "Which processing contract?" ,
body : "Do not mix bodies or response envelopes between these two surfaces." ,
choices : [
{
2026-08-17 21:20:45 +02:00
id : "ean" ,
label : "EAN batch" ,
2026-08-09 22:47:43 +02:00
description : "POST /products/process · { data: { process_id } }" ,
nextId : "answer.process.legacy"
},
{
id : "jobs" ,
label : "Dashboard-style jobs" ,
description : "POST /process · flat JSON · 202 Accepted" ,
nextId : "answer.process.jobs"
},
{
id : "chooser" ,
label : "Not sure — compare both" ,
nextId : "answer.process.chooser"
}
]
},
"q.export" : {
kind : "question" ,
id : "q.export" ,
pathKey : "export" ,
synonyms : [ "channel feed" , "google shopping" , "export csv" ],
title : "Export feeds — what do you need?" ,
choices : [
{
id : "setup" ,
label : "Create / template" ,
nextId : "answer.export.setup"
},
{
id : "generate" ,
label : "Generate full export" ,
nextId : "answer.export.generate"
},
{
id : "selected" ,
label : "Export selected products" ,
nextId : "answer.export.selected"
}
]
},
"q.catalog" : {
kind : "question" ,
id : "q.catalog" ,
pathKey : "catalog" ,
title : "Catalog work" ,
choices : [
{
id : "taxonomy" ,
label : "Categories & attributes" ,
nextId : "answer.taxonomy"
},
{
id : "products" ,
label : "Read or update products" ,
nextId : "answer.products"
},
{
id : "quality" ,
label : "Quality scores / reset" ,
nextId : "answer.products.quality"
}
]
},
"q.other" : {
kind : "question" ,
id : "q.other" ,
pathKey : "other" ,
title : "Marketing, account, or Try-it" ,
choices : [
{
id : "marketing" ,
label : "Marketing calendar / campaigns" ,
nextId : "answer.marketing"
},
{
id : "billing" ,
label : "Billing / plan limits" ,
nextId : "answer.billing"
},
{
id : "tryit" ,
label : "Authorize & Try-it in docs" ,
nextId : "answer.tryit"
}
]
},
"q.troubleshoot" : {
kind : "question" ,
id : "q.troubleshoot" ,
pathKey : "troubleshoot" ,
synonyms : [ "error" , "unauthorized" , "failed" , "empty" ],
title : "What’ s going wrong?" ,
choices : [
{
id : "auth" ,
label : "401 Unauthorized" ,
nextId : "answer.error.401"
},
{
id : "rate" ,
label : "429 rate limit" ,
nextId : "answer.error.429"
},
{
id : "data" ,
label : "Jobs stuck or empty products" ,
nextId : "q.troubleshoot.data"
}
]
},
"q.troubleshoot.data" : {
kind : "question" ,
id : "q.troubleshoot.data" ,
pathKey : "troubleshoot.data" ,
title : "Data / job symptoms" ,
choices : [
{
id : "job" ,
label : "Process job pending or failed" ,
nextId : "answer.error.job"
},
{
id : "empty" ,
label : "Empty catalog after sync" ,
nextId : "answer.error.empty"
},
{
id : "wrong" ,
label : "Wrong process endpoint?" ,
nextId : "answer.process.chooser"
}
]
},
/* ——— Answers ——— */
"answer.first-win" : {
kind : "answer" ,
id : "answer.first-win" ,
pathKey : "auth.first" ,
synonyms : [ "api key" , "authenticate" , "health" , "openapi" , "bearer" , "dk_" , "try it" , "try-it" , "authorize" ],
title : "First successful API call" ,
outcome : "Create a dk_ key, Authorize in RapiDoc, Try GET /health or /products." ,
body : "Public surface is API-key only under /api/v1. Health and OpenAPI are unauthenticated; everything else needs a key. Dashboard JSON under /api/* (cookies + CSRF) is a separate surface. In the docs viewer: 1) Create a key in Settings → API keys. 2) Open Authorize and paste Bearer dk_… (or X-API-Key). 3) Expand an operation and click TRY." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/health" , "Liveness (also /healthz and /readyz on the API host)" ),
endpoint ( "GET" , "/openapi.yaml" , "This OpenAPI document" ),
2026-08-17 21:20:45 +02:00
endpoint ( "GET" , "/products" , "List products ({ data, meta } envelope)" )
2026-08-09 22:47:43 +02:00
],
links : [
{ label : "Settings → API keys" , href : "/settings?tab=api-keys" , kind : "app" },
{ label : "Authorize (Try-it)" , href : docsAuthHref (), kind : "docs" },
{ label : "Auth overview" , href : docsOverviewHref ( "authenticate" ), kind : "docs" },
{ label : "Try GET /products" , href : docsOperationHref ( "GET" , "/products" ), kind : "docs" },
{ label : "OpenAPI YAML" , href : "/api/v1/openapi.yaml" , kind : "openapi" }
],
tip : TRY_IT_TIP ,
relatedIds : [ "answer.tryit" , "answer.feeds.crud" , "answer.process.chooser" ]
},
"answer.tryit" : {
kind : "answer" ,
id : "answer.tryit" ,
pathKey : "auth.tryit" ,
synonyms : [ "try it" , "try-it" , "authorize" , "rapidoc auth" , "test in browser" ],
title : "Authorize and Try-it in the docs" ,
outcome : "Unlock RapiDoc TRY for authenticated /api/v1 operations." ,
body : "1) Create or copy a company API key (dk_…). 2) Jump to Authorize and enter Authorization: Bearer dk_… (preferred) or X-API-Key. 3) Confirm the server URL matches your environment. 4) Open any operation below, fill params/body from the examples, and click TRY. Unauthenticated smoke: GET /health. Authenticated smoke: GET /products." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/health" , "No key required — confirm the viewer reaches the API" ),
endpoint ( "GET" , "/products" , "Authenticated smoke list (page=1&limit=1)" ),
2026-08-17 21:20:45 +02:00
endpoint ( "POST" , "/products/process" , "EAN batch — after Authorize" ),
2026-08-09 22:47:43 +02:00
endpoint ( "POST" , "/process" , "Jobs process — after Authorize" )
],
links : [
{ label : "Authorize panel" , href : docsAuthHref (), kind : "docs" },
{ label : "Overview → Authenticate" , href : docsOverviewHref ( "authenticate" ), kind : "docs" },
{ label : "Overview → Quick curl" , href : docsOverviewHref ( "quick-curl" ), kind : "docs" },
{ label : "Settings → API keys" , href : "/settings?tab=api-keys" , kind : "app" },
{ label : "Contact support" , href : "/support/new" , kind : "support" }
],
tip : TRY_IT_TIP ,
relatedIds : [ "answer.first-win" , "answer.error.401" , "answer.process.chooser" ]
},
"answer.feeds.crud" : {
kind : "answer" ,
id : "answer.feeds.crud" ,
pathKey : "feeds.crud" ,
synonyms : [ "create feed" , "list feeds" , "delete feed" ],
title : "Create and manage input feeds" ,
outcome : "Register a supplier CSV/XML/URL feed for your company." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/feeds" , "List input feeds" ),
endpoint ( "POST" , "/feeds" , "Create feed" ),
endpoint ( "GET" , "/feeds/{id}" , "Get feed" ),
endpoint ( "PATCH" , "/feeds/{id}" , "Update feed" ),
endpoint ( "DELETE" , "/feeds/{id}" , "Delete feed" )
],
links : [
{ label : "Feeds UI" , href : "/feeds" , kind : "app" },
{ label : "Feeds in docs" , href : docsTagHref ( "Feeds" ), kind : "docs" },
{ label : "Try GET /feeds" , href : docsOperationHref ( "GET" , "/feeds" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" },
{ label : "Stores hub" , href : "/stores" , kind : "app" }
],
warning : "Avoid deleting live feeds unless you intend to remove sync history for that source." ,
relatedIds : [ "answer.feeds.mapping" , "answer.feeds.sync" ]
},
"answer.feeds.mapping" : {
kind : "answer" ,
id : "answer.feeds.mapping" ,
pathKey : "feeds.mapping" ,
synonyms : [ "field mapping" , "extract schema" , "map columns" ],
title : "Map feed fields and extract schema" ,
outcome : "Discover sample paths, then PUT mappings before a meaningful sync." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "POST" , "/feeds/{id}/extract-schema" , "Extract schema sample paths and preview" ),
endpoint ( "GET" , "/feeds/{id}/mappings" , "Get feed mappings" ),
endpoint ( "PUT" , "/feeds/{id}/mappings" , "Put feed mappings" )
],
links : [
{ label : "Feeds UI" , href : "/feeds" , kind : "app" },
{ label : "Standard fields" , href : "/standard-fields" , kind : "app" },
{
label : "Extract schema in docs" ,
href : docsOperationHref ( "POST" , "/feeds/{id}/extract-schema" ),
kind : "docs"
},
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" }
],
tip : "Enable recommended standard fields in the UI before fine-tuning mappings." ,
relatedIds : [ "answer.feeds.sync" , "answer.taxonomy" ]
},
"answer.feeds.sync" : {
kind : "answer" ,
id : "answer.feeds.sync" ,
pathKey : "feeds.sync" ,
synonyms : [ "pull feed" , "refresh import" , "sync-process-sample" ],
title : "Sync a feed (and optional sample process)" ,
outcome : "Pull supplier rows into the company catalog; optionally process a sample." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "POST" , "/feeds/{id}/sync" , "Trigger feed sync" ),
endpoint ( "POST" , "/feeds/{id}/sync-process-sample" , "Sync then process a sample of raw products" ),
endpoint ( "GET" , "/products" , "List products after sync" )
],
links : [
{ label : "Sync in docs" , href : docsOperationHref ( "POST" , "/feeds/{id}/sync" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" },
{ label : "Feeds UI" , href : "/feeds" , kind : "app" }
],
tip : "Heavy mutations are rate-limited per company (HTTP 429: rate limit exceeded)." ,
relatedIds : [ "answer.process.legacy" , "answer.process.jobs" , "answer.error.empty" ]
},
"answer.process.legacy" : {
kind : "answer" ,
id : "answer.process.legacy" ,
2026-08-17 21:20:45 +02:00
pathKey : "process.ean" ,
2026-08-09 22:47:43 +02:00
synonyms : [ "ean" , "items[].ean" , "products/process" ],
2026-08-17 21:20:45 +02:00
title : "Public process (EAN batch)" ,
outcome : "Start and poll enrichment using POST/GET /products/process." ,
2026-08-09 22:47:43 +02:00
body : "POST body uses items[].ean (preferred). Handler also accepts raw_product_ids as an alternate on this same path. Responses use HTTP 200 with { data: { process_id, … } } and completed items[] when done." ,
authNote : AUTH_NOTE ,
endpoints : [
2026-08-17 21:20:45 +02:00
endpoint ( "POST" , "/products/process" , "Start processing by EAN" ),
2026-08-09 22:47:43 +02:00
endpoint ( "GET" , "/products/process/{id}" , "Processing job status by process_id" )
],
links : [
2026-08-17 21:20:45 +02:00
{ label : "Start in docs" , href : docsOperationHref ( "POST" , "/products/process" ), kind : "docs" },
2026-08-09 22:47:43 +02:00
{
2026-08-17 21:20:45 +02:00
label : "Status in docs" ,
2026-08-09 22:47:43 +02:00
href : docsOperationHref ( "GET" , "/products/process/{id}" ),
kind : "docs"
},
{ label : "Authorize & Try" , href : docsAuthHref (), kind : "docs" },
{ label : "Processing UI" , href : "/processing" , kind : "app" }
],
warning : "Not an alias of POST/GET /process — different body and envelope." ,
relatedIds : [ "answer.process.jobs" , "answer.process.chooser" , "answer.products" ]
},
"answer.process.jobs" : {
kind : "answer" ,
id : "answer.process.jobs" ,
pathKey : "process.jobs" ,
synonyms : [ "raw_product_ids" , "cancel job" , "retry job" ],
title : "Dashboard-style processing jobs" ,
outcome : "Start flat JSON jobs by raw_product_ids; poll, cancel, or retry." ,
2026-08-17 21:20:45 +02:00
body : "Same body shape as dashboard POST /api/processing/jobs. Start/retry return 202 Accepted with flat JSON (no data wrapper). Prefer /products/process for EAN-batch integrations." ,
2026-08-09 22:47:43 +02:00
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "POST" , "/process" , "Start processing job by raw_product_ids" ),
endpoint ( "GET" , "/process" , "List processing jobs" ),
endpoint ( "GET" , "/process/{id}" , "Processing job status" ),
endpoint ( "POST" , "/process/{id}/cancel" , "Cancel processing job" ),
endpoint ( "POST" , "/process/{id}/terminate" , "Terminate (alias of cancel)" ),
endpoint ( "POST" , "/process/{id}/retry" , "Retry a failed or cancelled job" )
],
links : [
{ label : "Start job in docs" , href : docsOperationHref ( "POST" , "/process" ), kind : "docs" },
{ label : "Processing tag" , href : docsTagHref ( "Processing" ), kind : "docs" },
{ label : "Authorize & Try" , href : docsAuthHref (), kind : "docs" },
{ label : "Processing UI" , href : "/processing" , kind : "app" }
],
relatedIds : [ "answer.process.legacy" , "answer.error.job" ]
},
"answer.process.chooser" : {
kind : "answer" ,
id : "answer.process.chooser" ,
pathKey : "process.which" ,
synonyms : [ "which process" , "dual contract" ],
title : "Which process API should I use?" ,
2026-08-17 21:20:45 +02:00
outcome : "Pick EAN batch for integrations; pick /process for dashboard-style jobs." ,
body : "1) Public process: POST/GET /products/process — items[].ean, HTTP 200 { data: { process_id } }. 2) Jobs: POST/GET /process — raw_product_ids, flat JSON, 202 on start. Mixing envelopes is the most common integration bug." ,
2026-08-09 22:47:43 +02:00
authNote : AUTH_NOTE ,
endpoints : [
2026-08-17 21:20:45 +02:00
endpoint ( "POST" , "/products/process" , "EAN batch" ),
2026-08-09 22:47:43 +02:00
endpoint ( "POST" , "/process" , "Dashboard-style jobs" )
],
links : [
2026-08-17 21:20:45 +02:00
{ label : "EAN process" , href : docsOperationHref ( "POST" , "/products/process" ), kind : "docs" },
2026-08-09 22:47:43 +02:00
{ label : "Jobs process" , href : docsOperationHref ( "POST" , "/process" ), kind : "docs" },
{
label : "Dual-mode overview" ,
href : docsOverviewHref ( "processing-contracts-dual-mode" ),
kind : "docs"
},
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" }
],
relatedIds : [ "answer.process.legacy" , "answer.process.jobs" ]
},
"answer.export.setup" : {
kind : "answer" ,
id : "answer.export.setup" ,
pathKey : "export.setup" ,
synonyms : [ "export template" , "create export feed" ],
title : "Create an export feed and template" ,
outcome : "Define an outbound channel feed and its template before generating files." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/export-feeds" , "List export feeds" ),
endpoint ( "POST" , "/export-feeds" , "Create export feed" ),
endpoint ( "GET" , "/export-feeds/{id}" , "Get export feed" ),
endpoint ( "PATCH" , "/export-feeds/{id}" , "Update export feed" ),
endpoint ( "PUT" , "/export-feeds/{id}/template" , "Update export feed template" ),
endpoint ( "DELETE" , "/export-feeds/{id}" , "Delete export feed" )
],
links : [
{ label : "Export feeds UI" , href : "/export-feeds" , kind : "app" },
{ label : "Export feeds tag" , href : docsTagHref ( "Export feeds" ), kind : "docs" },
{ label : "Try GET /export-feeds" , href : docsOperationHref ( "GET" , "/export-feeds" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" }
],
tip : "Input /feeds (ingest) ≠ /export-feeds (outbound)." ,
relatedIds : [ "answer.export.generate" , "answer.export.selected" ]
},
"answer.export.generate" : {
kind : "answer" ,
id : "answer.export.generate" ,
pathKey : "export.generate" ,
synonyms : [ "generate export" , "build channel file" ],
title : "Generate a full export feed file" ,
outcome : "Render the configured template into a downloadable/exportable feed file." ,
authNote : AUTH_NOTE ,
endpoints : [ endpoint ( "POST" , "/export-feeds/{id}/generate" , "Generate export feed file" )],
links : [
{
label : "Generate in docs" ,
href : docsOperationHref ( "POST" , "/export-feeds/{id}/generate" ),
kind : "docs"
},
{ label : "Authorize & Try" , href : docsAuthHref (), kind : "docs" },
{ label : "Export feeds UI" , href : "/export-feeds" , kind : "app" }
],
tip : "Generate is rate-limited with other heavy /api/v1 mutations." ,
relatedIds : [ "answer.export.setup" , "answer.export.selected" ]
},
"answer.export.selected" : {
kind : "answer" ,
id : "answer.export.selected" ,
pathKey : "export.selected" ,
synonyms : [ "export selected" , "export products" ],
title : "Export selected processed products" ,
outcome : "Push a chosen product set through an export feed without a full regenerate." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "POST" , "/export-feeds/{id}/export-products" , "Export selected processed products" )
],
links : [
{
label : "Export selected in docs" ,
href : docsOperationHref ( "POST" , "/export-feeds/{id}/export-products" ),
kind : "docs"
},
{ label : "Authorize & Try" , href : docsAuthHref (), kind : "docs" },
{ label : "Products UI" , href : "/products" , kind : "app" }
],
relatedIds : [ "answer.export.generate" , "answer.products" ]
},
"answer.taxonomy" : {
kind : "answer" ,
id : "answer.taxonomy" ,
pathKey : "taxonomy" ,
synonyms : [ "categories" , "attributes" , "taxonomy" ],
title : "Categories and attributes" ,
outcome : "Organize the catalog and define structured attributes used in descriptions." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/categories" , "List categories" ),
endpoint ( "POST" , "/categories" , "Create category" ),
2026-08-17 21:20:45 +02:00
endpoint ( "POST" , "/categories/create" , "Create category (alias of POST /categories)" ),
2026-08-09 22:47:43 +02:00
endpoint ( "GET" , "/categories/{id}" , "Get category by UUID" ),
endpoint ( "PATCH" , "/categories/{id}" , "Update category" ),
endpoint ( "DELETE" , "/categories/{id}" , "Delete category by unique_id" ),
endpoint ( "GET" , "/attributes" , "List attributes" ),
endpoint ( "POST" , "/attributes" , "Create attribute" ),
2026-08-17 21:20:45 +02:00
endpoint ( "POST" , "/attributes/create" , "Create attribute (alias of POST /attributes)" ),
2026-08-09 22:47:43 +02:00
endpoint ( "PATCH" , "/attributes/{id}" , "Update attribute" ),
endpoint ( "DELETE" , "/attributes/{id}" , "Delete attribute" )
],
links : [
{ label : "Categories UI" , href : "/categories" , kind : "app" },
{ label : "Attributes UI" , href : "/attributes" , kind : "app" },
{ label : "Categories tag" , href : docsTagHref ( "Categories" ), kind : "docs" },
{ label : "Attributes tag" , href : docsTagHref ( "Attributes" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" }
],
2026-08-17 21:20:45 +02:00
tip : "Prefer canonical POST /categories and POST /attributes; /create aliases exist for existing integrations." ,
2026-08-09 22:47:43 +02:00
relatedIds : [ "answer.feeds.mapping" , "answer.products" ]
},
"answer.products" : {
kind : "answer" ,
id : "answer.products" ,
pathKey : "products" ,
synonyms : [ "list products" , "get product" , "patch product" ],
title : "Read or update products" ,
outcome : "List the processed catalog, fetch one product, or patch fields." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/products" , "List products" ),
endpoint ( "GET" , "/products/{id}" , "Get processed product" ),
endpoint ( "PATCH" , "/products/{id}" , "Update processed product" )
],
links : [
{ label : "Products UI" , href : "/products" , kind : "app" },
{ label : "Products tag" , href : docsTagHref ( "Products" ), kind : "docs" },
{ label : "Try GET /products" , href : docsOperationHref ( "GET" , "/products" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" }
],
2026-08-17 21:20:45 +02:00
tip : "List uses query params: page, limit, status, search, sortBy, sortOrder, feedId." ,
2026-08-09 22:47:43 +02:00
relatedIds : [ "answer.products.quality" , "answer.process.legacy" ]
},
"answer.products.quality" : {
kind : "answer" ,
id : "answer.products.quality" ,
pathKey : "products.quality" ,
synonyms : [ "quality score" , "reset products" ],
title : "Product quality and reset" ,
outcome : "Inspect quality scores or reset products back to unprocessed." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/products/quality" , "List product quality scores" ),
endpoint ( "POST" , "/products/reset" , "Reset products to unprocessed" )
],
links : [
{ label : "Quality in docs" , href : docsOperationHref ( "GET" , "/products/quality" ), kind : "docs" },
{ label : "Reset in docs" , href : docsOperationHref ( "POST" , "/products/reset" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" },
{ label : "Products UI" , href : "/products" , kind : "app" }
],
warning : "Reset is destructive to processed state — confirm before calling in production." ,
relatedIds : [ "answer.products" , "answer.process.jobs" ]
},
"answer.marketing" : {
kind : "answer" ,
id : "answer.marketing" ,
pathKey : "marketing" ,
synonyms : [ "campaigns" , "calendar" , "seasonal" ],
title : "Marketing calendar (API)" ,
outcome : "List seasonal presets and prepare a calendar export via the public API." ,
2026-08-17 21:20:45 +02:00
body : "Public /api/v1/marketing/calendar* (and /campaigns aliases) are API-key routes for the content calendar. They are separate from session email campaigns under /api/campaigns in the dashboard UI." ,
2026-08-09 22:47:43 +02:00
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/marketing/calendar" , "List seasonal campaign presets" ),
endpoint ( "POST" , "/marketing/calendar/prepare" , "Prepare seasonal campaign export" ),
2026-08-17 21:20:45 +02:00
endpoint ( "GET" , "/campaigns" , "List presets (alias of GET /marketing/calendar)" ),
endpoint ( "POST" , "/campaigns/prepare" , "Prepare export (alias of POST /marketing/calendar/prepare)" )
2026-08-09 22:47:43 +02:00
],
links : [
{
label : "Calendar in docs" ,
href : docsOperationHref ( "GET" , "/marketing/calendar" ),
kind : "docs"
},
{ label : "Campaigns tag" , href : docsTagHref ( "Campaigns" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" },
{ label : "Campaigns UI" , href : "/campaigns" , kind : "app" },
{ label : "Marketing UI" , href : "/marketing" , kind : "app" }
],
relatedIds : [ "answer.export.generate" ]
},
"answer.billing" : {
kind : "answer" ,
id : "answer.billing" ,
pathKey : "billing" ,
synonyms : [ "credits" , "plan" , "upgrade" , "limits" ],
title : "Billing and plan limits" ,
outcome : "Plan and credit limits are enforced server-side on processing — manage them in the app, not via /api/v1." ,
body : "The public API-key surface does not expose checkout. Use Plans / Billing in the web app. Insufficient credits or free-tier gates typically surface as processing failures rather than OpenAPI operations." ,
links : [
{ label : "Plans" , href : "/plans" , kind : "app" },
{ label : "Billing" , href : "/billing" , kind : "app" },
{ label : "Settings" , href : "/settings" , kind : "app" },
{ label : "Contact support" , href : "/support/new" , kind : "support" }
],
2026-08-17 21:20:45 +02:00
tip : "After upgrading, retry the same process endpoint you already chose (EAN batch vs jobs)." ,
2026-08-09 22:47:43 +02:00
relatedIds : [ "answer.error.job" , "answer.process.chooser" ]
},
"answer.error.401" : {
kind : "answer" ,
id : "answer.error.401" ,
pathKey : "error.401" ,
synonyms : [ "unauthorized" , "invalid key" , "missing key" ],
title : "Fix 401 Unauthorized" ,
outcome : "Send a valid company API key on every authenticated /api/v1 call." ,
body : 'Missing or invalid keys return HTTP 401 with { "error": { "code": "unauthorized", "message": "Unauthorized" } }. Session cookies and CSRF tokens are for /api dashboard routes only.' ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/health" , "Unauthenticated liveness check" ),
endpoint ( "GET" , "/products" , "Authenticated smoke list" )
],
links : [
{ label : "Create API key" , href : "/settings?tab=api-keys" , kind : "app" },
{ label : "Authorize panel" , href : docsAuthHref (), kind : "docs" },
{ label : "Auth overview" , href : docsOverviewHref ( "authenticate" ), kind : "docs" },
{ label : "Contact support" , href : "/support/new" , kind : "support" }
],
tip : "Bearer is preferred when both Authorization and X-API-Key are set." ,
relatedIds : [ "answer.first-win" , "answer.error.429" ]
},
"answer.error.429" : {
kind : "answer" ,
id : "answer.error.429" ,
pathKey : "error.429" ,
synonyms : [ "rate limit" , "too many requests" ],
title : "Fix 429 rate limit exceeded" ,
outcome : "Back off and retry; heavy process / feed sync / export mutations are throttled per company." ,
body : "RateLimitV1Process guards authenticated /api/v1 mutations (in-process per API replica). Message: rate limit exceeded. Space out sync, process, generate, and export-products calls; prefer listing/GETs while waiting." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "POST" , "/feeds/{id}/sync" , "Sync (rate-limited)" ),
2026-08-17 21:20:45 +02:00
endpoint ( "POST" , "/products/process" , "EAN process (rate-limited)" ),
2026-08-09 22:47:43 +02:00
endpoint ( "POST" , "/process" , "Jobs process (rate-limited)" ),
endpoint ( "POST" , "/export-feeds/{id}/generate" , "Generate export (rate-limited)" )
],
links : [
{ label : "Browse Health tag" , href : docsTagHref ( "Health" ), kind : "docs" },
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" },
{ label : "Contact support" , href : "/support/new" , kind : "support" }
],
relatedIds : [ "answer.error.job" , "answer.billing" ]
},
"answer.error.job" : {
kind : "answer" ,
id : "answer.error.job" ,
pathKey : "error.job" ,
synonyms : [ "job failed" , "pending" , "cancel" , "retry" ],
title : "Process job pending or failed" ,
outcome : "Poll the matching status endpoint; cancel/retry only on the /process job surface." ,
2026-08-17 21:20:45 +02:00
body : "EAN batch: GET /products/process/{id} (data envelope). Jobs: GET /process/{id} plus POST …/cancel|terminate|retry. Confirm you started the job on the same contract you are polling." ,
2026-08-09 22:47:43 +02:00
authNote : AUTH_NOTE ,
endpoints : [
2026-08-17 21:20:45 +02:00
endpoint ( "GET" , "/products/process/{id}" , "EAN batch poll" ),
2026-08-09 22:47:43 +02:00
endpoint ( "GET" , "/process/{id}" , "Jobs poll" ),
endpoint ( "POST" , "/process/{id}/retry" , "Retry failed/cancelled job" )
],
links : [
{ label : "Processing UI" , href : "/processing" , kind : "app" },
{
label : "Compare process APIs" ,
href : docsOverviewHref ( "processing-contracts-dual-mode" ),
kind : "docs"
},
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" },
{ label : "Contact support" , href : "/support/new" , kind : "support" }
],
relatedIds : [ "answer.process.chooser" , "answer.billing" , "answer.error.429" ]
},
"answer.error.empty" : {
kind : "answer" ,
id : "answer.error.empty" ,
pathKey : "error.empty" ,
synonyms : [ "no products" , "empty after sync" , "zero products" ],
title : "Empty catalog after sync" ,
outcome : "Verify mappings and sync status, then list products again." ,
body : "Typical causes: feed not mapped, sync not finished, wrong company API key, or products still raw/unprocessed. Extract schema → PUT mappings → POST sync → GET /products. For enrichment, call the correct process contract next." ,
authNote : AUTH_NOTE ,
endpoints : [
endpoint ( "GET" , "/feeds/{id}" , "Get feed status" ),
endpoint ( "GET" , "/feeds/{id}/mappings" , "Confirm mappings exist" ),
endpoint ( "POST" , "/feeds/{id}/sync" , "Re-trigger sync" ),
endpoint ( "GET" , "/products" , "List products" )
],
links : [
{ label : "Feeds UI" , href : "/feeds" , kind : "app" },
{
label : "Mapping docs" ,
href : docsOperationHref ( "PUT" , "/feeds/{id}/mappings" ),
kind : "docs"
},
{ label : "Authorize" , href : docsAuthHref (), kind : "docs" },
{ label : "Contact support" , href : "/support/new" , kind : "support" }
],
relatedIds : [ "answer.feeds.mapping" , "answer.feeds.sync" , "answer.process.chooser" ]
}
}
};
/** Throws if the tree is structurally invalid (import-time safety for UI/tests). */
export function assertDocsGuideTree ( tree : DocsGuideTree = DOCS_GUIDE_TREE ) : void {
const errors = validateDocsGuideTree ( tree );
if ( errors . length > 0 ) {
throw new Error ( `docs-guide tree invalid: \ n- ${ errors . join ( "\n- " ) } ` );
}
}
assertDocsGuideTree ( DOCS_GUIDE_TREE );