Skip to content
nsin docs

Set the NsinNabz analytics tag

PUT
/domains/{domain}/analytics-tag
curl --request PUT \
--url https://api.nsin.ir/domains/example.com/analytics-tag \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "tag": "<script async src=\"https://nabz-s.nsincloud.ir/s.js\" data-site=\"site_AAAA1111\" data-edge=\"1\" data-gpc=\"1\"></script>" }'

Stores the NsinNabz tag for the edge to insert into the HTML pages of this domain’s proxied hostnames, so the site needs no pasted snippet. Gateway hostnames never get it. NsinNabz calls this itself when its “Install automatically through the NSIN edge” switch is turned on; the NSIN panel only shows the result. Requires domain.settings. No plan is needed.

The tag must be exactly NsinNabz’s tag, matching the whole string against:

^<script async src="https://[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?(:[0-9]{1,5})?/s\.js" data-site="[A-Za-z0-9_]{8,64}" data-edge="1"( data-gpc="1")?( data-cookie="1")?></script>$

and its script host (with the port, if there is one) must be a NsinNabz tracker host (nabz-s.nsincloud.ir or s.nsinnabz.ir). Nothing else is ever inserted into your pages.

Sending the tag that is already stored changes nothing: the answer carries the stored updated_at. A new tag reaches every edge node with the next records sync.

domain
required
string

The domain name (for example example.com) — not a numeric id.

Example
example.com
Media type application/json
object
tag
required

The NsinNabz <script> tag, byte for byte.

string
Example
{
"tag": "<script async src=\"https://nabz-s.nsincloud.ir/s.js\" data-site=\"site_AAAA1111\" data-edge=\"1\" data-gpc=\"1\"></script>"
}

The stored tag.

Media type application/json

A domain’s NsinNabz tag. Both fields are null when there is no tag.

object
tag
required

The <script> tag the edge inserts into the domain’s HTML pages.

string | null
updated_at
required

When the tag last changed (UTC).

string | null format: date-time
Example generated
{
"tag": "example",
"updated_at": "2026-04-15T12:00:00Z"
}

The body is not JSON or has no string tag (invalid request body), or the tag is refused with code invalid_analytics_tag: it does not match the pattern above, or its script host is not a NsinNabz tracker host. Nothing is stored.

Media type application/json
object
error
required

Human-readable description of what went wrong.

string
code
string
Allowed values: invalid_analytics_tag
Examples
{
"error": "invalid request body"
}

Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example invalidKey
{
"error": "invalid API key"
}

The key is read-only, your role on the domain lacks the required permission, or the domain’s plan does not include the feature.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

The key exceeded its request budget (300 requests per minute by default).

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example limited
{
"error": "rate limit exceeded"
}