TenanciTenanci

Help centerAPI referenceMarketing

Marketing

Tags, cookie banner, short links, goals and server-side conversions.

Get tags, cookie banner and links

GET/domains/{id}/marketingdomains:read

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Request

cURL
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/marketing" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 200

{
  "settings": {
    "consent": {
      "banner": true,
      "text": "Usamos cookies para medir as visitas e melhorar os anúncios.",
      "policyUrl": "https://barbeariadoze.com.br/privacidade",
      "position": "bottom",
      "color": "#1f2937"
    },
    "tags": {
      "ga4": "G-7KX2M9QL4P",
      "gtm": null,
      "googleAds": "AW-1098765432",
      "metaPixel": "873214569012345",
      "tiktok": null,
      "linkedin": null,
      "clarity": "k8m3x9q2ab",
      "hotjar": null,
      "pinterest": null
    },
    "firstParty": true
  },
  "links": [
    {
      "id": "lnk_6p2w9r",
      "slug": "promo-outubro",
      "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-outubro",
      "name": "Bio do Instagram",
      "shortUrl": "https://barbeariadoze.com.br/l/promo-outubro",
      "createdAt": "2026-10-14T12:30:00.000Z"
    }
  ]
}

Configure tags and cookie banner

PUT/domains/{id}/marketingdomains:write

Replaces the whole configuration: a tag missing from the body is turned off. The edge starts injecting the tags (and the banner, if on) on every page of the domain. Short links have their own routes.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Body

  • consentobject

    Cookie banner (GDPR/LGPD). Omitted fields go back to the default.

    • bannerboolean

      Cookie banner with accept/reject (Consent Mode v2). Without it, tags load right away.

    • textstring | null

      Banner text (empty = default text).

    • policyUrlstring | null

      Privacy policy link (http/https).

    • position"bottom" | "bottom-left" | "bottom-right"

      Banner position.

    • colorstring | null

      Button color in hex (#RRGGBB).

  • tagsobject

    Ids of the tags and pixels the edge injects. An omitted or empty tag is turned off.

    • ga4string | null

      Google Analytics 4 (G-XXXXXXXX).

    • gtmstring | null

      Google Tag Manager (GTM-XXXXXX).

    • googleAdsstring | null

      Google Ads (AW-123456789).

    • metaPixelstring | null

      Meta Pixel (digits only).

    • tiktokstring | null

      TikTok Pixel.

    • linkedinstring | null

      LinkedIn Insight Tag (partner id, digits only).

    • claritystring | null

      Microsoft Clarity (project id).

    • hotjarstring | null

      Hotjar (site id, digits only).

    • pintereststring | null

      Pinterest Tag (digits only).

  • firstPartybooleanrequired

    Serve the vendors' scripts from the domain itself (/__tenanci/t/…): they survive ad blockers.

Request

cURL
curl -X PUT "https://api.tenanci.com/v2/domains/dom_4h7n1q/marketing" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"consent":{"banner":true,"text":"Usamos cookies para medir as visitas e melhorar os anúncios.","policyUrl":"https://barbeariadoze.com.br/privacidade","position":"bottom","color":"#1f2937"},"tags":{"ga4":"G-7KX2M9QL4P","gtm":null,"googleAds":"AW-1098765432","metaPixel":"873214569012345","tiktok":null,"linkedin":null,"clarity":"k8m3x9q2ab","hotjar":null,"pinterest":null},"firstParty":true}'

Response 200

{
  "settings": {
    "consent": {
      "banner": true,
      "text": "Usamos cookies para medir as visitas e melhorar os anúncios.",
      "policyUrl": "https://barbeariadoze.com.br/privacidade",
      "position": "bottom",
      "color": "#1f2937"
    },
    "tags": {
      "ga4": "G-7KX2M9QL4P",
      "gtm": null,
      "googleAds": "AW-1098765432",
      "metaPixel": "873214569012345",
      "tiktok": null,
      "linkedin": null,
      "clarity": "k8m3x9q2ab",
      "hotjar": null,
      "pinterest": null
    },
    "firstParty": true
  }
}

