ads
PUT /v1/ads/site-tags/{tag_id}/first-party
Deploy first-party tracking with the customer's own Cloudflare API token.
Authentication
Send an API key as a bearer token. The key must carry the ads.manage permission; a key without it is refused with 403, not 404.
This endpoint takes no organisation id. Your key already identifies the organisation it belongs to, and the response is scoped to it.
Try it
Replace anything in angle brackets with your own values, and the key placeholder with a key from your dashboard.
curl -X PUT https://api.zinndigital.com/v1/ads/site-tags/{tag_id}/first-party \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "token": <string> }'Signed in? The API console in your dashboard fills in your real organisation id and your own key, and runs the request against the live API so you can see the actual response. Open this endpoint in the API console
Details
Gated on ads.manage; audit-logged (ads.first_party_connected, zone and route only). The token (Zone Read, Workers Scripts Edit, Workers Routes Edit) is checked by using it: one Worker zinn-ads-<id> is uploaded to the account of the site's zone and routed on <site_host>/ztag/* only. It serves the site's universal script and passes Google's tag gateway through, so gtag.js loads same-origin. Google decides where hits go: outside Europe they use <site_host>/ztag/ too; for visitors in Europe Google's library sends them to its regional endpoint, and it always sends a load-health probe and a session beacon straight to Google. Consent Mode v2 defaults are still set before any Google tag loads; before consent Google may send cookieless pings, and nothing is stored. No HTML, DNS or zone setting is changed. The token is kept only in Vault; sending a new one replaces it and destroys the old one. Refusals: refusal.adsconnect.firstParty.* (badToken, tokenRejected, permissionMissing, zoneNotFound 422; rateLimited, unavailable, vaultUnavailable 503).
Parameters
| Name | Type | Required | What it is |
|---|---|---|---|
tag_id (path) | string | Yes | — |
Request body
| Name | Type | Required | What it is |
|---|---|---|---|
token | string | Yes | — |
Response
| Name | Type | Required | What it is |
|---|---|---|---|
status | string<off, ok, needs_token, failed> | Yes | — |
path | string | Yes | The path on the site host: /ztag. |
provider | string | No | — |
zone_name | string | No | — |
route_pattern | string | Yes | — |
script_name | string | No | — |
last_error | string | No | An error code: tokenRejected, permissionMissing, zoneNotFound, rateLimited, unavailable, unexpected or routeMissing; empty when ok. |
token_hint | string | No | The token's last four characters |
checked_at | string | No | — |
snippet | string | Yes | — |
Errors this endpoint can return
401 · 403 · 404 · 422 · 503