REST API
Register GA4, Firebase and Tag Manager properties, trigger scans, inspect any ID without tracking it, read snapshots and diffs, and manage alert channels. One action-routed endpoint, JSON in and out. Requires an active Spy or Agency plan, except health, inspect, gtm.inspect and resolve, which work on every plan.
Base URL and authentication
Base URL: https://tagspy.io/api/v1. Every operation is selected with the action query parameter.
Create a key in My alerts → Developer access. The key is shown once; store it like a password. Revoke it from the same screen at any time. Send it as a bearer token:
curl "https://tagspy.io/api/v1?action=health" \
-H "Authorization: Bearer tsk_xxxxxxxxxxxxxxxx"Plans without API access receive 402 on every other action. Read-only actions also accept GET; actions that change something must be POST.
Core concepts
- Property: something you watch. A GA4 stream (G-/GT-), a Firebase app or a GTM container. Has a label, a scan cadence and a last-scanned time.
- Snapshot: the parsed configuration at one moment, stored immutably with a SHA-256 hash. If a scan produces the same hash as the last one, nothing new is stored.
- Diff: a semantic comparison between a snapshot and the one before it, as added, removed and modified entries. Cosmetic fields such as fetch time are ignored.
- Alert channel: where a change is delivered:
email,slack,teamsorwebhook. Global or scoped to one property.
Actions
| Method | action | Body / query | Response |
|---|---|---|---|
| GET | health | - | { ok, user, email, plan, superadmin, version } |
| GET | properties | - | { properties: Property[] } |
| POST | property.add | { ga4Id | containerId | appId, label? } | { property } (201) |
| POST | property.remove | { propertyId } | { removed: true } |
| POST | resolve | { url } | { url, final_url, candidates:[{id,source}], containers:[], error } |
| POST | scan | { ga4Id? | containerId? | appId? | propertyId? | url?, createIfMissing? (default true), alerts?: [{kind,target,label?}] (max 10) } | { property, resolution, scan:{snapshotId,changed,hash,isFirstSnapshot,summary}, alerts:{created: Channel[],errors} } |
| POST | inspect | { ga4Id? | appId? | containerId? | url? } | { property_id, platform, tracked:false, resolution, config } |
| POST | gtm.inspect | { containerId? | url? } | { container_id, platform:"gtm", tracked:false, resolution, container } |
| GET | snapshot | id | { snapshot:{ id, property_id, config_hash, fetched_at, config_json } } |
| GET | diff | snapshotId | { from, to, report } |
| GET | alert.list | - | { channels } |
| POST | alert.add | { kind, target, label?, propertyId? } | { channel } (201) |
| POST | alert.remove | { id } | { removed: true } |
Examples
List your properties:
curl "https://tagspy.io/api/v1?action=properties" \
-H "Authorization: Bearer $TAGSPY_KEY"{
"properties": [
{
"id": "6b0f6a52-3c1e-4f0e-9a43-0e5c2f6a1d11",
"property_id": "G-KN80RDFSQK",
"platform": "web",
"label": "Main site",
"scan_frequency": "hourly",
"last_scanned_at": "2026-10-21T08:00:12.000Z",
"last_change_at": "2026-10-19T14:02:44.000Z",
"created_at": "2026-10-01T09:12:00.000Z",
"snapshot_count": 12
}
]
}Scan a property (creating it if needed) and attach an alert in the same call:
curl -X POST "https://tagspy.io/api/v1?action=scan" \
-H "Authorization: Bearer $TAGSPY_KEY" \
-H "Content-Type: application/json" \
-d '{
"ga4Id": "G-KN80RDFSQK",
"createIfMissing": true,
"alerts": [{ "kind": "slack", "target": "https://hooks.slack.com/services/T000/B000/XXXX" }]
}'{
"property": { "id": "6b0f6a52-...", "property_id": "G-KN80RDFSQK" },
"resolution": null,
"scan": { "snapshotId": "c1d0...", "changed": true, "hash": "9f2c...", "isFirstSnapshot": false, "summary": ["Key event purchase added"] },
"alerts": { "created": [{ "id": "4e1a...", "kind": "slack", "active": true }], "errors": [] }
}Inspect any ID without tracking it, or read a diff:
curl -X POST "https://tagspy.io/api/v1?action=inspect" -H "Authorization: Bearer $TAGSPY_KEY" \
-H "Content-Type: application/json" -d '{"url":"https://example.com"}'
curl "https://tagspy.io/api/v1?action=diff&snapshotId=c1d0..." -H "Authorization: Bearer $TAGSPY_KEY"Errors
Errors are JSON, { "error": "message" }, with a matching HTTP status.
| Status | Meaning |
|---|---|
| 400 | Malformed request: missing or invalid parameter, bad JSON, unknown action. |
| 401 | Missing, invalid or revoked API key. |
| 402 | Your plan does not include this: no API access, property limit reached or channel not on your plan. |
| 403 | A session cookie was used from another site. Use an API key. |
| 404 | Property, snapshot or channel not found (or not yours). |
| 405 | A state-changing action was sent as GET. Send it as POST. |
| 413 | Request body over 32 KB. |
| 422 | Valid request, but the target cannot be processed: ID not found, container unreadable, URL with no tags. |
| 429 | Rate limit reached. Wait for the number of seconds in the Retry-After header. |
| 502 | The upstream Google file could not be fetched. Retry later. |
| 504 | The upstream Google file timed out. Retry later. |
Rate limits and idempotency
Fair-use limits per account: 60 requests per minute, 2,000 per day and 60 real scans per hour. Per-IP limits apply on top. MCP calls share the same budget.
Reads are safe to retry. scan is idempotent in effect: scanning an unchanged property stores no new snapshot and sends no alert. property.add for an ID you already watch returns the existing property.
Versioning
The API is unversioned and evolves additively: we add fields and actions, and do not remove or change existing ones without notice. Ignore fields you do not know.
Machine-readable spec: /docs/openapi.json (OpenAPI 3.1).