Create a campaign link

POST/domains/{id}/linksdomains:write

Short link on the customer's domain (https://<domain>/l/<slug>) that redirects to url and counts the click. Up to 500 per domain; a repeated slug returns 409 slug_taken.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Body

  • slugstringrequiredmax 60

    Short link path: https://<domain>/l/<slug>. Lowercase letters, digits and hyphens.

  • urlstringrequiredmax 2048

    Target (http/https), with the UTMs already in it.

  • namestring | null

    A name you'll recognize.

Request

cURL
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/links" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"slug":"promo-outubro","url":"https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-outubro","name":"Bio do Instagram"}'

Response 201

{
  "id": "lnk_6p2w9r",
  "slug": "promo-outubro",
  "url": "https://barbeariadoze.com.br/agendar?utm_source=instagram&utm_medium=bio&utm_campaign=promo-outubro",
  "name": "Bio do Instagram",
  "shortUrl": "https://barbeariadoze.com.br/l/promo-outubro",
  "createdAt": "2026-10-14T12:30:00.000Z"
}

List page goals

GET/domains/{id}/goalsdomains:read

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Request

cURL
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/goals" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 200

{
  "items": [
    {
      "id": "gol_3t8k1v",
      "name": "Lead",
      "pathPattern": "/obrigado",
      "value": 50,
      "currency": "BRL",
      "createdAt": "2026-10-14T12:40:00.000Z"
    }
  ]
}

Create a page goal

POST/domains/{id}/goalsdomains:write

