Skip to main content
TagManifest /Docs Dashboard

POST /evaluate-rule

Run a single rule against a container and return its findings in full, with evidence. Use this to replay a check after a fix or drill into one specific concern.

On this page 5

Summary

  • endpoint — POST /evaluate-rule
  • purpose — run one rule against a container and return its findings in the rule engine's own form, with evidence
  • mcp equivalent — evaluate_rule
  • rate limit — 500/day per user
  • synchronous — yes

Runs a single rule against a container you supply by URL, by GTM container ID, or in the request body. Returns each finding as the rule engine produced it. evidence and affectedItems are always included. affectedItems holds the affected items the rule reports (some rules list only the first 10 or 20). Use this endpoint to replay a specific check after a fix, or to investigate one concern in depth without running a full audit.

POST/v1/evaluate-rule

Request

Headers

HeaderRequiredValue
AuthorizationyesBearer <token>. An API key, or an MCP access token with the mcp:tools scope. See Authentication.
Content-Typerecommendedapplication/json. The body is read as JSON whether or not the header is sent.

Body parameters

FieldTypeRequiredDescription
rule_idstringrequiredThe rule to evaluate, for example ga4-event-name-invalid-chars. Use GET /rules to discover valid IDs.
urlstringone ofFull http(s) page URL. The endpoint fetches the HTML, takes the first GTM container ID it finds, then fetches and parses that container's gtm.js.
gtm_idstringone ofGTM container ID (e.g. GTM-EXAMPLE). The page is not fetched.
dataobjectone ofThe container itself: a GTM JSON export as downloaded, or an already parsed container. Nothing is fetched. The accepted forms are described under POST /scan.

At least one of url, gtm_id or data is required alongside rule_id. You may send more than one. The endpoint then uses the first that is present, in this order: data, then gtm_id, then url. A url must still be a full http(s) address even when it is not the one used.

Any other field in the body is refused with a 400.

Synchronous. Returns when evaluation completes. A container parsed in the last five minutes is reused. No scan IDs, no polling, no webhooks.

Response

Returns a result object for the rule. The fired boolean is true if the rule produced at least one finding. A rule can produce more than one.

Findings here are in the rule engine's own form, which differs from the scan endpoints. The field names are camelCase: ruleId and affectedItems, not rule_id and affected_items. evidence is a list of objects whose fields depend on the rule. Some rules add extra fields, such as subType on consent-no-cmp.

container.from_cache is true or false when the container was fetched, and null when you sent it in data. container.gtm_id is read from the container. When a parsed container in data carries no ID, a gtm_id sent in the same request is used. With neither, it is null.

{
  "rule_id": "ga4-event-name-invalid-chars",
  "evaluated_at": "2026-05-04T13:25:53.659Z",
  "duration_ms": 312,
  "fired": true,
  "finding_count": 1,
  "findings": [
    {
      "ruleId": "ga4-event-name-invalid-chars",
      "severity": "high",
      "category": "ga4",
      "title": "GA4 event names with invalid characters",
      "description": "1 GA4 event tags have event names containing spaces, hyphens, or starting with a number. GA4 event names must only contain letters, numbers, and underscores, and must start with a letter. Events with invalid names may not appear in reports as expected.",
      "affectedItems": [
        {
          "id": "14",
          "name": "GA4 - Form Submit",
          "eventName": "form-submit"
        }
      ],
      "evidence": [
        {
          "tagId": "14",
          "eventName": "form-submit"
        }
      ],
      "recommendation": "Rename events to use only letters, numbers, and underscores. Replace hyphens and spaces with underscores.",
      "action": "Fix event name characters",
      "tier": "warning"
    }
  ],
  "container": {
    "gtm_id": "GTM-EXAMPLE",
    "tag_count": 85,
    "from_cache": false
  }
}

Response headers

