[{"data":1,"prerenderedAt":794},["ShallowReactive",2],{"docs-\u002Fsdks\u002Fnode\u002F":3},{"id":4,"title":5,"body":6,"breadcrumb":757,"coderail":764,"dateModified":784,"datePublished":784,"description":785,"extension":786,"meta":787,"navigation":91,"next":784,"path":788,"prev":784,"schemaType":789,"seo":790,"stem":791,"wide":792,"__hash__":793},"docs\u002Fsdks\u002Fnode.md","Node.js",{"type":7,"value":8,"toc":750},"minimark",[9,13,29,34,37,41,66,69,284,299,303,320,379,385,416,419,567,589,592,596,614,617,674,682,686,700,738,746],[10,11,12],"p",{},"There is no officially published npm package for TagManifest today. This page documents two approaches that work against the live API: a minimal manual fetch wrapper suitable for most use cases, and a generated TypeScript client from the OpenAPI spec for teams that want full type coverage.",[14,15,17],"callout",{"variant":16},"warn",[10,18,19,23,24,28],{},[20,21,22],"strong",{},"Beta — generated client not officially published yet."," The OpenAPI spec at ",[25,26,27],"code",{},"\u002Fopenapi.json"," is stable, but the generated npm package is not in the registry. Use the manual wrapper for production, or generate a local client from the spec.",[30,31,33],"h2",{"id":32},"status","Status",[10,35,36],{},"The TagManifest REST API is stable and versioned at the path level. All six endpoints work with any HTTP client. An officially maintained npm package is planned; until then, the approaches below cover the full API surface.",[30,38,40],{"id":39},"manual-fetch-wrapper","Manual fetch wrapper",[10,42,43,44,47,48,47,51,47,54,57,58,61,62,65],{},"The wrapper below covers ",[25,45,46],{},"POST \u002Fscan-url",", ",[25,49,50],{},"POST \u002Fscan",[25,52,53],{},"POST \u002Fevaluate-rule",[25,55,56],{},"GET \u002Frules"," and ",[25,59,60],{},"GET \u002Frules-detail?rule_id=",", with error normalization and the ",[25,63,64],{},"TM_API_KEY"," environment variable convention. Paths are written without a trailing slash, as on the endpoint pages.",[10,67,68],{},"The API refuses unknown fields and query parameters with a 400, so pass only the fields each endpoint page lists.",[70,71,76],"pre",{"className":72,"code":73,"language":74,"meta":75,"style":75},"language-javascript shiki shiki-themes github-light github-dark","const BASE = \"https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\";\n\nasync function call(path, method, payload, apiKey) {\n  const opts = {\n    method,\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application\u002Fjson\",\n    },\n  };\n  if (payload) opts.body = JSON.stringify(payload);\n  const res = await fetch(`${BASE}${path}`, opts);\n  if (!res.ok) {\n    const body = await res.json().catch(() => ({}));\n    const err = new Error(body.error || res.statusText);\n    err.status = res.status;\n    err.body = body;\n    throw err;\n  }\n  return res.json();\n}\n\nexport const tagmanifest = {\n  scanUrl: (params) => call(\"\u002Fscan-url\", \"POST\", params, process.env.TM_API_KEY),\n  scanContainer: (params) => call(\"\u002Fscan\", \"POST\", params, process.env.TM_API_KEY),\n  evaluateRule: (params) => call(\"\u002Fevaluate-rule\", \"POST\", params, process.env.TM_API_KEY),\n  \u002F\u002F query may hold category, tier, status and limit. Any other key is refused with 400.\n  listRules: (query = {}) => {\n    const qs = new URLSearchParams(query).toString();\n    return call(`\u002Frules${qs ? \"?\" + qs : \"\"}`, \"GET\", null, process.env.TM_API_KEY);\n  },\n  getRule: (ruleId) =>\n    call(`\u002Frules-detail?rule_id=${encodeURIComponent(ruleId)}`, \"GET\", null, process.env.TM_API_KEY),\n};\n","javascript","",[25,77,78,86,93,99,105,111,117,123,129,135,141,147,153,159,165,171,177,183,189,195,201,207,212,218,224,230,236,242,248,254,260,266,272,278],{"__ignoreMap":75},[79,80,83],"span",{"class":81,"line":82},"line",1,[79,84,85],{},"const BASE = \"https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\";\n",[79,87,89],{"class":81,"line":88},2,[79,90,92],{"emptyLinePlaceholder":91},true,"\n",[79,94,96],{"class":81,"line":95},3,[79,97,98],{},"async function call(path, method, payload, apiKey) {\n",[79,100,102],{"class":81,"line":101},4,[79,103,104],{},"  const opts = {\n",[79,106,108],{"class":81,"line":107},5,[79,109,110],{},"    method,\n",[79,112,114],{"class":81,"line":113},6,[79,115,116],{},"    headers: {\n",[79,118,120],{"class":81,"line":119},7,[79,121,122],{},"      Authorization: `Bearer ${apiKey}`,\n",[79,124,126],{"class":81,"line":125},8,[79,127,128],{},"      \"Content-Type\": \"application\u002Fjson\",\n",[79,130,132],{"class":81,"line":131},9,[79,133,134],{},"    },\n",[79,136,138],{"class":81,"line":137},10,[79,139,140],{},"  };\n",[79,142,144],{"class":81,"line":143},11,[79,145,146],{},"  if (payload) opts.body = JSON.stringify(payload);\n",[79,148,150],{"class":81,"line":149},12,[79,151,152],{},"  const res = await fetch(`${BASE}${path}`, opts);\n",[79,154,156],{"class":81,"line":155},13,[79,157,158],{},"  if (!res.ok) {\n",[79,160,162],{"class":81,"line":161},14,[79,163,164],{},"    const body = await res.json().catch(() => ({}));\n",[79,166,168],{"class":81,"line":167},15,[79,169,170],{},"    const err = new Error(body.error || res.statusText);\n",[79,172,174],{"class":81,"line":173},16,[79,175,176],{},"    err.status = res.status;\n",[79,178,180],{"class":81,"line":179},17,[79,181,182],{},"    err.body = body;\n",[79,184,186],{"class":81,"line":185},18,[79,187,188],{},"    throw err;\n",[79,190,192],{"class":81,"line":191},19,[79,193,194],{},"  }\n",[79,196,198],{"class":81,"line":197},20,[79,199,200],{},"  return res.json();\n",[79,202,204],{"class":81,"line":203},21,[79,205,206],{},"}\n",[79,208,210],{"class":81,"line":209},22,[79,211,92],{"emptyLinePlaceholder":91},[79,213,215],{"class":81,"line":214},23,[79,216,217],{},"export const tagmanifest = {\n",[79,219,221],{"class":81,"line":220},24,[79,222,223],{},"  scanUrl: (params) => call(\"\u002Fscan-url\", \"POST\", params, process.env.TM_API_KEY),\n",[79,225,227],{"class":81,"line":226},25,[79,228,229],{},"  scanContainer: (params) => call(\"\u002Fscan\", \"POST\", params, process.env.TM_API_KEY),\n",[79,231,233],{"class":81,"line":232},26,[79,234,235],{},"  evaluateRule: (params) => call(\"\u002Fevaluate-rule\", \"POST\", params, process.env.TM_API_KEY),\n",[79,237,239],{"class":81,"line":238},27,[79,240,241],{},"  \u002F\u002F query may hold category, tier, status and limit. Any other key is refused with 400.\n",[79,243,245],{"class":81,"line":244},28,[79,246,247],{},"  listRules: (query = {}) => {\n",[79,249,251],{"class":81,"line":250},29,[79,252,253],{},"    const qs = new URLSearchParams(query).toString();\n",[79,255,257],{"class":81,"line":256},30,[79,258,259],{},"    return call(`\u002Frules${qs ? \"?\" + qs : \"\"}`, \"GET\", null, process.env.TM_API_KEY);\n",[79,261,263],{"class":81,"line":262},31,[79,264,265],{},"  },\n",[79,267,269],{"class":81,"line":268},32,[79,270,271],{},"  getRule: (ruleId) =>\n",[79,273,275],{"class":81,"line":274},33,[79,276,277],{},"    call(`\u002Frules-detail?rule_id=${encodeURIComponent(ruleId)}`, \"GET\", null, process.env.TM_API_KEY),\n",[79,279,281],{"class":81,"line":280},34,[79,282,283],{},"};\n",[10,285,286,287,290,291,294,295,298],{},"Node.js 18+ includes the global ",[25,288,289],{},"fetch"," implementation used above. For older Node versions, substitute ",[25,292,293],{},"node-fetch"," or ",[25,296,297],{},"undici",".",[30,300,302],{"id":301},"generated-client","Generated client",[10,304,305,306,311,312,315,316,319],{},"The ",[307,308,310],"a",{"href":309},"\u002Fopenapi\u002F","OpenAPI spec"," is available at ",[25,313,314],{},"https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fopenapi.json",". Use ",[25,317,318],{},"openapi-generator-cli"," to produce a typed TypeScript client:",[70,321,325],{"className":322,"code":323,"language":324,"meta":75,"style":75},"language-bash shiki shiki-themes github-light github-dark","npx @openapitools\u002Fopenapi-generator-cli generate \\\n  -i https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fopenapi.json \\\n  -g typescript-fetch \\\n  -o .\u002Ftagmanifest-client \\\n  --additional-properties=supportsES6=true,npmName=tagmanifest-client\n","bash",[25,326,327,344,354,364,374],{"__ignoreMap":75},[79,328,329,333,337,340],{"class":81,"line":82},[79,330,332],{"class":331},"sScJk","npx",[79,334,336],{"class":335},"sZZnC"," @openapitools\u002Fopenapi-generator-cli",[79,338,339],{"class":335}," generate",[79,341,343],{"class":342},"sj4cs"," \\\n",[79,345,346,349,352],{"class":81,"line":88},[79,347,348],{"class":342},"  -i",[79,350,351],{"class":335}," https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fopenapi.json",[79,353,343],{"class":342},[79,355,356,359,362],{"class":81,"line":95},[79,357,358],{"class":342},"  -g",[79,360,361],{"class":335}," typescript-fetch",[79,363,343],{"class":342},[79,365,366,369,372],{"class":81,"line":101},[79,367,368],{"class":342},"  -o",[79,370,371],{"class":335}," .\u002Ftagmanifest-client",[79,373,343],{"class":342},[79,375,376],{"class":81,"line":107},[79,377,378],{"class":342},"  --additional-properties=supportsES6=true,npmName=tagmanifest-client\n",[10,380,305,381,384],{},[25,382,383],{},"typescript-fetch"," generator produces a client that works in Node.js and browser environments. After generation:",[70,386,388],{"className":322,"code":387,"language":324,"meta":75,"style":75},"cd tagmanifest-client\nnpm install\nnpm run build\n",[25,389,390,398,406],{"__ignoreMap":75},[79,391,392,395],{"class":81,"line":82},[79,393,394],{"class":342},"cd",[79,396,397],{"class":335}," tagmanifest-client\n",[79,399,400,403],{"class":81,"line":88},[79,401,402],{"class":331},"npm",[79,404,405],{"class":335}," install\n",[79,407,408,410,413],{"class":81,"line":95},[79,409,402],{"class":331},[79,411,412],{"class":335}," run",[79,414,415],{"class":335}," build\n",[10,417,418],{},"Then import and configure:",[70,420,424],{"className":421,"code":422,"language":423,"meta":75,"style":75},"language-typescript shiki shiki-themes github-light github-dark","import { Configuration, DefaultApi } from \".\u002Ftagmanifest-client\";\n\nconst config = new Configuration({\n  basePath: \"https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\",\n  accessToken: process.env.TM_API_KEY,\n});\n\nconst api = new DefaultApi(config);\nconst result = await api.scanUrl({\n  scanUrlRequest: { url: \"https:\u002F\u002Fexample.com\", topN: 25 },\n});\nconsole.log(result.healthScore?.score);\n","typescript",[25,425,426,445,449,469,480,489,494,498,515,535,552,556],{"__ignoreMap":75},[79,427,428,432,436,439,442],{"class":81,"line":82},[79,429,431],{"class":430},"szBVR","import",[79,433,435],{"class":434},"sVt8B"," { Configuration, DefaultApi } ",[79,437,438],{"class":430},"from",[79,440,441],{"class":335}," \".\u002Ftagmanifest-client\"",[79,443,444],{"class":434},";\n",[79,446,447],{"class":81,"line":88},[79,448,92],{"emptyLinePlaceholder":91},[79,450,451,454,457,460,463,466],{"class":81,"line":95},[79,452,453],{"class":430},"const",[79,455,456],{"class":342}," config",[79,458,459],{"class":430}," =",[79,461,462],{"class":430}," new",[79,464,465],{"class":331}," Configuration",[79,467,468],{"class":434},"({\n",[79,470,471,474,477],{"class":81,"line":101},[79,472,473],{"class":434},"  basePath: ",[79,475,476],{"class":335},"\"https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\"",[79,478,479],{"class":434},",\n",[79,481,482,485,487],{"class":81,"line":107},[79,483,484],{"class":434},"  accessToken: process.env.",[79,486,64],{"class":342},[79,488,479],{"class":434},[79,490,491],{"class":81,"line":113},[79,492,493],{"class":434},"});\n",[79,495,496],{"class":81,"line":119},[79,497,92],{"emptyLinePlaceholder":91},[79,499,500,502,505,507,509,512],{"class":81,"line":125},[79,501,453],{"class":430},[79,503,504],{"class":342}," api",[79,506,459],{"class":430},[79,508,462],{"class":430},[79,510,511],{"class":331}," DefaultApi",[79,513,514],{"class":434},"(config);\n",[79,516,517,519,522,524,527,530,533],{"class":81,"line":131},[79,518,453],{"class":430},[79,520,521],{"class":342}," result",[79,523,459],{"class":430},[79,525,526],{"class":430}," await",[79,528,529],{"class":434}," api.",[79,531,532],{"class":331},"scanUrl",[79,534,468],{"class":434},[79,536,537,540,543,546,549],{"class":81,"line":137},[79,538,539],{"class":434},"  scanUrlRequest: { url: ",[79,541,542],{"class":335},"\"https:\u002F\u002Fexample.com\"",[79,544,545],{"class":434},", topN: ",[79,547,548],{"class":342},"25",[79,550,551],{"class":434}," },\n",[79,553,554],{"class":81,"line":143},[79,555,493],{"class":434},[79,557,558,561,564],{"class":81,"line":149},[79,559,560],{"class":434},"console.",[79,562,563],{"class":331},"log",[79,565,566],{"class":434},"(result.healthScore?.score);\n",[10,568,569,570,573,574,47,576,47,579,47,582,47,585,588],{},"Method names come from the ",[25,571,572],{},"operationId"," values in the spec: ",[25,575,532],{},[25,577,578],{},"scanContainer",[25,580,581],{},"evaluateRule",[25,583,584],{},"listRules",[25,586,587],{},"getRule",". The exact class, method and parameter names depend on the generator version. Check the README the generator writes into the output folder.",[10,590,591],{},"Regenerate the client whenever you pull a new version of the spec. The spec is hand-authored from the live function source and updated when endpoints change.",[30,593,595],{"id":594},"error-handling","Error handling",[10,597,598,599,602,603,606,607,609,610,613],{},"All non-2xx responses return a JSON body with an ",[25,600,601],{},"error"," string. The manual wrapper above normalizes these into JavaScript ",[25,604,605],{},"Error"," objects with a ",[25,608,32],{}," property. In the generated client, the generator wraps non-2xx responses in a ",[25,611,612],{},"ResponseError"," with the raw response attached.",[10,615,616],{},"The errors you are most likely to encounter:",[618,619,620,632],"table",{},[621,622,623],"thead",{},[624,625,626,629],"tr",{},[627,628,33],"th",{},[627,630,631],{},"Cause",[633,634,635,644,654,666],"tbody",{},[624,636,637,641],{},[638,639,640],"td",{},"400",[638,642,643],{},"Missing, malformed or unknown request field — check parameter names and types. A misspelt field is refused, not ignored.",[624,645,646,649],{},[638,647,648],{},"401",[638,650,651,652,298],{},"Invalid or missing API key — check ",[25,653,64],{},[624,655,656,659],{},[638,657,658],{},"429",[638,660,661,662,665],{},"Daily rate limit exceeded — read ",[25,663,664],{},"reset_at"," from the body and back off.",[624,667,668,671],{},[638,669,670],{},"502",[638,672,673],{},"The target URL or GTM CDN was unreachable — retry with backoff.",[10,675,676,677,681],{},"See ",[307,678,680],{"href":679},"\u002Ferrors\u002F","Errors"," for the full list.",[30,683,685],{"id":684},"rate-limit-headers","Rate-limit headers",[10,687,688,689,47,692,695,696,699],{},"Responses to requests that were counted include ",[25,690,691],{},"X-RateLimit-Limit",[25,693,694],{},"X-RateLimit-Remaining",", and ",[25,697,698],{},"X-RateLimit-Reset",". That covers 200 responses, the 429, and errors such as 400, 404 and 502. The headers are absent on 401, 403, 405 and 503 responses, so check that they exist before reading them:",[70,701,703],{"className":72,"code":702,"language":74,"meta":75,"style":75},"const res = await fetch(`${BASE}\u002Fscan-url`, { \u002F* … *\u002F });\nconst remainingHeader = res.headers.get(\"X-RateLimit-Remaining\");\nconst resetAt = res.headers.get(\"X-RateLimit-Reset\");\n\nif (remainingHeader !== null && parseInt(remainingHeader, 10) \u003C 5) {\n  console.warn(`Approaching scan_url limit. Resets at ${resetAt}`);\n}\n",[25,704,705,710,715,720,724,729,734],{"__ignoreMap":75},[79,706,707],{"class":81,"line":82},[79,708,709],{},"const res = await fetch(`${BASE}\u002Fscan-url`, { \u002F* … *\u002F });\n",[79,711,712],{"class":81,"line":88},[79,713,714],{},"const remainingHeader = res.headers.get(\"X-RateLimit-Remaining\");\n",[79,716,717],{"class":81,"line":95},[79,718,719],{},"const resetAt = res.headers.get(\"X-RateLimit-Reset\");\n",[79,721,722],{"class":81,"line":101},[79,723,92],{"emptyLinePlaceholder":91},[79,725,726],{"class":81,"line":107},[79,727,728],{},"if (remainingHeader !== null && parseInt(remainingHeader, 10) \u003C 5) {\n",[79,730,731],{"class":81,"line":113},[79,732,733],{},"  console.warn(`Approaching scan_url limit. Resets at ${resetAt}`);\n",[79,735,736],{"class":81,"line":119},[79,737,206],{},[10,739,740,741,745],{},"When the limit is reached, wait until the reset time. There are no paid plans and no way to raise a limit. See ",[307,742,744],{"href":743},"\u002Frate-limits\u002F","Rate limits"," for daily caps by tool.",[747,748,749],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}",{"title":75,"searchDepth":88,"depth":88,"links":751},[752,753,754,755,756],{"id":32,"depth":88,"text":33},{"id":39,"depth":88,"text":40},{"id":301,"depth":88,"text":302},{"id":594,"depth":88,"text":595},{"id":684,"depth":88,"text":685},[758,761,763],{"label":759,"href":760},"API Reference","\u002F",{"label":762},"SDKs",{"label":5},{"cards":765,"onpage":777},[766,772],{"title":767,"tabs":768},"Manual wrapper — scan URL",[769],{"label":770,"language":74,"code":771},"JavaScript","const BASE = \"https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fv1\";\n\nasync function scanUrl(params, apiKey) {\n  const res = await fetch(`${BASE}\u002Fscan-url`, {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${apiKey}`,\n      \"Content-Type\": \"application\u002Fjson\",\n    },\n    body: JSON.stringify(params),\n  });\n  if (!res.ok) {\n    const err = await res.json().catch(() => ({}));\n    throw Object.assign(\n      new Error(err.error || res.statusText),\n      { status: res.status }\n    );\n  }\n  return res.json();\n}\n\n\u002F\u002F Usage\nconst result = await scanUrl(\n  { url: \"https:\u002F\u002Fexample.com\", top_n: 25 },\n  process.env.TM_API_KEY\n);\nconsole.log(result.health_score.score);\n",{"title":773,"tabs":774},"Generated client install",[775],{"label":324,"language":324,"code":776},"npx @openapitools\u002Fopenapi-generator-cli generate \\\n  -i https:\u002F\u002Fdeveloper.tagmanifest.com\u002Fopenapi.json \\\n  -g typescript-fetch \\\n  -o .\u002Ftagmanifest-client \\\n  --additional-properties=supportsES6=true,npmName=tagmanifest-client\n\ncd tagmanifest-client && npm install && npm run build\n",[778,779,781,782,783],{"id":32,"label":33},{"id":780,"label":40},"manual-wrapper",{"id":301,"label":302},{"id":594,"label":595},{"id":684,"label":685},null,"Node.js client options for the TagManifest API. Manual fetch wrapper and generated client via openapi-generator-cli.","md",{},"\u002Fsdks\u002Fnode","TechArticle",{"title":5,"description":785},"sdks\u002Fnode",false,"UeQ-iDZ114DEzSDrz-UAA0U8jtgfe9ZURnCV6lpJ16Y",1796069482587]