POST /scan-url
Audit the GTM container on a public URL, or a known GTM container ID, in a single synchronous call.
Summary
- endpoint —
POST /scan-url - purpose — find the GTM container for a page or a GTM ID, parse it, and return findings plus a health score
- mcp equivalent —
scan_url - rate limit — 100/day per user
- synchronous — yes
Audit a published GTM container in a single synchronous call. Pass a URL and the endpoint reads the page HTML to find the GTM container ID, fetches that container's public gtm.js from Google, and runs every rule on it. Pass gtm_id if you already know the container ID; then no page is fetched.
The page is read only to find the container ID. The audit covers the container, not the page. The web scanner at tagmanifest.com adds page checks of its own; this endpoint does not run them.
Request
Headers
| Header | Required | Value |
|---|---|---|
Authorization | yes | Bearer <token>. An API key, or an MCP access token with the mcp:tools scope. See Authentication. |
Content-Type | recommended | application/json. The body is read as JSON whether or not the header is sent. |
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
url | string | one of | Full http(s) URL of a page. The endpoint fetches the HTML and takes the first GTM container ID it finds. Must be a full address even when gtm_id is also sent. |
gtm_id | string | one of | GTM container ID (e.g. GTM-EXAMPLE). When present, the page is not fetched. |
category | string | optional | Restrict findings to one category: consent, ga4, ads, ecommerce, security, pii, performance, quality, organization or dead-code. |
tier | string | optional | Restrict findings to one tier: error, warning, optimization, or info. |
top_n | number | optional | Maximum findings to return, most important first (by tier, then severity). Must be 0 or more. 0 returns no findings. Returns all findings when omitted. Numeric text such as "10" is accepted; a fraction is rounded down. |
include_evidence | boolean | optional | Return the longer finding: description, evidence, and the affected items the rule reports (some rules list only the first 10 or 20) in place of the first three. Default false. The text "true" and "false" are accepted. |
Any other field in the body is refused with a 400, so a misspelt filter is never silently ignored.
Synchronous. The endpoint returns when the scan completes. A container parsed in the last five minutes is reused, which skips the fetch from Google. No scan IDs, no polling, no webhooks.
Response
Returns a scan object with site metadata, container metadata, a findings array sorted by tier then severity, per-category and per-tier counts, and a health score.
| Field | Description |
|---|---|
site | The url you sent (or null), the gtm_id that was scanned, and from_cache. See Caching. |
container | Tag, trigger and variable counts, the GTM ID and the container name (or null). |
findings | The findings after the category and tier filters and the top_n cut. |
findings_total | How many findings match the filters, before top_n. |
findings_truncated | true when top_n cut the list short. |
by_category, by_tier | Counts of all findings in the container. Filters do not change them. |
health_score | The score for the whole container. Filters do not change it. See Health score. |
Each finding has rule_id, title, severity, tier, category, finding_count (always 1), affected_items, affected_items_total, action and recommendation. affected_items is a list of objects, one per tag, trigger or variable. Each has an id and a name, and some rules add fields such as eventName. By default the list holds the first three items and affected_items_total gives the number of items the rule reported.
With include_evidence: true a finding has description and evidence as well, affected_items holds the affected items the rule reports (some rules list only the first 10 or 20), and finding_count and affected_items_total are left out. The set of fields is fixed: a rule's own extra fields, such as subType, are not returned.
A finding's title and severity describe this container. They can differ from the rule's catalog entry in GET /rules. consent-no-cmp, for example, reports medium or high depending on what it found.
{
"scanned_at": "2026-05-04T13:25:53.659Z",
"duration_ms": 487,
"site": {
"url": "https://example.com",
"gtm_id": "GTM-EXAMPLE",
"from_cache": false
},
"container": {
"tag_count": 85,
"trigger_count": 34,
"variable_count": 52,
"gtm_id": "GTM-EXAMPLE",
"name": "Example Site"
},
"findings": [
{
"rule_id": "ga4-event-name-invalid-chars",
"title": "GA4 event names with invalid characters",
"severity": "high",
"tier": "warning",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{
"id": "14",
"name": "GA4 - Form Submit",
"eventName": "form-submit"
}
],
"affected_items_total": 1,
"action": "Fix event name characters",
"recommendation": "Rename events to use only letters, numbers, and underscores. Replace hyphens and spaces with underscores."
},
{
"rule_id": "consent-no-cmp",
"title": "No Consent Management Platform (CMP) detected",
"severity": "medium",
"tier": "warning",
"category": "consent",
"finding_count": 1,
"affected_items": [
{
"id": "21",
"name": "Google Ads - Conversion"
},
{
"id": "22",
"name": "Google Ads - Remarketing"
}
],
"affected_items_total": 2,
"action": "Deploy a CMP",
"recommendation": "Verify whether consent management is deployed outside GTM (check for CMP scripts in your page source). If consent is managed externally, no action needed in GTM. If no CMP exists and your site serves visitors in regions requiring consent, consider deploying one."
},
{
"rule_id": "ga4-debug-mode-hardcoded",
"title": "GA4 debug_mode hardcoded to \"true\"",
"severity": "high",
"tier": "optimization",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{
"id": "9",
"name": "GA4 - Config"
}
],
"affected_items_total": 1,
"action": "Fix debug_mode configuration",
"recommendation": "Remove the debug_mode parameter, or replace the literal \"true\" with a GTM variable that is only enabled in preview/debug environments."
}
],
"findings_total": 3,
"findings_truncated": false,
"by_category": {
"ga4": 2,
"consent": 1
},
"by_tier": {
"warning": 2,
"optimization": 1
},
"health_score": {
"score": 87,
"grade": "B",
"label": "Healthy",
"deductions": {
"error": 0,
"warning": 8,
"optimization": 5,
"info": 0,
"byCategory": {
"ga4": 2,
"consent": 1
}
},
"caps": {
"error": 35,
"warning": 20,
"optimization": 25,
"info": 0
},
"functionalIssueCount": 3
}
}
Response headers
| Header | Description |
|---|---|
X-RateLimit-Limit | Daily call ceiling for this endpoint (100) |
X-RateLimit-Remaining | Calls remaining in the current bucket |
X-RateLimit-Reset | ISO timestamp when the bucket resets (UTC midnight) |
These headers are on every response to a request that was counted, including the 400, 404, 429 and 502 errors below. They are absent on 401, 403, 405, 503 and on a 413 for a declared oversize body. See Rate limits.
Errors
| Status | Body | Cause |
|---|---|---|
400 | { "error": "Provide either url or gtm_id" } | Neither url nor gtm_id was supplied |
400 | { "error": "url must be a full http(s) URL" } | url value does not start with http:// or https:// |
400 | { "error": "Invalid gtm_id format: ..." } | gtm_id does not match GTM-[A-Z0-9]+ |
400 | { "error": "Unknown category \"privacy\". Category must be one of: ..." } | category or tier is not a real value. The message lists the accepted ones. An empty string is refused too: leave the field out. |
400 | { "error": "Unknown field: \"categories\" (did you mean \"category\"?). Accepted: ..." } | The body has a field this endpoint does not take. It is refused so that a misspelt filter is never silently ignored. |
400 | { "error": "top_n must be a number of 0 or more (got -5)." } | top_n is negative or not a number. A number sent as text is accepted; a fraction is rounded down. |
400 | { "error": "include_evidence must be true or false (got ...)." } | include_evidence is not a boolean (the text "true" and "false" are accepted, and null is treated as left out). |
400 | { "error": "url must be a full http(s) URL. To scan by container ID alone, leave url out." } | gtm_id was given together with a url that is not an address. |
401 | { "error": "Invalid or expired token" } | Missing, malformed, expired or revoked bearer token. An API key failure reads Invalid or revoked API key. |
403 | { "error": "insufficient_scope", "message": "This token was not granted 'mcp:tools', which this endpoint requires." } | An MCP access token without the mcp:tools scope. Not counted against the rate limit. |
404 | { "error": "No GTM container ID found in page HTML" } | The page was fetched but its HTML has no GTM- ID |
413 | { "error": "payload_too_large", "message": "Request body too large. The limit is 10 MB." } | Request body over 10 MB |
429 | { "error": "rate_limit_exceeded", "message": "Daily limit reached for scan_url (101/100)", "tool": "scan_url", "limit": 100, "count": 101, "reset_at": "..." } | Daily bucket exhausted; retry after X-RateLimit-Reset |
502 | { "error": "Failed to fetch page: https://example.com (HTTP 403)" } | The page at url could not be fetched. The reason is in brackets: the HTTP status the site returned, or a fetch error. The fetch gives up after 8 seconds per request, after more than 3 redirects, or when the page is over 5 MB. |
502 | { "error": "Container fetch failed: Failed to fetch gtm.js: HTTP 404. Google has no published container with that ID: check the ID, and that the container has been published." } | Google returned 404 for the container. The ID is wrong or the container has never been published. Retrying gives the same result. |
502 | { "error": "Container fetch failed: ..." } | Any other failure fetching or parsing gtm.js. May clear on a retry. |
503 | { "error": "rate_limiter_unavailable", "message": "..." } | The rate limiter could not be reached, so the scan was not run. The response has Retry-After: 30. |
500 | { "error": "..." } | Internal failure; retry once before reporting |
Try saying
Useful when wiring this endpoint to an agent that will call it programmatically.
Tell the agent something like:
You have access to TagManifest's REST API at https://developer.tagmanifest.com/v1.
Use POST /scan-url to audit a live web page for GTM tag issues.
Pass either "url" (a full https URL) or "gtm_id" (e.g. "GTM-EXAMPLE") in the request body.
Authentication: include header "Authorization: Bearer <api-key>".
Or, when the agent has direct HTTP capability:
- "Audit example.com using TagManifest's scan-url endpoint and return any consent findings"
- "Run a TagManifest scan on GTM-EXAMPLE and show only warning-tier findings"
See also
- MCP equivalent:
scan_url— same data, MCP path - POST /scan — use this instead when you have a GTM container export
- POST /evaluate-rule — run a single rule and get full evidence
Examples
curl https://developer.tagmanifest.com/v1/scan-url \
-H "Authorization: Bearer $TM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","top_n":25}'
const r = await fetch("https://developer.tagmanifest.com/v1/scan-url", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TM_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ url: "https://example.com", top_n: 25 })
});
const result = await r.json();
import httpx, os
r = httpx.post(
"https://developer.tagmanifest.com/v1/scan-url",
headers={"Authorization": f"Bearer {os.environ['TM_API_KEY']}"},
json={"url": "https://example.com", "top_n": 25},
)
result = r.json()
{
"scanned_at": "2026-05-04T13:25:53.659Z",
"duration_ms": 487,
"site": {
"url": "https://example.com",
"gtm_id": "GTM-EXAMPLE",
"from_cache": false
},
"container": {
"tag_count": 85,
"trigger_count": 34,
"variable_count": 52,
"gtm_id": "GTM-EXAMPLE",
"name": "Example Site"
},
"findings": [
{
"rule_id": "ga4-event-name-invalid-chars",
"title": "GA4 event names with invalid characters",
"severity": "high",
"tier": "warning",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{
"id": "14",
"name": "GA4 - Form Submit",
"eventName": "form-submit"
}
],
"affected_items_total": 1,
"action": "Fix event name characters",
"recommendation": "Rename events to use only letters, numbers, and underscores. Replace hyphens and spaces with underscores."
},
{
"rule_id": "consent-no-cmp",
"title": "No Consent Management Platform (CMP) detected",
"severity": "medium",
"tier": "warning",
"category": "consent",
"finding_count": 1,
"affected_items": [
{
"id": "21",
"name": "Google Ads - Conversion"
},
{
"id": "22",
"name": "Google Ads - Remarketing"
}
],
"affected_items_total": 2,
"action": "Deploy a CMP",
"recommendation": "Verify whether consent management is deployed outside GTM (check for CMP scripts in your page source). If consent is managed externally, no action needed in GTM. If no CMP exists and your site serves visitors in regions requiring consent, consider deploying one."
},
{
"rule_id": "ga4-debug-mode-hardcoded",
"title": "GA4 debug_mode hardcoded to \"true\"",
"severity": "high",
"tier": "optimization",
"category": "ga4",
"finding_count": 1,
"affected_items": [
{
"id": "9",
"name": "GA4 - Config"
}
],
"affected_items_total": 1,
"action": "Fix debug_mode configuration",
"recommendation": "Remove the debug_mode parameter, or replace the literal \"true\" with a GTM variable that is only enabled in preview/debug environments."
}
],
"findings_total": 3,
"findings_truncated": false,
"by_category": {
"ga4": 2,
"consent": 1
},
"by_tier": {
"warning": 2,
"optimization": 1
},
"health_score": {
"score": 87,
"grade": "B",
"label": "Healthy",
"deductions": {
"error": 0,
"warning": 8,
"optimization": 5,
"info": 0,
"byCategory": {
"ga4": 2,
"consent": 1
}
},
"caps": {
"error": 35,
"warning": 20,
"optimization": 25,
"info": 0
},
"functionalIssueCount": 3
}
}