HeaderDescription
X-RateLimit-LimitDaily call ceiling for this endpoint
X-RateLimit-RemainingCalls remaining in the current bucket
X-RateLimit-ResetISO timestamp when the bucket resets

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

StatusBodyCause
400{ "error": "Missing required field: rule_id" }rule_id not provided.
400{ "error": "Provide one of: data, gtm_id, url" }No container source in the body.
400{ "error": "Invalid gtm_id: ..." }GTM ID does not match the GTM-[A-Z0-9]+ pattern.
400{ "error": "url must be a full http(s) URL. For a container ID, use gtm_id." }url is not an address, for example a container ID put in the wrong field. Nothing is fetched.
400{ "error": "Unknown field: \"urls\" (did you mean \"url\"?). Accepted: rule_id, data, gtm_id, url." }The body has a field this endpoint does not take.
400{ "error": "data is not a GTM container: ..." }data is neither a GTM JSON export nor a parsed container. The full list of messages is under Bad data.
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": "Unknown rule_id: ..." }rule_id is not a rule the engine runs.
404{ "error": "No GTM container ID found in page HTML" }Page fetched successfully 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 evaluate_rule (501/500)", "tool": "evaluate_rule", "limit": 500, "count": 501, "reset_at": "..." }Daily bucket exhausted. Check X-RateLimit-Reset for the reset time.
502{ "error": "Failed to fetch page: ..." }Outbound fetch of the supplied url failed or returned a non-2xx status. 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" }Outbound gtm.js fetch failed. A 404 means Google has no published container with that ID.
503{ "error": "rate_limiter_unavailable", "message": "..." }The rate limiter could not be reached, so the rule was not run. The response has Retry-After: 30.
500{ "error": "Rule evaluation failed: ..." }Internal error during rule execution. Retry once before reporting.

Try saying

Useful when wiring this endpoint to an agent that calls it programmatically.

Tell the agent something like:

You have access to TagManifest's REST API at https://developer.tagmanifest.com/v1.
Use POST /evaluate-rule to run a single rule against a GTM container and get the full evidence.
Send rule_id plus at least one of: url, gtm_id, or data.
Authentication: include header "Authorization: Bearer <api-key>".

Or, when the agent has direct HTTP capability:

  • "Check whether example.com passes rule ga4-event-name-invalid-chars using TagManifest's evaluate-rule endpoint"
  • "Re-run the consent-no-cmp rule against GTM-EXAMPLE and show me the full evidence"
  • "After I push this fix, use evaluate-rule to confirm ga4-event-name-invalid-chars no longer fires on staging.example.com"

See also

Examples

Request
curl https://developer.tagmanifest.com/v1/evaluate-rule \
  -H "Authorization: Bearer $TM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rule_id":"ga4-event-name-invalid-chars","url":"https://example.com"}'
200 — finding
{
  "rule_id": "ga4-event-name-invalid-chars",
  "evaluated_at": "2026-05-04T13:25:53.659Z",
  "duration_ms": 312,
  "fired": true,
  "finding_count": 1,
  "findings": [
    {
      "ruleId": "ga4-event-name-invalid-chars",
      "severity": "high",
      "category": "ga4",
      "title": "GA4 event names with invalid characters",
      "description": "1 GA4 event tags have event names containing spaces, hyphens, or starting with a number. GA4 event names must only contain letters, numbers, and underscores, and must start with a letter. Events with invalid names may not appear in reports as expected.",
      "affectedItems": [
        {
          "id": "14",
          "name": "GA4 - Form Submit",
          "eventName": "form-submit"
        }
      ],
      "evidence": [
        {
          "tagId": "14",
          "eventName": "form-submit"
        }
      ],
      "recommendation": "Rename events to use only letters, numbers, and underscores. Replace hyphens and spaces with underscores.",
      "action": "Fix event name characters",
      "tier": "warning"
    }
  ],
  "container": {
    "gtm_id": "GTM-EXAMPLE",
    "tag_count": 85,
    "from_cache": false
  }
}