Set the NsinNabz analytics tag
const url = 'https://api.nsin.ir/domains/example.com/analytics-tag';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"tag":"<script async src=\"https://nabz-s.nsincloud.ir/s.js\" data-site=\"site_AAAA1111\" data-edge=\"1\" data-gpc=\"1\"></script>"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The domain name (for example example.com) — not a numeric id.
Example
example.comRequest Body required
Section titled “Request Body required ”object
The NsinNabz <script> tag, byte for byte.
Example
{ "tag": "<script async src=\"https://nabz-s.nsincloud.ir/s.js\" data-site=\"site_AAAA1111\" data-edge=\"1\" data-gpc=\"1\"></script>"}Responses
Section titled “ Responses ”The stored tag.
A domain’s NsinNabz tag. Both fields are null when there is no tag.
object
The <script> tag the edge inserts into the domain’s HTML pages.
When the tag last changed (UTC).
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.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid request body"}{ "code": "invalid_analytics_tag", "error": "tag does not match the NsinNabz tag format"}{ "code": "invalid_analytics_tag", "error": "tag script host is not allowed"}Missing, malformed, revoked or expired API key. (A valid key whose
account has been deactivated gets 403 account is inactive instead.)
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}