Counts a conversion when the visitor opens the page (e.g. /thank-you), without touching the app's code. Up to 50 per domain. With server-side conversions on, the goal also goes to Meta, TikTok and GA4.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Body

  • namestringrequiredmax 60

    Goal name: letters, digits, spaces and _ (e.g. Lead, Purchase).

  • pathPatternstringrequiredmax 300

    Page: /thank-you (exact), /order/* (it and below) or /order* (starts with). A full URL is accepted.

  • valuenumber | null

    Conversion value (>= 0).

  • currencystring | null

    Currency (3 letters; BRL by default when there's a value).

Request

cURL
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/goals" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Lead","pathPattern":"/obrigado","value":50,"currency":"BRL"}'

Response 201

{
  "id": "gol_3t8k1v",
  "name": "Lead",
  "pathPattern": "/obrigado",
  "value": 50,
  "currency": "BRL",
  "createdAt": "2026-10-14T12:40:00.000Z"
}

Delete a page goal

DELETE/domains/{id}/goals/{goalId}domains:write

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • goalIdpath · stringrequired

    Goal id (gol_…)

Request

cURL
curl -X DELETE "https://api.tenanci.com/v2/domains/dom_4h7n1q/goals/<goalId>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 204

Success

Get server-side conversions

GET/domains/{id}/conversionsdomains:readLanding+

One row per provider (meta, ga4, tiktok). hasPixel tells whether the matching tag id is set in PUT /domains/:id/marketing; without it nothing is sent.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Request

cURL
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/conversions" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 200

{
  "items": [
    {
      "provider": "meta",
      "configured": true,
      "enabled": true,
      "hasPixel": true,
      "testCode": "TEST48213",
      "lastSentAt": "2026-10-21T18:22:05.000Z",
      "lastError": null,
      "lastErrorAt": null
    },
    {
      "provider": "ga4",
      "configured": false,
      "enabled": false,
      "hasPixel": true,
      "testCode": null,
      "lastSentAt": null,
      "lastError": null,
      "lastErrorAt": null
    },
    {
      "provider": "tiktok",
      "configured": false,
      "enabled": false,
      "hasPixel": false,
      "testCode": null,
      "lastSentAt": null,
      "lastError": null,
      "lastErrorAt": null
    }
  ]
}

Configure server-side conversions

PUT/domains/{id}/conversions/{provider}domains:writeLanding+

Goals also go from the server to the provider (they survive ad blockers), only with the visitor's consent when the banner is on. Meta and TikTok deduplicate against the browser pixel; GA4 only receives page goals. The token is stored encrypted and never returned. With a dashboard session, owner/admin only.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • providerpath · stringrequired

    Provider: meta (Conversions API), ga4 (Measurement Protocol) or tiktok (Events API)

Body

  • secretstringmax 1000

    Provider token (Meta: Conversions API access token; GA4: Measurement Protocol API secret; TikTok: Events API access token). Required the first time.

  • testCodestring | null

    Meta/TikTok test code (events show up in "Test events"). null removes it.

  • enabledboolean

    Turns sending on/off without deleting the token.

Request

cURL
curl -X PUT "https://api.tenanci.com/v2/domains/dom_4h7n1q/conversions/<provider>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"secret":"TOKEN_DE_ACESSO_DA_META","testCode":"TEST48213"}'

Response 200

{
  "provider": "meta",
  "configured": true,
  "enabled": true,
  "hasPixel": true,
  "testCode": "TEST48213",
  "lastSentAt": null,
  "lastError": null,
  "lastErrorAt": null
}

Remove server-side conversions

DELETE/domains/{id}/conversions/{provider}domains:writeLanding+

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • providerpath · stringrequired

    Provider: meta (Conversions API), ga4 (Measurement Protocol) or tiktok (Events API)

Request

cURL
curl -X DELETE "https://api.tenanci.com/v2/domains/dom_4h7n1q/conversions/<provider>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 204

Success

Send a test event

POST/domains/{id}/conversions/{provider}/testdomains:writeLanding+

Sends a TenanciTest event to the provider right now and returns the result (detail carries the provider's response on failure). For GA4 it uses the validation endpoint.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • providerpath · stringrequired

    Provider: meta (Conversions API), ga4 (Measurement Protocol) or tiktok (Events API)

Request

cURL
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/conversions/<provider>/test" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 200

{
  "ok": true,
  "detail": ""
}

List campaign costs

GET/domains/{id}/costsdomains:readLanding+

Spend per campaign (utm_campaign) shows up in GET /domains/:id/analytics/campaigns as cost, cost per conversion and return.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Request

cURL
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/costs" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 200

{
  "items": [
    {
      "id": "cst_9d4m2x",
      "campaign": "promo-outubro",
      "source": "instagram",
      "startsOn": "2026-10-01",
      "endsOn": "2026-10-31",
      "amount": 1200,
      "currency": "BRL"
    }
  ]
}

Add campaign costs

POST/domains/{id}/costsdomains:writeLanding+

1 to 500 rows per call. Each entry is spread over the days of its period when computing the cost for a range. Different currencies are not converted.

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

Body

  • itemsobject[]required≤ 500 itens
    • campaignstringrequiredmax 200

      Campaign: the same value as utm_campaign.

    • sourcestring | null

      Source (utm_source), optional.

    • startsOnstringrequiredmax 10

      First day (YYYY-MM-DD).

    • endsOnstringrequiredmax 10

      Last day, inclusive (YYYY-MM-DD).

    • amountnumberrequired

      Amount spent in the period (e.g. 1200.50).

    • currencystringmax 3

      Currency (default BRL).

Request

cURL
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/costs" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"campaign":"promo-outubro","source":"instagram","startsOn":"2026-10-01","endsOn":"2026-10-31","amount":1200,"currency":"BRL"}]}'

Response 201

{
  "created": 1
}

Delete a cost entry

DELETE/domains/{id}/costs/{costId}domains:writeLanding+

Parameters

  • idpath · stringrequired

    Resource id (prj_…, dom_…)

  • costIdpath · stringrequired

    Cost entry id (cst_…)

Request

cURL
curl -X DELETE "https://api.tenanci.com/v2/domains/dom_4h7n1q/costs/<costId>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Response 204

Success