{"openapi":"3.1.0","info":{"title":"NSIN API","version":"1.0.0","summary":"Public REST API for NSIN CDN, DNS and edge-security management.","description":"The NSIN API lets you manage everything you can manage from the panel:\ndomains, DNS records, edge rules (cache, WAF, redirects, rate limiting, …),\nTLS certificates, analytics, uptime and domain sharing.\n\n## Authentication\n\nEvery endpoint in this reference is authenticated with an **API key**, with\none exception: the **NSIN SSO** endpoints at the end, which are the\nOAuth 2.1 / OpenID Connect provider and authenticate with their own\ncredentials (see that section). Create a key in the panel under\n*Settings → API keys*. Keys are shown once at creation time and are\nprefixed `nsin_`.\n\nSend the key either way — both are equivalent:\n\n```\nAuthorization: Bearer nsin_xxxxxxxxxxxxxxxxxxxx\n```\n```\nX-Api-Key: nsin_xxxxxxxxxxxxxxxxxxxx\n```\n\n### Read-only keys\n\nA key marked read-only may only issue `GET`, `HEAD` and `OPTIONS` requests,\nplus one `POST` that writes nothing: `POST /analytics/query`, which runs a\nread-only query over your request logs. Any other write returns `403` with\n`{\"error\": \"read-only API key\"}`, regardless of the endpoint.\n\n`GET /whoami` tells a client which credential it is holding — whether the\nkey is read-only, whether it may read mail (`email_read`), and for\napp-issued credentials which domains it may touch.\n\n### Reading mail (`email:read`)\n\nMail kept in a domain's inbox (Email Routing with an inbox plan) can be read\nwith a key only when that key has the **email:read** permission. It is off\nfor every key unless you turn it on, when you create the key or later, in\n*Settings → API keys*. Full access does not include it. A key without it\ngets `403` with `\"code\": \"email_read_required\"` on the inbox endpoints.\n\nWith it, a key may list the inbox, open a message, download the raw\n`.eml` and download an attachment, for the domains the key can see. It can\nnever move, mark, or delete mail, or accept the inbox terms: those stay in\nthe panel. Opening a message with a key does **not** mark it read unless\nyou add `?mark_read=true` (a read-only key never marks it). Every read\nmade with a key, lists included, is recorded with the key, the message and\nthe caller's IP.\n\nTo learn when mail arrives without polling, set a mail webhook on the\ndomain (see the `mailEvent` webhook below) and open the message by the\n`inbox_message_id` it carries.\n\n### What API keys cannot do\n\nSome parts of the product are deliberately unreachable with a key, so that a\nleaked key can never take over the account or spend money. These return\n`403` for **every** key, including full-access ones:\n\n| Surface | Reason |\n|---|---|\n| `/users/**` | Profile, password, sessions and API-key management. A key cannot mint or revoke keys. |\n| `/auth/**` | Login, registration, OTP. |\n| `/billing/**` | Plan catalogue and billing settings. |\n| `/admin/**` | Administrative surface. |\n| `/oauth/**`, `/.well-known/**` | NSIN SSO. A key must never be able to mint a federated login; these endpoints take their own credentials (see the SSO section). |\n| `POST /wallet/topup` | Moves money. |\n| `POST /subscriptions/purchase`, `/switch`, `/auto-renew` | Moves money. |\n| `POST /domains/{domain}/subscriptions/purchase`, `/switch`, `/auto-renew` | Moves money. |\n| `POST /domains/{domain}/gateway-packs/purchase` | Moves money. |\n| `PUT /domains/{domain}/billing-member` | Chooses whose wallet pays for the domain. |\n| `/domains/{domain}/email-routing/inbox/**` writes and terms | Moving, marking and deleting stored mail and accepting the inbox terms stay in the panel. Reads need `email:read`. |\n| `/domains/{domain}/email-routing/webhook/**` | The mail webhook settings carry its signing secret; they are set in the panel. |\n\nThe denied surfaces answer `{\"error\": \"this endpoint is not available to\nAPI keys\"}`; the money-moving writes answer `{\"error\": \"API keys cannot\nmove money — top-ups and plan purchases must be done from the panel\"}`.\nReading subscription, feature, traffic-usage, invoice and wallet state *is*\nallowed — only the money-moving writes are blocked.\n\nKeys belonging to a deactivated account are refused with `403`\n`{\"error\": \"account is inactive\"}`.\n\n## Rate limiting\n\nRequests are limited **per key**, by default to 300 requests per minute.\nExceeding it returns `429` with `{\"error\": \"rate limit exceeded\"}`.\nPanel (browser) traffic is limited separately and does not consume your key's\nbudget.\n\n## Conventions\n\n* **`{domain}` path parameter** — every path segment written as `{domain}` is\n  the domain **name** (`example.com`), not a numeric id. Percent-encode it if\n  it contains characters that are unsafe in a path segment.\n* **Errors** — all errors share one shape: `{\"error\": \"human readable message\"}`.\n  See the `Error` schema.\n* **Timestamps** — RFC 3339 / ISO 8601 strings in UTC unless stated otherwise.\n* **Byte counts** — always bytes; **traffic and quota** values are documented\n  per field.\n* **Access control** — a key inherits the permissions of the user who owns it.\n  For a shared domain that is the role granted to that user (`viewer`,\n  `editor`, `admin`); for your own domains it is `owner`. Endpoints document\n  the permission they require, and return `403` when the role lacks it and\n  `404` when the domain is not visible to you at all.\n\n## Plan features\n\nSeveral endpoints are gated on the domain's active plan (analytics, logs,\nWAF, custom certificates, …). When the plan does not include the feature the\nresponse is `403` with an `error` explaining which feature is missing. When\nthe domain has **no active plan at all** — for example a subscription that\nexpired and was not renewed — the gated endpoints answer `402` instead, and\nso do the writes that count against a plan allowance (new DNS records,\nrules and email addresses).\n","contact":{"name":"NSIN Support","url":"https://nsin.ir"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://api.nsin.ir","description":"Production"}],"security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"tags":[{"name":"Domains","description":"Add, configure, verify and remove domains."},{"name":"DNS Records","description":"DNS record CRUD, bulk operations, zone scan and import — including the\nstaged import sessions that let a scan be reviewed before it is written.\n"},{"name":"Gateways","description":"Ready-made records you can switch on for a domain in one call."},{"name":"SSL","description":"Certificate status, manual issuance and custom certificate upload."},{"name":"Rules","description":"Edge rules — cache, drop, redirect, rewrite, header, web optimization,\nWAF, captcha, basic auth, rate limit, bot routing, origin pools and\nroutes, fingerprinting and error pages. Every type has the same seven\noperations: list, create, reorder, get, update, delete and toggle.\n\nReading rules needs `domain.view`, every write `rules.edit`; a caller\nwithout them gets `404`, never `403`. Every change is pushed to the edge\nas soon as it is saved.\n\n**Plans.** A domain with no active plan cannot create rules (`402`), and\nthe plan caps how many rules of each type a domain may hold\n(`max_rules_per_set`, `403`). A rule type the plan does not include is\n*not* refused: the rule is created and can be edited, but it is saved\nswitched off, and switching it on is refused with `402` until the plan\nincludes the type. When a plan lapses to one without a type, the running\nrules of that type are switched off, not deleted. Rules the platform\nmanages (`managed_by`) are exempt.\n"},{"name":"Cache","description":"Cache statistics, key browsing and purging."},{"name":"Analytics","description":"Traffic analytics, request logs and ad-hoc queries over your own traffic."},{"name":"Uptime","description":"Origin outage detection: incidents, live per-host status, detection\nsettings, path-scoped monitors, the alert channels (email, SMS,\nwebhook) and the signed uptime webhook.\n"},{"name":"Custom Name Servers","description":"Let a domain answer under its own name servers (ns1.example.com,\nns2.example.com) instead of NSIN's. You set the names and their IPs at\nyour registrar. Enterprise plans.\n"},{"name":"Email Routing","description":"Custom email addresses on a domain (`info@example.com`) forwarded to\ndestination addresses you verify by clicking an emailed link. NSIN\npublishes the MX, SPF and DKIM records into the zone and receives and\nforwards the mail; nothing is stored.\n"},{"name":"Recommendations","description":"The per-domain advisory checklist — speed, SEO, reachability, security\nand plan findings — with per-user dismissals, and an account-wide view.\n"},{"name":"Sharing","description":"Domain members and invitations."},{"name":"Billing","description":"Read-only access to subscriptions, features, traffic usage, invoices and wallet."},{"name":"Support","description":"Support tickets."},{"name":"Notifications","description":"The notification feed — domain, plan and account events."},{"name":"Account","description":"Account-wide reads: who the calling credential is (`/whoami`), the\nunread counters (`/badges`) and the edge addresses to point DNS at.\n"},{"name":"Reseller","description":"For accounts NSIN has made resellers: create users, add and manage\ntheir domains, choose who pays, move money, invite users to log in and\nsee what their domains cost. Amounts are in rials. A guide is at\nhttps://reseller.nsin.ir/docs.\n"},{"name":"SSO","description":"NSIN SSO — the OAuth 2.1 / OpenID Connect provider that lets another\napplication sign users in with their NSIN account. These endpoints do\n**not** take an API key; each one authenticates with its own credential.\n"}],"paths":{"/domains/":{"get":{"tags":["Domains"],"operationId":"listDomains","summary":"List domains","description":"Every domain you can access — owned and shared with you — each with a\nshort SSL summary, its active subscription and your role on it.\n","responses":{"200":{"description":"Domain list.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DomainWithSsl"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Domains"],"operationId":"createDomain","summary":"Add a domain","description":"Registers a domain on your account. You become its owner.\n\n* `dns_mode: managed` (default) — NSIN hosts the zone and creates it\n  right away. The domain starts in `pending` until its nameservers\n  point at NSIN (see `GET /domains/ns-sets`), then flips to `active`\n  automatically; if they already do, it activates within moments.\n* `dns_mode: external` — you keep DNS elsewhere. The domain also starts\n  in `pending`: publish the CNAME from the `ssl_delegation` block (or\n  the legacy TXT from `verification`) and call\n  `POST /domains/{domain}/verify`. The window is 3 days; after that the\n  domain goes `failed` and `POST /domains/{domain}/verify/retry` starts\n  a new one.\n\nThe records currently published for the name are scanned in the\nbackground and handled as `import_mode` says. For an\nAPI key the default is `auto`: they are written straight into the new\nzone, so listing records right after this call shows them once the\nscan finishes. An external domain that is not verified yet always\nstages its scan for review instead — see the import-session endpoints.\n\nA credential issued to an NSIN SSO app with a limited domain selection\ncannot add domains.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainCreate"}}}},"responses":{"200":{"description":"Domain created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainDetail"}}}},"400":{"description":"Invalid or unsupported domain name. For a subdomain the answer also\ncarries `suggest`, the main domain to add instead.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"suggest":{"type":"string","example":"example.com","description":"Only when a subdomain was sent: its main (registrable) domain."}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The key is read-only, or the credential belongs to an NSIN SSO app\nlimited to a selection of domains, which cannot add new ones.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"restricted":{"value":{"error":"this credential is limited to specific domains"}}}}}},"409":{"description":"The domain is already registered — on this account (`you already own\nthis domain`) or on another one.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/ns-sets":{"get":{"tags":["Domains"],"operationId":"listNameserverSets","summary":"List accepted nameserver sets","description":"The nameserver sets a managed domain may be delegated to. The sets are\nparallel: each names the same NSIN nameserver nodes under a different\nhostname family. A delegation is accepted when it names **every node**\n— through any of that node's hostnames, so families may be mixed — and\n**nothing that is not an NSIN nameserver**. Naming one node twice (in\ntwo families) does not count for the missing one, and any third-party\nnameserver fails the check outright. The first set is the one shown in\nthe panel and is the recommended choice.\n\nOnce the delegation passes, the zone's own apex `NS` records are\nrewritten to match the names you actually delegated to.\n","responses":{"200":{"description":"Accepted nameserver sets.","content":{"application/json":{"schema":{"type":"object","properties":{"sets":{"type":"array","description":"Each entry is one complete, acceptable nameserver set.","items":{"type":"array","items":{"type":"string"}},"examples":[[["th.ns.nsin.ir","ny.ns.nsin.ir","eu.ns.nsin.ir"]]]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"getDomain","summary":"Get a domain","description":"Full domain state, including nameserver/verification progress, your role\nand permissions on it, and every edge setting.\n","responses":{"200":{"description":"Domain detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainDetail"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Domains"],"operationId":"updateDomain","summary":"Update domain settings","description":"Partial update — omitted fields are left unchanged. Requires the\n`domain.settings` permission. Every edge node is told to reload the\ndomain's configuration as soon as the change is saved.\n\nPlan limits apply to three fields: `cache_cap_mb`, `cache_l2_max_gb`\nand `cache_l2_ttl_days` may not exceed the ceilings of the domain's\nplan (`403`, with the ceiling in the body). Turning\n`markdown_for_agents` on needs an active plan, and turning the bot\ncache on — or changing a `bot_cache_*` setting while it is on — needs\na plan with the bot cache feature. Switching either off is never\nrefused. These two plan checks answer with a **plain-text** body, not\nthe usual JSON error.\n\n**Switching `dns_mode`** keeps records, rules, certificates and the\nplan, and puts the domain back to `pending`:\n\n* to `managed` — NSIN creates the zone, loads your records into it and\n  waits for the nameservers to point at NSIN (activating straight away\n  if they already do);\n* to `external` — NSIN removes its zone and opens a fresh 3-day\n  verification window (see `ssl_delegation` / `verification` in the\n  response).\n\nA banned domain cannot switch.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainUpdate"}}}},"responses":{"200":{"description":"Updated domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainDetail"}}}},"400":{"description":"Malformed body or an invalid value — `dns_mode` not\n`managed`/`external`, `cache_l2_max_gb` below 1,\n`cache_l2_ttl_days` outside 1–7, `cache_cap_mb` not one of the\ntiers, an HSTS step that skips a rung or a `hsts_preload` without\nits prerequisites, `min_tls_version` or `origin_protocol` not one\nof the listed values, a `bot_cache_*` window outside 300–86400 s\n(or fresh longer than max age), an unknown or empty\n`bot_cache_kinds`, or a path exclude that does not start with `/`,\nis longer than 256 characters, or is one of more than 50.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"hstsStep":{"value":{"error":"hsts_max_age_sec can only be raised one step at a time: next step is 3600 seconds. HSTS cannot be undone once browsers have seen it, so raise it only after the site has run without trouble at the current value"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan and the update turns\n`markdown_for_agents` or the bot cache on. Plain-text body.\n","content":{"text/plain":{"schema":{"type":"string","example":"This domain does not have an active plan."}}}},"403":{"description":"Read-only key or insufficient role (JSON); a cache value above the\nplan's ceiling (JSON, with `max_cap_mb`, `max_disk_gb` or\n`max_ttl_days` and `upgrade_url`); or the plan lacks the bot cache\nfeature (plain-text body).\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"max_cap_mb":{"type":"integer","description":"The largest `cache_cap_mb` the plan allows."},"max_disk_gb":{"type":"integer","description":"The largest `cache_l2_max_gb` the plan allows."},"max_ttl_days":{"type":"integer","description":"The largest `cache_l2_ttl_days` the plan allows."},"upgrade_url":{"type":"string","description":"Where in the panel to upgrade the plan."}}}]},"examples":{"capTooBig":{"value":{"error":"cache_cap_mb exceeds your plan limit","max_cap_mb":512,"upgrade_url":"/plans"}}}},"text/plain":{"schema":{"type":"string","example":"This feature is not enabled on this domain's plan. Upgrade the plan for this domain to use it."}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is banned, so its `dns_mode` cannot be changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Domains"],"operationId":"deleteDomain","summary":"Delete a domain","description":"Removes the domain with its records, certificates, email routing and\nDNS zone, drops every member and pending invitation, and cancels its\nplan (auto-renew is switched off; unused time is not refunded). The\nedge stops serving it straight away. Owner only (`domain.delete`).\nThis cannot be undone from the API.\n\nIf you only want to change how the domain's DNS is run, you don't need\nto delete it: `PUT /domains/{domain}` with `dns_mode` switches between\n`managed` and `external` and keeps records, rules, certificates and\nthe plan.\n\nThe body is optional. When you send one, it records why the domain is\nbeing deleted.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","enum":["re_add","keep_own_dns","external_hassle","site_not_working","too_expensive","moving_away","not_needed","other"],"description":"Why the domain is being deleted. `re_add`: to add it again\nwith different settings. `keep_own_dns`: the nameservers\ncan't or won't move to NSIN. `external_hassle`: keeping\nrecords and SSL in sync at another DNS provider is too much\nwork.\n"},"note":{"type":"string","maxLength":500,"description":"Free text. Longer notes are cut to 500 characters. A note\nsent without a `reason` is stored as `other`.\n"}}},"example":{"reason":"keep_own_dns","note":"My registrar won't let me change nameservers."}}}},"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"The body is JSON but can't be read, or `reason` isn't one of the listed codes. The domain is not deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/developer-mode":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Domains"],"operationId":"enableDeveloperMode","summary":"Enable developer mode","description":"Bypasses all cache reads and writes for this domain at the edge, so you\nalways see the origin's current response. Auto-expires — the response\ncarries the expiry — so a forgotten toggle can never permanently disable\ncaching. Requires `domain.settings`.\n\nIt also adds a temporary error page rule (`managed_by:\ndeveloper_mode`): `origin` mode for every 5xx on every path, evaluated\nbefore the domain's own error page rules. The origin's own error\nresponses reach visitors instead of an error page. The rule is removed\nwhen developer mode ends, whether it is disabled or expires.\n\nCalling this while developer mode is already on restarts the window\nfrom now. If the temporary rule was deleted, it is added back. If it\nwas only switched off, it stays off.\n","responses":{"200":{"description":"Developer mode enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperMode"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Domains"],"operationId":"disableDeveloperMode","summary":"Disable developer mode","description":"Turns developer mode off immediately and removes its temporary error\npage rule. Requires `domain.settings`.\n","responses":{"200":{"description":"Developer mode disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperMode"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/attack-settings":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"getAttackSettings","summary":"Get the automatic attack switches","description":"Whether automatic attack detection may add a blocking rule (in dry run)\nwhen it detects an attack on this domain (on by default), whether\nUnder Attack Mode switches on by itself during an attack nothing\nblocks (off by default), and whether behaviour detection watches the\ndomain (on by default). Requires `domain.view`.\n","responses":{"200":{"description":"The switch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttackSettings"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Domains"],"operationId":"setAttackSettings","summary":"Change the automatic attack switches","description":"Send any of the switches; a missing one keeps its value.\n\n`auto_attack_rules` off: attacks are still detected, recorded and\nreported, but no rule is added. Rules already added are left as they\nare.\n\n`auto_under_attack` on: when an attack is detected and no rule is\nblocking it, Under Attack Mode switches on by itself (with a 6-hour\ntimer) and off again when the attack ends or is marked as not an\nattack. A mode you switched on yourself is never switched off. Needs a\nplan with Under Attack Mode; otherwise the switch has no effect.\n\n`behaviour_detection` off: changes in how the domain's traffic behaves\n(not how much of it there is) are no longer recorded as attacks.\nFloods are still detected.\n\nRequires `domain.settings`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttackSettings"},"example":{"auto_under_attack":true}}}},"responses":{"200":{"description":"The new switch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttackSettings"}}}},"400":{"description":"None of `auto_attack_rules`, `auto_under_attack` or `behaviour_detection` given as a boolean.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/attacks":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"listAttacks","summary":"List detected attacks","description":"Attacks NSIN detected on the domain, newest first. An attack is a flood\nof at least 5× the domain's usual requests per minute for this hour\n(and at least 3000 per minute) for two minutes. NSIN then looks for what\nonly the attack's requests have (fingerprint, cookie name, path, …)\nand, when automatic attack rules are on, adds a managed custom rule in\ndry run (`managed_by: attack_signature`): it only counts what it would\nblock until it is enforced. An attack ends — and its rule is switched\noff — after 30 minutes back near normal traffic. `active` is the open\nattack, if any. Requires `domain.view`.\n","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"The attacks.","content":{"application/json":{"schema":{"type":"object","properties":{"attacks":{"type":"array","items":{"$ref":"#/components/schemas/Attack"}},"active":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/Attack"}]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/attacks/{attackId}/enforce":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"attackId","in":"path","required":true,"schema":{"type":"integer"}}],"post":{"tags":["Domains"],"operationId":"enforceAttackRule","summary":"Enforce an attack's rule","description":"Switches the attack's rule from dry run to enforce (and on), and marks\nthe attack `mitigating`. At most 3 attack rules are on per domain; the\noldest is switched off to make room. Requires `rules.edit`.\n","responses":{"200":{"description":"The attack.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attack"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No such attack on this domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The attack has no rule, or it has ended.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/attacks/{attackId}/ignore":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"attackId","in":"path","required":true,"schema":{"type":"integer"}}],"post":{"tags":["Domains"],"operationId":"ignoreAttack","summary":"Ignore an attack","description":"Switches the attack's rule off (it is kept) and marks the attack\n`ignored`. The attack stays open until traffic is back to normal, so\nthe same flood does not open a new one. Requires `rules.edit`.\n","responses":{"200":{"description":"The attack.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attack"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No such attack on this domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/under-attack":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"getUnderAttackMode","summary":"Get Under Attack Mode","description":"Whether Under Attack Mode is on for the domain, since when, when it\nswitches itself off, its bypass paths, and whether the domain's plan\nincludes it (`allowed`). Requires `domain.view`.\n","responses":{"200":{"description":"The domain's Under Attack Mode state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnderAttackMode"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Domains"],"operationId":"setUnderAttackMode","summary":"Switch Under Attack Mode","description":"While Under Attack Mode is on, every visitor solves a short check\nbefore reaching the site — except on `bypass_paths` (mobile-app and\nAPI paths that cannot run a browser) and verified good bots (search\nengines). A solved check is remembered for the edge's default\nclearance time.\n\nThe switch keeps one managed captcha rule on the domain\n(`managed_by: under_attack`, priority 1, zone-wide, `path_excludes` =\n`bypass_paths`). Rule endpoints list it but refuse to edit, delete,\ntoggle or reorder it (403); it does not count against any rule limit.\nSwitching off removes it.\n\nEvery field is optional; a missing one keeps its value.\n`auto_off_minutes` (0 = never, 60, 360 or 1440) restarts the auto-off\ntimer from now while the mode is on; switching on without it starts\nwith no timer. Switching on needs a plan with `under_attack_allowed`\n(every plan by default); switching off is always allowed. The change\nreaches the edge with the next records sync. Requires\n`domain.settings`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnderAttackModeBody"},"example":{"enabled":true,"bypass_paths":["/api/*","/app/*"],"auto_off_minutes":360}}}},"responses":{"200":{"description":"The new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnderAttackMode"}}}},"400":{"description":"An invalid `auto_off_minutes` or bypass path.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The domain's plan does not include Under Attack Mode, or the key lacks `domain.settings`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/analytics-tag":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"getAnalyticsTag","summary":"Get the NsinNabz analytics tag","description":"The NsinNabz `<script>` tag the edge inserts into this domain's HTML\npages, and when it last changed. Both fields are `null` when the domain\nhas no tag. Requires `domain.view`, so read-only keys may call it.\n","responses":{"200":{"description":"The domain's tag, or `null` in both fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsTag"},"examples":{"installed":{"value":{"tag":"<script async src=\"https://nabz-s.nsincloud.ir/s.js\" data-site=\"site_AAAA1111\" data-edge=\"1\"></script>","updated_at":"2026-09-30T08:15:04.123456Z"}},"none":{"value":{"tag":null,"updated_at":null}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Domains"],"operationId":"setAnalyticsTag","summary":"Set the NsinNabz analytics tag","description":"Stores the NsinNabz tag for the edge to insert into the HTML pages of\nthis domain's proxied hostnames, so the site needs no pasted snippet.\nGateway hostnames never get it. NsinNabz calls this itself when its\n\"Install automatically through the NSIN edge\" switch is turned on; the\nNSIN panel only shows the result. Requires `domain.settings`. No plan\nis needed.\n\nThe tag must be exactly NsinNabz's tag, matching the whole string\nagainst:\n\n```\n^<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\")?( data-api=\"https://[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?(:[0-9]{1,5})?/e\")?></script>$\n```\n\nand its script host (with the port, if there is one) must be a\nNsinNabz tracker host (`nabz-s.nsincloud.ir` or `s.nsinnabz.ir`).\nNothing else is ever inserted into your pages.\n\nSending the tag that is already stored changes nothing: the answer\ncarries the stored `updated_at`. A new tag reaches every edge node\nwith the next records sync.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tag"],"properties":{"tag":{"type":"string","description":"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":{"200":{"description":"The stored tag.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsTag"}}}},"400":{"description":"The body is not JSON or has no string `tag` (`invalid request\nbody`), or the tag is refused with `code`\n`invalid_analytics_tag`: it does not match the pattern above, or\nits script host is not a NsinNabz tracker host. Nothing is stored.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"code":{"type":"string","enum":["invalid_analytics_tag"]}}}]},"examples":{"body":{"value":{"error":"invalid request body"}},"format":{"value":{"code":"invalid_analytics_tag","error":"tag does not match the NsinNabz tag format"}},"host":{"value":{"code":"invalid_analytics_tag","error":"tag script host is not allowed"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Domains"],"operationId":"deleteAnalyticsTag","summary":"Remove the NsinNabz analytics tag","description":"Removes the tag; the edge stops inserting it with the next records\nsync. Answers `204` whether or not there was a tag. NsinNabz calls this\nwhen its edge install is switched off or the site leaves the account.\nDeleting the domain removes its tag too, and restoring the domain does\nnot bring it back. Requires `domain.settings`.\n","responses":{"204":{"description":"Removed","or there was no tag. No body.":null},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/custom-pages":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"getCustomPages","summary":"Get the domain's custom pages","description":"The pages a visitor sees when the edge itself answers instead of the\norigin: a block rule (`blocked`, 403), the WAF (`waf`, 403), a rate\nlimit (`rate_limit`, 429) and the maintenance switch (`maintenance`,\n503). A domain that never changed anything gets every page in mode\n`nsin` and maintenance off. Origin errors (5xx) are not here — those\nare error page rules. Requires `domain.view`.\n","responses":{"200":{"description":"The domain's custom pages.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomPages"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Domains"],"operationId":"setCustomPages","summary":"Set the domain's custom pages","description":"Replaces the whole setting — send all four pages, since a page left\nout goes back to the NSIN page. Each page is one of three modes:\n`nsin` (the branded NSIN page), `custom` (your own HTML, at most\n32 KiB, UTF-8) or `redirect` (a 302 to a full `http://` or `https://`\nURL). The field the mode does not use is kept as stored, so switching\nmodes does not lose a draft.\n\nWhile `maintenance.enabled` is true, every request to the domain is\nanswered by the edge with 503 and never reaches the origin, except\nfrom `maintenance.bypass_ips`. A maintenance redirect must point at\nanother domain.\n\nAnything other than the defaults needs a plan with rules. The change\nreaches the edge with the next records sync. Requires\n`domain.settings`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomPages"},"example":{"blocked":{"mode":"nsin","html":"","url":""},"waf":{"mode":"nsin","html":"","url":""},"rate_limit":{"mode":"custom","html":"<h1>Slow down</h1>","url":""},"maintenance":{"mode":"redirect","html":"","url":"https://status.example.net/","enabled":true,"bypass_ips":["203.0.113.7","198.51.100.0/24"]}}}}},"responses":{"200":{"description":"The stored setting.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomPages"}}}},"400":{"description":"The body is not JSON, or a page is invalid: an unknown `mode`,\n`custom` with no HTML, `redirect` with no URL, HTML over 32 KiB or\nnot UTF-8, a URL that is not a full `http(s)://` address or is\nover 2048 characters, a maintenance redirect onto the domain\nitself, more than 100 bypass addresses, or a bypass entry that is\nnot an IP, a CIDR or a `low-high` range. The message names the\npage. Nothing is stored.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"rate_limit: add the HTML of your page"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan and the setting is not the default.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"This domain does not have an active plan."}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/origin-protocols":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"probeOriginProtocols","summary":"Probe which HTTP versions the origins speak","description":"Makes a TLS handshake (reading the ALPN answer), a QUIC handshake and one\n`HEAD /` request (reading the `Alt-Svc` header) against every distinct\norigin behind the domain's proxied records, from the NSIN control plane,\nand reports whether each speaks HTTP/1.1, HTTP/2 and HTTP/3. HTTP/3\ncounts as supported when either the QUIC handshake completed or the\norigin advertised `h3` in `Alt-Svc`; `http3_via` says which. Use it\nbefore changing `origin_protocol`. Answers younger than 20 seconds are\nreused, so repeated calls do not hammer the origin. Requires `domain.view`.\n","responses":{"200":{"description":"Per-origin protocol support.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginProtocols"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/enable":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Domains"],"operationId":"enableDomain","summary":"Re-enable a disabled domain","description":"Brings a `disabled` domain back into service. A managed domain gets its\nzone rebuilt from its records and returns to `pending` until the\nnameservers are confirmed again. An external-DNS domain returns to\n`pending` with a fresh 3-day verification window: publish the record\nfrom `ssl_delegation` (or `verification`) and call\n`POST /domains/{domain}/verify`. Requires `domain.settings`.\n","responses":{"200":{"description":"Domain re-enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainDetail"}}}},"400":{"description":"The domain is not in the `disabled` state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"The DNS zone of a managed domain could not be rebuilt; the domain is still disabled. Retry in a moment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/checks":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Domains"],"operationId":"getManualChecks","summary":"Last result of each manual check","description":"The stored outcome of every user-triggered \"check now\" on this domain:\nnameserver delegation (`ns`), external-DNS verification (`txt`), the SSL\ndelegation record (`dv`), the proxied-record edge check (`edge`) and\nemail routing DNS (`email_dns`). Kinds that have never been checked are\nabsent.\n\nThese checks query public DNS, which can take up to a minute. An API\nkey gets its verdict inline from the check endpoint it called, and can\nuse this to read the last one at any time. Any other caller — the\npanel, or an NSIN SSO access token — gets `202` from the check endpoint\nwith the job running in the background, and polls this endpoint for\nthe verdict.\n\nRequires `domain.view`.\n","responses":{"200":{"description":"The stored checks, keyed by kind.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualChecks"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"}}}},"/domains/{domain}/check-ns":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Domains"],"operationId":"checkNameservers","summary":"Check nameserver delegation now","description":"Runs an immediate delegation check for a `pending` or `moved` **managed**\ndomain instead of waiting for the background checker. On success the\ndomain is activated right away, and the zone's apex `NS` records are\naligned with the delegation. The outcome is also stored as the `ns`\nentry of `GET /domains/{domain}/checks`.\n\nRate-limited to once per hour per domain, independently of the API key\nrate limit; the attempt counts even when the lookup fails. Requires\n`domain.settings`.\n","responses":{"200":{"description":"Check result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NsCheckResult"}}}},"202":{"$ref":"#/components/responses/CheckAccepted"},"400":{"description":"Not a managed domain, or the domain is not awaiting nameserver\nchanges.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"description":"Either the once-per-hour manual check limit (`next_check_at` says\nwhen the next one is allowed) or the API key rate limit was hit.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"next_check_at":{"type":"string","format":"date-time"}}}]},"examples":{"hourly":{"value":{"error":"You can check NS once per hour","next_check_at":"2026-09-28T12:00:00Z"}}}}}}}}},"/domains/{domain}/verify":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Domains"],"operationId":"verifyDomain","summary":"Verify an external-DNS domain","description":"Checks for the domain's verification record and activates the domain\nwhen it is found: the CNAME described by `ssl_delegation` (the record\nnew domains use — it stays in place afterwards as the domain's\nconnection to NSIN and lets NSIN issue its certificate), or the legacy\nTXT described by `verification`. Either is accepted. Only valid for\n`dns_mode: external`, on a domain that is `pending` or `moved` (a\n`moved` domain whose record was put back is reactivated the same way);\non an `active` domain it simply answers `verified: true`. Limited to\none check a minute per domain — the attempt counts even when the\nlookup fails. Requires `domain.settings`.\n","responses":{"200":{"description":"Verified — the domain is now active.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResult"}}}},"202":{"$ref":"#/components/responses/CheckAccepted"},"400":{"description":"Not an external-DNS domain, or not awaiting verification.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is `failed` — its verification window expired. Call\n`verify/retry` for a new window.\n","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"verified":{"type":"boolean","const":false}}}}}},"422":{"description":"The record was not found or did not match — `error` explains what\nwas seen — or the 3-day window has just run out (the domain is now\n`failed`). `verified` is `false`.\n","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"verified":{"type":"boolean","const":false},"next_check_at":{"type":"string","format":"date-time","description":"When the next manual check is allowed."}}}}}},"429":{"description":"A manual check ran less than a minute ago (`next_check_at` says when\nthe next one is allowed), or the API key rate limit was hit.\n","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"verified":{"type":"boolean","const":false},"next_check_at":{"type":"string","format":"date-time"}}}}}}}}},"/domains/{domain}/verify/retry":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Domains"],"operationId":"retryDomainVerification","summary":"Issue a fresh verification token","description":"Starts a new 3-day verification window for a `failed` external-DNS\ndomain: the domain returns to `pending` and gets a new TXT token (use\nthe `verification` block of the response). The `ssl_delegation` CNAME\ntarget never changes, so a CNAME already published keeps working.\nRequires `domain.settings`.\n","responses":{"200":{"description":"Verification reset with a new token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainDetail"}}}},"400":{"description":"Not an external-DNS domain, or not in the failed-verification state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/ssl/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["SSL"],"operationId":"getSslInfo","summary":"Get certificate status","description":"The domain's current certificate — issuer, validity, SANs, key size — plus\nwhether a manual re-issue is currently allowed, and `coverage`: proxied\nhostnames that are **not** on the certificate yet, with their retry state.\n","responses":{"200":{"description":"Certificate status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SslInfo"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["SSL"],"operationId":"uploadCustomCertificate","summary":"Upload a custom certificate","description":"Installs your own certificate and private key for the domain. Include the\nfull chain (leaf **and** intermediates) in `certificate` — a leaf-only\nupload makes clients fail chain verification.\n\n`hostnames` selects which of the certificate's SANs this upload should\ncover; use the `eligible` list from `POST /domains/{domain}/ssl/parse` to\npick them. Omitted, it is the apex and its wildcard (`example.com`,\n`*.example.com`), so the certificate must carry both.\n\nThe upload is pinned: those hostnames serve it from now on, ahead of\nthe certificate NSIN manages, and edge nodes pick it up within seconds.\nA certificate browsers would not trust is refused — a private CA (for\nexample a Cloudflare Origin CA certificate), a self-signed one, or a\nchain missing its intermediate (`code` says which). Requires\n`ssl.manage` and a plan that includes custom certificates.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomCertificateUpload"}}}},"responses":{"200":{"description":"Certificate installed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomCertificateResult"}}}},"400":{"description":"Missing fields, unparseable PEM, an encrypted private key,\nkey/certificate mismatch, a hostname the certificate does not cover\nor that is not part of this domain — or a certificate browsers\nwould not accept: `code` is `cert_untrusted` or\n`cert_incomplete_chain` (with `issuer` and the raw `trust_error`),\nor `cert_expired` / `cert_not_yet_valid` when the certificate is\noutside its validity dates (with `expires_at` / `valid_from`).\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"code":{"type":"string","enum":["cert_untrusted","cert_incomplete_chain","cert_expired","cert_not_yet_valid"],"description":"`cert_untrusted` — the issuer is not a public CA, or\nthe certificate is self-signed.\n`cert_incomplete_chain` — the intermediate\ncertificate is missing; paste the full chain.\n`cert_expired` — the certificate's `notAfter` has\npassed; renew it and upload the new one.\n`cert_not_yet_valid` — its `notBefore` is still in\nthe future.\n"},"issuer":{"type":"string","description":"The certificate's issuer."},"trust_error":{"type":"string","description":"The underlying verification error."},"expires_at":{"type":"string","format":"date-time","description":"With `cert_expired`: when the certificate expired."},"valid_from":{"type":"string","format":"date-time","description":"With `cert_not_yet_valid`: when the certificate becomes valid."}}}]},"examples":{"incompleteChain":{"value":{"error":"This certificate is missing its intermediate certificate. …","code":"cert_incomplete_chain","issuer":"CN=R11,O=Let's Encrypt,C=US","trust_error":"x509: certificate signed by unknown authority"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, or the plan does not include custom certificates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/ssl/parse":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["SSL"],"operationId":"parseCustomCertificate","summary":"Inspect a certificate before uploading","description":"Parses a certificate PEM and reports its subject, issuer, validity and\nSANs — without installing anything. `eligible` lists the SANs that belong\nto this domain and may therefore be passed as `hostnames` to the upload\ncall; `default_selection` is the subset the panel pre-selects.\nRequires `ssl.manage`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["certificate"],"properties":{"certificate":{"type":"string","description":"PEM-encoded certificate."}}}}}},"responses":{"200":{"description":"Parsed certificate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParsedCertificate"}}}},"400":{"description":"Missing or unparseable certificate PEM.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/ssl/issue":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["SSL"],"operationId":"issueCertificate","summary":"Request certificate issuance","description":"Starts an ACME order for the domain. Allowed only when the domain has\nno certificate yet or its last order `failed` — certificates are\notherwise issued and renewed automatically. An external-DNS domain\nneeds its `ssl_delegation` CNAME in place first.\n\nIssuance is asynchronous: this returns immediately with\n`status: \"pending\"`; poll `GET /domains/{domain}/ssl/` for the outcome.\nManual attempts are limited to one per hour per domain —\n`GET /ssl/` reports `can_manual_issue` and `next_manual_issue_at`.\nRequires `ssl.manage` and a plan that includes custom certificates.\n","responses":{"200":{"description":"Issuance started.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","examples":["SSL issuance started"]},"status":{"type":"string","const":"pending"},"last_issue_attempt_at":{"type":"string","format":"date-time"}}}}}},"400":{"description":"An external-DNS domain without its `ssl_delegation` CNAME, or SSL is\nnot in a state where a manual issue is allowed (it is neither\nmissing nor failed).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, or the plan does not include custom certificates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"An issuance is already in progress.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A manual issue was requested less than an hour ago\n(`next_manual_issue_at` says when the next is allowed), or the API\nkey rate limit was hit.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"next_manual_issue_at":{"type":"string","format":"date-time"}}}]}}}},"503":{"description":"The certificate issuer is temporarily unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/ssl/delegation/check":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["SSL"],"operationId":"checkSslDelegation","summary":"Check the SSL delegation record now","description":"Runs a live check of the `ssl_delegation` CNAME of an external-DNS\ndomain — the record that lets NSIN issue and renew its certificate\nautomatically — and records the result on the domain. A passing check\non a domain still awaiting verification also activates it: the record\nproves control of the domain's DNS exactly as the TXT record does.\n\nThe check queries `TXT _acme-challenge.{domain}` through public\nresolvers and looks for this domain's own canary value, so it tests\nwhat a certificate authority will see end to end. Rate limited to once\na minute per domain, shared with `verify`. The outcome is also stored\nas the `dv` entry of `GET /domains/{domain}/checks`. Requires\n`ssl.manage`.\n","responses":{"200":{"description":"The delegation is in place. Issuance proceeds automatically.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SslDelegationCheckResult"}}}},"202":{"$ref":"#/components/responses/CheckAccepted"},"400":{"description":"Not an external-DNS domain, or the domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"422":{"description":"The record was not found, has not propagated, or points at a\ndelegation that does not belong to this domain. `ok` is `false` and\n`error` says what was seen.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SslDelegationCheckResult"}}}},"429":{"description":"A check ran less than a minute ago (`next_check_at` says when the\nnext is allowed), or the API key rate limit was hit.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SslDelegationCheckResult"}}}}}}},"/domains/{domain}/ssl/certificates":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["SSL"],"operationId":"listDomainCertificates","summary":"List the domain's certificates","description":"A domain can hold more than one certificate at a time: the one NSIN\nissues and renews for it, and any you upload. Only one of them answers\nthe handshake for a given hostname — `in_use_for` says which hostnames\neach certificate is serving right now, and an empty `in_use_for` means\nthe domain holds it but is serving something else.\n\n`covers` is the subset of this domain's hostnames the certificate could\nserve, i.e. what selecting it would switch over. `selectable` is `false`\nwhen it cannot serve at all — expired, no stored private key, not\ntrusted by browsers, or covering none of the domain's names — and\n`reason` says which.\n","responses":{"200":{"description":"The domain's certificates, the one in use first.","content":{"application/json":{"schema":{"type":"object","properties":{"certificates":{"type":"array","items":{"$ref":"#/components/schemas/DomainCertificate"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/ssl/certificates/{certificateId}/select":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"certificateId","in":"path","required":true,"schema":{"type":"integer"},"description":"The `id` of a certificate from `GET /domains/{domain}/ssl/certificates`."}],"post":{"tags":["SSL"],"operationId":"selectDomainCertificate","summary":"Choose which certificate the edge serves","description":"Makes this certificate the one served, for every hostname of the domain\nit covers. Hostnames it does not cover keep whatever they were serving.\nEdge nodes are told to drop the affected hostnames immediately, so the\nchange is live within seconds.\n\nSelecting the certificate NSIN manages (`managed: true`) returns the\nhostname to automatic: each renewal is served as soon as it is issued.\nSelecting an uploaded one pins it — renewals keep running underneath and\nstay available to switch back to, but they are not served while the pin\nis in place. Requires `ssl.manage`.\n","responses":{"200":{"description":"Selected. `hostnames` lists the names that changed over.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"hostnames":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"The certificate cannot serve: expired, no stored private key, not\ntrusted, or it covers none of this domain's hostnames.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No such certificate for this domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/ssl/certificates/{certificateId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"certificateId","in":"path","required":true,"schema":{"type":"integer"},"description":"The `id` of a certificate from `GET /domains/{domain}/ssl/certificates`."}],"delete":{"tags":["SSL"],"operationId":"deleteDomainCertificate","summary":"Remove an uploaded certificate","description":"Forgets a certificate you uploaded. Any hostname serving it falls back\nto the certificate NSIN manages.\n\nOnly uploads can be removed — a certificate NSIN issues is replaced by\nits own renewal, so select a different one instead. The request is\nrefused when a hostname serving it has nothing to fall back on, rather\nthan taking that hostname off HTTPS. Requires `ssl.manage`.\n","responses":{"200":{"description":"Removed. `hostnames` lists the names that fell back.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"hostnames":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"The certificate is managed by NSIN, or removing it would leave a\nhostname with nothing to serve.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No such certificate for this domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/ssl/certificates/request":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["SSL"],"operationId":"requestManagedCertificate","summary":"Ask NSIN to issue a certificate as well","description":"Uploading a certificate keeps its hostnames out of every automatic\norder — NSIN must not silently replace material you installed on\npurpose — so a domain that uploaded before NSIN ever issued for it has\nno certificate of ours at all, and nothing to choose between. This asks\nfor one.\n\nYour certificate keeps serving throughout: the new one fills the\nautomatic slot behind it, and you switch over with\n`POST /domains/{domain}/ssl/certificates/{certificateId}/select` when\nyou are ready. From then on the name stays in our renewals, so whichever\none you are not serving stays valid.\n\nReturns immediately with `status: \"pending\"`; poll\n`GET /domains/{domain}/ssl/certificates`. Requires `ssl.manage` and a\nplan that includes custom certificates.\n","responses":{"200":{"description":"Issuance started.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string","example":"pending"}}}}}},"400":{"description":"NSIN already holds a certificate for this domain (select it\ninstead), or an external-DNS domain has not delegated\n`_acme-challenge` yet.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, or the plan does not include custom certificates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"A certificate has already been requested and is on its way.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"description":"The certificate issuer is temporarily unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/ssl/acme-dns":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["SSL"],"operationId":"getAcmeDnsAccount","summary":"Get the domain's acme-dns account","description":"Whether this domain proves control through an\n[acme-dns](https://github.com/joohoi/acme-dns) account, and which one.\nThe password is never returned.\n\n`cname_name` and `cname_target` are the record that must exist in your\nown DNS for the account to prove anything — check it against what is\nactually published if issuance is failing.\n","responses":{"200":{"description":"The account, or `configured: false`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcmeDnsAccount"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["SSL"],"operationId":"saveAcmeDnsAccount","summary":"Store acme-dns credentials for this domain","description":"Lets NSIN issue and renew certificates for a domain whose DNS is\nsomewhere we cannot write, by writing DNS-01 challenge values through\nan acme-dns instance you already delegate `_acme-challenge` to. Nothing\nin your own DNS has to change.\n\nSend the contents of your `acmedns.json` in `credentials`, as a string\n— the whole file, quoting and all if you lifted it out of a compose\nfile. A single pasted account object is also accepted.\n\n**A file covering several domains is normal, and only the entry for\nthis domain is stored.** If it has no entry for this domain the request\nis refused with `code: \"domain_not_covered\"` and `covered` lists the\ndomains it is actually for.\n\nThe credentials are then checked for real, by writing a throwaway\nvalue through the API — acme-dns has no other way to test an account.\nA failure is refused with `code: \"verification_failed\"`; pass\n`force: true` to store them anyway when you know the instance is\nmerely unreachable. Requires `ssl.manage` and a plan that includes\ncustom certificates.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["credentials"],"properties":{"credentials":{"type":"string","description":"The contents of acmedns.json."},"force":{"type":"boolean","description":"Store the account even if the live check fails."}}}}}},"responses":{"200":{"description":"Stored.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"acme_dns":{"$ref":"#/components/schemas/AcmeDnsAccount"}}}}}},"400":{"description":"Unreadable credentials, an entry missing a required field, a file\nwith no entry for this domain (`code: \"domain_not_covered\"`), or\ncredentials that did not work (`code: \"verification_failed\"`).\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"code":{"type":"string","enum":["domain_not_covered","verification_failed"]},"covered":{"type":"array","items":{"type":"string"},"description":"The domains the uploaded file does cover."}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, or the plan does not include custom certificates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["SSL"],"operationId":"deleteAcmeDnsAccount","summary":"Remove the domain's acme-dns account","description":"Issuance falls back to whatever this domain's DNS mode would otherwise\nuse. If `_acme-challenge` still points at acme-dns, that fallback will\nnot be able to prove control — remove the CNAME too, or replace it with\nthe delegation record shown on the SSL page. Requires `ssl.manage`.\n","responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/ssl/acme-dns/test":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["SSL"],"operationId":"testAcmeDnsAccount","summary":"Test the stored acme-dns credentials","description":"Re-checks the credentials already stored for this domain by writing a\nthrowaway value through the API, exactly as the upload did.\n\nAn acme-dns account can stop working long after it was accepted — the\nowner rotates it, the instance moves, an allowlist starts excluding our\negress — and nothing surfaces that until a renewal fails weeks later.\nRequires `ssl.manage`.\n","responses":{"200":{"description":"The credentials work.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"ok":{"type":"boolean"}}}}}},"400":{"description":"The credentials did not work (`code: \"verification_failed\"`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"No domain, or this domain has no acme-dns credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["DNS Records"],"operationId":"listRecords","summary":"List DNS records","description":"All records of the domain, newest first.\n\nProxied records may carry `origin_rules` — origin route or origin pool\nrules that override where that record's traffic actually goes, so the\neffective origin is **not** the record's `destination`. Routes are listed\nbefore pools, mirroring edge precedence.\n\nOn an **external-DNS** domain every proxied record also carries\n`edge_target` (what to publish in your own zone so the name reaches\nNSIN) and the stored verdict of the last edge check (`edge_status`,\n`edge_via`, `edge_detail`, `edge_checked_at`) — see the `Record` schema.\n","responses":{"200":{"description":"Record list.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecordWithOriginRules"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["DNS Records"],"operationId":"createRecord","summary":"Create a DNS record","description":"Creates one record and publishes it to the DNS zone (on a managed\ndomain). A name and type that already exist are refused — except TXT,\nwhere many records may share a name.\n\nSetting `proxied: true` routes the hostname through the NSIN edge: the\npublished DNS answer becomes the NSIN proxy IP, `destination` becomes\nthe origin the edge connects to, and the TTL is fixed at 120. Only `A`,\n`AAAA`, `CNAME` and `ANAME` can be proxied, a hostname can carry only\none proxied origin, and the origin must be an address the edge will\nconnect to (not a private, reserved or NSIN address). Proxied records\nare pushed to the edge at once and a certificate covering the name is\nrequested if needed.\n\nRequires `records.edit`; the record counts against the plan's record\nallowance, and `host_header` needs a plan with the Host-header override\nfeature.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordCreate"}}}},"responses":{"200":{"description":"Record created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"description":"Invalid record — a missing or disallowed type, a bad name or\ndestination for the type, TTL outside 1–604800, `timeout` outside\n1–1800, a comment over 1024 characters, a `host_header` outside the\ndomain and the owner's other active domains, an invalid\n`host_header_mode` (`field: host_header_mode`), a name and type\nthat already exist (`record exists` — for `TXT`, `MX`, `NS`, `SRV`,\n`CAA`, `TLSA`, `SSHFP` and `URI` several records may share a name,\nand only the same value twice is refused), a second\nproxied origin for the same hostname, or a proxied origin the edge\nrefuses (`code: proxy_origin_rejected`, `field: destination`).\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"field":{"type":"string","description":"The request field at fault, when known."},"code":{"type":"string","enum":["proxy_origin_rejected"],"description":"Present when a proxied origin is refused."}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan, so no records can be added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, the plan's record allowance is\nused up, or `host_header` is set on a plan without the Host-header\noverride feature.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"The DNS servers refused the write. Nothing was published; retry in a moment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/records/export":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["DNS Records"],"operationId":"exportZone","summary":"Export the zone as a BIND master file","description":"Renders the domain's records as a standard BIND zone file, served as a\ndownload (`text/plain`, `Content-Disposition: attachment`).\n\nFor a proxied record the file carries the **origin** the edge connects\nto, not the NSIN proxy IP that public DNS answers with — the export is\nthe zone as you configured it, so it stays usable if you restore it\nanywhere else. Proxy state is noted out of band, in a trailing\n`; nsin-proxied:true` comment. An apex alias (`ANAME`) is written as a\n`CNAME` plus an `; nsin-aname:true` comment, because `ANAME` is not a\nreal DNS type and stops most parsers. A row whose rdata is not valid\npresentation form is emitted as a `; SKIPPED` comment rather than\ndropped silently.\n\nRe-importing the file restores both: `POST .../records/import/parse`\nreads `nsin-proxied:true` (as well as Cloudflare's `cf-proxied:true`)\nand previews an apex `CNAME` as the `ANAME` it came from.\n\nThe `SOA` is synthesized — PowerDNS owns the live one — and its serial\nis derived from the records' last-modified time, so exporting unchanged\ndata twice produces a byte-identical file. The `NS` set is written only\nwhile NSIN is authoritative for the domain; for a domain on external DNS\nthe file carries no delegation, so it will not point the zone back at us\nif you feed it to another provider.\n\nRecord comments are never included. Read-only: requires `domain.view`,\nand unlike the write endpoints it stays available while the domain is\nsuspended or expired.\n","responses":{"200":{"description":"Zone file.","content":{"text/plain":{"schema":{"type":"string"},"example":"; BIND zone file exported from Nsin for example.com\n; Generated 2026-08-31T09:00:00Z\n$ORIGIN example.com.\n$TTL 3600\nexample.com.\t3600\tIN\tSOA\tny.nsin.ir. hostmaster.example.com. 2026083101 10800 3600 604800 3600\nexample.com.\t3600\tIN\tNS\tny.nsin.ir.\nexample.com.\t3600\tIN\tNS\tth.nsin.ir.\n\nexample.com.\t3600\tIN\tMX\t10 mail.example.net.\nblog.example.com.\t300\tIN\tCNAME\thosted.example.net.\nwww.example.com.\t120\tIN\tA\t203.0.113.10\t; nsin-proxied:true\n"}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/{recordId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RecordId"}],"put":{"tags":["DNS Records"],"operationId":"updateRecord","summary":"Update a DNS record","description":"Partial update — omitted fields keep their current value. The type\ncannot be changed. The same rules as creating apply to the new values\n(see `POST .../records/`); DNS is republished, a proxied change reaches\nthe edge at once, and on an external-DNS domain the edge check runs\nagain in the background. Records NSIN manages (`editable: false` —\ngateway records, locked Email Routing records) cannot be changed here.\nRequires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordUpdate"}}}},"responses":{"200":{"description":"Updated record.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"description":"Malformed body or an invalid value (see `POST .../records/`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"Setting `host_header` on a domain with no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, the record is not editable, or a\nnew `host_header` on a plan without the Host-header override\nfeature.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Domain or record not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"The DNS servers refused the write; retry in a moment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["DNS Records"],"operationId":"deleteRecord","summary":"Delete a DNS record","description":"Removes the record from the zone, and from the edge if it was proxied.\nRecords NSIN manages (`editable: false`) cannot be deleted here: turn\na gateway off with `DELETE /domains/{domain}/gateways/{gatewayId}`, and\nEmail Routing records go away when routing is disabled. Requires\n`records.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Read-only key, insufficient role, or the record is not editable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Domain or record not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/edge-check":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["DNS Records"],"operationId":"edgeCheckRecords","summary":"Re-check that proxied records point to NSIN (external DNS)","description":"For a domain whose DNS is hosted **outside** NSIN, resolves every\nproxied record right now and stores the verdict on each one\n(`edge_status` / `edge_via` / `edge_detail` / `edge_checked_at`).\n\nA background sweep does the same every 5 minutes (hourly once a\nrecord is confirmed), and a record is checked as soon as it is created\nor updated, so this is for \"I just fixed my DNS, look again\". Limited\nto once a minute per domain. A managed-DNS domain answers `400` with\n`error_code: managed_dns` — its proxied records always point here.\nThe outcome is also stored as the `edge` entry of\n`GET /domains/{domain}/checks`. Requires `domain.view`.\n","responses":{"200":{"description":"The fresh verdicts.","content":{"application/json":{"schema":{"type":"object","properties":{"checked":{"type":"integer","description":"Proxied records looked up."},"ok":{"type":"integer","description":"Records that resolve to NSIN."},"miss":{"type":"integer","description":"Records that resolve elsewhere or not at all."},"message":{"type":"string","description":"A one-line summary of the outcome."},"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"next_manual_check_at":{"type":"string","format":"date-time","description":"When this endpoint accepts the next call for this domain."}}}}}},"202":{"$ref":"#/components/responses/CheckAccepted"},"400":{"description":"The domain uses NSIN-managed DNS.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"error_code":{"type":"string","const":"managed_dns"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"description":"Checked less than a minute ago. `retry_after_seconds` says how long to wait.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"retry_after_seconds":{"type":"integer"}}}}}}}}},"/domains/{domain}/records/batch-update":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["DNS Records"],"operationId":"batchUpdateRecords","summary":"Update many records at once","description":"Applies an update to many records in one request. Each item accepts\nexactly the same optional fields as a single `PUT`.\n\n**Best-effort:** every record is processed independently, so one bad\nrecord does not abort the rest. The response always returns `200` with a\nper-record `results` array — check it rather than the status code. At\nmost 1000 records per call. The edge is notified once for the whole\nbatch. Requires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["updates"],"properties":{"updates":{"type":"array","items":{"allOf":[{"type":"object","required":["id"],"properties":{"id":{"type":"integer","description":"Id of the record to update."}}},{"$ref":"#/components/schemas/RecordUpdate"}]}}}}}}},"responses":{"200":{"description":"Per-record outcome.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResult"}}}},"400":{"description":"Malformed body, an empty `updates`, or more than 1000 records.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/batch-delete":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["DNS Records"],"operationId":"batchDeleteRecords","summary":"Delete many records at once","description":"Deletes many records in one request, at most 1000 per call.\nBest-effort per record — see `batch-update`; records NSIN manages are\nrefused per item. Requires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"integer"}}}}}}},"responses":{"200":{"description":"Per-record outcome.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResult"}}}},"400":{"description":"Malformed body, an empty `ids`, or more than 1000 records.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/scan":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["DNS Records"],"operationId":"scanRecords","summary":"Scan the domain's existing DNS","description":"Asks the domain's current authoritative nameservers which records\nexist and returns them as an import preview — nothing is written. Each\nentry is marked `new`, `overwrite` (an NSIN record with the same name\nand type already exists — for `MX`, `NS`, `SRV`, `CAA`, `TLSA`, `SSHFP`\nand `URI` also the same value) or `unsupported`.\n\nA zone transfer (AXFR) is tried first; when the nameservers refuse it,\nthe apex and a list of common subdomain names — plus names found in a\ncertificate-transparency index — are queried for A, AAAA, CNAME, MX and\nTXT records. A wildcard zone comes back as a single `*` record. The\nscan runs inline, within a time budget (2 minutes by default). Use it\nto review before calling `scan-import`, or use an import session,\nwhich runs the same scan in the background. Requires `domain.view`.\n","responses":{"200":{"description":"Scan preview.","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ImportPreviewRecord"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/scan-import":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["DNS Records"],"operationId":"scanImportRecords","summary":"Scan and import in one step","description":"Runs the same scan as `GET .../records/scan` and imports what it\nfinds, without a review step. Everything is created **unproxied**;\n`NS` records are never imported, and a name and type that already\nexist are skipped (TXT records are always added). Records reach DNS\nstraight away. Requires `records.edit`; the new records count against\nthe plan's record allowance.\n\nTo review what was found before anything reaches DNS, use\n`POST /domains/{domain}/records/import-sessions` instead.\n","responses":{"200":{"description":"Import outcome, plus the domain's full record list afterwards.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan, so no records can be added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, or the import would take the\ndomain past its plan's record allowance (nothing is written).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/import/parse":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["DNS Records"],"operationId":"parseZoneFile","summary":"Parse a zone file into an import preview","description":"Accepts a BIND-style zone file, uploaded as the multipart form field\n`file` (at most 2 MB), and returns what would be imported, with each\nentry marked `new`, `overwrite` (a record with the same name and type\nexists — `existing_id`; TXT records never overwrite, and `MX`, `NS`,\n`SRV`, `CAA`, `TLSA`, `SSHFP` and `URI` only overwrite a record with\nthe same value) or `unsupported`.\nNothing is written — pass the entries you want to\n`POST .../records/import`. Requires `domain.view`.\n\nThe `SOA` and the apex `NS` records are skipped. Each entry keeps the\nfile's own TTL (a line with none takes `$TTL`, else 3600), capped at\n604800 (one week). A TTL of `1` — how a Cloudflare export writes its\nautomatic TTL — or `0` becomes 120, NSIN's Auto, and a proxied entry\nalways gets 120, as a proxied record created by hand does. A line\ncarrying Cloudflare's `cf-proxied:true` comment, or the\n`nsin-proxied:true` comment NSIN's own export writes, is previewed with\n`proxied: true`, unless the type cannot be proxied or the origin is an\naddress the edge refuses to proxy to (then `reason` says so). A `CNAME`\nat the apex is previewed as `ANAME` — that is how NSIN's export writes\nan apex alias and how Cloudflare exports a flattened apex.\n","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The zone file to parse. At most 2 MB."}}}}}},"responses":{"200":{"description":"Import preview.","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ImportPreviewRecord"}}}}}}},"400":{"description":"No `file` form field, or the file is larger than 2 MB. Lines the\nparser cannot read are skipped rather than failing the request.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/import":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["DNS Records"],"operationId":"importRecords","summary":"Import records","description":"Creates the supplied records. A non-TXT record whose name and type\nalready exist overwrites that record's destination, TTL and MX\npriority — its `proxied` setting is kept, whatever the item says. TXT\nrecords are always added. Best-effort per record — the response counts\nwhat succeeded and lists what failed (a type that is not allowed, an\ninvalid value, a record that is not editable, or a proxied origin the\nedge refuses). A `CNAME` at `@` is refused per row (\"use type ANAME for\nroot\"). `ttl` is kept, capped at 604800; a missing, `0` or `1` (a\nCloudflare export's automatic TTL) `ttl` becomes 120, and a proxied\nrecord always gets 120 — on an overwrite, the proxy state the record\nkeeps decides. On a managed domain the\nzone is updated straight away. Requires `records.edit`; the\nnew records count against the plan's record allowance.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ImportRecordItem"}}}}}}},"responses":{"200":{"description":"Import outcome.","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"overwritten":{"type":"integer"},"failed":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"error":{"type":"string"}}}}}}}}},"400":{"description":"Malformed request body, or `records` is empty.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan, so no records can be added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, or the import would take the\ndomain past its plan's record allowance (nothing is written).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/import-sessions":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["DNS Records"],"operationId":"startRecordImportSession","summary":"Start a record import session","description":"Scans the domain's current nameservers — a zone transfer where they\nallow one, otherwise a sweep of common names — into a staging session.\nNothing is written to the zone. Requires `records.edit`.\n\nThe scan runs in the background: the session comes back `scanning` with\nan empty `records` list, and you poll\n`GET .../records/import-sessions/current` until it turns `ready`.\n\nEach staged row carries the proxy setting it would be imported with\n(`proxied`): **on** for the website rows the edge can carry — a\nproxyable type pointing at an address the edge accepts — and off for\nwhat proxying would break: mail hosts and in-zone `MX` targets,\nunderscored names (`_acme-challenge`, DKIM keys) and labels that name\na non-HTTP service (`ssh`, `vpn`, `ns1`, …), each with a warning saying\nwhy. A row that would overwrite an existing record mirrors that\nrecord's setting, because an import never changes it. Change any of it\nper row in the commit body.\n\nThis works before the domain is active, including an external-DNS\ndomain that is not verified yet: the owner can review and commit its\nscan at once. Only the automatic commit waits for verification.\n\n**Idempotent.** If the domain already has an open session it comes back\nwith `200` and no new scan is started, so a double click or a retry\ncannot start a second sweep.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["manual_scan","domain_create","zone_file"],"default":"manual_scan","description":"Recorded on the session so support can answer \"where did\nthis import come from\" months later. An unrecognised value\nfalls back to `manual_scan`.\n"}}}}}},"responses":{"200":{"description":"An open session already existed and is returned unchanged. No new\nscan was started.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSession"}}}},"202":{"description":"A new session was created and its scan is running. `status` is\n`scanning` and `records` stays empty until it finishes.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSession"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled or banned.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"disabled":{"value":{"error":"domain is disabled"}}}}}},"429":{"$ref":"#/components/responses/ImportScanThrottled"}}}},"/domains/{domain}/records/import-sessions/current":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["DNS Records"],"operationId":"getCurrentRecordImportSession","summary":"Get the domain's open import session","description":"The newest session whose status is `scanning` or `ready` — what you poll\nwhile a scan runs, and what tells you there are staged records still\nwaiting for a decision. Requires `domain.view`.\n","responses":{"200":{"description":"The open session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSession"}}}},"204":{"description":"No open session: nothing is scanning and nothing is waiting to be\nreviewed. There is no body.\n"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/import-sessions/{sessionId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/ImportSessionId"}],"get":{"tags":["DNS Records"],"operationId":"getRecordImportSession","summary":"Get one import session","description":"One session in any status, including finished ones — what was found,\nwhat was committed and when. Requires `domain.view`.\n\nSessions are resolved within the domain, so an id belonging to another\ndomain is reported as not found.\n","responses":{"200":{"description":"The session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSession"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/ImportSessionNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["DNS Records"],"operationId":"discardRecordImportSession","summary":"Discard an import session","description":"The \"skip for now\" path: the staged rows are dropped, nothing is written\nto the zone, and the auto-commit is cancelled — somebody who explicitly\nskipped the review must not get a surprise import hours later. Requires\n`records.edit`.\n\nThe records themselves are untouched at the old provider; run another\nscan whenever you want them.\n","responses":{"200":{"description":"Discarded.","content":{"application/json":{"schema":{"type":"object","properties":{"discarded":{"type":"boolean"},"records_dropped":{"type":"integer","description":"How many staged rows were thrown away."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/ImportSessionNotFound"},"409":{"description":"The session is no longer open — it has already been committed,\nsuperseded by a rescan, or discarded. The body carries its current\n`status`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSessionConflict"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/import-sessions/{sessionId}/commit":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/ImportSessionId"}],"post":{"tags":["DNS Records"],"operationId":"commitRecordImportSession","summary":"Commit a reviewed import session","description":"Writes the reviewed set into the domain's records and into DNS. Requires\n`records.edit`, and the session must be `ready`.\n\n* `mode: \"selected\"` with `records` — commits exactly what you post.\n  This is the reviewed path: send back the rows you kept, with the\n  `proxied` flags you chose.\n* `mode: \"all\"`, an empty `records`, or **no body at all** — commits the\n  session's own preselected rows with the proxy defaults it staged\n  (the `proxied` flag of each row — on for website rows).\n\nAn existing record with the same name and type is overwritten; for the\ntypes that hold several values per name (`MX`, `NS`, `SRV`, `CAA`,\n`TLSA`, `SSHFP`, `URI`) only one with the same value is, and a new\nvalue is added next to the others. Per-row\nproblems come back in `failed` and never abort the batch.\n\nThe session is claimed before anything is written, so a second click\nloses the race and gets `409` rather than importing twice. A whole-import\nfailure — the plan's record limit — releases the session back to `ready`,\nso you can upgrade and commit the same staged rows again.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSessionCommit"}}}},"responses":{"200":{"description":"Import outcome, plus the domain's full record list afterwards.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSessionCommitResult"}}}},"400":{"description":"Nothing to commit — `mode: \"selected\"` with no usable rows, or a\nsession whose every row was unsupported.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"empty":{"value":{"error":"no records to import"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan, so records cannot be created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, insufficient role, or the import would exceed the\nplan's record limit. The session stays `ready` and can be committed\nagain after an upgrade.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/ImportSessionNotFound"},"409":{"description":"The domain is disabled, the session is not `ready`, or somebody\nelse — a second click, or the auto-commit — already claimed it. The\nbody carries the session's current `status`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSessionConflict"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/records/import-sessions/{sessionId}/rescan":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/ImportSessionId"}],"post":{"tags":["DNS Records"],"operationId":"rescanRecordImportSession","summary":"Rescan, superseding an import session","description":"Marks this session `superseded` and starts a fresh one against the\n**same nameservers the original scan read**. Requires `records.edit`.\n\nReusing the stored nameservers is the whole point: once the domain is\ndelegated to NSIN, resolving its nameservers again finds ours, and a\nrescan would transfer our own still-empty zone and report that the old\nprovider had nothing.\n\nThe old session is kept rather than rewritten, so a rescan can never\nrace a commit already in flight, and the record of what was originally\nfound survives.\n","responses":{"200":{"description":"An open session already existed and is returned unchanged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSession"}}}},"202":{"description":"The replacement session was created and its scan is running.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportSession"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/ImportSessionNotFound"},"409":{"description":"The domain is disabled, or this session is being committed right\nnow and cannot be superseded.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"committing":{"value":{"error":"this import is being committed"}}}}}},"429":{"$ref":"#/components/responses/ImportScanThrottled"}}}},"/domains/{domain}/gateways/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Gateways"],"operationId":"listGateways","summary":"List gateways","description":"Every gateway currently offered, each with whether it is switched on for\nthis domain and, when it is, the record that was created for it —\ntogether with this domain's gateway plan standing: whether gateways are\nincluded at all, and how much of the rolling 30-day allowances\n(requests and egress bytes) has been used. Gateways switched on earlier\nwhose catalog entry has since been withdrawn are listed too, marked\n`retired`, so they can still be switched off. Requires `domain.view`.\n\nEach entry carries its icon inline as a base64 `data:` URI, which is\nmost of the response's size. Pass `icons=url` to get a cacheable\n`icon_url` instead (see `GET /gateway-presets/{presetId}/icon`).\n","parameters":[{"name":"icons","in":"query","description":"`url` returns `icon_url` instead of the inline `icon`.","schema":{"type":"string","enum":["url"]}}],"responses":{"200":{"description":"Gateway list and quota standing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayList"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/gateways/terms":{"get":{"tags":["Gateways"],"summary":"Gateway terms of use status","description":"Whether this domain has accepted the gateway terms of use, and who\naccepted them. Gateways route traffic over shared egress IP addresses\nthat can change, so the terms must be accepted before a gateway can be\nenabled — `POST .../apply` returns 403 with\n`error_code: gateway_terms_required` until they are.\n\nAcceptance is per DOMAIN, not per user.\n","operationId":"getGatewayTerms","parameters":[{"$ref":"#/components/parameters/DomainName"}],"responses":{"200":{"description":"Terms status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayTerms"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"}}}},"/domains/{domain}/gateways/terms/accept":{"post":{"tags":["Gateways"],"summary":"Accept the gateway terms of use","description":"Records acceptance for this domain. Idempotent — re-accepting keeps the\noriginal timestamp and accepter. Requires the same permission as\nenabling a gateway.\n","operationId":"acceptGatewayTerms","parameters":[{"$ref":"#/components/parameters/DomainName"}],"responses":{"200":{"description":"Terms status after acceptance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayTerms"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"}}}},"/domains/{domain}/gateways/{gatewayId}/apply":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/GatewayId"}],"post":{"tags":["Gateways"],"operationId":"enableGateway","summary":"Switch a gateway on","description":"Creates the gateway's record on this domain and returns it. The record is\nproxied through the NSIN edge and counts against your plan's record\nlimit, but it is **not editable** — updating or deleting it through the\nDNS record endpoints returns 403. Use the rename and delete endpoints\nbelow instead.\n\nSend a `name` to choose the hostname yourself; omit the body entirely and\none is generated as `<slug>-<5 digits>`.\n\nA gateway can be on at most once per domain. Requires `records.edit`.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayName"}}}},"responses":{"201":{"description":"Gateway switched on; the created record.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"description":"Invalid gateway id, or an invalid `name`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient permission, the gateway terms of use are not accepted\nyet (`error_code: gateway_terms_required`), the plan does not\ninclude gateways, or the plan's record limit is already reached.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"error_code":{"type":"string","enum":["gateway_terms_required"]}}}]}}}},"404":{"description":"Domain not found, or no such gateway is on offer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The domain is disabled, uses external DNS (`error_code:\nexternal_dns`), or this gateway is already on — in that last case\nthe response carries the existing record under `record`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/gateways/{gatewayId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/GatewayId"}],"put":{"tags":["Gateways"],"operationId":"renameGateway","summary":"Rename a gateway","description":"Changes the hostname of a gateway that is already on, moving it in the\nzone. Only the name changes — the origin and Host header behind the\ngateway stay ours. This is the only way to rename the record, since the\nDNS record endpoints refuse it. Requires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayName"}}}},"responses":{"200":{"description":"The renamed record.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"description":"Missing or invalid name — not a valid hostname label, `@`, or a wildcard.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Domain not found, or this gateway is not on for it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The domain is disabled, uses external DNS (`error_code:\nexternal_dns`), or a record with that name already exists.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Gateways"],"operationId":"disableGateway","summary":"Switch a gateway off","description":"Deletes the record this gateway created and removes it from the zone.\nThis is the only way to remove a gateway record. Requires `records.edit`.\n","responses":{"200":{"description":"Switched off.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Domain not found, or this gateway is not on for it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/gateway-presets/{presetId}/icon":{"parameters":[{"name":"presetId","in":"path","required":true,"description":"Numeric id of the gateway (the `id` of a gateway list item).","schema":{"type":"integer"}}],"get":{"tags":["Gateways"],"operationId":"getGatewayIcon","summary":"Get a gateway's icon image","description":"The icon of one catalog gateway, as image bytes. You normally reach it\nthrough the `icon_url` that `GET /domains/{domain}/gateways/?icons=url`\nreturns (a path on the API origin, with the version already in `?v=`)\ninstead of the inline base64 `icon`.\n\n**Public — no authentication**, so an `<img>` tag can load it: catalog\nicons are not secret. The URL is content-addressed: when `v` names the\ncurrent icon the response may be cached for a year (`immutable`). An\nold or missing `v` still gets the *current* icon, but on a short\nlifetime, so a stale URL never pins a stale picture. `ETag` is the\nversion; send it back in `If-None-Match` for a `304`.\n\nThe body is PNG, JPEG, GIF, WebP or SVG. SVG is served with a\nsandboxing `Content-Security-Policy`, so it can only be drawn.\n","security":[],"parameters":[{"name":"v","in":"query","description":"The icon version from `icon_url`. Optional; see above.","schema":{"type":"string"}}],"responses":{"200":{"description":"The icon.","headers":{"Cache-Control":{"description":"`public, max-age=31536000, immutable` when `v` is the current\nversion; `public, max-age=300, must-revalidate` or `no-cache`\notherwise.\n","schema":{"type":"string"}},"ETag":{"description":"The icon version, quoted.","schema":{"type":"string"}}},"content":{"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/gif":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}},"image/svg+xml":{"schema":{"type":"string","format":"binary"}}}},"304":{"description":"`If-None-Match` matches the current version."},"404":{"description":"No such gateway, or it has no icon. Empty body."}}}},"/domains/{domain}/rules/cache/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listCacheRules","summary":"List cache rules","description":"Decides what the edge caches, for how long, and which safety bypasses apply. A domain may hold several cache rules with different tradeoffs; each is self-contained.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Cache rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CacheRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createCacheRule","summary":"Create a cache rule","description":"Decides what the edge caches, for how long, and which safety bypasses apply. A domain may hold several cache rules with different tradeoffs; each is self-contained.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/cache/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderCacheRules","summary":"Reorder cache rules","description":"Sets the `priority` of several cache rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/cache/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getCacheRule","summary":"Get a cache rule","description":"Returns one cache rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateCacheRule","summary":"Update a cache rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteCacheRule","summary":"Delete a cache rule","description":"Deletes one cache rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/cache/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleCacheRule","summary":"Enable or disable a cache rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/drop/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listDropRules","summary":"List drop rules","description":"Blocks matching requests at the edge, optionally restricted by visitor country.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Drop rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DropRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createDropRule","summary":"Create a drop rule","description":"Blocks matching requests at the edge, optionally restricted by visitor country.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/drop/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderDropRules","summary":"Reorder drop rules","description":"Sets the `priority` of several drop rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/drop/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getDropRule","summary":"Get a drop rule","description":"Returns one drop rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateDropRule","summary":"Update a drop rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteDropRule","summary":"Delete a drop rule","description":"Deletes one drop rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/drop/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleDropRule","summary":"Enable or disable a drop rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DropRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/custom/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listCustomRules","summary":"List custom rules","description":"Expression firewall rules: conditions on any cookie, header, query\nparameter, path, method, host, user agent, referer, client IP, country\nor JA4/JA4H fingerprint, combined with `all` (AND) or `any` (OR), then\n`block`, `captcha` or `log`. The edge runs them right after drop rules.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Custom rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CustomRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createCustomRule","summary":"Create a custom rule","description":"Creates an expression firewall rule. Requires `rules.edit`.\n\nHow many custom rules a domain may hold is the plan's\n`max_custom_rules` (see `GET /domains/{domain}/features`); at the limit\nthe create answers `403`. If the domain's plan does not include this\nrule type, the rule is still created — but switched off\n(`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRuleBody"},"example":{"name":"Padding cookie flood","action":"block","action_mode":"dry_run","conditions":[{"field":"cookie","key":"padding","op":"exists"}]}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"description":"The key is read-only, the domain is at its plan's\n`max_rules_per_set`, or it already holds `max_custom_rules` custom\nrules.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/custom/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderCustomRules","summary":"Reorder custom rules","description":"Sets the `priority` of several custom rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/custom/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getCustomRule","summary":"Get a custom rule","description":"Returns one custom rule by id. A rule that does not exist, belongs to\nanother domain or to another rule type answers `404`, as does a domain\nyou cannot read. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateCustomRule","summary":"Update a custom rule","description":"Partial update — omitted fields keep their current value; a\n`conditions` list that is sent replaces the old one whole. Requires\n`rules.edit`.\n\nSetting `enabled: true` is refused with `402` when the domain's plan\ndoes not include the type, and with `403` while the domain already\nruns `max_custom_rules` enabled custom rules (after a downgrade the\nextra rules are kept, but no more can be switched on). Every other\nchange is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"description":"The key is read-only, or switching the rule on would exceed `max_custom_rules`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteCustomRule","summary":"Delete a custom rule","description":"Deletes one custom rule and removes it from the edge immediately. A\nrule that does not exist, belongs to another domain or to another rule\ntype answers `404`, as does a caller without `rules.edit`. Requires\n`rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/custom/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleCustomRule","summary":"Enable or disable a custom rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan\ndoes not include its type, and with `403` while the domain already\nruns `max_custom_rules` enabled custom rules; switching it off always\nworks.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"description":"The key is read-only, or switching the rule on would exceed `max_custom_rules`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/redirect/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listRedirectRules","summary":"List redirect rules","description":"Returns an HTTP redirect for matching requests instead of proxying them to the origin.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Redirect rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RedirectRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createRedirectRule","summary":"Create a redirect rule","description":"Returns an HTTP redirect for matching requests instead of proxying them to the origin.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedirectRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedirectRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/redirect/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderRedirectRules","summary":"Reorder redirect rules","description":"Sets the `priority` of several redirect rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/redirect/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getRedirectRule","summary":"Get a redirect rule","description":"Returns one redirect rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedirectRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateRedirectRule","summary":"Update a redirect rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedirectRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedirectRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteRedirectRule","summary":"Delete a redirect rule","description":"Deletes one redirect rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/redirect/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleRedirectRule","summary":"Enable or disable a redirect rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedirectRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rewrite/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listRewriteRules","summary":"List rewrite rules","description":"Rewrites the path and/or query string before the request is sent to the origin. The visitor's URL is unchanged.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Rewrite rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RewriteRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createRewriteRule","summary":"Create a rewrite rule","description":"Rewrites the path and/or query string before the request is sent to the origin. The visitor's URL is unchanged.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rewrite/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderRewriteRules","summary":"Reorder rewrite rules","description":"Sets the `priority` of several rewrite rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rewrite/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getRewriteRule","summary":"Get a rewrite rule","description":"Returns one rewrite rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateRewriteRule","summary":"Update a rewrite rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteRewriteRule","summary":"Delete a rewrite rule","description":"Deletes one rewrite rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rewrite/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleRewriteRule","summary":"Enable or disable a rewrite rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/header/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listHeaderRules","summary":"List header rules","description":"Adds, overrides and removes HTTP headers — on the request before it\nreaches the origin, on the response before it reaches the visitor, or\nboth from the same rule.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Header rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/HeaderRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createHeaderRule","summary":"Create a header rule","description":"Adds, overrides and removes HTTP headers on the request, the response,\nor both. Unlike every other rule type, header rules **compose**: every\nmatching rule runs, in priority order.\n\nNot available on the Free plan, and refused on gateway records.\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeaderRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeaderRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/header/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderHeaderRules","summary":"Reorder header rules","description":"Sets the `priority` of several header rules at once. Lower priority\nvalues are evaluated first, and because header rules compose rather\nthan stopping at the first match, order decides which rule wins when\ntwo of them write the same header name — the later one does. The body\nis a bare array. Requires `rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/header/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getHeaderRule","summary":"Get a header rule","description":"Returns one header rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeaderRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateHeaderRule","summary":"Update a header rule","description":"Partial update — omitted fields keep their current value. Sending `ops`\nreplaces the whole list; there is no per-op patch. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeaderRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeaderRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteHeaderRule","summary":"Delete a header rule","description":"Deletes one header rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/header/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleHeaderRule","summary":"Enable or disable a header rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeaderRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/optimize/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listOptimizeRules","summary":"List web optimization rules","description":"Shrinks matching responses at the edge: converts JPEG/PNG images to\nWebP, minifies JavaScript and CSS, and sets the brotli level used for\ncached text.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Optimization rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OptimizeRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createOptimizeRule","summary":"Create a web optimization rule","description":"At least one action must be enabled (`images`, `minify_js`,\n`minify_css`, or a non-zero `compress_level`); a rule that does nothing\nis rejected rather than left to shadow later rules.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/optimize/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderOptimizeRules","summary":"Reorder web optimization rules","description":"Sets the `priority` of several optimization rules at once. Lower\npriority values are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/optimize/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getOptimizeRule","summary":"Get a web optimization rule","description":"Returns one web optimization rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateOptimizeRule","summary":"Update a web optimization rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteOptimizeRule","summary":"Delete a web optimization rule","description":"Deletes one web optimization rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/optimize/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleOptimizeRule","summary":"Enable or disable a web optimization rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/waf/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listWafRules","summary":"List WAF rules","description":"Runs the OWASP Core Rule Set against matching requests at the chosen paranoia level and blocks once the anomaly score passes the threshold.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"WAF rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WafRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createWafRule","summary":"Create a WAF rule","description":"Runs the OWASP Core Rule Set against matching requests at the chosen paranoia level and blocks once the anomaly score passes the threshold.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/waf/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderWafRules","summary":"Reorder WAF rules","description":"Sets the `priority` of several WAF rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/waf/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getWafRule","summary":"Get a WAF rule","description":"Returns one WAF rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateWafRule","summary":"Update a WAF rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteWafRule","summary":"Delete a WAF rule","description":"Deletes one WAF rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n\nDeleting the default **NSIN Shield** rule (`managed_by: shield`) is\nremembered: it is not re-created automatically until you call\n`POST /domains/{domain}/rules/waf/shield/restore`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/waf/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleWafRule","summary":"Enable or disable a WAF rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/waf/shield/status":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"getWafShieldStatus","summary":"Default protection status","description":"State of the default NSIN Shield rule — the critical-only WAF rule the\nplatform creates for every domain on a plan that includes it. Requires\n`domain.view`.\n","responses":{"200":{"description":"Shield status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafShieldStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/waf/shield/restore":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Rules"],"operationId":"restoreWafShield","summary":"Restore default protection","description":"Re-creates the default NSIN Shield rule after it was deleted, and\nclears the \"dismissed\" mark so the platform keeps it provisioned.\nTakes no body. Requires `rules.edit` and a plan that includes default\nprotection.\n","responses":{"200":{"description":"Shield status after the restore.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WafShieldStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The key is read-only, or the domain's plan does not include default protection.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"409":{"description":"Default protection is paused across NSIN (`platform_enabled` is\n`false` on the status). Nothing to do — try again once it resumes.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/captcha/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listCaptchaRules","summary":"List captcha rules","description":"Challenges visitors on matching paths before letting them through. A solved challenge is remembered for `ttl_sec`.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Captcha rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CaptchaRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createCaptchaRule","summary":"Create a captcha rule","description":"Challenges visitors on matching paths before letting them through. A solved challenge is remembered for `ttl_sec`.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptchaRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptchaRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/captcha/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderCaptchaRules","summary":"Reorder captcha rules","description":"Sets the `priority` of several captcha rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/captcha/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getCaptchaRule","summary":"Get a captcha rule","description":"Returns one captcha rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptchaRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateCaptchaRule","summary":"Update a captcha rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptchaRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptchaRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteCaptchaRule","summary":"Delete a captcha rule","description":"Deletes one captcha rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/captcha/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleCaptchaRule","summary":"Enable or disable a captcha rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptchaRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/basic_auth/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listBasicAuthRules","summary":"List basic auth rules","description":"Puts an HTTP Basic sign-in prompt in front of the matching paths. A\nrequest without accepted credentials is answered `401` at the edge and\nnever reaches your origin.\n\nPasswords are write-only: `users` comes back as usernames plus a\n`has_password` flag, never the password or its hash.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Basic auth rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BasicAuthRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createBasicAuthRule","summary":"Create a basic auth rule","description":"Protects the matching paths with the supplied username/password pairs.\nAt least one user is required, and every user needs a password of 8–128\ncharacters.\n\nResponses on protected paths are never cached at the edge.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicAuthRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicAuthRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/basic_auth/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderBasicAuthRules","summary":"Reorder basic auth rules","description":"Sets the `priority` of several basic auth rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/basic_auth/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getBasicAuthRule","summary":"Get a basic auth rule","description":"Returns one basic auth rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicAuthRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateBasicAuthRule","summary":"Update a basic auth rule","description":"Partial update — omitted fields keep their current value.\n\n`users` is the exception: when present it replaces the whole list, so a\nusername you leave out is removed. Within it, an entry whose `password`\nis omitted keeps the password that username already has, which is how\nyou rename or remove users without retyping everyone's credentials.\n\nRequires `rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicAuthRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicAuthRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteBasicAuthRule","summary":"Delete a basic auth rule","description":"Deletes one basic auth rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/basic_auth/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleBasicAuthRule","summary":"Enable or disable a basic auth rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Disabling a\nrule removes the sign-in prompt from the paths it covered. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasicAuthRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rate-limit/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listRateLimitRules","summary":"List rate limit rules","description":"Counts requests per key over a sliding window and drops or challenges the ones above the limit.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Rate limit rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RateLimitRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createRateLimitRule","summary":"Create a rate limit rule","description":"Counts requests per key over a sliding window and drops or challenges the ones above the limit.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rate-limit/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderRateLimitRules","summary":"Reorder rate limit rules","description":"Sets the `priority` of several rate limit rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rate-limit/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getRateLimitRule","summary":"Get a rate limit rule","description":"Returns one rate limit rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateRateLimitRule","summary":"Update a rate limit rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteRateLimitRule","summary":"Delete a rate limit rule","description":"Deletes one rate limit rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/rate-limit/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleRateLimitRule","summary":"Enable or disable a rate limit rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/bot-route/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listBotRouteRules","summary":"List bot route rules","description":"Acts on classified bot traffic — block it, serve alternative content, send it to a different origin, or just tag it in telemetry.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Bot route rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BotRouteRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createBotRouteRule","summary":"Create a bot route rule","description":"Acts on classified bot traffic — block it, serve alternative content, send it to a different origin, or just tag it in telemetry.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotRouteRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotRouteRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/bot-route/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderBotRouteRules","summary":"Reorder bot route rules","description":"Sets the `priority` of several bot route rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/bot-route/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getBotRouteRule","summary":"Get a bot route rule","description":"Returns one bot route rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotRouteRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateBotRouteRule","summary":"Update a bot route rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotRouteRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotRouteRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteBotRouteRule","summary":"Delete a bot route rule","description":"Deletes one bot route rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/bot-route/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleBotRouteRule","summary":"Enable or disable a bot route rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotRouteRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_pool/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listOriginPoolRules","summary":"List origin pool rules","description":"Load-balances matching traffic across several origins with optional health checking. Overrides the DNS record's own destination for every path it matches.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Origin pool rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OriginPoolRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createOriginPoolRule","summary":"Create an origin pool rule","description":"Load-balances matching traffic across several origins with optional health checking. Overrides the DNS record's own destination for every path it matches.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginPoolRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginPoolRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_pool/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderOriginPoolRules","summary":"Reorder origin pool rules","description":"Sets the `priority` of several origin pool rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_pool/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getOriginPoolRule","summary":"Get an origin pool rule","description":"Returns one origin pool rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginPoolRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateOriginPoolRule","summary":"Update an origin pool rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginPoolRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginPoolRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteOriginPoolRule","summary":"Delete an origin pool rule","description":"Deletes one origin pool rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_pool/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleOriginPoolRule","summary":"Enable or disable an origin pool rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginPoolRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_route/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listOriginRouteRules","summary":"List origin route rules","description":"Sends matching paths to a different origin than the DNS record's destination. Takes precedence over origin pools.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Origin route rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OriginRouteRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createOriginRouteRule","summary":"Create an origin route rule","description":"Sends matching paths to a different origin than the DNS record's destination. Takes precedence over origin pools.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginRouteRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginRouteRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_route/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderOriginRouteRules","summary":"Reorder origin route rules","description":"Sets the `priority` of several origin route rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_route/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getOriginRouteRule","summary":"Get an origin route rule","description":"Returns one origin route rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginRouteRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateOriginRouteRule","summary":"Update an origin route rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginRouteRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginRouteRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteOriginRouteRule","summary":"Delete an origin route rule","description":"Deletes one origin route rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/origin_route/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleOriginRouteRule","summary":"Enable or disable an origin route rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginRouteRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/fingerprint/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listFingerprintRules","summary":"List fingerprint rules","description":"Matches requests on their TLS/HTTP fingerprint (JA4, JA4H) and drops, challenges or tags them.\n\nReturned in evaluation order. Requires `domain.view`.\n","responses":{"200":{"description":"Fingerprint rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FingerprintRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createFingerprintRule","summary":"Create a fingerprint rule","description":"Matches requests on their TLS/HTTP fingerprint (JA4, JA4H) and drops, challenges or tags them.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FingerprintRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FingerprintRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/fingerprint/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderFingerprintRules","summary":"Reorder fingerprint rules","description":"Sets the `priority` of several fingerprint rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Requires\n`rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/fingerprint/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getFingerprintRule","summary":"Get a fingerprint rule","description":"Returns one fingerprint rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FingerprintRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateFingerprintRule","summary":"Update a fingerprint rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FingerprintRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FingerprintRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteFingerprintRule","summary":"Delete a fingerprint rule","description":"Deletes one fingerprint rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/fingerprint/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleFingerprintRule","summary":"Enable or disable a fingerprint rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FingerprintRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/error-page/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Rules"],"operationId":"listErrorPageRules","summary":"List error page rules","description":"Controls what visitors see for selected status codes — the NSIN branded page, your own HTML, or the origin's own response passed through untouched.\n\nReturned in evaluation order. While developer mode is on, its temporary\nrule (`managed_by: developer_mode`) comes first. Requires `domain.view`.\n","responses":{"200":{"description":"Error page rules.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ErrorPageRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Rules"],"operationId":"createErrorPageRule","summary":"Create an error page rule","description":"Controls what visitors see for selected status codes — the NSIN branded page, your own HTML, or the origin's own response passed through untouched.\n\nRequires `rules.edit`.\n\nIf the domain's plan does not include this rule type, the rule is still\ncreated — but switched off (`enabled: false`), whatever the body says.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPageRuleBody"}}}},"responses":{"200":{"description":"Rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPageRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/RulePlanLimited"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/error-page/reorder":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"patch":{"tags":["Rules"],"operationId":"reorderErrorPageRules","summary":"Reorder error page rules","description":"Sets the `priority` of several error page rules at once. Lower priority\nvalues are evaluated first. The body is a bare array. Entries for\ndeveloper mode's temporary rule are ignored: it always goes first.\nRequires `rules.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderRequest"}}}},"responses":{"200":{"description":"Number of rules whose priority changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleReorderResult"}}}},"400":{"description":"Malformed body, or a negative priority.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleDomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/error-page/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"get":{"tags":["Rules"],"operationId":"getErrorPageRule","summary":"Get an error page rule","description":"Returns one error page rule by id. A rule that does not exist, belongs to another\ndomain or to another rule type answers `404`, as does a domain you cannot\nread. Requires `domain.view`.\n","responses":{"200":{"description":"The rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPageRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Rules"],"operationId":"updateErrorPageRule","summary":"Update an error page rule","description":"Partial update — omitted fields keep their current value. Requires\n`rules.edit`.\n\nDeveloper mode's temporary rule can't be updated. It can still be\ntoggled or deleted.\n\nSetting `enabled: true` on a rule whose type the domain's plan does not\ninclude is refused with `402`; every other change is allowed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPageRuleBody"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPageRule"}}}},"400":{"$ref":"#/components/responses/RuleInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"409":{"description":"The rule is developer mode's temporary rule.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"managed_by":{"type":"string","enum":["developer_mode"]}}}]},"examples":{"developerMode":{"value":{"error":"this rule was added by developer mode and is removed when developer mode ends, so it can't be edited; switch it off or delete it here, or create your own error page rule","managed_by":"developer_mode"}}}}}},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Rules"],"operationId":"deleteErrorPageRule","summary":"Delete an error page rule","description":"Deletes one error page rule and removes it from the edge immediately. A rule that\ndoes not exist, belongs to another domain or to another rule type answers\n`404`, as does a caller without `rules.edit`. Requires `rules.edit`.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/rules/error-page/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/RuleId"}],"patch":{"tags":["Rules"],"operationId":"toggleErrorPageRule","summary":"Enable or disable an error page rule","description":"Flips the rule's `enabled` flag. Takes no request body — the new state\nis always the opposite of the current one, and is returned. Requires\n`rules.edit`.\n\nSwitching a rule **on** is refused with `402` when the domain's plan does\nnot include its type; switching it off always works.\n","responses":{"200":{"description":"The rule in its new state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPageRule"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/RulePlanLocked"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/RuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/overview":{"get":{"tags":["Analytics"],"operationId":"analyticsOverview","summary":"Per-domain totals across your account","description":"One row per domain you can access, with request, bandwidth and visitor\ntotals for the period. Account-wide — takes no `domain` parameter.\n","parameters":[{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"One entry per domain.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OverviewItem"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/domains-overview":{"get":{"tags":["Analytics"],"operationId":"analyticsDomainsOverview","summary":"Per-domain totals with sparkline","description":"Like `/analytics/overview`, plus an error rate, a small\nrequests-over-time series for sparklines, and the most recent log\ntimestamp seen for each domain.\n","parameters":[{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"One entry per domain.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DomainsOverviewItem"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/global-summary":{"get":{"tags":["Analytics"],"operationId":"analyticsGlobalSummary","summary":"Account-wide summary","description":"Headline figures — requests, bandwidth, unique visitors, error rate and\ncache hit rate — aggregated across every active domain you can access.\nThe peak requests-per-second figure is a separate, on-demand call:\n`GET /analytics/global-summary/peak`.\n\nBesides the usual periods, `all` covers the whole retained history.\nAnswers are cached per account: for 1–10 minutes depending on the\nperiod, and for a day with `all`.\n","parameters":[{"name":"period","in":"query","description":"Time window, ending now — the values of the shared `period`\nparameter, plus `all` for the whole retained history. An\nunrecognised value falls back to `24h`.\n","schema":{"type":"string","enum":["1h","3h","6h","12h","24h","48h","7d","30d","all"],"default":"24h"}}],"responses":{"200":{"description":"Account-wide totals.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalSummary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/global-summary/peak":{"get":{"tags":["Analytics"],"operationId":"analyticsGlobalSummaryPeak","summary":"Account-wide peak requests per second","description":"The highest number of requests served in any single second of the\nperiod, across the same domains `/analytics/global-summary` covers.\n\nThis is a full scan of the request log rather than a lookup, so it is\nserved on demand and may take a while for long periods. Results are\ncached per account; `all` is refreshed at most once a day.\n","parameters":[{"name":"period","in":"query","description":"Time window, ending now. Same values as `/analytics/global-summary`,\nincluding `all` for the whole retained history. An unrecognised\nvalue falls back to `24h`.\n","schema":{"type":"string","enum":["1h","3h","6h","12h","24h","48h","7d","30d","all"],"default":"24h"}}],"responses":{"200":{"description":"Peak requests per second.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalSummaryPeak"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/bandwidth-overview":{"get":{"tags":["Analytics"],"operationId":"analyticsBandwidthOverview","summary":"Origin-direction bandwidth across your domains","description":"Bytes sent to and received from origins, as a time series plus per-domain\ntotals.\n\n`ratio` is `min(up,down) / max(up,down)`. A value near `1.0` means the\ndomain pushes about as much to the origin as it pulls back, which is\nunusual for web traffic (downloads normally dominate) and sets\n`flagged`.\n","parameters":[{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"Bandwidth series and per-domain totals.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OriginBandwidthResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/tunnel-suspects":{"get":{"tags":["Analytics"],"operationId":"analyticsTunnelSuspects","summary":"Clients whose traffic resembles a proxy tunnel","description":"Clients whose WebSocket/gRPC traffic looks like a VPN or proxy tunnel run\nbehind the CDN: sustained volume over a single fixed path, with opaque\npayloads and no sign of ordinary browsing (no real assets fetched, no\nreferer).\n\nThis is a heuristic for investigation, not proof of abuse. `balance` is\ninformational — tunnels used for browsing are download-heavy, so\nsymmetry is **not** a criterion.\n","parameters":[{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"Suspected tunnel clients.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TunnelSuspectsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/nodes":{"get":{"tags":["Analytics"],"operationId":"analyticsListNodes","summary":"List edge nodes","description":"Active edge nodes (points of presence). Use `name` as the `node` filter\non `/analytics/traffic-by-node` and `/analytics/origins`.\n","responses":{"200":{"description":"Edge nodes.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Node identifier used in filters."},"label":{"type":"string","description":"Human-readable name."},"country":{"type":"string","description":"ISO country code."}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/nodes-overview":{"get":{"tags":["Analytics"],"operationId":"analyticsNodesOverview","summary":"Traffic by edge node, across your domains","description":"Per-node totals, error and cache rates, latency, a requests-over-time\nseries, and the busiest domains on each node — aggregated over every\ndomain you can see, or one domain with `domain_id`.\n\nThis is the account-wide counterpart of `/analytics/traffic-by-node`,\nwhich covers a single domain and splits by cache status instead.\n\nTwo kinds of row need care when reading the list:\n\n* `node: \"\"` — requests the serving edge did not stamp with a node name.\n  They are counted so the per-node rows still add up to `totals`, but\n  they cannot be attributed to a point of presence.\n* `requests: 0` with `registered: true` — a node that is in service but\n  served nothing in the period. Kept in the list so a node that stopped\n  reporting is visible rather than silently absent.\n\n`error_rate` and `cache_hit_rate` are percentages (0–100). Durations are\nin milliseconds and exclude WebSocket requests, whose lifetime is the\nwhole upgraded connection.\n","parameters":[{"$ref":"#/components/parameters/Period"},{"name":"domain_id","in":"query","description":"Numeric domain id — note this endpoint scopes by **id**, not by the\ndomain name the rest of the API uses. Omit to cover every active\ndomain you can see.\n","schema":{"type":"integer"}}],"responses":{"200":{"description":"Per-node totals with the scope-wide total they add up to.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NodesOverviewResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/node-countries":{"get":{"tags":["Analytics"],"operationId":"analyticsNodeCountries","summary":"List edge node countries","description":"The distinct countries NSIN's edge nodes are in, sorted — the values\nthe `nodeCountry` filter of `/analytics/logs` accepts. Needs no domain.\n","responses":{"200":{"description":"Country codes.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/summary":{"get":{"tags":["Analytics"],"operationId":"analyticsSummary","summary":"Traffic summary for one domain","description":"Headline figures for the domain over the period: requests, bandwidth,\nunique visitors, error rate and latency percentiles.\n\nUnique visitors are counted as distinct (client IP, JA4 TLS\nfingerprint) pairs, which separates people sharing one NAT address by\ndevice. On plain HTTP there is no JA4, so it degrades to counting IPs.\nLatency figures exclude WebSocket requests, whose duration spans the\nwhole connection.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Summary figures.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsSummary"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/overview-compare":{"get":{"tags":["Analytics"],"operationId":"analyticsOverviewCompare","summary":"This period against the one before it","description":"Totals for the last `period` and for the equally long window just\nbefore it, each with its status-code breakdown, plus an hourly\ncache-split series spanning both windows. It is everything a\nperiod-over-period overview needs — KPI tiles with deltas, a\n\"previous period\" ghost line, a status-class bar — from one request\nand one scan of the request log, instead of calling `summary`,\n`cache`, `status-codes` and `traffic-by-cache` once per window.\n\nOnly `3h`, `6h`, `12h` and `24h` are accepted; any other `period` is a\n`400`. The windows are `[since, boundary)` (previous) and\n`[boundary, now)` (current). Series buckets are clock hours in\nAsia/Tehran (UTC+03:30), emitted as UTC instants, oldest first; the\nbucket that contains `boundary` carries traffic from both windows.\n\nRequires `analytics.view` on the domain and a plan with the\n`monitoring` feature. Answers are cached for 2 minutes (`3h`, `6h`) or\n5 minutes (`12h`, `24h`) and shared between identical requests.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"period","in":"query","description":"Length of each of the two windows. The previous window is the same length, ending where the current one starts.","schema":{"type":"string","enum":["3h","6h","12h","24h"],"default":"24h"}},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Both windows' totals and the combined series.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OverviewCompare"}}}},"400":{"description":"The `domain` query parameter is missing, or `period` is not one of the accepted values.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"badPeriod":{"value":{"error":"period must be 3h, 6h, 12h or 24h"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/traffic-trend":{"get":{"tags":["Analytics"],"operationId":"analyticsTrafficTrend","summary":"Billable traffic per day or hour, over whole days","description":"Billable bytes and requests per bucket over a window of whole\nAsia/Tehran days, with the window's totals, an optional split by host\nor by serving tier, the previous window's totals, and the days whose\ndata is known to be incomplete.\n\nBytes are **billable** bytes — cache + proxied + direct egress, what\nbilling charges for — so these numbers are the bill's (show GB as\nbytes / 1024³, as billing does). Buckets are Tehran days or Tehran\nhours given as UTC instants (a Tehran day starts at 20:30 UTC, an hour\nat `:30`). Every bucket of the window is listed — empty ones as zeros\n— and only the one that holds now is `partial`.\n\n`granularity=hour` (and `auto` on a window of two days or less) is\ndrawn from 30-minute rollups where they cover the window, or from the\nrequest log for a window of one day. Where neither can, a longer\nwindow is answered in days and `window.granularity` says so. Daily\nbuckets read from the hourly rollup may give up to 30 minutes around\nTehran midnight to the neighbouring day; totals are exact.\n\nRequires `analytics.view` on the domain and a plan with the\n`monitoring` feature. Answers are cached (2 minutes for `today`, 5 for\n`7d`, 10 for longer windows) and shared between identical requests.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/TrafficRange"},{"$ref":"#/components/parameters/TrafficFrom"},{"$ref":"#/components/parameters/TrafficTo"},{"$ref":"#/components/parameters/TrafficHostname"},{"name":"granularity","in":"query","description":"Bucket size. `auto` is `hour` for a window of two days or less and\n`day` beyond. `hour` is refused (`400`) on a window over 7 days.\n","schema":{"type":"string","enum":["auto","hour","day"],"default":"auto"}},{"name":"split","in":"query","description":"Split each bucket's bytes: `host` by the 5 hostnames with the most\nbytes over the window plus `other`, `tier` by `cache` / `proxied`\n/ `direct`. `none` adds no split.\n","schema":{"type":"string","enum":["none","host","tier"],"default":"none"}},{"name":"compare","in":"query","description":"`1` adds `previous`: the totals of the window of equal length right before this one.","schema":{"type":"string","enum":["0","1"],"default":"0"}}],"responses":{"200":{"description":"The trend.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrafficTrend"}}}},"400":{"$ref":"#/components/responses/TrafficParamInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/traffic-highlights":{"get":{"tags":["Analytics"],"operationId":"analyticsTrafficHighlights","summary":"Busiest day and hour, and what changed","description":"The window's busiest Asia/Tehran day and busiest UTC hour (each with\nthe hostname that carried most of it), and **what changed**: up to 5\nhosts and files whose billable bytes per day moved the most between\n\"now\" — the last N full days of the window — and \"before\", the N days\nright before them, N = min(7, max(1, days / 2)). A change is listed\nwhen it is at least 1 GB (1024³ bytes) a day **and** at least 20% of\nthe domain's daily average over both periods, biggest move first.\nHosts come from the traffic rollups; files from the files sketch,\nand are left out while it does not cover both periods. `today` has no\nfull day, so no changes.\n\nRequires `analytics.view` on the domain and a plan with the\n`monitoring` feature. Cached like `traffic-trend`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/TrafficRange"},{"$ref":"#/components/parameters/TrafficFrom"},{"$ref":"#/components/parameters/TrafficTo"},{"$ref":"#/components/parameters/TrafficHostname"}],"responses":{"200":{"description":"Peaks and changes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrafficHighlights"}}}},"400":{"$ref":"#/components/responses/TrafficParamInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/top-files":{"get":{"tags":["Analytics"],"operationId":"analyticsTopFiles","summary":"The files that used the most bytes","description":"The paths (without query string) that sent the most bytes, with their\nshare of the window's billable bytes and their request counts. Under\na wildcard record (`*.example.com`) a file is reported with the real\nhost it was requested on when the origin request named it.\n\nFigures come from per-hour sketches of the top 100 files per hostname\nand are **estimates** (`approx` is always `true`; `bytes_error` bounds\neach one). The window is whole UTC hours: a Tehran day's first half\nhour rounds down, at both ends. Files are kept 35 days: a window\nreaching further back is cut to the last 35 days (`clamped: true`).\nUntil the sketches cover the window, a window of one day is read from\nthe request log (slower) and a longer one answers\n`available: false` with no items.\n\nRequires `analytics.view` on the domain and a plan with the\n`monitoring` feature. Cached like `traffic-trend`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/TrafficRange"},{"$ref":"#/components/parameters/TrafficFrom"},{"$ref":"#/components/parameters/TrafficTo"},{"$ref":"#/components/parameters/TrafficHostname"},{"name":"limit","in":"query","description":"How many files to return.","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Files by bytes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopFiles"}}}},"400":{"$ref":"#/components/responses/TrafficParamInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/breakdown":{"get":{"tags":["Analytics"],"operationId":"analyticsBreakdown","summary":"What used the traffic, by one dimension","description":"The domain's traffic over the window broken down by one dimension,\nranked by **bytes**:\n\n* `host` — hostnames, billable bytes (kept 400 days).\n* `content_type` — response Content-Type without parameters, billable\n  bytes; a response without one is `\"\"`, labelled `(none)`.\n* `country` — visitor country (ISO code), all egress bytes.\n* `asn` — visitor network (AS number, labelled with its name), all\n  egress bytes.\n* `status` — HTTP status code, all egress bytes.\n* `client` — client IP, labelled `network · country`, all egress\n  bytes. The top clients are picked with a sketch (`approx: true`) and\n  then counted exactly. **Requires the `logs` feature** as well\n  (`403` without it).\n\nEvery dimension but `host` is kept 35 days (`client` 34): a window\nreaching further back is cut (`clamped: true`). Until a dimension's\nrollup covers the window, a window of one day is read from the\nrequest log and a longer one answers `available: false`.\n`total_bytes` is always the window's billable bytes.\n\nRequires `analytics.view` on the domain and a plan with the\n`monitoring` feature. Cached like `traffic-trend`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/TrafficRange"},{"$ref":"#/components/parameters/TrafficFrom"},{"$ref":"#/components/parameters/TrafficTo"},{"$ref":"#/components/parameters/TrafficHostname"},{"name":"dim","in":"query","required":true,"description":"The dimension.","schema":{"type":"string","enum":["host","content_type","country","asn","status","client"]}},{"name":"limit","in":"query","description":"How many values to return.","schema":{"type":"integer","minimum":1,"maximum":50,"default":10}}],"responses":{"200":{"description":"Values by bytes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Breakdown"}}}},"400":{"$ref":"#/components/responses/TrafficParamInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/requests":{"get":{"tags":["Analytics"],"operationId":"analyticsRequests","summary":"Requests over time","description":"Request counts per time bucket (see the `period` parameter for the\nbucket size). Buckets with no traffic are omitted. Requires\n`analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Time series.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RequestsDataPoint"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/requests-compare":{"get":{"tags":["Analytics"],"operationId":"analyticsRequestsCompare","summary":"Requests over time, for period-over-period comparison","description":"Request counts in whole-day windows, for charts that overlay one period\non another. Unlike `/analytics/requests` — which ends *now* and takes a\n`period` — this window always starts at a local midnight, so every\nbucket covers a complete day and days can be compared like for like.\n\n* `granularity: hour` returns hourly buckets, meant to be drawn as one\n  line per day (hour-by-hour overlay). `days` defaults to 3, max 14.\n* `granularity: day` returns one bucket per day for day-over-day change.\n  `days` defaults to 14, max 35 — the ClickHouse row retention, beyond\n  which no data exists.\n\nScope is one domain (`domain_id`), or — by default — every active domain\nyou can see. The response has the time-series shape of\n`/analytics/requests`, except that each `timestamp` is the bucket's\nstart as Asia/Tehran wall-clock time, `YYYY-MM-DD HH:MM:SS` with no\nzone (not RFC 3339): `2026-09-28 00:00:00` is 2026-09-27T20:30:00Z.\nBuckets with no traffic are omitted rather than zero-filled.\n","parameters":[{"name":"granularity","in":"query","description":"Bucket size. Anything other than `day` is treated as `hour`.","schema":{"type":"string","enum":["hour","day"],"default":"hour"}},{"name":"days","in":"query","description":"Number of whole days to return, counting back from today. Clamped to\nthe granularity's maximum. `0` or omitted uses the default.\n","schema":{"type":"integer","minimum":1,"maximum":35}},{"name":"domain_id","in":"query","description":"Numeric domain id — note this endpoint scopes by **id**, not by the\ndomain name the rest of the API uses. Omit to cover every active\ndomain you can see.\n","schema":{"type":"integer"}}],"responses":{"200":{"description":"Time series.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RequestsCompareDataPoint"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/visitors":{"get":{"tags":["Analytics"],"operationId":"analyticsVisitors","summary":"Unique visitors over time","description":"Distinct visitors per bucket, counted as (client IP, JA4) pairs. Note\nthat visitors do not sum across buckets — the same person appears in\nevery bucket they were active in.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Time series.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RequestsDataPoint"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/bandwidth":{"get":{"tags":["Analytics"],"operationId":"analyticsBandwidth","summary":"Bandwidth over time","description":"Bytes per time bucket in both directions: `bytes_in` received from\nvisitors, `bytes_out` sent to them. Requires `analytics.view` and a plan\nwith `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Time series.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BandwidthDataPoint"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/top-uris":{"get":{"tags":["Analytics"],"operationId":"analyticsTopUris","summary":"Most requested URIs","description":"The domain's 10 most requested page URLs, busiest first. Asset files —\nany path ending in a file extension such as `.css`, `.js` or `.png` — are\nleft out, so the list shows pages rather than static files. For `7d` and\n`30d` the counts come from hourly sketches and are approximate. Requires\n`analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Top URIs by request count.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TopUri"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/top-requests":{"get":{"tags":["Analytics"],"operationId":"analyticsTopRequests","summary":"Top-N breakdown by a chosen metric","description":"A ranked breakdown of the domain's traffic. `metric` selects what is\nranked, and which fields of each row are populated — rows omit the\nfields that do not apply.\n\nIt takes no `hostname` or `path` filter: every row covers the whole\ndomain.\n\nRequires a plan including the `logs` feature.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"metric","in":"query","required":true,"description":"* `slow_requests` — slowest paths, with average and maximum duration. Excludes WebSockets.\n* `uris` — most requested paths.\n* `errors_5xx` — paths returning server errors.\n* `hosts` — busiest subdomains.\n* `countries` — busiest visitor countries.\n* `user_agents` — busiest user agents.\n* `networks` — busiest visitor networks, keyed `AS<number>` with the operator in `label`.\n","schema":{"type":"string","enum":["slow_requests","uris","errors_5xx","hosts","countries","user_agents","networks"]}},{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"Ranked rows.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TopRequestRow"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/countries":{"get":{"tags":["Analytics"],"operationId":"analyticsCountries","summary":"Traffic by visitor country","description":"The 20 visitor countries with the most requests, busiest first, each\nwith its requests, egress bytes and unique visitors. The country is\nresolved from the client IP. Visitor counts use a mergeable estimator —\nexact below a few thousand visitors per country, within about 1% above.\nRequires `analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Per-country totals.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CountryStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/asns":{"get":{"tags":["Analytics"],"operationId":"analyticsAsns","summary":"Traffic by visitor network (ASN)","description":"The 10 client networks (autonomous systems) with the most requests,\nbusiest first, with their egress bytes. Requests whose network could not\nbe resolved (private addresses, for example) are left out. Requires\n`analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Per-network totals.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AsnStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/protocols":{"get":{"tags":["Analytics"],"operationId":"analyticsProtocols","summary":"Traffic by HTTP protocol version","description":"Requests grouped by the HTTP version the client used: `h1`, `h2`, `h3`,\nor `other`. Requires `analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Per-protocol request counts.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProtocolStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/tls":{"get":{"tags":["Analytics"],"operationId":"analyticsTls","summary":"TLS versions, cipher suites and session resumption","description":"What your visitors negotiate with the edge. Every count here is\nrestricted to TLS-terminated requests, so plain-HTTP traffic never\nenters the totals — a domain redirecting `:80` to `:443` does not read\nas though a slice of its visitors used no TLS at all.\n\n`pct` in `versions` is a share of all TLS requests. `pct` in `ciphers`\nis a share of the returned suites only: the list is capped at the top\n12, and the shares are normalised over that list so they still add up\nto 100%.\n\nThis is the visitor-to-edge leg only. The edge-to-origin handshake is\nnot reported here.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"TLS mix for the period.","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"$ref":"#/components/schemas/TlsSummary"},"versions":{"type":"array","items":{"$ref":"#/components/schemas/TlsVersionStats"}},"ciphers":{"type":"array","description":"Top 12 cipher suites, most used first.","items":{"$ref":"#/components/schemas/TlsCipherStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/ai-crawlers":{"get":{"tags":["Analytics"],"operationId":"analyticsAiCrawlers","summary":"AI crawler traffic, in full","description":"Everything the AI Crawl Control pages are built from, in one response:\nperiod counters, a timeseries, a per-crawler table, and the paths\ncrawlers read or were refused.\n\n`summary`, `series`, `top_paths` and `blocked_paths` cover AI crawlers\nonly — the kinds listed in `ai_kinds`, or the single kind named by\n`crawler`. Classic search and SEO crawlers (`googlebot`, `bingbot`,\n`yandexbot`, `ahrefsbot`, `semrushbot`, `mj12bot`, `generic-bot`) are\ndeliberately left out of those, so they cannot drown the AI numbers.\n`crawlers` is the exception: it lists **every** bot kind actually seen\non the domain, so nothing is invisible.\n\nHuman traffic never reaches any of these numbers.\n\nThe Markdown counters in `summary` describe the Markdown-for-Agents\nfeature: `markdown_answered` is what the edge actually rewrote to\nMarkdown, and `markdown_missed` is the rest of what could plausibly\nhave been Markdown (`markdown_eligible` — responses below `300`).\nRedirects, `404`s and images are not counted against the feature.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"name":"crawler","in":"query","description":"Narrow every panel except `crawlers` to one bot kind, from the\ncanonical catalog — the values in `ai_kinds`, plus `googlebot`,\n`bingbot`, `duckduckbot`, `yandexbot`, `ahrefsbot`, `semrushbot`,\n`mj12bot` and `generic-bot`. Omit for all AI crawlers.\n","schema":{"type":"string"},"example":"gptbot"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"AI crawler activity for the period.","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"$ref":"#/components/schemas/AiCrawlerSummary"},"crawlers":{"type":"array","description":"Every bot kind seen, busiest first — not limited to AI crawlers.","items":{"$ref":"#/components/schemas/AiCrawlerStats"}},"series":{"type":"array","items":{"$ref":"#/components/schemas/AiCrawlerDataPoint"}},"top_paths":{"type":"array","description":"Top 10 paths AI crawlers read successfully.","items":{"$ref":"#/components/schemas/AiCrawlerPath"}},"blocked_paths":{"type":"array","description":"Top 10 paths AI crawlers asked for and did not get (`4xx`\nor `5xx`) — the content agents want but cannot cite.\n","items":{"$ref":"#/components/schemas/AiCrawlerPath"}},"ai_kinds":{"type":"array","description":"The bot kinds counted as AI crawler traffic.","items":{"type":"string"}}}}}}},"400":{"description":"The `domain` query parameter is missing, or `crawler` is not a known bot kind.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"unknownCrawler":{"value":{"error":"unknown crawler"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/status-codes":{"get":{"tags":["Analytics"],"operationId":"analyticsStatusCodes","summary":"Traffic by HTTP status code","description":"Requests per HTTP status code returned to visitors, busiest first.\nRequires `analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Per-status-code counts.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StatusCodeStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/unreachable-reasons":{"get":{"tags":["Analytics"],"operationId":"analyticsUnreachableReasons","summary":"Why requests could not be served","description":"A breakdown of failed requests by cause, with plain-language\nexplanations and who is responsible (`client`, `origin`, `network` or\n`config`) — so you can tell a visitor hanging up from your server\ncrashing without reading raw proxy errors.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Failure reasons.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/UnreachableReason"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/cache":{"get":{"tags":["Analytics"],"operationId":"analyticsCache","summary":"Cache hit, miss and bypass counts","description":"`hit_rate` is `hits / (hits + misses)` — bypasses are excluded from the\ndenominator, since a bypassed request was never a caching candidate.\n`bypass_reasons` breaks down why requests bypassed the cache.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Cache counters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheAnalytics"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/bot-cache":{"get":{"tags":["Analytics"],"operationId":"analyticsBotCache","summary":"Cache counters for verified search-engine crawlers","description":"The cache section restricted to requests from **verified**\nsearch-engine crawlers (Googlebot, Bingbot, Applebot, DuckDuckBot,\nYandexBot) — the traffic the domain's bot cache serves — split per\ncrawler. A spoofed User-Agent never counts: \"verified\" is the edge's own\nverdict against the operator's published IP ranges or reverse DNS.\nWith the bot cache off the numbers show what crawlers get from the\nordinary cache, which is the baseline the feature improves.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Crawler cache counters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotCacheAnalytics"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/traffic-by-cache":{"get":{"tags":["Analytics"],"operationId":"analyticsTrafficByCache","summary":"Egress bytes by cache status over time","description":"Egress bytes and request counts per time bucket, split by cache status\n(`hit`, `miss`, `bypass`). Compute a hit ratio from the request counts:\nhits are small and misses large, so a bytes split understates it. Accepts\n`node` to narrow to one edge node. Requires `analytics.view` and a plan\nwith `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"},{"$ref":"#/components/parameters/NodeFilter"}],"responses":{"200":{"description":"Time series.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TrafficByCacheDataPoint"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/traffic-by-reqstatus":{"get":{"tags":["Analytics"],"operationId":"analyticsTrafficByReqStatus","summary":"Egress bytes by serving path over time","description":"Serving path is orthogonal to cache status: `cache` went through the\ncaching pipeline, `proxied` reached the origin through the edge proxy,\nand `direct` reached the origin without it.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"},{"$ref":"#/components/parameters/NodeFilter"}],"responses":{"200":{"description":"Time series.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TrafficByReqStatusDataPoint"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/traffic-by-node":{"get":{"tags":["Analytics"],"operationId":"analyticsTrafficByNode","summary":"Traffic by edge node","description":"Requests and egress bytes per edge node that served the domain, with\nthe cache split of those bytes and each node's display label and country.\nRequires `analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/NodeFilter"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Per-node totals.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TrafficByNodeStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/origins":{"get":{"tags":["Analytics"],"operationId":"analyticsOrigins","summary":"Edge-to-origin request statistics","description":"How each of your origin addresses is performing as seen from the edge —\nrequest counts, failures, server errors and upstream latency — with the\nper-node split that produced them.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/NodeFilter"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Per-origin statistics.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OriginStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/user-agents":{"get":{"tags":["Analytics"],"operationId":"analyticsUserAgents","summary":"Traffic by user-agent category","description":"Requests grouped into user-agent categories: `Search Engine Bots`,\n`AI/LLM Crawlers`, `Mobile Devices`, `Desktop Browsers`, and\n`Scripted Agents` for everything else. The first matching category wins,\nso a mobile Googlebot counts as a search engine bot. Requires\n`analytics.view` and a plan with `monitoring`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"$ref":"#/components/parameters/HostnameFilter"},{"$ref":"#/components/parameters/PathFilter"}],"responses":{"200":{"description":"Per-category request counts.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/UserAgentCategoryStats"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/gateways":{"get":{"tags":["Analytics"],"operationId":"analyticsGateways","summary":"Requests per gateway","description":"Request counts for each gateway currently switched on for the domain,\nwith a zero-filled series over the period — one point per bucket whether\nor not traffic landed in it.\n\nWhich hostnames count as gateways is resolved server-side from the\ndomain's records, so a gateway switched off drops out of this response\nalong with its history.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"One entry per enabled gateway. Empty when none are on.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GatewayStat"}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/logs":{"get":{"tags":["Analytics"],"operationId":"analyticsLogs","summary":"Raw request logs","description":"Individual request records, newest first unless `sort` says otherwise,\nwith every filter applied as an AND. Requires `analytics.view` and a\nplan including the `logs` feature.\n\n`from`/`to` narrow the rows to an exact window inside `period` (a\nchart bucket, say); `period` still sets the query's time budget. The\nlist and its total are computed separately: `has_more` says whether\nanother page exists without needing the total, `count` controls how\nhard the total works, and `fields=list` returns only the columns a list\nrow needs (fetch the rest for one row by `rayId`). Sorting by anything\nbut `time` needs a window of at most 24 hours (7 days on one domain).\n\nHeader and body fields are retained for a shorter window than the rest\nof the row, so older entries return them empty.\n\nWhen your origin answers with a 5xx, the body it sent is kept exactly\nand returned as `origin_error_body` for 3 days. A page of rows carries\nthe first 2 KB of each body; ask for the request by `rayId` to get all\nof it. `origin_error_body_state` says whether the body is whole, cut,\nempty or already deleted.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"name":"limit","in":"query","description":"Rows per page, 1–500. Values outside the range fall back to 100.","schema":{"type":"integer","default":100,"minimum":1,"maximum":500}},{"name":"offset","in":"query","schema":{"type":"integer","default":0,"minimum":0}},{"name":"status","in":"query","description":"Exact HTTP status code.","schema":{"type":"string"}},{"name":"method","in":"query","description":"HTTP method — case-insensitive.","schema":{"type":"string"}},{"name":"uri","in":"query","description":"URI substring match.","schema":{"type":"string"}},{"name":"cache","in":"query","description":"Cache status: `hit`, `miss` or `bypass`.","schema":{"type":"string","enum":["hit","miss","bypass"]}},{"name":"reqStatus","in":"query","description":"Serving path: `cache`, `proxied` or `direct`.","schema":{"type":"string","enum":["cache","proxied","direct"]}},{"name":"rayId","in":"query","description":"Exact ray id of a single request. A query with `rayId` is the one that returns the whole `origin_error_body`.","schema":{"type":"string"}},{"name":"hostname","in":"query","description":"Exact host, a subdomain of it, or a bare subdomain label.","schema":{"type":"string"}},{"name":"originHost","in":"query","description":"Host header sent to the origin.","schema":{"type":"string"}},{"name":"originSni","in":"query","description":"SNI presented to the origin.","schema":{"type":"string"}},{"name":"originAddr","in":"query","description":"Origin address the edge connected to.","schema":{"type":"string"}},{"name":"originAddrs","in":"query","description":"Comma-separated list of origin addresses.","schema":{"type":"string"}},{"name":"remoteAddr","in":"query","description":"Client IP address.","schema":{"type":"string"}},{"name":"country","in":"query","description":"Client ISO country code.","schema":{"type":"string"}},{"name":"nodeCountry","in":"query","description":"ISO country of the edge node that served the request.","schema":{"type":"string"}},{"name":"node","in":"query","description":"Edge node name.","schema":{"type":"string"}},{"name":"threat","in":"query","description":"Threat category.","schema":{"type":"string"}},{"name":"detectAction","in":"query","description":"Action a detection rule took on the request.","schema":{"type":"string"}},{"name":"botKind","in":"query","description":"Classified bot kind.","schema":{"type":"string"}},{"name":"wafRuleId","in":"query","description":"A CRS rule id that fired.","schema":{"type":"string"}},{"name":"headerSearch","in":"query","description":"Substring searched across the captured headers.","schema":{"type":"string"}},{"name":"uriPatterns","in":"query","description":"Comma-separated URI patterns.","schema":{"type":"string"}},{"name":"from","in":"query","description":"Start of an exact window inside `period`: RFC 3339, unix seconds, or\n`YYYY-MM-DD HH:MM:SS` read as Asia/Tehran time.\n","schema":{"type":"string"}},{"name":"to","in":"query","description":"End of the window, in the same forms as `from`.","schema":{"type":"string"}},{"name":"sort","in":"query","description":"Column to order by, optionally with the direction as `key:dir`.\nDefault `time:desc`. Anything else is a `400`.\n","schema":{"type":"string","enum":["time","status","latency","out","in","originStatus","host","path","method","ip","cc","node","cache","proto","ja4","ja4h"]}},{"name":"dir","in":"query","description":"Sort direction.","schema":{"type":"string","enum":["asc","desc"]}},{"name":"count","in":"query","description":"`exact` (default) counts every matching row; `capped` stops at\n10 000 (`total_state: capped` then means \"10 000 or more\"); `0`\nskips the count (`total_state: skipped`) — use it for page 2 and on.\n","schema":{"type":"string","enum":["exact","capped","0"]}},{"name":"fields","in":"query","description":"`list` returns only the columns a list row shows.","schema":{"type":"string","enum":["list"]}},{"name":"errReason","in":"query","description":"Failure reason, e.g. `origin_timeout` (the `reason` keys of `/analytics/unreachable-reasons`).","schema":{"type":"string"}},{"name":"errFault","in":"query","description":"Who was responsible for a failure.","schema":{"type":"string","enum":["origin","nsin","network","client","config"]}},{"name":"errLeg","in":"query","description":"Which hop failed (see `err_leg` on the log entry).","schema":{"type":"string"}},{"name":"edgeAddr","in":"query","description":"The NSIN edge address that received the request. Exact match.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of request logs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogsResponse"}}}},"400":{"description":"The `domain` query parameter is missing, `sort`/`dir` is not a known\nvalue, or the sort needs a shorter window.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/security/actions":{"get":{"tags":["Analytics"],"operationId":"securityActions","summary":"Security actions by family","description":"Every request an edge rule acted on, per hour and action family\n(custom, rate, uam, drop, fingerprint, waf, captcha, ddos, other), split\ninto enforced and dry run, plus totals per action. Hourly UTC buckets.\n`available` is false (with empty lists) until the platform's security\nrollups are in place.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"name":"family","in":"query","description":"Only this action family.","schema":{"type":"string","enum":["custom","rate","uam","drop","fingerprint","waf","captcha","ddos","other"]}}],"responses":{"200":{"description":"The figures.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityActions"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/security/top-rules":{"get":{"tags":["Analytics"],"operationId":"securityTopRules","summary":"Busiest rules","description":"The 20 rules that acted most in the period, with name, type, action and\nthe enforced / dry-run split.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"name":"family","in":"query","description":"Only this action family.","schema":{"type":"string","enum":["custom","rate","uam","drop","fingerprint","waf","captcha","ddos","other"]}}],"responses":{"200":{"description":"The figures.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityTopRules"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/security/rate-keys":{"get":{"tags":["Analytics"],"operationId":"securityRateKeys","summary":"Tripped rate-limit keys","description":"The 20 rate-limit keys (`rl_key`, e.g. `ja4h=…|path=/ajax.php`) that\ntripped most. Read from request logs; the period is capped at 24h.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"The figures.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityRateKeys"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/security/uam":{"get":{"tags":["Analytics"],"operationId":"securityUnderAttack","summary":"Under Attack Mode challenged vs cleared","description":"Per hour: visitors shown the Under Attack Mode check (`challenged`) and\nrequests let through with a solved check (`cleared`).\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"The figures.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityUnderAttack"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/security/bot-scores":{"get":{"tags":["Analytics"],"operationId":"securityBotScores","summary":"Bot score distribution","description":"Requests per bot score bucket (bucket 0 = scores 1–9, … 9 = 90–99; 1 =\nbot, 99 = human-like), how many scored under 30 (`low`, `low_share`),\nand the JA4H fingerprints and networks most common under 30 (last 24h at\nmost).\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"}],"responses":{"200":{"description":"The figures.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityBotScores"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/security/attacks":{"get":{"tags":["Analytics"],"operationId":"securityAttacks","summary":"Attacks with rule hits","description":"The 50 newest attacks on the domain, each with how often its rule\nacted (`rule_hits`, enforced and dry run).\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"The figures.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityAttacks"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"},"504":{"$ref":"#/components/responses/AnalyticsTimeout"}}}},"/analytics/security/behaviour":{"get":{"tags":["Analytics"],"operationId":"securityBehaviour","summary":"How the traffic behaves over time","description":"Share of asset requests, of requests with cookies and of low bot\nscores over the last 24 hours (15-minute steps) or 7 days (hourly).\nA sudden change here is what behaviour detection reacts to.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"range","in":"query","schema":{"type":"string","enum":["24h","7d"],"default":"24h"}}],"responses":{"200":{"description":"The series.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BehaviourSeries"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/waf-logs":{"get":{"tags":["Analytics"],"operationId":"analyticsWafLogs","summary":"WAF event logs","description":"Requests the WAF evaluated, with the rules that fired and the score they\nproduced. Entries where `dryRun` is true were logged only — the request\nwas not actually blocked.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"$ref":"#/components/parameters/Period"},{"name":"limit","in":"query","schema":{"type":"integer","default":100}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"hostname","in":"query","description":"Substring match on hostname.","schema":{"type":"string"}},{"name":"action","in":"query","description":"The action taken.","schema":{"type":"string"}},{"name":"ruleId","in":"query","description":"A CRS rule id that fired.","schema":{"type":"string"}},{"name":"clientIp","in":"query","schema":{"type":"string"}},{"name":"country","in":"query","schema":{"type":"string"}},{"name":"rayId","in":"query","schema":{"type":"string"}},{"name":"blocked","in":"query","description":"Restrict to blocked or non-blocked requests.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"A page of WAF events.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WafLogEntry"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/PlanRequired"},"403":{"$ref":"#/components/responses/AnalyticsPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/analytics/markdown-tester":{"get":{"tags":["Analytics"],"operationId":"analyticsMarkdownTester","summary":"Preview Markdown-for-Agents conversion","description":"Fetches one page twice — once normally and once with\n`Accept: text/markdown` — and returns both responses so you can compare\nthem. Ownership is checked but there is no plan gate: you may preview\nthe conversion before enabling `markdown_for_agents` on the domain.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"hostname","in":"query","description":"Which hostname to fetch. Defaults to the domain apex.","schema":{"type":"string"}},{"name":"path","in":"query","description":"Path to fetch.","schema":{"type":"string","default":"/"}}],"responses":{"200":{"description":"Both fetches, side by side.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkdownTesterResult"}}}},"400":{"description":"Missing `domain`, or an invalid hostname or path.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/analytics/query":{"post":{"tags":["Analytics"],"operationId":"analyticsQuery","summary":"Run a custom query over your request logs","description":"Runs a read-only SQL `SELECT` against the `requests` table — your raw\nrequest log — for analyses the dedicated endpoints do not cover.\n\n**Scoping is enforced by the database engine**, not by your query: a\nfilter restricting rows to the domains this key can access is appended\nto every read of `requests`. You cannot read another account's traffic,\nhowever the query is written.\n\nRestrictions:\n\n* A single statement only, starting with `SELECT` or `WITH`.\n* Only the `requests` table may be read. Common table expressions you\n  define yourself are fine; other tables and any `db.table` reference\n  are rejected.\n* Writes, DDL and settings changes are rejected.\n* Execution is capped at 30 seconds and 10 000 returned rows —\n  `truncated` tells you when the cap was hit.\n\nUseful `requests` columns: `event_time`, `domain_id`, `hostname`,\n`method`, `uri`, `status`, `bytesIn`, `bytesOut`, `duration` (ms),\n`remoteAddr`, `country`, `asn`, `asnOrg`, `userAgent`, `cacheStatus`,\n`reqStatus`, `isWS`, `protocol`, `referer`, `originStatus`,\n`originAddr`, `error`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sql"],"properties":{"sql":{"type":"string","description":"The query to run.","examples":["SELECT toStartOfHour(event_time) AS h, count() AS c FROM requests WHERE status >= 500 GROUP BY h ORDER BY h"]}}}}}},"responses":{"200":{"description":"Query result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsQueryResult"}}}},"400":{"description":"The query was rejected by validation, or the database refused it.\n`detail` carries the underlying message when the engine rejected it.\n","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"detail":{"type":"string"}}},"examples":{"disallowedTable":{"value":{"error":"querying \"system.parts\" is not allowed; only the 'requests' table may be read"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The account has no domains whose logs could be queried. (Read-only\nkeys *may* call this endpoint: it is the one `POST` they are\nallowed, because it writes nothing.)\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"noDomains":{"value":{"error":"you have no domains to query"}}}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/AnalyticsUnavailable"}}}},"/uptime":{"get":{"tags":["Uptime"],"operationId":"listOutageIncidents","summary":"List outage incidents","description":"The domain's sustained origin-outage incidents, most recent first. An\nincident opens when a watched scope's origin-error rate stays above the\ndomain's threshold for the whole detection window, and resolves after\n`recover_min` clear minutes.\n\nIncidents come from two sources: the domain's default whole-host watch,\nand each uptime monitor. Read `monitor_id` / `scope_label` to tell them\napart.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"limit","in":"query","required":false,"description":"How many incidents to return, 1-200. Out-of-range values fall back to the default.","schema":{"type":"integer","default":50,"minimum":1,"maximum":200}}],"responses":{"200":{"description":"Incident history.","content":{"application/json":{"schema":{"type":"object","properties":{"incidents":{"type":"array","items":{"$ref":"#/components/schemas/OutageIncident"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/active":{"get":{"tags":["Uptime"],"operationId":"getActiveOutages","summary":"Outage incidents open right now","description":"A one-glance answer to \"is anything down?\" — the incidents currently\nopen for this domain. Cheaper than `/uptime/live` (it reads only the\nincident records, no traffic aggregation), so it is the endpoint to poll\nfor a status indicator.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"Active outages.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeActive"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/live":{"get":{"tags":["Uptime"],"operationId":"getUptimeLive","summary":"Current origin-error status per subdomain","description":"What is happening right now, per watched scope, over the domain's\ndetection window — including hosts that are erroring but have not (yet)\ncrossed the alert thresholds. Distinct from `/uptime`, which lists only\nsustained outages.\n\nOne hostname may appear on several rows: the whole-host watch\n(`monitor_id: 0`) plus one row per uptime monitor that matches it, each\nmeasured over its own traffic. Key on (`hostname`, `monitor_id`).\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"Live status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeLive"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/settings":{"get":{"tags":["Uptime"],"operationId":"getUptimeSettings","summary":"Get outage-detection settings","description":"The domain's outage-detection settings: the thresholds, with the valid\nrange for each in `bounds`; the subdomain scope of the default\nwhole-host watch (`uptime_host_*`); and the alert channels' master\nswitches (`notify_email`, `notify_sms`, `notify_webhook`) with\n`webhook_configured`. The switches gate every recipient at once — the\nowner and each member — on top of each person's own notification\npreferences. The webhook URL and secret are not included here; read\nthem with `GET /uptime/webhook`. Requires `analytics.view`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"Current settings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeSettings"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Uptime"],"operationId":"updateUptimeSettings","summary":"Update outage-detection settings","description":"Partial update — omitted fields keep their current value. Values are\nclamped to the ranges reported in `bounds`. Requires `domain.settings`\n(not analytics read access: retuning detection is a settings change).\n\nNarrowing `uptime_host_includes` / `uptime_host_excludes` can strand an\nopen incident on a subdomain that is no longer watched. The detector\ncloses it on its next tick, without a recovery notification.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeSettingsUpdate"}}}},"responses":{"200":{"description":"Updated settings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeSettings"}}}},"400":{"description":"The `domain` query parameter is missing, the body is malformed, a\nthreshold is out of range, or the host scope is invalid — a match\ntype other than `exact`/`wildcard`/`regex` while a host filter is\nset, too many entries, an over-long entry, or a regex that does not\ncompile.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"badMatchType":{"value":{"error":"uptime_host_match_type must be 'exact', 'wildcard', or 'regex' when a host filter is set"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/monitors":{"parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"get":{"tags":["Uptime"],"operationId":"listUptimeMonitors","summary":"List the domain's uptime monitors","description":"A monitor narrows outage detection to a host+path scope you name, using\nthe same thresholds as the whole-host watch. Without one, a failing\n`/checkout` is diluted by every healthy marketing request and never\ncrosses the domain-wide threshold.\n","responses":{"200":{"description":"The domain's monitors, oldest first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeMonitorList"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Uptime"],"operationId":"createUptimeMonitor","summary":"Create an uptime monitor","description":"Requires `domain.settings`. A monitor must narrow something — a monitor\nwith neither a host scope nor a path scope is just a duplicate of the\nwhole-host watch and is rejected. At most `max` monitors per domain\n(see the list endpoint); the cap is a detection-cost ceiling, not a plan\nlimit.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeMonitorBody"}}}},"responses":{"201":{"description":"The created monitor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeMonitor"}}}},"400":{"$ref":"#/components/responses/UptimeMonitorInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/monitors/{id}":{"parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"put":{"tags":["Uptime"],"operationId":"updateUptimeMonitor","summary":"Update an uptime monitor","description":"Partial update — omitted fields keep their current value, and an\nexplicit empty array clears a list. Requires `domain.settings`.\n\nDisabling a monitor here closes its open incident silently: you turned\nthe watch off, so no recovery notification is sent.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeMonitorBody"}}}},"responses":{"200":{"description":"The updated monitor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeMonitor"}}}},"400":{"$ref":"#/components/responses/UptimeMonitorInvalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/UptimeMonitorNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Uptime"],"operationId":"deleteUptimeMonitor","summary":"Delete an uptime monitor","description":"Requires `domain.settings`. The monitor's open incident is resolved\nwithout a recovery notification; its resolved incident history is kept,\nbecause it is the record behind alerts you may still be reading.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"400":{"description":"Invalid monitor id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/UptimeMonitorNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/monitors/{id}/enabled":{"parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"patch":{"tags":["Uptime"],"operationId":"setUptimeMonitorEnabled","summary":"Enable or disable an uptime monitor","description":"The cheap toggle behind a monitor list's switch — it changes nothing\nelse. Requires `domain.settings`. Disabling closes the monitor's open\nincident silently, with no recovery notification.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"The updated monitor.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeMonitor"}}}},"400":{"description":"Invalid monitor id, or an invalid body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/UptimeMonitorNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/webhook":{"get":{"tags":["Uptime"],"operationId":"getUptimeWebhook","summary":"Get the uptime webhook","description":"The webhook URL and its signing secret. Requires `domain.settings`. The\nURL and the on/off switch are changed with `PUT /uptime/settings`\n(`webhook_url`, `notify_webhook`). See `UptimeWebhookEvent` for what is\nsent.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"The webhook.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeWebhook"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/webhook/test":{"post":{"tags":["Uptime"],"operationId":"testUptimeWebhook","summary":"Send a test event to the uptime webhook","description":"POSTs one `test` event to the saved URL — a single attempt, no retries —\nand returns what happened. Works while the webhook is switched off.\nLimited to one test every 10 seconds per domain. Requires\n`domain.settings`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"The delivery. `ok` is `false` when the endpoint did not answer 2xx.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeWebhookDelivery"}}}},"400":{"description":"The `domain` query parameter is missing, or no webhook URL is saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/webhook/rotate-secret":{"post":{"tags":["Uptime"],"operationId":"rotateUptimeWebhookSecret","summary":"Generate a new webhook signing secret","description":"Replaces the domain's webhook signing secret with a new random\n`whsec_…` value and returns it. Deliveries are signed with the new\nsecret from the next one on, so the old secret stops verifying at once\n— update your receiver first. Requires `domain.settings`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"The webhook, with its new secret.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeWebhook"}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/uptime/webhook/deliveries":{"get":{"tags":["Uptime"],"operationId":"listUptimeWebhookDeliveries","summary":"List recent webhook deliveries","description":"The domain's last 50 webhook deliveries, newest first — incident events\nand tests alike — with the HTTP status your endpoint answered, how many\nattempts it took, how long it took and the error, if any. Older\ndeliveries are pruned. Requires `domain.settings`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"Recent deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/UptimeWebhookDelivery"}}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/recommendations":{"get":{"tags":["Recommendations"],"operationId":"listRecommendations","summary":"Get the domain's advisory checklist","description":"Per-domain advice derived from analytics, configuration and live probes.\nItems with `status: ok` are passing checks; `warn` items suggest an\naction. Dismissed items are still returned, flagged `dismissed: true`.\n\nWhether an item can be hidden depends on its severity, and `dismissible`\nsays so per item: `low` hides permanently, `medium` for 7 days (after\nwhich it returns if the problem is still there), and `high` cannot be\nhidden at all.\n\nThe checks that read traffic are computed in the background and\ncached. When they are not ready within about 12 seconds the answer\ncarries the configuration checks only, with `computing: true` — ask\nagain a few seconds later. `scope=records` returns only the DNS-record\nchecks (no apex or `www` record, an empty zone, …), which are always\ncomputed fresh and never wait. Requires `domain.view`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"},{"name":"scope","in":"query","description":"`records` returns only the DNS-record checks.","schema":{"type":"string","enum":["records"]}}],"responses":{"200":{"description":"Checklist items.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Recommendation"}},"computing":{"type":"boolean","description":"Present (`true`) while the traffic checks are still being\ncomputed; they are missing from `data`. Ask again shortly.\n"},"incomplete":{"type":"boolean","description":"Present (`true`) when a traffic query failed: the checks\nit feeds are missing until the next attempt.\n"}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/recommendations/overview":{"get":{"tags":["Recommendations"],"operationId":"overviewRecommendations","summary":"Outstanding recommendations across every domain","description":"The account-wide checklist: one entry per domain you can see that has at\nleast one outstanding item (`warn`, not dismissed by you). Domains with\nnothing outstanding are omitted — `summary.domains` still counts them.\n\nThis endpoint never computes a checklist while you wait. It reads the\nper-domain cache the other endpoints fill and, for domains with nothing\ncached yet, starts a few background computes per call and reports them\nin `pending`; poll while `computing` is `true` and the list fills in.\nThe assembled answer is then cached per caller for 5 minutes, so one\nrequest covers the whole account however many domains it has.\n","responses":{"200":{"description":"Outstanding items per domain.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"domain_id":{"type":"integer"},"domain":{"type":"string"},"items":{"type":"array","description":"Outstanding items only, worst severity first.","items":{"$ref":"#/components/schemas/Recommendation"}},"passing":{"type":"integer","description":"Checks that passed (or were dismissed) on this domain."},"checked_at":{"type":"string","format":"date-time","description":"When this domain's checklist was last computed."}}}},"summary":{"type":"object","properties":{"domains":{"type":"integer","description":"Domains looked at."},"affected":{"type":"integer","description":"Domains with at least one outstanding item."},"issues":{"type":"integer"},"high":{"type":"integer"},"medium":{"type":"integer"},"low":{"type":"integer"}}},"pending":{"type":"integer","description":"Domains whose checklist has not been computed yet."},"computing":{"type":"boolean","description":"True while `pending` is above zero. The list is incomplete:\nthe domains still being checked may hold items that are not\nin `data` yet, so this is \"still looking\", not \"all clear\".\n"},"generated_at":{"type":"string","format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/recommendations/count":{"get":{"tags":["Recommendations"],"operationId":"countRecommendations","summary":"Count outstanding recommendations","description":"How many of the domain's checklist items need action for you: `warn`\nitems you have not dismissed. Cheap enough to poll — it only reads the\ncached checklist. Requires `domain.view`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"Outstanding count.","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"computing":{"type":"boolean","description":"Present (and `true`) only when the checklist for this\ndomain has not been computed yet: the server has started\ncomputing it in the background and `count` is `0` for\nnow. Poll again; the field disappears once the checklist\nexists. This endpoint never computes the checklist\nitself — it is polled by the panel's sidebar badge from\nevery page — so its answer is always immediate.\n"}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/recommendations/fix":{"post":{"tags":["Recommendations"],"operationId":"applyRecommendationFix","summary":"Apply a one-click fix","description":"Runs the fix a recommendation offers in `action.apply` (or `alt.apply`).\nThe server re-reads the problem first: if it is gone the answer is\n`already_done`, and if the item no longer offers this fix the answer is\n`409` with the fresh list. Otherwise it applies the change through the\nsame code as the feature's own endpoint, tells the edges, checks that\nthe change took effect, and returns the domain's new checklist.\n\nFixes: `attack_enforce`, `attack_ignore`, `under_attack_on` (6-hour\ntimer), `under_attack_off`, `auto_attack_rules_on`/`_off`,\n`auto_under_attack_on`/`_off`, `waf_restore`, `waf_enable`,\n`waf_enforce`, `waf_dry_run`, `login_rate_limit` (a per-IP limit of 10\nPOSTs a minute on wp-login.php and xmlrpc.php, answered with a check),\n`login_rate_limit_off` (send the `rule_id` from the fix's `undo`; a rule\nedited since is left alone). The `_off` and `waf_dry_run` fixes are\nundos and need no recommendation.\n\nNeeds the permission of the change itself: `rules.edit` for attack and\nWAF fixes, `domain.settings` for the switches.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["apply"],"properties":{"apply":{"type":"string","description":"The fix name from the recommendation's action."},"rule_id":{"type":"integer","description":"Only for login_rate_limit_off: the rule id from the fix's undo."}}},"example":{"apply":"waf_enforce"}}}},"responses":{"200":{"description":"Applied, or already done.","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"string","enum":["applied","already_done"]},"message":{"type":"string"},"undo":{"type":"object","description":"Present when the change can be undone in one call.","properties":{"apply":{"type":"string"},"label":{"type":"string"},"rule_id":{"type":"integer","description":"Send back with the undo (login_rate_limit_off)."}}},"data":{"type":"array","description":"The domain's checklist after the change.","items":{"type":"object"}}}}}}},"400":{"description":"Missing `domain` or `apply`, or an unknown fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Missing permission, or the plan does not include it (`upgrade_required`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The item no longer offers this fix (the attack ended, someone else fixed it). `data` is the fresh list.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"The fix failed or did not take effect.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/recommendations/dismiss":{"post":{"tags":["Recommendations"],"operationId":"dismissRecommendation","summary":"Dismiss a recommendation","description":"Hides one checklist item for the calling user on this domain. Dismissals\nare per user, not per domain — they do not affect other members.\n\nHow long it stays hidden depends on the item's severity: a `low` item is\nhidden for good, a `medium` one for 7 days, and a `high` one cannot be\nhidden at all (`409`). Repeating the call on a `medium` item restarts\nits 7 days. Requires `domain.view` — dismissing only changes what you\nsee.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key"],"properties":{"key":{"type":"string","description":"The recommendation's `key`."}}}}}},"responses":{"200":{"description":"Dismissed.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"400":{"description":"Missing `domain`, or missing `key` in the body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The item is a `high`-severity warning, which cannot be dismissed.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Recommendations"],"operationId":"undismissRecommendation","summary":"Restore a dismissed recommendation","description":"Undoes your dismissal of one checklist item on this domain, so it shows\nagain if it still applies. Restoring an item that was never dismissed\nis not an error. Only your own dismissal is affected. Requires\n`domain.view`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key"],"properties":{"key":{"type":"string"}}}}}},"responses":{"200":{"description":"Restored.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"400":{"description":"Missing `domain`, or missing `key` in the body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/cache/stats/":{"get":{"tags":["Cache"],"operationId":"getCacheStats","summary":"Cached entry count and size for a domain","description":"The domain's live cache footprint, as reported by every storage node\nand summed, with the per-node breakdown. Results are cached briefly, so\na purge can take a few seconds to show up here. When a node does not\nanswer (or none is configured) the figures are a floor and `partial` is\n`true` — \"0 bytes\" then does not mean an empty cache. Requires\n`domain.view`.\n","parameters":[{"$ref":"#/components/parameters/DomainQuery"}],"responses":{"200":{"description":"Cache footprint.","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"integer","description":"Cached objects across all nodes."},"size_bytes":{"type":"integer","description":"Their total size in bytes."},"nodes":{"type":"array","description":"Per-node figures; the totals are their sum. Absent when there is nothing to break down.","items":{"$ref":"#/components/schemas/CacheNodeTotal"}},"partial":{"type":"boolean","description":"Present (`true`) when a storage node did not answer, so the totals are a lower bound."}}}}}},"400":{"$ref":"#/components/responses/DomainQueryRequired"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/cache/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"delete":{"tags":["Cache"],"operationId":"purgeDomainCache","summary":"Purge the entire cache for a domain","description":"Removes every cached entry for the domain, on every storage node.\n\nThe sweep runs in the background: a `202` means it was queued and\n`deleted` is not yet known. It is only accepted when every storage\nnode can be reached — otherwise nothing is purged and the answer is\n`503` naming what is unreachable, so a region never keeps serving a\ncopy you were told was gone. Requires `cache.edit` and a plan including\ncache purge.\n","responses":{"200":{"description":"Nothing to purge — the domain has no cached hostnames.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurgeResult"}}}},"202":{"description":"Purge queued; it runs in the background.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurgeResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, your role on the domain lacks `cache.edit`, or cache purge is not on the domain's plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"description":"Part of the cache storage fleet cannot be reached. Nothing was\npurged; `unreached` says what and why. Try again shortly.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurgeResult"}}}}}}},"/domains/{domain}/cache/keys":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Cache"],"operationId":"listCacheKeys","summary":"Browse cached entries","description":"A page of the domain's individual cached objects.\n\nNote the two host/path pairs on each row: `host` and `path` are the\nhuman-readable request URL, while `hostname` (the storage namespace) and\n`store_path` are the stored identity you must echo back when purging a\nspecific row. The listing is a registry of what was written, so it can\nlag the storage by a little. Requires `domain.view`.\n","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":100,"minimum":1,"maximum":500}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"count","in":"query","description":"`0` skips computing `total` (a second pass over the domain's\nentries) — use it when paging with `offset` and you already know\nthe total. The response then carries `count_skipped: true`.\n","schema":{"type":"string","enum":["0"]}},{"name":"sort","in":"query","description":"Sort column. Anything else falls back to `cached_at`.","schema":{"type":"string","enum":["size","host","hostname","path","expires_at","cached_at"]}},{"name":"dir","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"hostname","in":"query","description":"Exact match on the storage namespace host.","schema":{"type":"string"}},{"name":"host","in":"query","description":"Match on the request host — substring, or a `*` wildcard.","schema":{"type":"string"}},{"name":"node","in":"query","description":"Edge node that cached the entry. Case-sensitive as stored.","schema":{"type":"string"}},{"name":"path","in":"query","description":"Match on the request path — substring, or a `*` wildcard.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of cached entries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheKeysPage"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/CacheRegistryUnavailable"}}}},"/domains/{domain}/cache/keys/summary":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Cache"],"operationId":"getCacheKeysSummary","summary":"Cache totals with per-node breakdown","description":"Entry count and byte size for the whole domain, broken down by the edge\nnode that cached each entry. It takes no filters — it always covers\nthe whole domain. Computed at most once a minute per domain (a purge\nrefreshes it at once). Requires `domain.view`.\n","responses":{"200":{"description":"Totals.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheTotals"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/CacheRegistryUnavailable"}}}},"/domains/{domain}/cache/keys/content":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Cache"],"operationId":"getCacheKeyContent","summary":"Download one cached object","description":"The stored bytes behind a listing row, read straight from cache storage —\nyour origin is never contacted, so this works even when the site is down.\n\nAddress the entry by its **stored** identity: copy `hostname`, `node` and\n`key_hash` verbatim from a `/domains/{domain}/cache/keys` row. `node` is\nthe edge location that cached it, so the same URL cached at three\nlocations is three entries and you choose which copy you get.\n\nThe body is returned in its original uncompressed form with the stored\n`Content-Type`, always as an attachment. The cached response's own status\ncode and age travel in `X-Nsin-Cache-Status` and `X-Nsin-Cached-At` — the\nHTTP status describes only whether the read succeeded.\n\nA `404` with `entry is no longer cached` means the listing row outlived\nthe object (it expired, was evicted, or was purged). Requires\n`domain.view`.\n","parameters":[{"name":"hostname","in":"query","required":true,"description":"The row's `hostname` — the storage namespace, not the request host.","schema":{"type":"string"}},{"name":"node","in":"query","required":true,"description":"The row's `node` — the edge location holding this copy. Case-sensitive.","schema":{"type":"string"}},{"name":"key_hash","in":"query","required":true,"description":"The row's `key_hash`.","schema":{"type":"string"}}],"responses":{"200":{"description":"The stored object. `Content-Type` is whatever was cached; the payload\nis the uncompressed body.\n","headers":{"X-Nsin-Cache-Node":{"description":"Edge location this copy came from.","schema":{"type":"string"}},"X-Nsin-Cache-Status":{"description":"HTTP status of the cached response.","schema":{"type":"integer"}},"X-Nsin-Cached-At":{"description":"When the object was cached (RFC 3339).","schema":{"type":"string","format":"date-time"}}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Missing or malformed `hostname`, `node` or `key_hash`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Domain or hostname not yours, or the entry is no longer cached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"The stored entry could not be decoded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Cache storage is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/cache/keys/purge":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Cache"],"operationId":"purgeCacheKeys","summary":"Purge or refresh selected cached entries","description":"Targets specific entries — either by listing them in `entries`, or by\nmatching a `filter`. Supply one or the other.\n\n* `mode: \"delete\"` (default) removes the entry and drops it from the\n  listing.\n* `mode: \"refresh\"` only evicts the stored copy, so the next visitor\n  re-fills it. The row stays and updates itself.\n\n`entries` must carry each row's **stored** identity — copy `hostname`,\n`store_path`, `key_hash` and `node` straight from the listing (note the\nrequest body uses camelCase for these). Entries belonging to another\ndomain are rejected.\n\n`truncated` is `true` when a filter matched more entries than one call\nmay touch — repeat the call until it is `false`. When a storage node\nthat may hold the entries does not confirm, the answer is `502` with\n`complete: false` and `unreached` — the purge did not fully happen.\nRequires `cache.edit` and a plan including cache purge.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachePurgeKeysRequest"}}}},"responses":{"200":{"description":"Purge result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachePurgeKeysResult"}}}},"400":{"description":"Malformed body, or neither `entries` nor `filter` supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"The domain has no active plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Read-only key, your role on the domain lacks `cache.edit`, or cache purge is not on the domain's plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is disabled or banned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"A storage node that may hold the entries did not confirm. `unreached` says which and why; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachePurgeKeysResult"}}}},"503":{"$ref":"#/components/responses/CacheRegistryUnavailable"}}}},"/domains/{domain}/members":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Sharing"],"operationId":"listDomainMembers","summary":"List domain members","description":"Everyone with access to the domain — the owner first, then each member —\nwith their role and effective notification matrix, plus your own role\nand whether you may manage membership (`can_edit`). The owner always\nreceives every notification and has no preferences to change. Requires\n`domain.view`.\n","responses":{"200":{"description":"Members.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberList"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/members/notify-catalog":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Sharing"],"operationId":"getMemberNotifyCatalog","summary":"Notification categories, channels and role defaults","description":"The vocabulary behind a member's `notify` matrix: every category, every\noutbound channel, and what each grantable role receives when the member\nhas made no explicit choice. Read it instead of hard-coding those lists,\nso a category added later shows up on its own. Requires `domain.view`.\n\nThe in-app feed is not a channel and cannot be switched off\n(`in_app_always_on` is always `true`): the notification row is both the\nfeed and the de-duplication key, so suppressing it would make the same\nevent re-send on every tick forever.\n","responses":{"200":{"description":"The catalog.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotifyCatalog"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/members/{userId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"userId","in":"path","required":true,"description":"The member's user id, from the member list.","schema":{"type":"integer"}}],"patch":{"tags":["Sharing"],"operationId":"updateDomainMember","summary":"Change a member's role or notifications","description":"Partial update. Changing `role` requires `members.manage`; a member may\nchange their own notification preferences without it.\n\nThe owner's role cannot be changed, and the owner always receives every\nnotification category.\n\nA role change freezes whatever the OLD role was switching on, so a\ndemotion cannot silently mute alerts the member was already receiving.\nCategories they never touched still follow the new role.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberUpdate"}}}},"responses":{"200":{"description":"The membership after the change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberUpdateResult"}}}},"400":{"description":"Invalid user id or body, nothing to update, an invalid role, or an\nattempt to change the owner's role or notifications.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Domain or member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Sharing"],"operationId":"removeDomainMember","summary":"Remove a member","description":"Revokes a member's access to the domain. Removing someone else requires\n`members.manage`; any member may remove themselves (leave the domain)\nwith just `domain.view`. The owner cannot be removed. If the member was\nthe domain's nominated payer, the nomination is cleared at the same time\nand both they and the owner are notified — the owner pays again.\n","responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"400":{"description":"Invalid user id, or an attempt to remove the owner.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Domain or member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/invites":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Sharing"],"operationId":"listDomainInvites","summary":"List pending invitations","description":"Invitations that have not yet been accepted. Invites addressed to\nsomeone who already has access are filtered out. Requires\n`members.manage`.\n","responses":{"200":{"description":"Pending invitations.","content":{"application/json":{"schema":{"type":"object","properties":{"invites":{"type":"array","items":{"$ref":"#/components/schemas/Invite"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Sharing"],"operationId":"createDomainInvite","summary":"Invite someone to the domain","description":"Creates an invitation and emails it.\n\nAn invite is bound to the address it was sent to: forwarding the email\ndoes not let someone else accept it. Requires `members.manage`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteCreate"}}}},"responses":{"200":{"description":"Invitation created, with its accept link.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invite"}}}},"400":{"description":"Invalid body, an invalid role, a missing or malformed email, an\nattempt to invite yourself, or an attempt to invite the domain's\nowner.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"That user is already a member.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/invites/{inviteId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/InviteId"}],"delete":{"tags":["Sharing"],"operationId":"revokeDomainInvite","summary":"Revoke an invitation","description":"Cancels a pending invitation or share link: its link stops working at\nonce. Memberships already created through it are not affected — remove\nthose with `DELETE /domains/{domain}/members/{userId}`. Requires\n`members.manage`.\n","responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Domain or invitation not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/invites/{inviteId}/resend":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/InviteId"}],"post":{"tags":["Sharing"],"operationId":"resendDomainInvite","summary":"Resend an invitation","description":"Refreshes the invitation's expiry and emails it again. Share links\ncannot be resent. Requires `members.manage`.\n","responses":{"200":{"description":"Resent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invite"}}}},"400":{"description":"The invite is a share link, or is no longer active.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Domain or invitation not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invites/{token}":{"parameters":[{"$ref":"#/components/parameters/InviteToken"}],"get":{"tags":["Sharing"],"operationId":"getInvite","summary":"Inspect an invitation","description":"What an invitation grants, for the authenticated caller. Use it before\naccepting to show who invited them and to which domain.\n\n`email_match` reports whether the invitation was addressed to the\ncalling account — `POST /invites/{token}/accept` will refuse when it is\nfalse. When it is false, `invited_email` carries the masked target\naddress.\n\nIf the caller already has access, `already_member` is true and the\nremaining fields describe their existing role.\n","responses":{"200":{"description":"Invitation details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitePreview"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"The invitation does not exist, has expired, was revoked, or is used up.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invites/{token}/accept":{"parameters":[{"$ref":"#/components/parameters/InviteToken"}],"post":{"tags":["Sharing"],"operationId":"acceptInvite","summary":"Accept an invitation","description":"Joins the domain with the role the invitation carries.\n\nThe invitation binds to the address it was sent to, so accepting from a\ndifferent account fails with `403` and `code: \"invite_email_mismatch\"`.\nAccepting when you already have access is a no-op that returns\n`already_member: true`.\n","responses":{"200":{"description":"Accepted, or you already had access.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteAcceptResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Read-only key, or the invitation was sent to a different email\naddress.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteMismatch"}}}},"404":{"description":"The invitation does not exist, has expired, was revoked, or is used up.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/wallet":{"get":{"tags":["Billing"],"operationId":"getWallet","summary":"Get wallet balance","description":"Your wallet balance, in rials. `negative_since` is set while the\nbalance is below zero. If it stays negative past the grace window,\npaid domains are suspended; it clears as soon as the balance is\nnon-negative again.\n\nAlso carries the ids of your newest invoices (not traffic statements),\nso a client can tell when a new one has arrived without loading the\ninvoice list.\n","responses":{"200":{"description":"Wallet.","content":{"application/json":{"schema":{"type":"object","properties":{"wallet":{"$ref":"#/components/schemas/Wallet"},"recent_invoice_ids":{"type":"array","items":{"type":"integer"},"description":"Ids of your 50 newest invoices, excluding traffic statements, newest first."},"latest_invoice_id":{"type":"integer","description":"The first of `recent_invoice_ids`; `0` when you have none."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/wallet/transactions":{"get":{"tags":["Billing"],"operationId":"listWalletTransactions","summary":"List wallet transactions","description":"The wallet ledger, newest first. `amount_rials` is signed: positive is a\ncredit, negative a debit. Traffic charges carry the domain they are\nattributed to.\n","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":50,"minimum":1,"maximum":200}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Ledger rows.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WalletTransaction"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/wallet/transactions/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Billing"],"operationId":"getWalletTransaction","summary":"Get one wallet transaction","description":"The ledger row, plus — for a traffic charge — the per-domain byte and\ncost breakdown of that billing window. A traffic charge is billed once\nper account per window, summed across all your domains, so `by_domain`\nis how you attribute it.\n","responses":{"200":{"description":"Transaction detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletTransactionDetail"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No such transaction on this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/wallet/topup-result":{"get":{"tags":["Billing"],"operationId":"getTopupResult","summary":"Look up a top-up payment result","description":"The outcome of a wallet top-up, by payment gateway authority. Reading is\nallowed; starting a top-up is not available to API keys.\n","parameters":[{"name":"authority","in":"query","required":true,"description":"The payment gateway authority returned when the top-up started.","schema":{"type":"string"}}],"responses":{"200":{"description":"Payment outcome.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"ref_code":{"type":"string"},"amount_rials":{"type":"integer"}}}}}},"400":{"description":"Missing `authority`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No such payment on this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/wallet/period-statement":{"get":{"tags":["Billing"],"operationId":"getWalletPeriodStatement","summary":"Get one subscription's period statement","description":"The period statement of one of your subscriptions, named by\n`subscription_id` or `domain`: the running estimate\n(`is_estimate: true`) while the subscription is active, otherwise its\nlatest closed statement, or `null` when it has neither. For a domain,\nthe subscription in force is used, else the most recent one.\n\nPlans are per domain, so an account has no single billing period:\nwithout `subscription_id` or `domain` the answer is\n`{\"statement\": null}`. List your subscriptions with\n`GET /subscriptions`; closed periods are in\n`GET /wallet/period-statements`.\n","parameters":[{"name":"subscription_id","in":"query","description":"One of your subscriptions (`GET /subscriptions`).","schema":{"type":"integer"}},{"name":"domain","in":"query","description":"A domain name; its subscription in force, else the most recent one you held on it.","schema":{"type":"string"}}],"responses":{"200":{"description":"The statement, or `null`.","content":{"application/json":{"schema":{"type":"object","properties":{"statement":{"oneOf":[{"$ref":"#/components/schemas/PeriodStatement"},{"type":"null"}]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No subscription of yours matches `subscription_id` / `domain`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/wallet/period-statements":{"get":{"tags":["Billing"],"operationId":"listWalletPeriodStatements","summary":"List completed billing-period statements","description":"One statement per closed billing period across all your\nsubscriptions, newest period first: the plan price, traffic by class\nand what the traffic cost, with the per-GB prices in force for that\nperiod. These are statements, not tax invoices\n(`not_a_tax_invoice: true`).\n","parameters":[{"name":"limit","in":"query","description":"How many statements to return, 1–200.","schema":{"type":"integer","default":50,"minimum":1,"maximum":200}},{"name":"subscription_id","in":"query","description":"Only this subscription's statements.","schema":{"type":"integer"}},{"name":"domain","in":"query","description":"Only statements of the subscriptions you have held on this domain.","schema":{"type":"string"}}],"responses":{"200":{"description":"Completed statements, newest first.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PeriodStatement"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/subscriptions":{"get":{"tags":["Billing"],"operationId":"listSubscriptions","summary":"List your subscriptions","description":"Every subscription on your account, across all your domains and\nincluding past ones, newest first, each with its plan and billing\nterm. Overrides NSIN support applied to a subscription appear as\n`override_*` fields.\n","responses":{"200":{"description":"Subscriptions.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/subscriptions/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Billing"],"operationId":"getSubscription","summary":"Get one subscription","description":"One of your subscriptions with its billing-period statement (the\nclosed statement for a finished period) and its invoices.\n","responses":{"200":{"description":"Subscription with its statement and invoices.","content":{"application/json":{"schema":{"type":"object","properties":{"subscription":{"$ref":"#/components/schemas/Subscription"},"period_statement":{"oneOf":[{"$ref":"#/components/schemas/PeriodStatement"},{"type":"null"}]},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No such subscription on this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/subscriptions/current":{"get":{"tags":["Billing"],"operationId":"getCurrentSubscriptionDeprecated","summary":"Current subscription (removed)","deprecated":true,"description":"**Removed.** Subscriptions are per domain. Always returns `410`; use\n`GET /domains/{domain}/subscription` instead.\n","responses":{"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Endpoint removed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","const":"subscription_moved_to_domain"},"message":{"type":"string"}}}}}}}}},"/features":{"get":{"tags":["Billing"],"operationId":"getAccountFeatures","summary":"Plan summary per domain","description":"One row per domain you own (shared domains are not included), with the\nplan it is on, the subscription status and when it expires — a cheap\noverview. For what a domain's plan actually allows use\n`GET /domains/{domain}/features`.\n","responses":{"200":{"description":"Per-domain plan summary.","content":{"application/json":{"schema":{"type":"object","properties":{"domains":{"type":"array","items":{"$ref":"#/components/schemas/DomainPlanSummary"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/traffic-usage":{"get":{"tags":["Billing"],"operationId":"getAccountTrafficUsage","summary":"Traffic usage and pricing across your account","description":"Recent daily traffic rows (up to 90) with totals, plus the current\nper-gigabyte prices.\n\nTraffic is billed in three tiers — `cached` (served from cache),\n`proxied` (fetched through the edge proxy) and `direct` — each priced\nseparately. Older rows may carry only the legacy `bypass_bytes` column;\nthose are folded into the direct total.\n","responses":{"200":{"description":"Usage rows, totals and prices.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountTrafficUsage"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invoices":{"get":{"tags":["Billing"],"operationId":"listInvoices","summary":"List invoices","description":"Your invoices across all your domains — plan purchases, renewals,\ntop-ups and manual invoices — newest first, each with its line items.\nTraffic statements are not included.\n","parameters":[{"name":"limit","in":"query","description":"How many invoices to return, 1–200.","schema":{"type":"integer","default":200,"minimum":1,"maximum":200}},{"name":"offset","in":"query","schema":{"type":"integer","default":0,"minimum":0}}],"responses":{"200":{"description":"Invoices, newest first.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invoices/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Billing"],"operationId":"getInvoice","summary":"Get one invoice","description":"One of your invoices with its line items, the account it is issued to,\nthe payment behind it (for a top-up) and the subscription it belongs\nto. Traffic statements answer `404`.\n","responses":{"200":{"description":"Invoice with its holder, payment and subscription.","content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/Invoice"},"user":{"type":"object","description":"The invoice's holder, as printed on it.","properties":{"id":{"type":"integer"},"email":{"type":"string"},"phone_number":{"type":"string"},"name":{"type":"string"},"address":{"type":"string"},"birth_date":{"type":"string","format":"date"}}},"subscription":{"allOf":[{"$ref":"#/components/schemas/Subscription"}],"description":"The subscription the invoice belongs to, when it has one."},"payment":{"type":"object","description":"The payment behind a top-up invoice.","properties":{"id":{"type":"integer"},"amount_rials":{"type":"integer"},"status":{"type":"string"},"gateway":{"type":"string","description":"Payment gateway, e.g. `zarinpal`."},"authority":{"type":"string","description":"The gateway's payment authority."},"ref_code":{"type":"string","description":"The gateway's reference."},"ref_id":{"type":"string"},"purpose":{"type":"string","example":"wallet_topup"},"description":{"type":"string"},"sandbox":{"type":"boolean"},"paid_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No such invoice on this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/subscription":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Billing"],"operationId":"getDomainSubscription","summary":"Get the domain's current subscription","description":"The domain's current subscription itself, with its entitlements\n(`effective_features`), the current traffic-allowance window and the\ntraffic used in it (`quota_period_used_bytes`). `null` when the domain\nhas no subscription. Readable by every member of the domain, not only\nthose with `billing`. For its statement, invoices and wallet movements\nuse `GET /domains/{domain}/subscriptions/{id}`.\n","responses":{"200":{"description":"Current subscription, or `null`.","content":{"application/json":{"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Subscription"}]}}}},"400":{"description":"Missing domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/subscriptions":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Billing"],"operationId":"listDomainSubscriptions","summary":"List the domain's subscription history","description":"Every subscription the domain has had, newest first, with plan and\nterm. Requires `billing` on the domain, or being its nominated payer;\nanyone else gets `404`.\n","responses":{"200":{"description":"Subscriptions.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/subscriptions/{id}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Billing"],"operationId":"getDomainSubscriptionById","summary":"Get one of the domain's subscriptions","description":"One subscription of the domain with its billing-period statement, its\ninvoices (not traffic statements) and the wallet movements tied to it.\nRequires `billing` on the domain, or being its nominated payer; anyone\nelse gets `404`.\n","responses":{"200":{"description":"Subscription with its statement, invoices and wallet movements.","content":{"application/json":{"schema":{"type":"object","properties":{"subscription":{"$ref":"#/components/schemas/Subscription"},"period_statement":{"oneOf":[{"$ref":"#/components/schemas/PeriodStatement"},{"type":"null"}]},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"transactions":{"type":"array","description":"Wallet movements belonging to this subscription — the\npurchase debit, renewal debits and any refunds of its\ninvoices — newest first. Empty when the term was never\npaid from the wallet.\n","items":{"$ref":"#/components/schemas/WalletTransaction"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Domain or subscription not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/payer":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Billing"],"operationId":"getDomainPayer","summary":"Who pays for this domain, and what they have","description":"The wallet a purchase or a renewal on this domain will actually spend,\nand its balance. The panel shows this on the purchase dialog, and any\nintegration that spends on a shared domain should: the owner's\nnomination of a paying member (made in the panel) takes effect with no\nconsent step, so whoever clicks Buy must see whose money is about to move — and\nan insufficient balance should be visible up front rather than arriving\nas a surprise `402`.\n\nRequires `billing` on the domain, or being the nominated payer yourself.\nSomeone being charged can always see what for, whatever their role.\n","responses":{"200":{"description":"The domain's payer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainPayer"}}}},"400":{"description":"Missing domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/gateway-packs":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Billing"],"operationId":"getDomainGatewayPacks","summary":"Gateway request packs for this domain","description":"The catalog of gateway request packs, whether this domain can use one,\nand its pack balance. A pack adds gateway requests to one domain without\nchanging its plan. Packs never expire. They are used only by requests\nabove the plan's own gateway allowance in a plan period.\n\nBuying a pack moves money, so it is done from the panel. API keys get\n`403` on `POST /domains/{domain}/gateway-packs/purchase`. Readable by\nshared members.\n","responses":{"200":{"description":"Pack catalog and this domain's position.","content":{"application/json":{"schema":{"type":"object","properties":{"packs":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","example":"lite"},"name":{"type":"string","example":"Lite"},"requests":{"type":"integer","example":250000},"price_rials":{"type":"integer","description":"VAT included.","example":10000000},"saving_percent":{"type":"integer","description":"Saving per request against the smallest pack."}}}},"eligible":{"type":"boolean"},"ineligible_reason":{"type":"string","enum":["","no_plan","gateways_not_on_plan","unlimited"]},"plan_requests_cap":{"type":"integer","nullable":true,"description":"The plan's own request allowance per period; null = unlimited."},"requests_used":{"type":"integer","description":"Gateway requests served this plan period."},"pack_period_requests":{"type":"integer","description":"Pack credit this period may draw on; the period's cap is plan_requests_cap plus this."},"pack_requests_left":{"type":"integer","description":"Unspent pack requests. They never expire."},"purchased_requests":{"type":"integer","description":"Every pack ever bought for this domain."},"quota_exceeded":{"type":"boolean"},"purchases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"pack_key":{"type":"string"},"pack_name":{"type":"string"},"requests":{"type":"integer"},"price_rials":{"type":"integer"},"invoice_id":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/features":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Billing"],"operationId":"getDomainFeatures","summary":"Get the domain's effective plan entitlements","description":"What this domain's plan actually allows — the resolved values after any\nper-subscription overrides, so this is the authority on whether a\nfeature is available.\n\nA limit of `null` means unlimited. Use this before calling a gated\nendpoint rather than inferring capability from the plan name. Readable\nby shared members.\n","responses":{"200":{"description":"Effective entitlements.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainFeatures"}}}},"400":{"description":"Missing domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/traffic-usage":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Billing"],"operationId":"getDomainTrafficUsage","summary":"Get the domain's traffic usage","description":"The domain's recent daily traffic rows (up to 90) and current prices,\nand — while it has an active or grace subscription — its traffic\nallowance (`traffic_limit_gb`), the current allowance window, the\ntraffic used and charged in that window, and the window's split by\nhostname. All-time totals are included too. Same three-tier model as\nthe account-wide endpoint. Readable by every member of the domain.\n\nThe hostname split is the one expensive part: `hostnames=0` leaves it\nout, and `view=summary` also skips every allowance-window figure.\nFigures that could not be read are left out rather than sent as zero.\n\n`daily=1` adds `quota_daily`: the allowance window day by day, the\nrunning total against the allowance, and when it ran out or will at\nthe current rate.\n","parameters":[{"name":"view","in":"query","description":"`summary` returns only the daily rows, prices, the allowance, the window bounds and the all-time totals.","schema":{"type":"string","enum":["summary"]}},{"name":"hostnames","in":"query","description":"`0` leaves out `traffic_by_hostname`.","schema":{"type":"string","enum":["0"]}},{"name":"daily","in":"query","description":"`1` adds `quota_daily`. Combines with `hostnames=0`; with `view=summary` it is always null.","schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"Usage rows, window figures and prices.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainTrafficUsageSummary"}}}},"400":{"description":"Missing domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/invoices":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Billing"],"operationId":"listDomainInvoices","summary":"List the domain's invoices","description":"The domain's invoices — whoever paid them — newest first, up to 200,\neach with its line items. Traffic statements are not included.\nRequires `billing` on the domain, or being its nominated payer; anyone\nelse gets `404`.\n","responses":{"200":{"description":"Invoices, newest first.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/invoices/{id}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Billing"],"operationId":"getDomainInvoice","summary":"Get one of the domain's invoices","description":"One invoice of the domain with its line items and the subscription it\nbelongs to; `user` (the holder) is included when the invoice is yours.\nTraffic statements answer `404`. Requires `billing` on the domain, or\nbeing its nominated payer; anyone else gets `404`.\n","responses":{"200":{"description":"Invoice with its subscription.","content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/Invoice"},"user":{"type":"object","description":"The invoice's holder, as printed on it.","properties":{"id":{"type":"integer"},"email":{"type":"string"},"phone_number":{"type":"string"},"name":{"type":"string"},"address":{"type":"string"},"birth_date":{"type":"string","format":"date"}}},"subscription":{"allOf":[{"$ref":"#/components/schemas/Subscription"}],"description":"The subscription the invoice belongs to, when it has one."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Domain or invoice not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/tickets":{"get":{"tags":["Support"],"operationId":"listTickets","summary":"List your support tickets","description":"Your support tickets, most recently updated first, without their messages.\n`is_unread` is `true` on an open ticket whose newest message is a reply\nfrom support you have not read yet.\n","responses":{"200":{"description":"Tickets.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TicketListItem"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Support"],"operationId":"createTicket","summary":"Open a support ticket","description":"Send JSON for a text-only ticket, or `multipart/form-data` to attach\nfiles. See `TicketAttachmentUpload` for what may be attached.\n\nWith `multipart/form-data`, `message` may be empty as long as at least\none file is attached; with JSON it is required.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subject","message"],"properties":{"subject":{"type":"string"},"message":{"type":"string"}}}},"multipart/form-data":{"schema":{"allOf":[{"type":"object","required":["subject"],"properties":{"subject":{"type":"string"},"message":{"type":"string"}}},{"$ref":"#/components/schemas/TicketAttachmentUpload"}]}}}},"responses":{"201":{"description":"The created ticket and its first message.","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"$ref":"#/components/schemas/Ticket"},"first_message":{"$ref":"#/components/schemas/TicketMessage"}}}}}},"400":{"description":"Invalid body, a missing/oversized subject or message, or a rejected\nattachment — wrong type, over its size cap, more than eight files,\nor a file whose contents do not match its extension.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"badType":{"value":{"error":"only JPEG, PNG, GIF, WebP images or .txt/.log/.json files are allowed (images up to 3 MB, text up to 1 MB)"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/tickets/unread-count":{"get":{"tags":["Support"],"operationId":"getTicketUnreadCount","summary":"Count tickets with unread replies","description":"How many of your open tickets have a reply from support you have not\nread — the number `is_unread` flags in the list. `GET /badges` returns it\ntogether with the notification count.\n","responses":{"200":{"description":"Unread count.","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/tickets/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"get":{"tags":["Support"],"operationId":"getTicket","summary":"Get a ticket with its messages","description":"One of your tickets with its whole thread, oldest message first, each\nmessage with its author and attachments. Fetching a ticket marks it read\nfor you, so the unread count drops.\n","responses":{"200":{"description":"The ticket, including its message thread.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ticket"}}}},"400":{"description":"Invalid id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No such ticket on this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/tickets/{id}/messages":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"post":{"tags":["Support"],"operationId":"addTicketMessage","summary":"Reply to a ticket","description":"Send JSON for a text-only reply, or `multipart/form-data` to attach\nfiles. See `TicketAttachmentUpload` for what may be attached.\n\nWith `multipart/form-data`, `message` may be empty as long as at least\none file is attached; with JSON it is required. Replies are only\naccepted while the ticket is open.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}},"multipart/form-data":{"schema":{"allOf":[{"type":"object","properties":{"message":{"type":"string"}}},{"$ref":"#/components/schemas/TicketAttachmentUpload"}]}}}},"responses":{"200":{"description":"The created message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketMessage"}}}},"400":{"description":"Invalid id, invalid body, an empty/oversized message, a closed\nticket, or a rejected attachment — wrong type, over its size cap,\nmore than eight files, or contents that do not match the extension.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"closed":{"value":{"error":"ticket is closed"}},"badType":{"value":{"error":"only JPEG, PNG, GIF, WebP images or .txt/.log/.json files are allowed (images up to 3 MB, text up to 1 MB)"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"description":"No such ticket on this account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/notifications":{"get":{"tags":["Notifications"],"operationId":"listNotifications","summary":"List your notifications","description":"Every event NSIN raised for you — domain lifecycle, uptime, SSL expiry,\nplan and wallet — newest first. Domain events reach the domain owner and\nany member subscribed to that category, so this returns your own copy.\n\n`total` and `unread_count` always describe the whole feed, not the\npage or the filter, so they can drive a tab label or a badge directly.\n","parameters":[{"name":"limit","in":"query","description":"Page size. Default 20, maximum 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"before","in":"query","description":"Return only notifications with a lower id — the cursor for fetching\nthe next page. Use the last id of the previous page.\n","schema":{"type":"integer"}},{"name":"unread","in":"query","description":"Set to `true` to return only notifications you have not seen.","schema":{"type":"boolean"}},{"name":"domain","in":"query","description":"Restrict the feed to one domain, by numeric domain id. Account-wide\nnotifications (wallet, invoices, tickets) are excluded when set.\n","schema":{"type":"integer"}}],"responses":{"200":{"description":"Notifications.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Notification"}},"total":{"type":"integer","description":"Notifications in the whole feed."},"unread_count":{"type":"integer","description":"Unseen notifications in the whole feed."},"has_more":{"type":"boolean","description":"Another page exists below this one."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/notifications/unread-count":{"get":{"tags":["Notifications"],"operationId":"getNotificationUnreadCount","summary":"Count unseen notifications","description":"How many notifications in your feed you have not marked seen — the\nnumber behind the panel's notification badge. `GET /badges` returns it\ntogether with the unread ticket count.\n","responses":{"200":{"description":"Unread count.","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/notifications/read":{"post":{"tags":["Notifications"],"operationId":"markNotificationsRead","summary":"Mark notifications as seen","description":"Stamps the given notifications as seen, which is what removes them from\nthe unread count. Send `ids` for specific notifications, or `all: true`\nfor the whole feed. Notifications already seen keep their original\ntimestamp, so replaying a request is harmless.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Provide `ids` or `all`.","properties":{"ids":{"type":"array","description":"Notification ids to mark seen. At most 100.","items":{"type":"integer"}},"all":{"type":"boolean","description":"Mark the whole feed seen. Ignores `ids`."}}}}}},"responses":{"200":{"description":"The number of notifications updated, and the unread count that remains.","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"integer"},"unread_count":{"type":"integer"}}}}}},"400":{"description":"Neither `ids` nor `all` was given, or more than 100 ids were sent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/whoami":{"get":{"tags":["Account"],"operationId":"whoami","summary":"Identify the calling credential","description":"Says who the caller is and what kind of credential it used — never any\nprofile data. Use it to check a key before relying on it: whether it is\nread-only, which account it acts for, and — for a credential issued\nthrough NSIN SSO (an access token, or an `nsin_` key an app minted with\none) — which domains it may touch.\n\nWorks with an API key, an NSIN SSO access token (with or without the\n`nsin:full` scope — this is one of the two endpoints an identity-only\ntoken may call) and a panel session. A credential bound to an SSO\nclient reports `domain_access`; when the user has revoked the app,\n`grant_revoked` is `true` and the selection is empty, which is how a\nconnected app learns it was disconnected without guessing from `404`s.\n","security":[{"bearerAuth":[]},{"apiKeyAuth":[]},{"ssoAuth":[]}],"responses":{"200":{"description":"The caller's identity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhoAmI"},"examples":{"apiKey":{"value":{"user_id":42,"auth":"key","read_only":true,"admin":false,"key_id":7}},"ssoToken":{"value":{"user_id":42,"auth":"sso","read_only":false,"admin":false,"client_id":"my-app","scope":"openid profile nsin:full","domain_access":{"all":false,"domain_ids":[12],"domains":[{"id":12,"name":"example.com"}]}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/badges":{"get":{"tags":["Account"],"operationId":"getBadges","summary":"Unread counters for tickets and notifications","description":"Both of the panel's header badges in one request: open support\ntickets whose latest message is an unread reply from support, and\nunseen notifications. The numbers are exactly what\n`GET /tickets/unread-count` and `GET /notifications/unread-count`\nreturn — poll this one endpoint instead of both.\n","responses":{"200":{"description":"Unread counters.","content":{"application/json":{"schema":{"type":"object","properties":{"tickets_unread":{"type":"integer","description":"Open tickets with an unread reply from support."},"notifications_unread":{"type":"integer","description":"Notifications in your feed not yet marked seen."}}},"example":{"tickets_unread":1,"notifications_unread":4}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/proxy-ip/":{"get":{"tags":["Account"],"operationId":"getProxyIp","summary":"Get the edge proxy IP","description":"What to point DNS at for an externally-hosted zone. For managed\ndomains NSIN sets this automatically when you mark a record proxied.\n\nPrefer `cname` for subdomains when it is present: a CNAME follows any\nfuture change of our addresses, an A record does not. The apex has to\nuse the A addresses in `ips`. Per-record values (which honour address\npins) are on each record's `edge_target` in the records listing.\n","responses":{"200":{"description":"Proxy IP.","content":{"application/json":{"schema":{"type":"object","properties":{"ip":{"type":"string","description":"The first edge address (legacy single value)."},"ips":{"type":"array","description":"Every edge address a proxied record publishes.","items":{"type":"string"}},"cname":{"type":"string","description":"Hostname to CNAME proxied subdomains at. Empty when not configured.","example":"edge.nsin.ir"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/reseller/v1/me":{"get":{"tags":["Reseller"],"operationId":"resellerMe","summary":"Your reseller account","description":"Your status, wallet balance, credit line and how many users you have\nout of your limit. `spendable_rials` is the balance plus the credit\nline: what charges may still take before your wallet counts as in debt.\n","responses":{"200":{"description":"Your reseller account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerMe"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotReseller"}}}},"/reseller/v1/users":{"get":{"tags":["Reseller"],"operationId":"resellerListUsers","summary":"List your users","description":"Every account you created, newest first.","responses":{"200":{"description":"Your users.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ResellerUser"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotReseller"}}},"post":{"tags":["Reseller"],"operationId":"resellerCreateUser","summary":"Create a user","description":"Creates an account you manage. It has no email, phone or password of\nits own: the contact you give is stored for a later login invite and\nonly becomes the account's login when the person accepts that invite.\nSo a create never fails, and tells you nothing, because an address\nalready belongs to another NSIN account.\n\nNew users start with billing mode `reseller` (you pay).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUserInput"},"example":{"label":"Shop Arya","name":"Ali Rezaei","contact_email":"ali@example.com"}}}},"responses":{"201":{"description":"The new user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUser"}}}},"400":{"description":"Neither `label` nor `name` was given, or a field is too long or not a valid email or phone.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"409":{"description":"You have reached your limit of users. NSIN support can raise it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reseller/v1/users/{id}":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"get":{"tags":["Reseller"],"operationId":"resellerGetUser","summary":"Get a user","responses":{"200":{"description":"The user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUser"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotReseller"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"}}},"patch":{"tags":["Reseller"],"operationId":"resellerUpdateUser","summary":"Edit a user","description":"Changes the label, name or stored contact. Send only the fields to\nchange. Changing the contact cancels a pending login invite.\n\nOnce the person has taken over their login (accepted an invite, or\nhas an email, phone or password of their own), their name and contact\nare theirs: only `label` can still be changed.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUserInput"}}}},"responses":{"200":{"description":"The updated user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUser"}}}},"400":{"description":"A field is too long or not a valid email or phone.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"},"409":{"description":"The person has taken over their login; their name and contact can't be changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Reseller"],"operationId":"resellerDeleteUser","summary":"Delete a user","description":"Only possible while nothing is left behind the account: no live domain\nit owns or pays for, an empty wallet, and no person who has taken the\nlogin over. There is no cascade.\n","responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"},"409":{"description":"Domains or money are left (`domains` and `balance_rials` say how\nmany and how much), or the person has taken over their login.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"domains":{"type":"integer"},"balance_rials":{"type":"integer","format":"int64"}}}]}}}}}}},"/reseller/v1/users/{id}/suspend":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"post":{"tags":["Reseller"],"operationId":"resellerSuspendUser","summary":"Suspend a user's domains","description":"Pauses every live domain of the user at the edge. This is your own\npause, kept apart from a billing pause (which a wallet top-up lifts).\nA domain added after this call is not paused; suspend again if needed.\n","responses":{"200":{"description":"How many domains changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerSuspendResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"}}}},"/reseller/v1/users/{id}/unsuspend":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"post":{"tags":["Reseller"],"operationId":"resellerUnsuspendUser","summary":"Lift your suspension of a user's domains","responses":{"200":{"description":"How many domains changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerSuspendResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"}}}},"/reseller/v1/users/{id}/domains":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"post":{"tags":["Reseller"],"operationId":"resellerAddDomain","summary":"Add a domain for a user","description":"The same request and answers as `POST /domains`, but the domain is\nadded to the user's account: it is theirs, with their name servers\nand their limits, and you manage it with owner rights through the\nnormal `/domains/...` endpoints. If the user is in billing mode\n`reseller`, you pay for it from its first charge.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainCreate"}}}},"responses":{"200":{"description":"Domain created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainDetail"}}}},"400":{"description":"Invalid or unsupported domain name (see `POST /domains`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"},"409":{"description":"The domain is already registered (see `POST /domains`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reseller/v1/domains":{"get":{"tags":["Reseller"],"operationId":"resellerListDomains","summary":"List your users' domains","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this user's domains."}],"responses":{"200":{"description":"Live domains of your users, by name.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ResellerDomain"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotReseller"}}}},"/reseller/v1/users/{id}/billing":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"put":{"tags":["Reseller"],"operationId":"resellerSetBilling","summary":"Choose who pays for a user's domains","description":"`reseller`: your wallet (and credit line) pays for the user's domains\nfrom now on. `self`: the user's own wallet pays; send them money with\nthe transfer endpoint. Charges already made stay where they were.\n\nWhile you pay, the user and their domain's members can't buy plans,\nswitch plans, change auto-renew or buy gateway packs: those are yours\nto do through the normal billing endpoints.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["mode"],"properties":{"mode":{"type":"string","enum":["reseller","self"]}}}}}},"responses":{"200":{"description":"The updated user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUser"}}}},"400":{"description":"`mode` is not `reseller` or `self`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"}}}},"/reseller/v1/users/{id}/wallet/transfer":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"post":{"tags":["Reseller"],"operationId":"resellerTransfer","summary":"Send money to a user","description":"Moves money from your wallet to the user's. Only your balance can be\nsent, never your credit line: you must stay at zero or above.\n\nSend a fresh `idempotency_key` for each transfer and reuse it only to\nretry the same transfer after a timeout; a retry answers\n`already_applied: true` instead of moving the money twice. Reusing a\nkey for another user or amount is refused.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerMoveRequest"},"example":{"amount_rials":5000000,"idempotency_key":"c1b7b0a2-3f4e-4c51-9a1e-2b6f8f0d1e11"}}}},"responses":{"200":{"description":"Done (or done before, with `already_applied`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerMove"}}}},"400":{"description":"`amount_rials` is not positive, or `idempotency_key` is missing or longer than 64 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"description":"Your balance is too low (the credit line can't be sent).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"},"409":{"description":"The idempotency key was already used for a different transfer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reseller/v1/users/{id}/wallet/reclaim":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"post":{"tags":["Reseller"],"operationId":"resellerReclaim","summary":"Take money back from a user","description":"Moves money from the user's wallet back to yours: at most what you\nsent them (minus what you already took back) and at most what they\nhold. Money the user topped up themselves stays theirs. The\nidempotency key works as for transfers.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerMoveRequest"}}}},"responses":{"200":{"description":"Done (or done before, with `already_applied`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerMove"}}}},"400":{"description":"`amount_rials` is not positive, or `idempotency_key` is missing or longer than 64 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"},"409":{"description":"More than you can take back, or the idempotency key was used for a different request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reseller/v1/users/{id}/wallet/statement":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"get":{"tags":["Reseller"],"operationId":"resellerStatement","summary":"A user's wallet statement","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"before","in":"query","required":false,"schema":{"type":"integer"},"description":"Only entries with an id below this one, to page back."}],"responses":{"200":{"description":"The user's ledger, newest first, and what you could take back now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerStatement"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotReseller"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"}}}},"/reseller/v1/users/{id}/invite":{"parameters":[{"$ref":"#/components/parameters/ResellerUserId"}],"post":{"tags":["Reseller"],"operationId":"resellerInviteUser","summary":"Invite a user to log in","description":"Sends the user a link to choose a password and sign in to the NSIN\npanel, by email or by SMS (Iranian mobiles only) to the contact you\nstored. The link works for 7 days and only for that contact; editing\nthe contact cancels it. Accepting writes the contact onto the account\nas verified.\n\nAt most one invite per user every 10 minutes, and 50 invites a day in\nall; changing a user's contact does not reset either. The default channel is email when the user has one, else SMS.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","enum":["email","sms"]}}}}}},"responses":{"200":{"description":"Sent. The user, with `invited_at` set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUser"}}}},"400":{"description":"No email or phone for the channel, or SMS to a number that isn't an Iranian mobile.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ReadOnlyKey"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"},"409":{"description":"The user already has their own login.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"An invite went out a few minutes ago, or you reached the daily limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reseller/v1/usage":{"get":{"tags":["Reseller"],"operationId":"resellerUsage","summary":"What your users' domains cost","description":"Spend on your users' domains per UTC day, per user and per domain:\ntraffic charges, and plan and gateway-pack purchases. Each amount is\nwhat the domains cost whoever paid; `paid_by_you_rials` is the part\ncharged to your wallet. Deleted domains still count.\n\nRequests and bandwidth are in the account analytics\n(`GET /analytics/domains-overview`), which cover your users' domains.\n","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":90,"default":30}},{"name":"user_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this user."}],"responses":{"200":{"description":"Spend.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResellerUsage"}}}},"400":{"description":"`days` is outside 1–90.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/NotReseller"},"404":{"$ref":"#/components/responses/ResellerUserNotFound"}}}},"/.well-known/openid-configuration":{"get":{"tags":["SSO"],"operationId":"ssoDiscovery","summary":"OpenID Connect discovery document","security":[],"description":"Everything an OIDC client needs to configure itself: the issuer, the\nendpoint URLs, and the response types, grant types, scopes and signing\nalgorithms this provider supports.\n\nNote that `authorization_endpoint` points at the NSIN **panel**\n(`https://panel.nsin.ir/oauth/authorize`), not at this API — that step\nis a page the user sees, not a request your server makes.\n\nCacheable for an hour.\n","responses":{"200":{"description":"Discovery document.","content":{"application/json":{"schema":{"type":"object","properties":{"issuer":{"type":"string","example":"https://api.nsin.ir"},"authorization_endpoint":{"type":"string","example":"https://panel.nsin.ir/oauth/authorize"},"token_endpoint":{"type":"string","example":"https://api.nsin.ir/oauth/token"},"userinfo_endpoint":{"type":"string","example":"https://api.nsin.ir/oauth/userinfo"},"jwks_uri":{"type":"string","example":"https://api.nsin.ir/.well-known/jwks.json"},"revocation_endpoint":{"type":"string","example":"https://api.nsin.ir/oauth/revoke"},"response_types_supported":{"type":"array","items":{"type":"string"}},"response_modes_supported":{"type":"array","items":{"type":"string"}},"grant_types_supported":{"type":"array","items":{"type":"string"}},"subject_types_supported":{"type":"array","items":{"type":"string"}},"code_challenge_methods_supported":{"type":"array","items":{"type":"string"}},"token_endpoint_auth_methods_supported":{"type":"array","items":{"type":"string"}},"scopes_supported":{"type":"array","items":{"type":"string"}},"id_token_signing_alg_values_supported":{"type":"array","items":{"type":"string"}},"claims_supported":{"type":"array","items":{"type":"string"}},"authorization_response_iss_parameter_supported":{"type":"boolean"}}}}}}}}},"/.well-known/jwks.json":{"get":{"tags":["SSO"],"operationId":"ssoJwks","summary":"Token signing keys (JWKS)","security":[],"description":"The RSA public keys that verify our access and ID tokens, as a JWK Set.\nVerify offline against these — never by calling back to NSIN on every\nrequest. Cache by `kid` and refetch once when you meet a `kid` you do\nnot know. Cacheable for an hour.\n","responses":{"200":{"description":"JWK Set.","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"kty":{"type":"string","example":"RSA"},"use":{"type":"string","example":"sig"},"alg":{"type":"string","example":"RS256"},"kid":{"type":"string"},"n":{"type":"string","description":"Modulus, base64url."},"e":{"type":"string","description":"Exponent, base64url."}}}}}}}}}}}},"/oauth/client-info":{"get":{"tags":["SSO"],"operationId":"ssoClientInfo","summary":"Look up a client before redirecting","security":[],"description":"Confirms that a `client_id` exists and is active, and — when\n`redirect_uri` is given — that the URI is registered for it. The panel\ncalls this before it redirects, so a mistyped client or redirect is\nreported on screen instead of being bounced to an unverified URL.\n\nNothing secret is returned.\n","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string"},"example":"nc_9f3c1d2e4b5a6789"},{"name":"redirect_uri","in":"query","required":false,"description":"When present, it must be one of the client's registered URIs, matched exactly.","schema":{"type":"string"}}],"responses":{"200":{"description":"The client's public description.","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"first_party":{"type":"boolean","description":"NSIN's own app — consent is implicit."},"public":{"type":"boolean","description":"PKCE-only client with no secret."}}}}}},"400":{"description":"The redirect_uri is not registered for this client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"404":{"description":"Unknown or inactive client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}}}},"/oauth/authorize":{"post":{"tags":["SSO"],"operationId":"ssoAuthorize","summary":"Approve an authorization request","security":[{"panelAuth":[]}],"description":"The server side of the panel's `/oauth/authorize` page. It is called by\nthe NSIN panel with the signed-in user's session, never by a relying\nparty: your application's part of this step is the browser redirect to\n`{panel}/oauth/authorize?…`, and the redirect back that follows.\n\nDocumented here because it defines the parameters your redirect must\ncarry. `state` is required. PKCE is mandatory for every client:\n`code_challenge_method` must be `S256` and `code_challenge` must be\n`BASE64URL(SHA256(code_verifier))` with a verifier of 43–128 unreserved\ncharacters.\n\nA first-party client asking only for identity scopes is approved\nsilently. Everything else needs a stored grant — a third-party client\nfor any scope, and ANY client, first-party included, that asks for\n`nsin:full` — because the grant carries the user's **domain\nselection**. The first request answers `consent_required` with the\nclient's name, the human descriptions of the scopes and, when\n`nsin:full` is requested, a `domain_access` block (the current\nselection and every domain the user could pick). The panel shows the\nconsent card with a domain picker and repeats the request with\n`consent: true` and `domains` (`\"all\"`, or a list of domain ids the\nuser has a role on). Every credential obtained through the grant — the\naccess token, and any `nsin_` key the app mints with it — is bound to\nthe client and limited, live, to that selection; `GET /whoami` reports\nit as `domain_access`, and revoking the app in *Connected apps* leaves\nthose credentials no domain at all.\n\n`prompt=none` is the silent sign-in probe: a covering grant answers\nwith the redirect as usual, anything else answers `consent_required`\nand nothing is written (the panel turns it into\n`error=consent_required` on the redirect_uri). `prompt=consent` always\nshows the card, prefilled from the existing grant, so a connected app\ncan offer \"change domain access\".\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["client_id","redirect_uri","response_type","scope","state","code_challenge","code_challenge_method"],"properties":{"client_id":{"type":"string"},"redirect_uri":{"type":"string","description":"Must match one of the client's registered URIs exactly."},"response_type":{"type":"string","enum":["code"]},"scope":{"type":"string","description":"Space-separated. Must include `openid`.","example":"openid profile email offline_access"},"state":{"type":"string","description":"Opaque value echoed back on the redirect. Required."},"code_challenge":{"type":"string"},"code_challenge_method":{"type":"string","enum":["S256"]},"nonce":{"type":"string","description":"Echoed in the ID token."},"consent":{"type":"boolean","description":"Set by the panel when the user approves the consent card."},"prompt":{"type":"string","enum":["none","consent"],"description":"`none` never interacts and never writes a grant; `consent` always shows the card. Anything else is ignored."},"domains":{"description":"The domain selection. Required with `consent: true` when\n`nsin:full` is requested, ignored otherwise: `\"all\"`, or a\nnon-empty list of domain ids the user owns or is a member\nof. An id outside that set answers `400 invalid_request`\nwith `error_description` \"domain not accessible\".\n","oneOf":[{"type":"string","enum":["all"]},{"type":"array","items":{"type":"integer"}}]}}}}}},"responses":{"200":{"description":"Either the URL to send the browser to, or a request for consent.\n","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"redirect_to":{"type":"string","description":"The registered redirect_uri with `code`, `state` and `iss` appended.","example":"https://app.example/auth/callback?code=nac_…&state=xyz&iss=https%3A%2F%2Fapi.nsin.ir"}}},{"type":"object","properties":{"consent_required":{"type":"boolean","enum":[true]},"client":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"first_party":{"type":"boolean"}}},"scopes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"}}}},"domain_access":{"type":"object","description":"Present only when `nsin:full` is requested.","properties":{"current":{"description":"The existing grant's selection, to prefill the picker — `\"all\"` when there is none.","oneOf":[{"type":"string","enum":["all"]},{"type":"array","items":{"type":"integer"}}]},"domains":{"type":"array","description":"Every domain the user has a role on, sorted by name, at most 1000.","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","admin","editor","viewer"]}}}}}}}}]}}}},"400":{"description":"`invalid_client`, `invalid_redirect_uri`, `unsupported_response_type`,\n`invalid_request` (missing or malformed PKCE / state, or a missing\nor inaccessible `domains` selection) or `invalid_scope`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"401":{"description":"No panel session, or a legacy session token with no session id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The account is not active.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/oauth/token":{"post":{"tags":["SSO"],"operationId":"ssoToken","summary":"Exchange a code, or refresh a token","security":[],"description":"Accepts `application/x-www-form-urlencoded` (the OAuth default) and\nJSON. A confidential client authenticates with `client_secret_post` or\nHTTP Basic; a public client sends no secret and is protected by PKCE\nalone.\n\n**`grant_type=authorization_code`** — send `code`, `redirect_uri`,\n`client_id` and `code_verifier`. The code is single-use and lives five\nminutes. A code that never existed, has expired or has already been\nredeemed all answer the same `invalid_grant`.\n\n**`grant_type=refresh_token`** — send `refresh_token` and `client_id`.\nRefresh tokens rotate: the response carries a new one and the presented\ntoken is burnt. Presenting a burnt token is treated as a leak and\nrevokes every token of that login. `scope` may be sent to narrow the new\ntoken; it can never widen.\n\nA `refresh_token` is only issued when the `offline_access` scope was\ngranted. Rate limited to 60 requests per minute per IP and 600 per\nminute per `client_id`.\n","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/OAuthTokenRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenRequest"}}}},"responses":{"200":{"description":"A fresh token set.","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string","description":"RS256 JWT. Verify it against the JWKS."},"token_type":{"type":"string","enum":["Bearer"]},"expires_in":{"type":"integer","description":"Access token lifetime in seconds."},"refresh_token":{"type":"string","description":"Present only when `offline_access` was granted."},"id_token":{"type":"string","description":"RS256 JWT carrying the identity claims the scopes allow."},"scope":{"type":"string","description":"The scopes actually granted, space-separated."}}}}}},"400":{"description":"`invalid_request`, `unsupported_grant_type`, `invalid_grant`\n(unknown, expired, already-used or mismatched code or refresh\ntoken — deliberately indistinguishable), `invalid_scope`, or\n`unauthorized_client` for a client that has been switched off.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"401":{"description":"`invalid_client` — the client id is unknown or the secret is wrong.\nCarries `WWW-Authenticate: Basic` when Basic auth was attempted.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"429":{"description":"Too many token requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"slowDown":{"value":{"error":"slow_down"}}}}}}}}},"/oauth/revoke":{"post":{"tags":["SSO"],"operationId":"ssoRevoke","summary":"Revoke a refresh token","security":[],"description":"Revokes a refresh token and every token rotated from the same login —\nthis is what a relying party calls on sign-out. Access tokens are short\nlived and are not tracked; they stop working when they expire, or\nsooner if the underlying NSIN session is revoked.\n\nPer RFC 7009 the answer is always `200`, whether or not the token\nexisted: an error would turn this endpoint into a way to test tokens.\nA confidential client must send its secret, or the request is a silent\nno-op.\n","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/OAuthRevokeRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/OAuthRevokeRequest"}}}},"responses":{"200":{"description":"Always, regardless of whether anything was revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}}}}},"/oauth/userinfo":{"get":{"tags":["SSO"],"operationId":"ssoUserinfo","summary":"The signed-in user's claims","security":[{"ssoAuth":[]}],"description":"The OIDC UserInfo endpoint. Returns the claims the token's scopes allow\n— nothing more, and nothing at all beyond `sub` without `profile`,\n`email` or `phone`.\n\nThe token is verified here directly: signature, expiry, the client still\nbeing active, the account still being active, and the underlying NSIN\nsession still being live. Signing out of NSIN therefore takes this\nendpoint away from a relying party within the access-token lifetime.\n","responses":{"200":{"description":"Claims.","content":{"application/json":{"schema":{"type":"object","properties":{"sub":{"type":"string","description":"The NSIN user id, as a decimal string."},"updated_at":{"type":"integer","description":"Unix seconds of the last profile change."},"name":{"type":"string","description":"Scope `profile`."},"email":{"type":"string","description":"Scope `email`."},"email_verified":{"type":"boolean","description":"Scope `email`."},"phone_number":{"type":"string","description":"Scope `phone`."},"phone_number_verified":{"type":"boolean","description":"Scope `phone`."},"admin":{"type":"boolean","description":"First-party clients only."},"national_code":{"type":"string","description":"First-party clients with scope `nsin:identity` only."},"birth_date":{"type":"string","description":"First-party clients with scope `nsin:identity` only."}}}}}},"401":{"description":"`invalid_token` — missing, malformed, expired or revoked. Carries a\n`WWW-Authenticate: Bearer` header.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}}}},"/oauth/grants":{"get":{"tags":["SSO"],"operationId":"ssoListGrants","summary":"Connected apps","security":[{"panelAuth":[]}],"description":"The applications this user has approved, as shown in the panel under\n*Connected apps*: every third-party app, and every first-party app\n(Nsincloud) holding write access to the account — the grant that\ncarries the app's domain selection. First-party apps used only to\nsign in are not listed: that access is implicit in having an NSIN\naccount.\n\nPanel session only — an SSO token cannot read or change this list, so\nthat no connected app can see or revoke another.\n","responses":{"200":{"description":"Approved applications.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"client_id":{"type":"string"},"name":{"type":"string"},"first_party":{"type":"boolean"},"scope":{"type":"string","description":"Space-separated scopes the user approved."},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"},"domain_access":{"$ref":"#/components/schemas/DomainAccess"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/oauth/grants/{client_id}":{"put":{"tags":["SSO"],"operationId":"ssoUpdateGrant","summary":"Change an app's domain access","security":[{"panelAuth":[]}],"description":"Replaces the domain selection of an active grant. It takes effect on\nthe app's key and tokens with their next request. Ids outside the\ndomains the user has a role on answer `400 invalid_request`.\n","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domains"],"properties":{"domains":{"description":"`\"all\"`, or a non-empty list of domain ids.","oneOf":[{"type":"string","enum":["all"]},{"type":"array","items":{"type":"integer"}}]}}}}}},"responses":{"200":{"description":"The updated row, in the shape of the list.","content":{"application/json":{"schema":{"type":"object","properties":{"client_id":{"type":"string"},"name":{"type":"string"},"first_party":{"type":"boolean"},"scope":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"},"domain_access":{"$ref":"#/components/schemas/DomainAccess"}}}}}},"400":{"description":"Malformed `domains`, or an id the user has no role on.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No active grant for this client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}}},"delete":{"tags":["SSO"],"operationId":"ssoRevokeGrant","summary":"Disconnect an app","security":[{"panelAuth":[]}],"description":"Withdraws the user's approval of one application and revokes every\nrefresh token it holds for them and every `nsin_` API key it minted\nfor them, so it is signed out rather than merely un-listed; an access\ntoken still in flight sees no domain at all. It can ask for consent\nagain on the next sign-in.\n","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The application is disconnected.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/domains/{domain}/custom-ns/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Custom Name Servers"],"operationId":"getCustomNameservers","summary":"Get custom name servers","description":"The domain's own name servers, the IP the registrar must hold for\neach, and whether the registrar uses them yet (`status`). Requires\n`domain.view`.\n","responses":{"200":{"description":"The custom name server state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomNSStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/custom-ns/enable":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Custom Name Servers"],"operationId":"enableCustomNameservers","summary":"Turn on custom name servers","description":"Creates one locked `A` record per name, pointing at an NSIN name\nserver. Nothing changes for visitors until you set the names AND\ntheir IPs (from `names`) at your registrar. Sending other names\nrenames them, but only while the registrar does not use them yet\n(`409` otherwise). Sending the same names again changes nothing, and\ncancels a turn-off in progress. `409` also when a record already uses\none of the names (`field: names`).\n\nA pending domain goes active by itself once the registrar shows the\nnames with the right IPs. For safety it is refused (`409`) when the\nregistrar ALREADY shows these names (point it to NSIN's names first),\nor when another account used them on this domain in the last 30 days;\n`503` when the registry cannot be asked right now. Requires\n`records.edit`.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"names":{"type":"array","minItems":2,"maxItems":5,"items":{"type":"string","pattern":"^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"},"description":"The first label of each name. Default `[\"ns1\", \"ns2\"]`.","examples":[["ns1","ns2"]]}}}}}},"responses":{"200":{"description":"Turned on; the state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomNSStatus"}}}},"400":{"description":"A name is not a single DNS label, is used twice, or there are fewer than 2 or more than 5.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The domain is not active or pending on NSIN, a record uses one of the names, the registrar already uses the current names, or (pending) already shows the new ones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"The records could not be published; nothing was changed. Try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Custom name servers are not available on this platform yet, or (pending domain) the registry could not be asked; try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/custom-ns/disable":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Custom Name Servers"],"operationId":"disableCustomNameservers","summary":"Turn off custom name servers","description":"When the registrar does not use the names, they are removed at once.\nWhen it does, `state` becomes `turning_off`: put `old_ns` back at\nyour registrar, and the names are removed once it shows those again,\nso the domain never stops answering. Idempotent. Requires\n`records.edit`.\n","responses":{"200":{"description":"Turned off, or turning off; the state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomNSStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"description":"The records could not be removed. Try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/email-routing/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Email Routing"],"operationId":"getEmailRouting","summary":"Email routing status","description":"Everything the routing page shows: whether routing is on and its\nstatus, the published records with their last public-check verdict,\nwhat enabling would have to remove or merge (while unconfigured), the\nlast 24 hours' counts, the plan's caps against current usage, the DKIM\nrecord and the platform's mail hosts. Requires `domain.view`.\n","responses":{"200":{"description":"Routing status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/enable":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Email Routing"],"operationId":"enableEmailRouting","summary":"Enable email routing","description":"Publishes the MX, SPF and DKIM records and turns routing on. Any MX\nrecords the domain already has must be removed (they would route mail\nelsewhere) — send `remove_existing_mx: true` to agree, otherwise the\ncall answers `409` with `conflict: mx` and the rows. An existing SPF\nrecord is merged rather than duplicated (`merge_spf: true`); two SPF\nrecords answer `409` with `conflict: spf_multiple`. The removed MX rows\nare kept so a later disable can put them back.\n\nRefused while no mail host is ready (`503`, `code: hosts_not_ready`),\non external DNS (`409`, `conflict: external_dns`), on a domain with no\nactive plan (`402`) and on a plan without the feature (`403`).\nIdempotent: an enabled domain answers `200` unchanged. Requires\n`domain.settings`.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingEnableRequest"}}}},"responses":{"200":{"description":"Routing enabled; the status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/EmailRoutingNoPlan"},"403":{"$ref":"#/components/responses/EmailRoutingPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"$ref":"#/components/responses/EmailRoutingConflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EmailRoutingDNSWriteFailed"},"503":{"description":"No mail host has checked in recently (`code: hosts_not_ready`), or\nthe platform is missing its key-encryption key (`code: kek_unset`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}}}}},"/domains/{domain}/email-routing/disable":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Email Routing"],"operationId":"disableEmailRouting","summary":"Disable email routing","description":"Removes the managed records (and our include term from a merged SPF),\noptionally re-creates the MX records enable removed, and turns routing\noff. Rules and destinations are kept for a later enable. Idempotent.\nRequires `domain.settings`.\n","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingDisableRequest"}}}},"responses":{"200":{"description":"Routing disabled; the status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/EmailRoutingDNSWriteFailed"}}}},"/domains/{domain}/email-routing/unlock":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Email Routing"],"operationId":"unlockEmailRoutingRecords","summary":"Unlock the managed records","description":"Makes the MX/SPF/DKIM rows editable through the record endpoints so\nyou can migrate away at your own pace. Routing keeps working while the\nrecords still exist; status becomes `unlocked`. Requires\n`domain.settings`.\n","responses":{"200":{"description":"Records unlocked; the status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"$ref":"#/components/responses/EmailRoutingNotEnabled"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/lock":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Email Routing"],"operationId":"lockEmailRoutingRecords","summary":"Lock the managed records","description":"Reverses unlock: the MX, SPF and DKIM rows Email Routing published go\nback to `editable: false`, so the record endpoints refuse them again,\nand the status leaves `unlocked` (it becomes `ready`, or\n`misconfigured` if the last DNS check failed). Records you changed\nwhile unlocked are not reset — run a DNS check to see where they stand.\nRequires `domain.settings`.\n","responses":{"200":{"description":"Records locked; the status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"$ref":"#/components/responses/EmailRoutingNotEnabled"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/dns/check":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Email Routing"],"operationId":"checkEmailRoutingDNS","summary":"Check the published records now","description":"Queries the public nameserver for the domain's MX, SPF and DKIM and\nmarks each managed record `ok`, `missing` or `extra` (a foreign MX or\na second SPF). A domain whose records do not answer is `misconfigured`\nand its mail hosts stop accepting for it until the records are back.\nThe same check runs every five minutes on its own. Once a minute per\ndomain: sooner answers `429` with `retry_after_seconds`. Requires\n`domain.view`.\n","responses":{"200":{"description":"Fresh verdict; the status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingStatus"}}}},"202":{"$ref":"#/components/responses/CheckAccepted"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"$ref":"#/components/responses/EmailRoutingNotEnabled"},"429":{"description":"The per-key rate limit, or a check less than a minute ago.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportScanThrottledError"}}}},"502":{"description":"The public lookup failed; nothing changed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/email-routing/settings":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"put":{"tags":["Email Routing"],"operationId":"updateEmailRoutingSettings","summary":"Update routing settings","description":"Omitted fields are untouched. `subaddressing` lets `user+tag@` match\nthe `user@` rule (an exact `user+tag@` rule still wins) and is what\npermits a `+` in a rule's local part. Requires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingSettingsRequest"}}}},"responses":{"200":{"description":"Settings saved; the status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingStatus"}}}},"400":{"description":"Malformed body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/catch-all":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Email Routing"],"operationId":"getEmailCatchAll","summary":"Get the catch-all","description":"What happens to mail for an address on this domain that no rule\nmatches: when `enabled`, it is forwarded to `destination_id` or\ndropped (`action`); when not, it is rejected. Requires `domain.view`.\n","responses":{"200":{"description":"The catch-all.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailCatchAll"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Email Routing"],"operationId":"updateEmailCatchAll","summary":"Update the catch-all","description":"`destination_id` is required when `action` is `forward` and must be a\nVERIFIED destination on the domain owner's account. Requires\n`records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailCatchAllRequest"}}}},"responses":{"200":{"description":"The catch-all as saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailCatchAll"}}}},"400":{"description":"Invalid action, a missing or unverified destination, or a\ndestination on the domain itself (`code: loop`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/rules/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Email Routing"],"operationId":"listEmailRules","summary":"List email addresses","description":"Every custom address on the domain, by local part. `active` says\nwhether the address is live right now: enabled, routing on, and (for\n`forward`) its destination verified. Requires `domain.view`.\n","responses":{"200":{"description":"Rule list.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EmailRule"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Email Routing"],"operationId":"createEmailRule","summary":"Create an email address","description":"`local_part` is the part before `@` — ASCII letters, digits and\n`!#$%&'*+/=?^_\\`{|}~.-`, at most 64 characters, lowercased; a `+` only\nwhen the domain's `subaddressing` is on. `action` is `forward` (with a\n`destination_id` from the domain owner's account) or `drop`. A rule\nwhose destination is not verified yet is stored and goes live on\nverification. Counts against the plan's `max_email_rules`. Requires\n`records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRuleRequest"}}}},"responses":{"201":{"description":"The created rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRule"}}}},"400":{"description":"Invalid local part, action or destination (`field` names it).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/EmailRoutingNoPlan"},"403":{"$ref":"#/components/responses/EmailRoutingPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"An address with this local part already exists (`conflict: local_part`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingConflictError"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/rules/{ruleId}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/EmailRuleId"}],"put":{"tags":["Email Routing"],"operationId":"updateEmailRule","summary":"Update an email address","description":"Changes one address. Omitted fields are untouched; the same rules as\ncreating apply to the new values (a unique local part, a verified\ndestination for `forward`). The mail hosts pick the change up within a\nminute. Requires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRuleRequest"}}}},"responses":{"200":{"description":"The updated rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRule"}}}},"400":{"description":"Invalid local part, action or destination (`field` names it).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/EmailRuleNotFound"},"409":{"description":"An address with this local part already exists (`conflict: local_part`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingConflictError"}}}},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Email Routing"],"operationId":"deleteEmailRule","summary":"Delete an email address","description":"Removes one address. Mail to it is then handled by the catch-all, or\nrejected when the catch-all is off. It frees a slot of the plan's\naddress allowance. The mail hosts pick the change up within a minute.\nRequires `records.edit`.\n","responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/EmailRuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/rules/{ruleId}/toggle":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/EmailRuleId"}],"post":{"tags":["Email Routing"],"operationId":"toggleEmailRule","summary":"Enable or disable an email address","description":"Flips the address's `enabled` flag and returns it. A disabled address\nis treated as if it did not exist. Switching on a `forward` address\nthat has no destination is refused with `400`. Requires\n`records.edit`.\n","responses":{"200":{"description":"The rule after the flip.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRule"}}}},"400":{"description":"The rule forwards but has no destination; set one first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/EmailRuleNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/summary":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/EmailRange"},{"name":"from","in":"query","description":"Start of a `custom` range, RFC 3339.","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","description":"End of a `custom` range, RFC 3339.","schema":{"type":"string","format":"date-time"}}],"get":{"tags":["Email Routing"],"operationId":"getEmailSummary","summary":"Message counts over time","description":"Received / forwarded / dropped / rejected / deferred, as totals and as\na bucketed series. `received` is every message except discarded\nbounces. Requires `domain.view`.\n","responses":{"200":{"description":"Totals and series.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailSummary"}}}},"400":{"description":"Bad range or custom bounds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/EmailActivityUnavailable"}}}},"/domains/{domain}/email-routing/activity":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/EmailRange"},{"name":"from","in":"query","description":"Start of a `custom` range, RFC 3339.","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","description":"End of a `custom` range, RFC 3339.","schema":{"type":"string","format":"date-time"}},{"name":"status","in":"query","description":"Narrow to one status.","schema":{"type":"string","enum":["forwarded","dropped","rejected","deferred","bounce_dropped","stored"]}},{"name":"q","in":"query","description":"Case-insensitive match against sender, recipient, subject and Message-ID.","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","default":1,"minimum":1}},{"name":"per_page","in":"query","schema":{"type":"integer","default":50,"minimum":1,"maximum":200}}],"get":{"tags":["Email Routing"],"operationId":"getEmailActivity","summary":"Activity log","description":"One row per message, newest first: envelope addresses, the\nauthentication verdicts (SPF, DKIM, DMARC, ARC), what happened to it\nand why. `subject` is present only while subject logging is on for\nthe platform. Kept 30 days. Requires `domain.view`.\n","responses":{"200":{"description":"A page of events.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailActivity"}}}},"400":{"description":"Bad range or custom bounds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/EmailActivityUnavailable"}}}},"/domains/{domain}/email-routing/inbox/":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"name":"folder","in":"query","description":"`inbox` (default), `spam`, `trash`, or `all`.","schema":{"type":"string","enum":["inbox","spam","trash","all"],"default":"inbox"}},{"name":"mailbox","in":"query","description":"Only mail for this local part (`info` for `info@example.com`).","schema":{"type":"string","maxLength":64}},{"name":"q","in":"query","description":"Case-insensitive match against From, subject and envelope sender.","schema":{"type":"string","maxLength":200}},{"name":"unread","in":"query","description":"`true` (or `1`) for unread mail only.","schema":{"type":"boolean"}},{"name":"page","in":"query","schema":{"type":"integer","default":1,"minimum":1,"maximum":1000}},{"name":"per_page","in":"query","schema":{"type":"integer","default":50,"minimum":1,"maximum":100}}],"get":{"tags":["Email Routing"],"operationId":"listInboxMessages","summary":"List stored mail","description":"Mail kept in the domain's inbox, newest first, with unread counts per\nfolder, the mailbox list and the inbox usage. Metadata only — open a\nmessage for its content. Needs a key with **email:read** and\n`domain.view` on the domain. Every list made with a key is recorded.\n","responses":{"200":{"description":"A page of messages.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxList"}}}},"400":{"description":"Bad filter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The key has no `email:read` (`\"code\": \"email_read_required\"`), or\nthe plan has no inbox and the domain has no stored mail\n(`\"code\": \"plan_required\"`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/domains/{domain}/email-routing/inbox/{id}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/InboxMessageID"},{"name":"mark_read","in":"query","description":"`true` marks the message read for everyone. Without it a key leaves\nit unread, so the owner still sees it as new. Ignored for read-only\nkeys.\n","schema":{"type":"boolean","default":false}}],"get":{"tags":["Email Routing"],"operationId":"getInboxMessage","summary":"Open a stored message","description":"The parsed message: headers, plain text, sanitised HTML (scripts,\nhandlers and remote content removed), the attachment list and\nwarnings. SPF/DKIM/DMARC come from what NSIN checked on arrival, never\nfrom the mail's own headers. Needs **email:read** and `domain.view`.\nOpens are limited to two at a time per domain (`429` with\n`retry_after_seconds` when busy). Recorded before anything is served.\n","responses":{"200":{"description":"The message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboxMessage"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The key has no `email:read`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such message on this domain, or the domain is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The mail is no longer on the mail host or can no longer be opened.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many opens for this domain right now; retry after `retry_after_seconds`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"The mail host did not answer; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/email-routing/inbox/{id}/raw":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/InboxMessageID"}],"get":{"tags":["Email Routing"],"operationId":"getInboxMessageRaw","summary":"Download the raw .eml","description":"The message exactly as received (RFC 5322), as an\n`application/octet-stream` download named `message-<id>.eml`. Never\nmarks it read. Needs **email:read** and `domain.view`; same open limit\nand record as opening it.\n","responses":{"200":{"description":"The raw message.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The key has no `email:read`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such message on this domain.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The mail is no longer on the mail host.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many opens for this domain right now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/email-routing/inbox/{id}/attachments/{index}":{"parameters":[{"$ref":"#/components/parameters/DomainName"},{"$ref":"#/components/parameters/InboxMessageID"},{"name":"index","in":"path","required":true,"description":"The attachment's `index` from the message's `attachments` list.","schema":{"type":"integer","minimum":0}}],"get":{"tags":["Email Routing"],"operationId":"getInboxAttachment","summary":"Download one attachment","description":"One attachment as an `application/octet-stream` download. Treat it as\nuntrusted: `dangerous: true` in the list marks executable types.\nNeeds **email:read** and `domain.view`; same open limit and record as\nopening the message.\n","responses":{"200":{"description":"The attachment.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The key has no `email:read`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such message or attachment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many opens for this domain right now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains/{domain}/email-routing/destinations/":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Email Routing"],"operationId":"listDomainEmailDestinations","summary":"List the domain owner's destinations","description":"The destinations a rule on this domain may forward to — the domain\nOWNER's account's, whoever is asking. Requires `domain.view`.\n","responses":{"200":{"description":"Destination list.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EmailDestination"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Email Routing"],"operationId":"createDomainEmailDestination","summary":"Add a destination to the domain owner's account","description":"Same as the account-level create, but the destination lands on the\ndomain OWNER's account and the verification mail names this domain.\nOnly the owner and admin-role members may; editors choose from the\nlist instead. Requires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDestinationRequest"}}}},"responses":{"201":{"description":"Destination created; the verification mail is on its way.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDestinationCreated"}}}},"400":{"description":"Invalid address, a domain with no mail server (`code: no_mx`), or a loop (`code: loop`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Editor role, or the account is at its destination cap.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"The account already has this destination (`conflict: destination`, the row under `destination`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingConflictError"}}}},"429":{"$ref":"#/components/responses/EmailVerifyThrottled"}}}},"/domains/{domain}/email-routing/setup":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Email Routing"],"operationId":"setupEmailRouting","summary":"Set up email routing in one call","description":"The first-run shortcut: turns routing on (exactly as the enable\nendpoint does, with the same `remove_existing_mx` / `merge_spf`\nanswers and the same refusals), adds `destination_email` to the domain\nowner's account if it is not there yet, and creates\n`local_part@domain` forwarding to it.\n\nThe destination gets one verification mail and the address stays\ninactive until the link is clicked — unless the destination is the\nowner's own verified account email, which is saved verified and gets\nno mail. Everything is checked before anything is written, and the\nenable runs first: a refused setup creates nothing. If a later step\nfails after the enable (a destination cap, a rule limit) the error body\ncarries `enabled: true`. Safe to repeat: an existing destination and an\nexisting address are kept as they are. Requires `domain.settings`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingSetupRequest"}}}},"responses":{"200":{"description":"Routing is on; the status, the address and the destination.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingSetupResult"}}}},"400":{"description":"Invalid `local_part` or `destination_email` (`field` names which), a destination domain with no mail server (`code: no_mx`), or a loop (`code: loop`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/EmailRoutingNoPlan"},"403":{"$ref":"#/components/responses/EmailRoutingPlanLimited"},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"$ref":"#/components/responses/EmailRoutingConflict"},"429":{"$ref":"#/components/responses/EmailVerifyThrottled"},"502":{"$ref":"#/components/responses/EmailRoutingDNSWriteFailed"},"503":{"description":"No mail host has checked in recently (`code: hosts_not_ready`), or\nthe platform is missing its key-encryption key (`code: kek_unset`).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}}}}},"/domains/{domain}/email-routing/send":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"post":{"tags":["Email Routing"],"operationId":"sendEmail","summary":"Send an email from one of the domain's addresses","description":"Queues a plain-text message FROM an address that exists and is switched\non on this domain, TO up to `sending.max_recipients` recipients. A mail\nhost delivers it a few seconds later, signed with the domain's DKIM\nkey, so SPF, DKIM and DMARC pass for the domain. Replies go to the\nsender address and are forwarded like any other mail.\n\nThe answer is `202` with one `queued` row per recipient; read the\noutcome from the sent list. A soft failure is retried up to five times\nover about ninety minutes. Each recipient counts once against the\nplan's `max_email_sends_per_day` (UTC day), delivered or not.\n\nRefused when the plan does not include sending (`403`, `code: plan`),\nEmail Routing is off (`409`, `conflict: not_enabled`), the domain is\nsuspended (`403`, `code: suspended`), the daily limit is reached\n(`429`, `code: daily_cap`), the domain is sending too fast (`429`,\n`code: rate`) or too many of today's messages were refused by the\nreceiving servers (`429`, `code: bounces`). No HTML and no attachments.\nRequires `records.edit`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailSendRequest"}}}},"responses":{"202":{"description":"Queued; one row per recipient and the updated sending allowance.","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/EmailSentMessage"}},"sending":{"$ref":"#/components/schemas/EmailSendingStatus"}}}}}},"400":{"description":"A field is invalid; `field` is one of `from_local`, `from_name`, `to`, `subject`, `text`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/EmailRoutingNoPlan"},"403":{"description":"The plan does not include sending (`code: plan`), or email on the domain is suspended (`code: suspended`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"404":{"$ref":"#/components/responses/DomainNotFound"},"409":{"description":"Email Routing is not enabled on the domain (`conflict: not_enabled`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingConflictError"}}}},"413":{"description":"The text is over `sending.max_text_kb`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The daily limit (`code: daily_cap`), the per-minute limit (`code: rate`) or today's refusals (`code: bounces`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"503":{"description":"Sending is switched off on the platform (`code: platform_off`) or no mail host is ready (`code: hosts_not_ready`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}}}}},"/domains/{domain}/email-routing/sent":{"parameters":[{"$ref":"#/components/parameters/DomainName"}],"get":{"tags":["Email Routing"],"operationId":"listSentEmail","summary":"List sent email","description":"Mail sent from this domain with the send endpoint, newest first, one\nrow per recipient, with the receiving server's answer. Rows are kept\n30 days; the text of a message is never kept. Requires `domain.view`.\n","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"A page of sent mail.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EmailSentMessage"}},"total":{"type":"integer"},"page":{"type":"integer"},"per_page":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/DomainNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/email-routing/destinations/":{"get":{"tags":["Email Routing"],"operationId":"listEmailDestinations","summary":"List my destinations","description":"Every destination on your own account, verified or pending, with how\nmany rules use each.\n","responses":{"200":{"description":"Destination list.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EmailDestination"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Email Routing"],"operationId":"createEmailDestination","summary":"Add a destination","description":"Adds an address to your account and emails it a verification link.\nRules may point at it immediately but only fire once it is verified.\nRefused for an address on a domain that itself uses NSIN email routing\n(`code: loop`) or whose domain has no mail server (`code: no_mx`).\nSends are paced: one per destination per minute, ten per account and\nforty per client address per hour.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDestinationRequest"}}}},"responses":{"201":{"description":"Destination created; the verification mail is on its way.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDestinationCreated"}}}},"400":{"description":"Invalid address, no mail server, or a loop (`code`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingCodedError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The account is at its destination cap (`max_destinations`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The account already has this destination (`conflict: destination`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingConflictError"}}}},"429":{"$ref":"#/components/responses/EmailVerifyThrottled"}}}},"/email-routing/destinations/{destinationId}/resend":{"parameters":[{"$ref":"#/components/parameters/EmailDestinationId"}],"post":{"tags":["Email Routing"],"operationId":"resendEmailDestinationVerification","summary":"Resend the verification mail","description":"Issues a fresh link for an unverified destination. Subject to the same\ncooldown and hourly caps as create.\n","responses":{"200":{"description":"Sent; how long until the next resend is allowed.","content":{"application/json":{"schema":{"type":"object","properties":{"resend_cooldown_seconds":{"type":"integer"}}}}}},"400":{"description":"The destination is already verified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/EmailDestinationNotFound"},"429":{"$ref":"#/components/responses/EmailVerifyThrottled"}}}},"/email-routing/destinations/{destinationId}":{"parameters":[{"$ref":"#/components/parameters/EmailDestinationId"}],"delete":{"tags":["Email Routing"],"operationId":"deleteEmailDestination","summary":"Delete a destination","description":"Removes the destination and DISABLES every rule and catch-all that\nused it, on every domain of the account. The mail hosts stop\nforwarding there within a minute.\n","responses":{"204":{"description":"Deleted."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/EmailDestinationNotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/email-routing/destinations/verify":{"post":{"tags":["Email Routing"],"operationId":"verifyEmailDestination","summary":"Verify a destination from its emailed link","description":"Consumes the token from the verification mail. No authentication —\nthe person clicking owns the destination mailbox and need not be an\nNSIN user; the single-use 256-bit token is the proof. Once verified,\nrules pointing at the destination go live within a minute.\n","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailVerifyRequest"}}}},"responses":{"200":{"description":"Verified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailVerifyResult"}}}},"400":{"description":"Malformed token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"The link expired or was already used.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"uptimeEvent":{"post":{"tags":["Uptime"],"operationId":"uptimeWebhookEvent","summary":"Uptime alert delivered to your webhook","description":"What NSIN sends to the webhook URL saved with `PUT /uptime/settings`\n(`webhook_url`, `notify_webhook: true`): one `outage.opened` when an\nincident opens on the domain, one `outage.resolved` when it resolves,\nand `test` for `POST /uptime/webhook/test`. Each incident sends each\nevent at most once.\n\n**Verify every request.** `X-Nsin-Signature` is\n`sha256=<hex HMAC-SHA256>` of `<X-Nsin-Timestamp>.<raw body>`, keyed\nwith the domain's signing secret (`GET /uptime/webhook`). The\ntimestamp is inside the MAC, so reject requests whose timestamp is too\nold to stop replays.\n\nAnswer with any `2xx` within 5 seconds. Anything else — another\nstatus, a timeout, a connection error — is retried twice, after 5 and\n30 seconds. Redirects are not followed, and a URL that resolves to a\nprivate or otherwise disallowed address is refused without retrying.\nEvery delivery is listed in `GET /uptime/webhook/deliveries`.\n","security":[],"parameters":[{"name":"X-Nsin-Event","in":"header","required":true,"description":"The event name, repeated from the body.","schema":{"type":"string","enum":["outage.opened","outage.resolved","test"]}},{"name":"X-Nsin-Timestamp","in":"header","required":true,"description":"When the request was signed, in unix seconds.","schema":{"type":"string","example":"1759050000"}},{"name":"X-Nsin-Signature","in":"header","required":true,"description":"`sha256=` followed by the hex HMAC-SHA256 of `<timestamp>.<raw body>`.","schema":{"type":"string"}},{"name":"User-Agent","in":"header","description":"Always `Nsin-Uptime-Webhook/1`.","schema":{"type":"string","const":"Nsin-Uptime-Webhook/1"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeWebhookEvent"}}}},"responses":{"2XX":{"description":"Delivery accepted. Any other answer counts as a failure and is retried."}}}},"mailEvent":{"post":{"tags":["Email Routing"],"operationId":"mailWebhookEvent","summary":"Mail arrival delivered to your webhook","description":"What NSIN sends to the mail webhook URL saved for a domain in the\npanel (*Email Routing → More options → Webhook*): one\n`mail.stored` when a message is kept in the inbox and one\n`mail.forwarded` when one is forwarded. `test` comes from the panel's\n*Send test* button. Metadata only — never the body or attachments.\nFor stored mail, open it with\n`GET /domains/{domain}/email-routing/inbox/{inbox_message_id}` and a\nkey that has **email:read**.\n\n**Verify every request.** `X-Nsin-Signature` is\n`sha256=<hex HMAC-SHA256>` of `<X-Nsin-Timestamp>.<raw body>`, keyed\nwith the webhook's signing secret (shown in the panel). Reject a\ntimestamp older than a few minutes to stop replays, and use\n`event_id` to drop a repeat.\n\n```python\nimport hashlib, hmac, time\n\ndef verify(secret: str, headers, body: bytes) -> bool:\n    ts = headers[\"X-Nsin-Timestamp\"]\n    if abs(time.time() - int(ts)) > 300:\n        return False\n    mac = hmac.new(secret.encode(), ts.encode() + b\".\" + body, hashlib.sha256)\n    return hmac.compare_digest(\"sha256=\" + mac.hexdigest(), headers[\"X-Nsin-Signature\"])\n```\n\nAnswer with any `2xx` within 5 seconds. Anything else — another\nstatus, a timeout, a connection error — is retried four more times,\nafter 30 seconds, 2 minutes, 10 minutes and 1 hour. A test is tried\nonce. The URL must be `https://`; redirects are not followed, and a URL\nthat resolves to a private, loopback, link-local or metadata address is\nrefused without retrying. At most 60 events per domain per minute are\nsent; more are skipped and the panel says so. Delivery runs in the\nbackground, so events may arrive out of order and a few seconds late.\n","security":[],"parameters":[{"name":"X-Nsin-Event","in":"header","required":true,"description":"The event name, repeated from the body.","schema":{"type":"string","enum":["mail.stored","mail.forwarded","test"]}},{"name":"X-Nsin-Event-Id","in":"header","required":true,"description":"The event's id, repeated from the body; the same on every retry.","schema":{"type":"string","example":"evt_3f9a0c1d2e4b5a6978c0d1e2"}},{"name":"X-Nsin-Timestamp","in":"header","required":true,"description":"When the request was signed, in unix seconds.","schema":{"type":"string","example":"1762992000"}},{"name":"X-Nsin-Signature","in":"header","required":true,"description":"`sha256=` followed by the hex HMAC-SHA256 of `<timestamp>.<raw body>`.","schema":{"type":"string"}},{"name":"User-Agent","in":"header","description":"Always `Nsin-Mail-Webhook/1`.","schema":{"type":"string","const":"Nsin-Mail-Webhook/1"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailWebhookEvent"}}}},"responses":{"2XX":{"description":"Delivery accepted. Any other answer counts as a failure and is retried."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"`Authorization: Bearer nsin_…`. The token is an NSIN API key, not a JWT.\n"},"apiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"`X-Api-Key: nsin_…`. Equivalent to the bearer form — use whichever suits\nyour client.\n"},"ssoAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"`Authorization: Bearer <access token>` where the token is an RS256 JWT\nissued by NSIN SSO (`POST /oauth/token`) — **not** an API key. Used by\nthe SSO endpoints of this reference, and by any NSIN endpoint when the\ntoken carries the `nsin:full` scope.\n"},"panelAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"The session token the NSIN panel holds after sign-in. Only the panel\nitself uses the endpoints marked with this scheme; they are documented\nso that an SSO integration can see what the browser step does.\n"}},"parameters":{"ResellerUserId":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"The id of one of your users."},"InboxMessageID":{"name":"id","in":"path","required":true,"description":"A stored message's `id` (from the inbox list or a `mail.stored` webhook).","schema":{"type":"integer","minimum":1}},"DomainName":{"name":"domain","in":"path","required":true,"description":"The domain **name** (for example `example.com`) — not a numeric id.\n","schema":{"type":"string"},"example":"example.com"},"DomainQuery":{"name":"domain","in":"query","required":true,"description":"The domain **name** (for example `example.com`). These endpoints take the\ndomain as a query parameter rather than a path segment.\n","schema":{"type":"string"},"example":"example.com"},"Period":{"name":"period","in":"query","description":"Time window, ending now. Time series are bucketed by minute for `1h`,\nby hour up to `48h`, and by day for `7d` and `30d`. Buckets are cut on\nAsia/Tehran (UTC+03:30) boundaries and emitted as UTC instants, so an\nhourly bucket starts at `:30` UTC. An unrecognised value falls back to\n`24h`.\n","schema":{"type":"string","enum":["1h","3h","6h","12h","24h","48h","7d","30d"],"default":"24h"}},"HostnameFilter":{"name":"hostname","in":"query","description":"Narrow to one subdomain. Matches the exact host, any subdomain of it, or\na bare label — so `example.com` matches `api.example.com`, and `api`\nmatches `api.example.com`, but `exam` matches neither.\n","schema":{"type":"string"}},"PathFilter":{"name":"path","in":"query","description":"Narrow to a URL path prefix.","schema":{"type":"string"}},"NodeFilter":{"name":"node","in":"query","description":"Narrow to one edge node. Use `name` from `GET /analytics/nodes`.","schema":{"type":"string"}},"TrafficRange":{"name":"range","in":"query","description":"The window, in whole Asia/Tehran days (UTC+03:30), ending today:\n`today` is today so far, `7d` today and the 6 days before it, `30d`\nand `90d` likewise. `custom` takes `from` and `to`. The window is\n`[Tehran midnight of the first day, min(Tehran midnight after the\nlast day, now))` — a Tehran day starts at 20:30 UTC the evening\nbefore.\n","schema":{"type":"string","enum":["today","7d","30d","90d","custom"],"default":"7d"}},"TrafficFrom":{"name":"from","in":"query","description":"First day of a `range=custom` window, inclusive: the Gregorian date\nof an Asia/Tehran calendar day. At most 400 days before today; the\nwindow spans at most 400 days. Refused with any other `range`.\n","schema":{"type":"string","format":"date","example":"2026-09-21"}},"TrafficTo":{"name":"to","in":"query","description":"Last day of a `range=custom` window, inclusive (a Tehran calendar\nday, `YYYY-MM-DD`). Not before `from`, not after today. When it is\ntoday the window ends now.\n","schema":{"type":"string","format":"date","example":"2026-09-27"}},"TrafficHostname":{"name":"hostname","in":"query","description":"Narrow to one hostname of the domain, as the `hostname` values these\nendpoints return (`host` keys, a file's `record`) — for example\n`*.example.com` for a wildcard record. Matched exactly, ignoring\ncase; unlike `HostnameFilter` it does not match subdomains.\n","schema":{"type":"string","example":"*.example.com"}},"RuleId":{"name":"ruleId","in":"path","required":true,"description":"Numeric id of the rule.","schema":{"type":"integer"}},"InviteId":{"name":"inviteId","in":"path","required":true,"description":"Numeric id of the invitation.","schema":{"type":"integer"}},"InviteToken":{"name":"token","in":"path","required":true,"description":"The invitation token from the accept link.","schema":{"type":"string"}},"RecordId":{"name":"recordId","in":"path","required":true,"description":"Numeric id of the DNS record.","schema":{"type":"integer"}},"GatewayId":{"name":"gatewayId","in":"path","required":true,"description":"Numeric id of the gateway, from the gateway list.","schema":{"type":"integer"}},"EmailRuleId":{"name":"ruleId","in":"path","required":true,"description":"Numeric id of the email address rule, from the rule list.","schema":{"type":"integer"}},"EmailDestinationId":{"name":"destinationId","in":"path","required":true,"description":"Numeric id of the email destination, from the destination list.","schema":{"type":"integer"}},"EmailRange":{"name":"range","in":"query","description":"Time window, ending now. `30m` buckets by minute, `24h` by hour, `7d`\nand `30d` by day. `custom` takes RFC 3339 `from` and `to` (at most 31\ndays apart) and picks the bucket from the span.\n","schema":{"type":"string","enum":["30m","24h","7d","30d","custom"],"default":"24h"}},"ImportSessionId":{"name":"sessionId","in":"path","required":true,"description":"Numeric id of the record import session. Sessions are resolved within\nthe domain, so an id from another domain reads as not found.\n","schema":{"type":"integer"}}},"responses":{"NotReseller":{"description":"The account is not an active reseller (or NSIN has frozen it), or the\nkey belongs to an NSIN SSO app limited to a few domains.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"notReseller":{"value":{"error":"forbidden"}}}}}},"ResellerUserNotFound":{"description":"No user with this id among yours.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"notFound":{"value":{"error":"user not found"}}}}}},"Unauthorized":{"description":"Missing, malformed, revoked or expired API key. (A valid key whose\naccount has been deactivated gets `403` `account is inactive` instead.)\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"invalidKey":{"value":{"error":"invalid API key"}}}}}},"Forbidden":{"description":"The key is read-only, your role on the domain lacks the required\npermission, or the domain's plan does not include the feature.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ReadOnlyKey":{"description":"The key is read-only and this endpoint is a write. Read-only keys may\nonly issue `GET`, `HEAD` and `OPTIONS`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"readOnly":{"value":{"error":"read-only API key"}}}}}},"DomainNotFound":{"description":"No such domain, or it is not visible to this account. Domains you cannot\naccess are reported as not found rather than forbidden.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RuleDomainNotFound":{"description":"No such domain, or your role on it does not permit this operation. The\nrules endpoints deliberately answer `404` rather than `403` for an\ninsufficient role, so they never confirm that a domain exists to someone\nwho cannot use it.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"notFound":{"value":{"error":"not found"}}}}}},"RuleNotFound":{"description":"The domain or the rule does not exist, the rule belongs to another\ndomain or another rule type, or your role does not permit this\noperation.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RuleInvalid":{"description":"Malformed body, an invalid field value, or `record_ids` containing a\nrecord that does not belong to this domain. Cache and header rules\nalso refuse `record_ids` naming a gateway record.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"foreignRecords":{"value":{"error":"record_ids do not belong to this domain"}}}}}},"RulePlanLimited":{"description":"The key is read-only, or the domain already holds as many rules of\nthis type as its plan allows (`max_rules_per_set`). A rule type the\nplan does not include is **not** refused here — the rule is saved\nswitched off.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"atCap":{"value":{"error":"You have reached the maximum number of rules for this domain's plan. Upgrade the plan for this domain to add more."}}}}}},"RulePlanLocked":{"description":"The request would switch on a rule whose type the domain's plan does\nnot include, or the domain has no active plan at all. Such a rule can\nbe created, edited and switched off, but it stays off until the plan\nincludes its type: buy or upgrade the domain's plan, then switch it on.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"locked":{"value":{"error":"This rule type is not on this domain's plan. The rule is saved switched off — buy or upgrade this domain's plan to switch it on."}},"noPlan":{"value":{"error":"This domain has no active plan. Buy a plan for this domain to switch rules on."}}}}}},"DomainQueryRequired":{"description":"The `domain` query parameter is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"missing":{"value":{"error":"domain is required"}}}}}},"UptimeMonitorInvalid":{"description":"The `domain` query parameter is missing, the body is malformed, a scope\nentry is too long, a regex entry does not compile, the monitor narrows\nnothing, or the domain is already at its monitor cap.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"notNarrowed":{"value":{"error":"a monitor must narrow something: set a subdomain scope or a path scope"}},"capReached":{"value":{"error":"a domain may have at most 10 uptime monitors"}}}}}},"UptimeMonitorNotFound":{"description":"No such monitor on this domain. A monitor id belonging to another domain\nis reported the same way, so an id can never be used to probe another\ntenant.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"notFound":{"value":{"error":"monitor not found"}}}}}},"AnalyticsPlanLimited":{"description":"The domain's plan does not include the feature this endpoint needs\n(`monitoring` for most sections, `logs` for raw and top-N request data).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"AnalyticsUnavailable":{"description":"Either the analytics backend is temporarily unreachable (retry; no data\nis lost), or the answer is still being computed. The per-domain\nsections and the cached account-wide views (`domains-overview`,\n`global-summary`, `global-summary/peak`, `requests-compare`,\n`bandwidth-overview`, `nodes-overview`) wait at most about 25 seconds\nfor their query; past that they answer `503` with `pending: true` and\na `Retry-After` header, while the query keeps running and caches its\nresult, so the retry is served from that cache instead of starting the\nsame scan again. Identical concurrent requests share one computation.\n","headers":{"Retry-After":{"description":"Seconds to wait before retrying. Sent only with `pending`.","schema":{"type":"integer","example":5}}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"pending":{"type":"boolean","description":"`true` when the query is still running rather than\nfailing. Retry after `Retry-After` seconds.\n"}}}]},"examples":{"unavailable":{"value":{"error":"analytics unavailable"}},"pending":{"value":{"error":"still computing — try again in a few seconds","pending":true}}}}}},"AnalyticsTimeout":{"description":"The query ran out of time for this period. Retrying the same request\nruns the same query again, so ask for a shorter `period` (or narrow it\nwith `hostname`/`path`) instead.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"timedOut":{"value":{"error":"summary timed out for this period; try a shorter one"}}}}}},"TrafficParamInvalid":{"description":"The `domain` query parameter is missing, or another parameter is not\nvalid: an unknown `range`, `from`/`to` without `range=custom` (or\nmissing with it), a date that is not `YYYY-MM-DD`, `to` before `from`\nor after today, a custom window over 400 days or starting more than\n400 days ago, `granularity=hour` on a window over 7 days, an unknown\n`split`, `compare`, `dim`, or a `limit` out of range.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"badRange":{"value":{"error":"range must be today, 7d, 30d, 90d or custom"}},"tooLong":{"value":{"error":"a custom window spans at most 400 days"}},"hourly":{"value":{"error":"granularity=hour needs a window of 7 days or less"}}}}}},"CheckAccepted":{"description":"Returned instead of the inline verdict to callers that are not API\nkeys (the panel, an NSIN SSO access token): the check keeps running in\nthe background — it can take up to a minute — and its result is read\nfrom `GET /domains/{domain}/checks`. A second call while one is running\nreturns the running job. The body may carry the endpoint's own extra\nfields (for example `next_check_at`).\n","content":{"application/json":{"schema":{"type":"object","properties":{"checking":{"type":"boolean","const":true},"check":{"$ref":"#/components/schemas/ManualCheck"},"message":{"type":"string","description":"What to show the user while the check runs."}},"additionalProperties":true}}}},"PlanRequired":{"description":"The domain has no active plan at all, so no plan feature is available\non it. Buy or renew a plan for the domain. (A plan that is active but\ndoes not include the feature answers `403` instead.)\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"noPlan":{"value":{"error":"This domain does not have an active plan."}}}}}},"CacheRegistryUnavailable":{"description":"The cache registry is temporarily unreachable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ImportSessionNotFound":{"description":"No such domain or import session, the session belongs to another domain,\nor the domain is not visible to this account.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"notFound":{"value":{"error":"import session not found"}}}}}},"ImportScanThrottled":{"description":"A scan for this domain ran less than five minutes ago. One scan is up to\nroughly 1100 outbound DNS queries, so it is throttled per domain — this\nis separate from, and additional to, the per-key rate limit. Wait\n`retry_after_seconds` and retry.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportScanThrottledError"},"examples":{"throttled":{"value":{"error":"a scan for this domain ran a moment ago; please wait before scanning again","retry_after_seconds":173}}}}}},"EmailRoutingPlanLimited":{"description":"The key is read-only, your role lacks the permission, the plan does not\ninclude Email Routing (`upgrade_url`), or the plan's `max_email_rules`\nis reached — the body then carries `max_rules` and `upgrade_url`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingPlanLimitedError"},"examples":{"atCap":{"value":{"error":"You have reached the maximum number of email addresses for this domain's plan. Upgrade the plan for this domain to add more.","max_rules":50,"upgrade_url":"/plans"}}}}}},"EmailRoutingConflict":{"description":"Something in the zone has to change first. `conflict` says what:\n`mx` (existing MX records, listed under `records` — re-send with\n`remove_existing_mx: true`), `spf` (an existing SPF record, with the\n`merged` preview — re-send with `merge_spf: true`), `spf_multiple`\n(two SPF records; keep one), `external_dns` (the domain does not use\nNSIN DNS) or `domain_status` (the domain is disabled).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingConflictError"},"examples":{"existingMX":{"value":{"error":"this domain already has MX records; enabling email routing replaces them","conflict":"mx","records":[{"id":12,"name":"@","content":"mail.example.ir.","priority":10}]}}}}}},"EmailRoutingNoPlan":{"description":"The domain has no active plan. The body carries `upgrade_url`.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingPlanLimitedError"},"examples":{"noPlan":{"value":{"error":"This domain does not have an active plan. Purchase a plan for this domain before adding email addresses.","upgrade_url":"/plans"}}}}}},"EmailRoutingNotEnabled":{"description":"Email routing is not enabled on this domain (`conflict: not_enabled`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRoutingConflictError"}}}},"EmailRoutingDNSWriteFailed":{"description":"The nameservers could not be updated; nothing was changed. Retry in a\nmoment.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"EmailRuleNotFound":{"description":"No such domain, or no such rule on it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"EmailDestinationNotFound":{"description":"No such destination on your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"EmailActivityUnavailable":{"description":"The activity log store is temporarily unreachable. Retry; no data is lost.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"unavailable":{"value":{"error":"activity log temporarily unavailable"}}}}}},"EmailVerifyThrottled":{"description":"The per-key rate limit, a verification mail to this destination less\nthan a minute ago (`cooldownSecondsRemaining`), or the account's or\nyour address's hourly send cap.\n","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"cooldownSecondsRemaining":{"type":"integer"}}}]}}}},"RateLimited":{"description":"The key exceeded its request budget (300 requests per minute by default).\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"limited":{"value":{"error":"rate limit exceeded"}}}}}}},"schemas":{"ResellerMe":{"type":"object","properties":{"user_id":{"type":"integer"},"status":{"type":"string","enum":["active"]},"balance_rials":{"type":"integer","format":"int64"},"credit_limit_rials":{"type":"integer","format":"int64","description":"How far below zero charges may take your wallet. 0 means prepaid only."},"spendable_rials":{"type":"integer","format":"int64","description":"Balance plus credit line."},"users":{"type":"integer"},"max_users":{"type":"integer"}}},"ResellerUserInput":{"type":"object","properties":{"label":{"type":"string","maxLength":128,"description":"Your own name for the account. Only you see it."},"name":{"type":"string","maxLength":128,"description":"The person's name."},"contact_email":{"type":"string","format":"email","description":"Where a login invite can go. Not the account's login until accepted."},"contact_phone":{"type":"string","description":"Where an SMS invite can go (Iranian mobile)."}}},"ResellerUser":{"type":"object","properties":{"id":{"type":"integer"},"label":{"type":"string"},"name":{"type":["string","null"]},"contact_email":{"type":"string"},"contact_phone":{"type":"string"},"invited_at":{"type":["string","null"],"format":"date-time","description":"When the last login invite was sent."},"login_accepted":{"type":"boolean","description":"The person accepted an invite and has their own login."},"billing_mode":{"type":"string","enum":["reseller","self"]},"balance_rials":{"type":"integer","format":"int64","description":"The user's own wallet."},"domains":{"type":"integer"},"suspended_domains":{"type":"integer","description":"Domains you suspended."},"created_at":{"type":"string","format":"date-time"}}},"ResellerDomain":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"user_id":{"type":"integer"},"status":{"type":"string"},"dns_mode":{"type":"string","enum":["managed","external"]},"suspended":{"type":"boolean","description":"Paused for billing (the payer's wallet stayed in debt)."},"reseller_suspended":{"type":"boolean","description":"Paused by you."},"created_at":{"type":"string","format":"date-time"}}},"ResellerSuspendResult":{"type":"object","properties":{"domains_changed":{"type":"integer"},"suspended":{"type":"boolean"}}},"ResellerMoveRequest":{"type":"object","required":["amount_rials","idempotency_key"],"properties":{"amount_rials":{"type":"integer","format":"int64","minimum":1},"idempotency_key":{"type":"string","maxLength":64,"description":"Unique per movement; reuse only to retry the same one."}}},"ResellerMove":{"type":"object","properties":{"amount_rials":{"type":"integer","format":"int64"},"reseller_balance_rials":{"type":"integer","format":"int64"},"account_balance_rials":{"type":"integer","format":"int64"},"reclaimable_rials":{"type":"integer","format":"int64","description":"What you could take back from this user now."},"already_applied":{"type":"boolean","description":"This key was used before; nothing moved this time."}}},"ResellerStatement":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"type":{"type":"string","description":"For example topup, purchase, traffic_usage, reseller_transfer_in, reseller_reclaim_out."},"amount_rials":{"type":"integer","format":"int64","description":"Positive for money in","negative for money out.":null},"balance_after":{"type":"integer","format":"int64"},"description":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}}},"reclaimable_rials":{"type":"integer","format":"int64"}}},"ResellerSpend":{"type":"object","properties":{"traffic_rials":{"type":"integer","format":"int64"},"plans_rials":{"type":"integer","format":"int64","description":"Plan and gateway-pack purchases."},"total_rials":{"type":"integer","format":"int64"},"paid_by_you_rials":{"type":"integer","format":"int64"},"traffic_bytes":{"type":"integer","format":"int64"}}},"ResellerUsage":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"First UTC day."},"to":{"type":"string","format":"date","description":"Last UTC day (today)."},"totals":{"$ref":"#/components/schemas/ResellerSpend"},"days":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"traffic_rials":{"type":"integer","format":"int64"},"plans_rials":{"type":"integer","format":"int64"}}}},"users":{"type":"array","description":"Highest spend first.","items":{"allOf":[{"type":"object","properties":{"user_id":{"type":"integer"}}},{"$ref":"#/components/schemas/ResellerSpend"}]}},"domains":{"type":"array","description":"Highest spend first.","items":{"allOf":[{"type":"object","properties":{"domain_id":{"type":"integer"},"name":{"type":"string"},"user_id":{"type":"integer"},"deleted":{"type":"boolean"}}},{"$ref":"#/components/schemas/ResellerSpend"}]}}}},"EmailRoutingCodedError":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable reason (`hosts_not_ready`, `kek_unset`, `loop`, `no_mx`, `unverified`)."},"field":{"type":"string","description":"The offending body field, when one applies."}}}]},"EmailRoutingConflictError":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"conflict":{"type":"string","description":"What conflicts (`mx`, `spf`, `spf_multiple`, `external_dns`, `domain_status`, `not_enabled`, `local_part`, `destination`)."},"records":{"type":"array","description":"For `mx` / `spf_multiple` — the rows in the way.","items":{"$ref":"#/components/schemas/EmailConflictRecord"}},"record_id":{"type":"integer","description":"For `spf` — the existing SPF row."},"content":{"type":"string","description":"For `spf` — its current value."},"merged":{"type":"string","description":"For `spf` — what it becomes with our include merged in."},"destination":{"$ref":"#/components/schemas/EmailDestination","description":"For `destination` — the existing row."}}}]},"EmailRoutingPlanLimitedError":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"max_rules":{"type":["integer","null"]},"upgrade_url":{"type":"string"}}}]},"EmailConflictRecord":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"content":{"type":"string"},"priority":{"type":"integer"}}},"EmailRoutingEnableRequest":{"type":"object","properties":{"remove_existing_mx":{"type":"boolean","description":"Agree to remove the domain's existing MX records (they are snapshotted for disable)."},"merge_spf":{"type":"boolean","description":"Agree to merge our include term into the domain's existing SPF record."}}},"EmailRoutingDisableRequest":{"type":"object","properties":{"restore_previous_mx":{"type":"boolean","description":"Re-create the MX records enable removed."}}},"EmailRoutingSettingsRequest":{"type":"object","properties":{"subaddressing":{"type":"boolean","description":"Match `user+tag@` against the `user@` rule."}}},"EmailPlatform":{"type":"object","description":"NSIN's mail platform — what the domain's records point at.","properties":{"mx_hosts":{"type":"array","description":"The MX targets published for the domain.","items":{"type":"object","properties":{"host":{"type":"string"},"priority":{"type":"integer"}}}},"spf_include":{"type":"string","description":"The name the domain's SPF record must `include:`."},"forward_domain":{"type":"string","description":"Domain the forwarded mail's envelope sender is rewritten to (SRS)."}}},"EmailDNSRecord":{"type":"object","properties":{"type":{"type":"string","enum":["MX","TXT"],"description":"Record type."},"name":{"type":"string","description":"Relative to the domain; `@` is the apex."},"content":{"type":"string","description":"The value the record must have."},"priority":{"type":"integer","description":"MX priority."},"ttl":{"type":"integer","description":"TTL in seconds."},"state":{"type":"string","enum":["ok","missing","extra","unchecked"],"description":"`extra` is a foreign MX or a second SPF seen publicly."},"record_id":{"type":"integer","description":"The managed record's id, when the row is ours."}}},"EmailRoutingStatus":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether Email Routing is switched on for the domain."},"status":{"type":"string","enum":["unconfigured","ready","misconfigured","unlocked","suspended"],"description":"`unconfigured` — not enabled. `ready` — enabled, and the zone\ncarries the MX, SPF and DKIM records mail needs. `misconfigured` —\nenabled, but the last DNS check found a record missing or a\nforeign one in the way (see `dns`). `unlocked` — the managed\nrecords were unlocked for editing (`POST .../email-routing/unlock`).\n`suspended` — forwarding is paused by NSIN (`suspended_reason` says\nwhy).\n"},"hosts_ready":{"type":"boolean","description":"At least one mail host has checked in recently. Enable is refused while false."},"locked":{"type":"boolean","description":"The managed records are not editable."},"subaddressing":{"type":"boolean","description":"`user+tag@` addresses are delivered to the `user@` rule. Set with `PUT .../email-routing/settings`."},"suspended_reason":{"type":"string","description":"Why forwarding is suspended — `over_cap` when the plan's daily forward allowance is used up, otherwise NSIN's note. Empty when not suspended."},"catch_all":{"$ref":"#/components/schemas/EmailCatchAll"},"dns":{"type":"object","description":"The DNS records mail needs, and what the last check found.","properties":{"checked_at":{"type":["string","null"],"format":"date-time","description":"When DNS was last checked; `null` before the first check."},"ok":{"type":"boolean","description":"Every required record was found and nothing conflicting was."},"records":{"type":"array","items":{"$ref":"#/components/schemas/EmailDNSRecord"}},"problems":{"type":"array","items":{"type":"string"},"description":"Human-readable findings of the last check."}}},"conflicts":{"type":["object","null"],"description":"Only while unconfigured — what enable would have to remove or merge.","properties":{"mx":{"type":"array","items":{"$ref":"#/components/schemas/EmailConflictRecord"}},"spf":{"type":["object","null"],"properties":{"record_id":{"type":"integer"},"content":{"type":"string"},"merged":{"type":"string"}}},"spf_multiple":{"type":"boolean"}}},"previous_mx_available":{"type":"boolean","description":"Enable removed MX records that disable can restore."},"counts_24h":{"$ref":"#/components/schemas/EmailCounts"},"limits":{"type":"object","description":"The plan's Email Routing allowances and today's use.","properties":{"max_rules":{"type":["integer","null"],"description":"Custom addresses the plan allows on this domain. `null` means unlimited."},"rules_used":{"type":"integer","description":"Custom addresses the domain holds now."},"max_forwards_per_day":{"type":["integer","null"],"description":"Messages the plan lets this domain forward per UTC day. `null` means unlimited."},"forwards_today":{"type":"integer","description":"Messages forwarded so far today (UTC)."}}},"sending":{"$ref":"#/components/schemas/EmailSendingStatus"},"inbox":{"type":"object","description":"The domain's inbox (keeping mail on its addresses; plans with the inbox).","properties":{"allowed":{"type":"boolean","description":"New mail may be kept: the plan has the inbox and it is on for the platform."},"plan_enabled":{"type":"boolean"},"ready":{"type":"boolean","description":"A mail host can keep mail right now."},"used_bytes":{"type":"integer"},"cap_bytes":{"type":["integer","null"],"description":"null = no limit."},"has_messages":{"type":"boolean","description":"The domain has kept mail (readable even when the plan no longer has the inbox)."}}},"dkim":{"type":"object","description":"Always present. Before Email Routing is enabled the selector and name are already known (they come from platform settings) and `txt` is empty, because the key is generated at enable time.","properties":{"selector":{"type":"string","description":"The DKIM selector."},"name":{"type":"string","description":"The TXT name relative to the domain."},"txt":{"type":"string","description":"The DKIM TXT value (`v=DKIM1; …`). Empty until enabled."}}},"platform":{"$ref":"#/components/schemas/EmailPlatform"}}},"EmailRoutingSetupRequest":{"type":"object","required":["local_part","destination_email"],"properties":{"local_part":{"type":"string","description":"The part before @ of the first address, e.g. `info`."},"destination_email":{"type":"string","format":"email","description":"The inbox its mail is forwarded to."},"remove_existing_mx":{"type":"boolean","default":false,"description":"Agree to replace the domain's existing MX records."},"merge_spf":{"type":"boolean","default":false,"description":"Merge NSIN's include into the domain's existing SPF record."}}},"EmailRoutingSetupResult":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/EmailRoutingStatus"},"rule":{"$ref":"#/components/schemas/EmailRule"},"destination":{"$ref":"#/components/schemas/EmailDestination"}}},"EmailSendingStatus":{"type":"object","description":"Whether this domain may send mail right now, and how much of today's allowance is used.","properties":{"plan_enabled":{"type":"boolean","description":"The plan includes sending (`email_sending_enabled`)."},"allowed":{"type":"boolean","description":"A send would be accepted now (limits aside)."},"reason":{"type":"string","description":"Why not, when `allowed` is false: `platform_off`, `plan`, `not_enabled` or `suspended`. Empty otherwise."},"max_per_day":{"type":["integer","null"],"description":"Recipients the plan lets this domain send to per UTC day. `null` means unlimited."},"sent_today":{"type":"integer","description":"Recipients queued so far today (UTC)","whatever became of them.":null},"max_recipients":{"type":"integer","description":"Recipients allowed in one message."},"max_text_kb":{"type":"integer","description":"Largest message text","in KB.":null},"max_subject":{"type":"integer","description":"Longest subject","in characters.":null}}},"EmailSendRequest":{"type":"object","required":["from_local","to","subject","text"],"properties":{"from_local":{"type":"string","description":"The part before @ of the sender. Must be an existing, switched-on address on the domain."},"from_name":{"type":"string","maxLength":64,"description":"Optional display name shown next to the sender address."},"to":{"type":"array","minItems":1,"items":{"type":"string","format":"email"},"description":"Recipients. Duplicates are sent once."},"subject":{"type":"string","maxLength":200},"text":{"type":"string","description":"The message as plain UTF-8 text."},"in_reply_to":{"type":"integer","description":"Optional: the id of a mail in this domain's inbox being answered. The message then carries In-Reply-To / References with that mail's Message-ID."}}},"EmailSentMessage":{"type":"object","description":"One recipient of one sent message.","properties":{"id":{"type":"integer"},"group_id":{"type":"string","description":"Shared by the recipients of one send."},"from":{"type":"string","description":"The sender address."},"from_name":{"type":"string"},"to":{"type":"string","description":"This row's recipient."},"subject":{"type":"string"},"status":{"type":"string","enum":["queued","sending","sent","failed"],"description":"`queued` with `attempts` above 0 is a soft failure waiting for its next try."},"attempts":{"type":"integer","description":"Delivery attempts so far."},"smtp_code":{"type":"integer","description":"The receiving server's last reply code. 0 before the first attempt."},"response":{"type":"string","description":"The receiving server's last reply text."},"tls":{"type":"string","description":"TLS version of the last delivery connection","empty if none.":null},"created_at":{"type":"string","format":"date-time"},"sent_at":{"type":["string","null"],"format":"date-time"},"next_try_at":{"type":["string","null"],"format":"date-time","description":"When a soft failure is tried again."}}},"EmailCounts":{"type":"object","properties":{"received":{"type":"integer","description":"Every message except discarded bounces."},"forwarded":{"type":"integer","description":"Messages delivered to a destination."},"dropped":{"type":"integer","description":"Messages accepted and discarded by a `drop` rule or catch-all."},"rejected":{"type":"integer","description":"Messages refused."},"deferred":{"type":"integer","description":"Messages temporarily refused (the sender retries), for example over the daily forward cap."},"stored":{"type":"integer","description":"Messages kept in the domain's inbox and not forwarded (`store`, or `forward_store` whose forward failed)."},"sent":{"type":"integer","description":"Recipients that mail sent from this domain (the send endpoint) was delivered to. Present on the status counters only."}}},"EmailCatchAll":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether the catch-all handles mail for addresses you have not created. Off, such mail is refused as an unknown user."},"action":{"type":"string","enum":["forward","drop","store","forward_store"],"description":"`forward` to the destination, `drop` (accept and discard), `store` (keep in the domain's inbox; plans with the inbox) or `forward_store` (both)."},"destination_id":{"type":["integer","null"],"description":"The destination for `forward`."},"destination_email":{"type":["string","null"],"description":"That destination's address."},"destination_verified":{"type":"boolean","description":"Whether the destination has confirmed its address."}}},"EmailCatchAllRequest":{"type":"object","properties":{"enabled":{"type":"boolean"},"action":{"type":"string","enum":["forward","drop","store","forward_store"]},"destination_id":{"type":"integer","description":"Required when `action` is `forward` or `forward_store`; a verified destination on the owner's account."}}},"EmailRule":{"type":"object","properties":{"id":{"type":"integer"},"local_part":{"type":"string","description":"The part before the `@`, lowercased."},"address":{"type":"string","description":"The full address, `local_part@domain`."},"action":{"type":"string","enum":["forward","drop","store","forward_store"],"description":"`forward` delivers to the destination; `drop` accepts the mail and discards it; `store` keeps it in the domain's inbox; `forward_store` does both. The two inbox actions need a plan with the inbox (403 `plan_required` otherwise)."},"destination_id":{"type":["integer","null"],"description":"The destination mail is forwarded to. `null` for `drop`."},"destination_email":{"type":["string","null"],"description":"That destination's address."},"destination_verified":{"type":"boolean","description":"Whether the destination has confirmed its address; unverified destinations receive nothing."},"enabled":{"type":"boolean","description":"Your switch."},"active":{"type":"boolean","description":"Whether the address is live right now — enabled, routing on for the\ndomain, and (for `forward` / `forward_store`) the destination verified.\n"},"inbox_ready":{"type":"boolean","description":"Whether a mail host can keep mail right now. `store` / `forward_store` addresses wait for one otherwise."},"name":{"type":"string","description":"Optional label."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"EmailRuleRequest":{"type":"object","properties":{"local_part":{"type":"string","description":"The part before the `@`: ASCII letters, digits and ``!#$%&'*+/=?^_`{|}~.-``, up to 64 characters, lowercased on save. A `+` is allowed only while subaddressing is on for the domain."},"action":{"type":"string","enum":["forward","drop","store","forward_store"],"description":"What to do with mail to the address. Defaults to `forward`."},"destination_id":{"type":"integer","description":"Required for `forward` and `forward_store`; from the domain owner's account."},"name":{"type":"string","maxLength":256},"enabled":{"type":"boolean","description":"Update only; create always starts enabled."}}},"EmailSummary":{"type":"object","properties":{"range":{"type":"string"},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"bucket":{"type":"string","enum":["minute","hour","day"]},"totals":{"$ref":"#/components/schemas/EmailCounts"},"sent":{"type":"integer","description":"Recipients that mail sent from this domain was delivered to","over the same range.":null},"series":{"type":"array","items":{"allOf":[{"type":"object","properties":{"t":{"type":"string","format":"date-time"}}},{"$ref":"#/components/schemas/EmailCounts"}]}}}},"EmailEvent":{"type":"object","description":"One recipient transaction on a mail host.","properties":{"event_time":{"type":"string","format":"date-time","description":"When it happened (UTC)."},"node":{"type":"string","description":"The mail host."},"session_id":{"type":"string","description":"SMTP session id on the mail host; one session can carry several transactions."},"txn_id":{"type":"string","description":"The transaction within the session."},"domain_id":{"type":"integer"},"domain":{"type":"string"},"rule_id":{"type":"integer","description":"The rule that matched, 0 for none / catch-all."},"message_id":{"type":"string","description":"The message's `Message-ID` header."},"from_addr":{"type":"string","description":"Envelope sender (`MAIL FROM`)."},"from_domain":{"type":"string","description":"Domain part of the envelope sender."},"to_addr":{"type":"string","description":"Envelope recipient on your domain."},"destination":{"type":"string","description":"Where it was forwarded."},"subject":{"type":"string","description":"Truncated to 128; absent while subject logging is off."},"status":{"type":"string","enum":["forwarded","dropped","rejected","deferred","bounce_dropped","stored"]},"action":{"type":"string","enum":["forward","drop","store","forward_store","catch_all","srs_bounce","none"]},"reject_stage":{"type":"string","description":"`connect | rbl | helo | mailfrom | rcpt | data | auth | loop | upstream | quota`, or empty."},"spf":{"type":"string","description":"SPF verdict for the incoming message."},"dkim":{"type":"string","description":"DKIM verdict for the incoming message."},"dmarc":{"type":"string","description":"DMARC verdict for the incoming message."},"dmarc_policy":{"type":"string","description":"The sender domain's published DMARC policy."},"arc":{"type":"string","description":"ARC verdict for the incoming message."},"error_code":{"type":"string","description":"The SMTP code returned to the sender."},"error_detail":{"type":"string","description":"The receiving server's text, when it refused."},"client_ip":{"type":"string","description":"Address of the server that sent the message to NSIN."},"client_helo":{"type":"string","description":"The name that server gave in `HELO`/`EHLO`."},"client_ptr":{"type":"string","description":"Reverse DNS name of `client_ip`."},"rbl_zone":{"type":"string","description":"The DNS blocklist that listed the sender, when one caused the rejection."},"size":{"type":"integer","description":"Message size in bytes."},"spam_score":{"type":"number","description":"Spam filter score."},"is_spam":{"type":"integer","enum":[0,1],"description":"`1` when the spam filter flagged the message."},"tls_in":{"type":"string","description":"TLS used by the sending server; empty for plain SMTP."},"tls_out":{"type":"string","description":"TLS used when forwarding; empty when none."},"tls_out_verified":{"type":"integer","enum":[0,1],"description":"`1` when the forwarding connection verified the receiving server's certificate."},"upstream_mx":{"type":"string","description":"The destination's mail server the message was handed to."},"upstream_ip":{"type":"string","description":"That server's address."},"egress_ip":{"type":"string","description":"The NSIN address the message left from."},"duration_ms":{"type":"integer","description":"Transaction time in milliseconds."},"upstream_ms":{"type":"integer","description":"Time spent with the destination's server, in milliseconds."},"attempts":{"type":"integer","description":"Delivery attempts made to the destination."}}},"InboxMessageSummary":{"type":"object","description":"One stored message as the list shows it.","properties":{"id":{"type":"integer","description":"Use it with `GET …/inbox/{id}`."},"rcpt":{"type":"string","description":"The address it was sent to on your domain."},"mailbox":{"type":"string","description":"The local part of `rcpt` (`info`)."},"from":{"type":"string","description":"The From header."},"mail_from":{"type":"string","description":"The envelope sender."},"subject":{"type":"string"},"sent_at":{"type":["string","null"],"format":"date-time","description":"The Date header","when it parsed.":null},"created_at":{"type":"string","format":"date-time","description":"When it arrived."},"size":{"type":"integer","description":"Size in bytes."},"has_attachments":{"type":"boolean"},"read":{"type":"boolean"},"folder":{"type":"string","enum":["inbox","spam","trash"]},"is_spam":{"type":"boolean"},"auth":{"type":"object","description":"What NSIN checked on arrival.","properties":{"spf":{"type":"string"},"dkim":{"type":"string"},"dmarc":{"type":"string"}}}}},"InboxList":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/InboxMessageSummary"}},"total":{"type":"integer"},"page":{"type":"integer"},"per_page":{"type":"integer"},"unread":{"type":"object","description":"Unread counts per folder.","properties":{"inbox":{"type":"integer"},"spam":{"type":"integer"}}},"mailboxes":{"type":"array","items":{"type":"string"}},"usage":{"type":"object","properties":{"used_bytes":{"type":"integer"},"cap_bytes":{"type":["integer","null"],"description":"`null` = no cap."}}}}},"InboxMessage":{"allOf":[{"$ref":"#/components/schemas/InboxMessageSummary"},{"type":"object","properties":{"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"reply_to":{"type":"array","items":{"type":"string"}},"message_id":{"type":"string","description":"The Message-ID header."},"headers":{"type":"array","description":"The headers in order. Authentication-Results not written by NSIN are removed.","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"text":{"type":"string","description":"The plain-text body (or text made from the HTML)."},"html":{"type":"string","description":"Sanitised HTML; empty when the mail has none."},"html_has_remote":{"type":"boolean","description":"The HTML referred to remote images","which were removed.":null},"attachments":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"Use it with `…/attachments/{index}`."},"filename":{"type":"string"},"content_type":{"type":"string"},"size":{"type":"integer"},"dangerous":{"type":"boolean","description":"An executable or script type."}}}},"warnings":{"type":"array","description":"Things to be careful about, such as `foreign_auth_results` or `link_mismatch`.","items":{"type":"string"}},"spam_score":{"type":"number"}}}]},"MailWebhookEvent":{"type":"object","description":"The body of a mail webhook request. Signed as described in the\n`mailEvent` webhook.\n","required":["event","event_id","domain","status","received_at","sent_at"],"properties":{"event":{"type":"string","enum":["mail.stored","mail.forwarded","test"]},"event_id":{"type":"string","description":"Unique per event; the same on every retry."},"domain":{"type":"string","example":"example.com"},"status":{"type":"string","enum":["stored","forwarded","test"]},"message_id":{"type":"string","description":"The Message-ID header, `<…>` included."},"from":{"type":"string","description":"The From header for stored mail; the envelope sender for forwarded mail."},"mail_from":{"type":"string","description":"The envelope sender."},"to":{"type":"string","description":"The address on your domain the mail was sent to."},"subject":{"type":"string","description":"Empty for forwarded mail while subject logging is off."},"size":{"type":"integer","description":"Size in bytes."},"received_at":{"type":"string","format":"date-time"},"inbox_message_id":{"type":["integer","null"],"description":"For `mail.stored`: the id to open with `GET /domains/{domain}/email-routing/inbox/{id}`. `null` otherwise."},"folder":{"type":"string","enum":["inbox","spam"],"description":"For `mail.stored`: where it was put."},"txn":{"type":"string","description":"The mail transaction id","as in the activity log.":null},"sent_at":{"type":"string","format":"date-time","description":"When this attempt was sent."}},"example":{"event":"mail.stored","event_id":"evt_3f9a0c1d2e4b5a6978c0d1e2","domain":"example.com","status":"stored","message_id":"<CAF1234@mail.sender.example>","from":"Alice <alice@sender.example>","mail_from":"alice@sender.example","to":"info@example.com","subject":"Order 1042","size":18342,"received_at":"2026-11-13T09:30:12Z","inbox_message_id":5821,"folder":"inbox","txn":"7c2e1a90b3","sent_at":"2026-11-13T09:30:13Z"}},"EmailActivity":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/EmailEvent"}},"page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}},"EmailDestination":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string"},"verified":{"type":"boolean","description":"Whether the address was confirmed through the emailed link."},"verified_at":{"type":["string","null"],"format":"date-time","description":"When it was confirmed."},"created_at":{"type":"string","format":"date-time"},"last_sent_at":{"type":["string","null"],"format":"date-time","description":"When the last verification mail went out."},"resend_cooldown_seconds":{"type":"integer","description":"Seconds until another verification mail may be sent; 0 when allowed now."},"in_use":{"type":"integer","description":"Rules and catch-alls pointing at it."},"last_failure":{"type":"string","description":"The receiving server's last refusal, when forwards to it are bouncing."},"last_failure_at":{"type":["string","null"],"format":"date-time","description":"When `last_failure` was recorded."}}},"EmailDestinationRequest":{"type":"object","required":["email"],"properties":{"email":{"type":"string","description":"A bare ASCII address, at most 254 characters."}}},"EmailDestinationCreated":{"type":"object","properties":{"destination":{"$ref":"#/components/schemas/EmailDestination"},"resend_cooldown_seconds":{"type":"integer"}}},"EmailVerifyRequest":{"type":"object","required":["token"],"properties":{"token":{"type":"string","description":"The 64-character token from the emailed link."}}},"EmailVerifyResult":{"type":"object","properties":{"email":{"type":"string"},"verified":{"type":"boolean"}}},"CustomNSStatus":{"type":"object","properties":{"available":{"type":"boolean","description":"The platform offers custom name servers."},"plan_allows":{"type":"boolean","description":"The domain's plan includes them (Enterprise)."},"can_enable":{"type":"boolean","description":"The domain is active on NSIN's name servers."},"suffix":{"type":"string","description":"What follows each name","e.g. `.example.com`.":null},"labels":{"type":"array","items":{"type":"string"},"description":"The current names' first labels","or the defaults.":null},"state":{"type":"string","enum":["","on","turning_off"]},"status":{"type":"string","enum":["waiting","working","wrong_ip","no_ip","other","checking"],"description":"`waiting`: the registrar still shows NSIN's names. `working`: it shows\nyours with the right IPs. `wrong_ip`: it has another IP for the hosts\nin `wrong_ip`. `no_ip`: it has the names but no IPs. `other`:\nsomething else. `checking`: no answer yet.\n"},"names":{"type":"array","items":{"type":"object","properties":{"host":{"type":"string","examples":["ns1.example.com"]},"ip":{"type":"string","examples":["198.51.100.10"]}}}},"wrong_ip":{"type":["array","null"],"items":{"type":"string"}},"old_ns":{"type":"array","items":{"type":"string"},"description":"The names to put back at the registrar when turning off."},"min_names":{"type":"integer"},"max_names":{"type":"integer"}}},"Error":{"type":"object","description":"The single error shape used by every endpoint.","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable description of what went wrong."}},"examples":[{"error":"read-only API key"}]},"DomainAccess":{"type":"object","description":"Which domains a client-bound credential (NSIN SSO) may touch. `all`\ntrue means every domain, including ones added later. Otherwise\n`domain_ids` is the selection as stored and `domains` names the live\nones among them; an empty selection is what a revoked grant leaves\nbehind. `GET /whoami` reports it for SSO tokens and app-minted keys.\n","required":["all"],"properties":{"all":{"type":"boolean"},"domain_ids":{"type":"array","items":{"type":"integer"}},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}}}}},"WhoAmI":{"type":"object","description":"The calling credential, as `GET /whoami` resolves it.","required":["user_id","auth","read_only","admin"],"properties":{"user_id":{"type":"integer","description":"The account the credential acts for."},"auth":{"type":"string","enum":["key","sso","jwt"],"description":"Kind of credential: `key` an `nsin_` API key, `sso` an NSIN SSO\naccess token, `jwt` the panel's own session.\n"},"read_only":{"type":"boolean","description":"`true` only for a read-only API key. SSO tokens are limited by\nscope and domain selection, not read-limited, so they report\n`false`.\n"},"admin":{"type":"boolean","description":"Whether the account is NSIN staff."},"key_id":{"type":"integer","description":"The API key's id. Present only when `auth` is `key`."},"client_id":{"type":"string","description":"The NSIN SSO client the credential is bound to: the client an SSO\ntoken was issued to, or the app that minted this API key. Absent\nfor keys you created yourself in the panel.\n"},"scope":{"type":"string","description":"Space-separated scopes granted to an SSO token. Present only when `auth` is `sso`."},"domain_access":{"allOf":[{"$ref":"#/components/schemas/DomainAccess"}],"description":"The domains a client-bound credential may touch. Absent for panel\nsessions and for keys you created yourself, which carry no domain\nrestriction.\n"},"grant_revoked":{"type":"boolean","description":"Present, and `true`, when the user has revoked the SSO grant behind\nthis credential: it can no longer see any domain.\n"}}},"OAuthError":{"type":"object","description":"The RFC 6749 error shape, used by the NSIN SSO endpoints only. It is\ndeliberately different from `Error`: OAuth clients match on the machine\n`error` code, and only show `error_description` to a developer.\n","required":["error"],"properties":{"error":{"type":"string","description":"The machine-readable code.","example":"invalid_grant"},"error_description":{"type":"string","description":"A human-readable explanation. Never match on this."}},"examples":[{"error":"invalid_grant","error_description":"authorization code is invalid or expired"}]},"OAuthTokenRequest":{"type":"object","description":"The union of both grant types. Send it form-encoded or as JSON.\n","required":["grant_type","client_id"],"properties":{"grant_type":{"type":"string","enum":["authorization_code","refresh_token"]},"client_id":{"type":"string"},"client_secret":{"type":"string","description":"Confidential clients only, and only when not using HTTP Basic. A\npublic client never sends one.\n"},"code":{"type":"string","description":"`authorization_code` only — the value from the redirect."},"redirect_uri":{"type":"string","description":"`authorization_code` only — must equal the one the code was issued for."},"code_verifier":{"type":"string","description":"`authorization_code` only. The PKCE verifier, 43–128 characters from\n`[A-Za-z0-9._~-]`, whose SHA-256 produced the `code_challenge`.\n"},"refresh_token":{"type":"string","description":"`refresh_token` only."},"scope":{"type":"string","description":"`refresh_token` only, and optional: narrows the new token. It can\nnever widen — asking for more than was granted is `invalid_scope`.\n"}}},"OAuthRevokeRequest":{"type":"object","required":["token","client_id"],"properties":{"token":{"type":"string","description":"The refresh token to revoke."},"client_id":{"type":"string"},"client_secret":{"type":"string","description":"Required for confidential clients; without it the call is a silent no-op."}}},"Message":{"type":"object","properties":{"message":{"type":"string"}},"examples":[{"message":"deleted"}]},"Role":{"type":"string","description":"Your role on a domain. `owner` is implicit for the domain's creator and\nfor global admins; the other three are grantable via sharing.\n","enum":["owner","admin","editor","viewer"]},"Permission":{"type":"string","description":"One capability on a domain.","enum":["domain.view","domain.settings","domain.delete","records.edit","rules.edit","cache.edit","ssl.manage","analytics.view","billing","members.manage"]},"DomainStatus":{"type":"string","description":"* `pending` — waiting to be activated: a managed domain for its\n  nameservers to point at NSIN (disabled after 28 days without that),\n  an external-DNS domain for its verification record (3-day window).\n* `failed` — an external-DNS domain whose 3-day verification window ran\n  out. Start a new window with `POST /domains/{domain}/verify/retry`.\n* `active` — serving.\n* `moved` — was active, but the delegation (managed) or the\n  verification record (external) is gone. The domain keeps serving for\n  a 3-day grace window, then is disabled; putting it back reactivates\n  it at the next check.\n* `disabled` — not serving: zone removed, records un-proxied, cache\n  purged. Re-enable with `POST /domains/{domain}/enable`.\n* `banned` — administratively blocked.\n","enum":["pending","failed","active","moved","disabled","banned"]},"Domain":{"type":"object","description":"A domain and its edge configuration.","properties":{"id":{"type":"integer"},"name":{"type":"string","examples":["example.com"]},"status":{"$ref":"#/components/schemas/DomainStatus"},"dns_mode":{"type":"string","enum":["managed","external"],"description":"`managed` — NSIN hosts the DNS zone. `external` — you host DNS\nelsewhere and prove ownership with a TXT record.\n"},"user_id":{"type":"integer","description":"Id of the owning user."},"verification_started_at":{"type":"string","format":"date-time","description":"External-DNS domains: when the current 3-day verification window\nopened (at creation, on a switch to `external`, on re-enable and on\n`verify/retry`).\n"},"cache_l2_max_gb":{"type":"integer","description":"Per-domain cap on disk (L2) cache size, in GB."},"cache_l2_ttl_days":{"type":"integer","minimum":1,"maximum":7,"description":"How long a disk-cache entry may live, in days. Maximum 7."},"cache_cap_mb":{"type":"integer","enum":[128,256,512,2048,4096],"description":"Largest response body NSIN will buffer and cache, in MB. Bigger\nresponses stream straight from origin and are never cached. The\nselectable ceiling depends on the domain's plan.\n"},"developer_mode_until":{"type":"string","format":"date-time","description":"While set and in the future, the edge bypasses cache reads and writes\nfor this domain and passes the origin's own error responses through\n(see `POST /domains/{domain}/developer-mode`). Absent when developer\nmode is off.\n"},"pending_since":{"type":"string","format":"date-time","description":"When the domain last entered `pending`."},"moved_since":{"type":"string","format":"date-time","description":"When the domain went `moved`; the 3-day grace window counts from here."},"next_check_at":{"type":"string","format":"date-time","description":"When the background nameserver checker will next look at this domain."},"last_manual_ns_check_at":{"type":"string","format":"date-time","description":"Last user-triggered nameserver check; these are limited to one per hour."},"last_manual_verify_at":{"type":"string","format":"date-time","description":"Last user-triggered verification check (`POST /domains/{domain}/verify`); limited to one per minute."},"under_attack":{"type":"boolean","description":"Under Attack Mode is switched on (see `GET /domains/{domain}/under-attack`)."},"under_attack_bypass_paths":{"type":["array","null"],"items":{"type":"string"},"description":"Under Attack Mode's bypass paths."},"under_attack_bypass_ips":{"type":["array","null"],"items":{"type":"string"},"description":"Under Attack Mode's bypass IPs, CIDRs and ranges."},"under_attack_bypass_hosts":{"type":["array","null"],"items":{"type":"string"},"description":"Under Attack Mode's bypass hosts (wildcard patterns)."},"under_attack_since":{"type":["string","null"],"format":"date-time","description":"When Under Attack Mode was switched on."},"under_attack_until":{"type":["string","null"],"format":"date-time","description":"When Under Attack Mode switches itself off; null = no timer."},"shield_dismissed_at":{"type":"string","format":"date-time","description":"Set when the default \"NSIN Shield\" WAF rule was deleted from this\ndomain. While set, the rule is not re-created automatically;\n`POST /domains/{domain}/rules/waf/shield/restore` brings it back and\nclears this.\n"},"sec_no_sniff":{"type":"boolean","description":"Send `X-Content-Type-Options: nosniff`. Off by default — it can break\nan origin that mislabels asset MIME types.\n"},"sec_referrer_policy":{"type":"boolean","description":"Send `Referrer-Policy: strict-origin-when-cross-origin`."},"sec_strip_headers":{"type":"boolean","description":"Strip origin fingerprint headers from responses."},"hsts_enabled":{"type":"boolean","description":"Send `Strict-Transport-Security`, telling browsers to use HTTPS only\nfor this domain. Off by default.\n\n**This one cannot be undone.** A browser that has seen the header\nrefuses plain HTTP for the whole `hsts_max_age_sec` even after the\nheader stops being sent; switching it off only stops new visitors\nfrom being pinned. Enable it only when every path on the domain\nworks over HTTPS. The edge's value replaces an origin's own\n`Strict-Transport-Security` header (a browser reads only the first\none it receives).\n"},"hsts_max_age_sec":{"type":"integer","enum":[0,300,3600,86400,604800,2592000,31536000],"description":"How long browsers keep enforcing HTTPS, in seconds. `0` is\n\"never set\". Only the listed values are accepted, and this API\nraises it **one step at a time** — from 0 the only allowed next\nvalue is 300, then 3600, and so on. Lowering it is always allowed\nand is the way back out. The edge treats anything under 300 as off.\nTurning `hsts_enabled` on while this is `0` sets it to 300.\n"},"hsts_include_subdomains":{"type":"boolean","description":"Add `includeSubDomains`, applying the rule to every subdomain,\nincluding ones created later. A subdomain not served over HTTPS\nbecomes unreachable for visitors who have seen the header.\n"},"hsts_preload":{"type":"boolean","description":"Add the `preload` directive, the prerequisite for submitting the\ndomain at hstspreload.org. Requires `hsts_enabled`,\n`hsts_include_subdomains` and `hsts_max_age_sec` of 31536000.\n\nEffectively permanent: getting off the browser preload list means\nasking hstspreload.org to delist the domain and waiting for people\nto update their browsers. If a precondition is later removed, this\nflag is cleared with it.\n"},"min_tls_version":{"type":"string","enum":["1.2","1.3"],"description":"Lowest TLS version a visitor may connect with. `1.2` (default)\naccepts TLS 1.2 and 1.3; `1.3` refuses TLS 1.2 handshakes. Nothing\nbelow 1.2 is offered on any domain. It is enforced during the TLS\nhandshake from the SNI, so a client below the minimum gets a\nconnection error rather than an HTTP response. HTTP/3 is TLS 1.3 by\ndefinition and is unaffected.\n"},"markdown_for_agents":{"type":"boolean","description":"Serve a Markdown rendering of eligible HTML pages to clients sending\n`Accept: text/markdown`. Requires an active plan.\n"},"analytics_tag":{"type":"string","readOnly":true,"description":"The NsinNabz `<script>` tag the edge inserts into this domain's\nHTML pages; empty when there is none. Set and removed through\n`/domains/{domain}/analytics-tag`, not through this object.\n"},"analytics_tag_updated_at":{"type":"string","format":"date-time","readOnly":true,"description":"When `analytics_tag` last changed. Absent when there is no tag."},"origin_protocol":{"type":"string","enum":["http1","http2","http3"],"description":"HTTP version the edge speaks to this domain's origins on the direct\npath. Default `http1`, and deliberately so: over HTTP/2 an upload is\nlimited by the origin's per-stream window (64 KB on nginx), which\ncaps each upload near 4 MB/s at a 16 ms edge-to-origin round trip.\n`http3` falls back to TCP per origin when the QUIC dial fails. The\ntunnel path from Iranian edges to foreign origins is always HTTP/1.1.\nProbe what your origin supports with `GET /domains/{domain}/origin-protocols`.\n"},"default_static_cache":{"type":"boolean","description":"Cache static files (CSS, JavaScript, images, fonts, media, downloads)\nat the edge automatically, even with no cache rule — the way\nCloudflare does for every proxied hostname. On by default. HTML is\nnever cached by this; your own cache rules always take precedence,\nand any path you exclude in a rule is never cached by the default.\nFreshness follows your origin's `Cache-Control`; with none, 5 minutes.\n"},"bot_cache_enabled":{"type":"boolean","description":"Bot cache: keep an edge copy of every HTML page for verified\nsearch-engine crawlers (Googlebot, Bingbot, Applebot, DuckDuckBot,\nYandexBot) and serve them from it, regardless of the origin's\n`Cache-Control`. Human visitors are unaffected. A crawler must pass\nthe operator's own verification (published IP ranges / reverse DNS);\na spoofed User-Agent never gets the copy. Requires a plan with\n`bot_cache_enabled`; the edge switches it off automatically while\nthe plan lacks it.\n"},"bot_cache_fresh_sec":{"type":"integer","description":"Bot cache: seconds a copy is served without asking the origin\n(300–86400, default 3600). Older copies are still served and\nrefreshed in the background with a conditional request.\n"},"bot_cache_max_age_sec":{"type":"integer","description":"Bot cache: seconds after which a copy is no longer served and is\nfetched again (300–86400, default 86400).\n"},"bot_cache_kinds":{"type":"array","items":{"type":"string","enum":["googlebot","bingbot","applebot","duckduckbot","yandexbot"]},"description":"Crawlers the bot cache serves. A domain that never set it (empty)\nserves all of them; an update must list at least one.\n"},"bot_cache_path_excludes":{"type":"array","items":{"type":"string"},"description":"Wildcard path patterns (`/api/*`) never served from the bot cache."},"proxy_ips":{"type":"array","items":{"type":"string"},"description":"Edge addresses every proxied record of this domain is pinned to,\ninstead of the platform default set. Set by NSIN support only (for\nexample for a dedicated address); absent in the normal case.\n"},"gateway_requests_30d":{"type":"integer","format":"int64","description":"Requests served by this domain's gateway hostnames in the rolling 30-day window, as of `gateway_quota_counted_at`."},"gateway_bytes_30d":{"type":"integer","format":"int64","description":"Egress bytes of the gateway hostnames over the same window. A meter\nfor the gateway allowance, not a second charge — the bytes are\nalready billed as the domain's ordinary traffic.\n"},"gateway_quota_exceeded":{"type":"boolean","description":"The plan's gateway allowance (requests or bytes) is spent, so the\ngateway hostnames answer `429` until enough traffic ages out of the\nwindow. The rest of the domain is unaffected.\n"},"gateway_quota_counted_at":{"type":"string","format":"date-time","description":"When the gateway usage above was last recomputed. Absent before the first count."},"gateway_quota_reason":{"type":"string","enum":["requests","bytes"],"description":"Which gateway cap tripped. Absent while nothing has."},"gateway_terms_accepted_at":{"type":"string","format":"date-time","description":"When this domain's gateway terms of use were accepted (see\n`POST /domains/{domain}/gateways/terms/accept`). Absent until then;\nswitching a gateway on is refused without it.\n"},"gateway_terms_accepted_by":{"type":"integer","description":"User id of whoever accepted the gateway terms."},"billing_user_id":{"type":"integer","description":"The member nominated to pay for this domain. Absent when the owner\npays (the normal case). Only the owner can set it, in the panel —\nAPI keys cannot change who pays.\n"},"billing_user_set_by":{"type":"integer","description":"User id of whoever made the current billing nomination."},"billing_user_set_at":{"type":"string","format":"date-time","description":"When the current billing nomination took effect. Charges for a billing window that started earlier stay with the previous payer."},"outage_alerts":{"type":"boolean","description":"Notify the owner when a subdomain suffers a sustained origin outage."},"uptime_threshold_pct":{"type":"integer","minimum":50,"maximum":100,"description":"Per-minute origin-error percentage that counts as \"down\"."},"uptime_window_min":{"type":"integer","minimum":2,"maximum":60,"description":"Minutes the domain must stay down before an incident opens."},"uptime_min_requests":{"type":"integer","description":"Minimum origin-eligible requests in the window — the traffic floor below which no incident opens."},"uptime_min_active_min":{"type":"integer","description":"Minimum populated one-minute buckets required in the window."},"uptime_recover_min":{"type":"integer","description":"Consecutive clear minutes before an incident resolves."},"uptime_host_match_type":{"$ref":"#/components/schemas/HostMatchType"},"uptime_host_includes":{"type":"array","items":{"type":"string"},"description":"Subdomains the default whole-host uptime watch covers. Absent or\nempty means every subdomain. Change with `PUT /uptime/settings`.\n"},"uptime_host_excludes":{"type":"array","items":{"type":"string"},"description":"Subdomains the default uptime watch skips; an exclude always beats an include."},"suspended":{"type":"boolean","description":"Paused for billing. The edge refuses the domain's TLS handshake, so\nvisitors get a connection error. Clears automatically once the\nwallet is no longer negative.\n"},"suspended_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"deleted_at":{"type":["string","null"],"format":"date-time","description":"Always `null` — deleted domains are never returned."}}},"DomainVerification":{"type":"object","description":"The legacy TXT record that proves ownership of an external-DNS domain.\nStill accepted, but new domains verify with the CNAME in\n`ssl_delegation`, which also keeps their certificate renewing — prefer\nthat one.\n","properties":{"host":{"type":"string","description":"Name to create the TXT record at."},"type":{"type":"string","const":"TXT"},"value":{"type":"string","description":"Exact TXT value to publish."},"verified":{"type":"boolean","description":"Whether the domain has passed verification: `false` only while it is `pending` or `failed`."},"expires_at":{"type":"string","format":"date-time","description":"End of the current 3-day verification window. Absent once verified."},"seconds_remaining":{"type":"integer","description":"Seconds left in the verification window."},"next_manual_check_at":{"type":"string","format":"date-time","description":"When `POST /domains/{domain}/verify` may be called again (once a minute). Absent once verified, or if it never ran."},"auto_check_seconds":{"type":"integer","description":"How often NSIN re-checks the record on its own, in seconds (300)."}}},"SslDelegation":{"type":"object","description":"An external-DNS domain's verification record: one CNAME, created once\nand never rotated. It proves ownership (a pending domain activates when\nit is found) and stays in place afterwards as the domain's connection\nto NSIN, which is what lets NSIN issue and renew the certificate for the\napex and its wildcard. Once it has passed, removing or changing it\nmarks the domain `moved` — it keeps serving for a 3-day grace period,\nthen is disabled — exactly as a managed domain whose nameservers leave.\n","properties":{"host":{"type":"string","description":"Name to create the CNAME at, e.g. `_acme-challenge.example.com`."},"type":{"type":"string","const":"CNAME"},"value":{"type":"string","description":"The CNAME target, unique to this domain."},"ok":{"type":"boolean","description":"Whether the last live check found this domain's delegation in place."},"checked_at":{"type":"string","format":"date-time","description":"When the last check ran."},"ok_at":{"type":"string","format":"date-time","description":"When the delegation last passed."},"error":{"type":"string","description":"Why the last check failed — or, with `ok` true, a CAA policy on the\ndomain that prevents Let's Encrypt from issuing.\n"},"next_manual_check_at":{"type":"string","format":"date-time"},"auto_check_seconds":{"type":"integer","description":"How often NSIN re-checks the record on its own."}}},"DomainDetail":{"allOf":[{"$ref":"#/components/schemas/Domain"},{"type":"object","properties":{"verification":{"$ref":"#/components/schemas/DomainVerification"},"ssl_delegation":{"$ref":"#/components/schemas/SslDelegation"},"nsin_ns":{"type":"array","description":"The canonical (first) accepted nameserver set.","items":{"type":"string"}},"nsin_ns_sets":{"type":"array","description":"Every accepted nameserver set. The delegation must name every\nNSIN nameserver node, through any set's hostname for it, and\nnothing else; see `GET /domains/ns-sets`.\n","items":{"type":"array","items":{"type":"string"}}},"current_ns":{"type":"array","description":"The nameservers currently observed in the parent zone.","items":{"type":"string"}},"my_role":{"$ref":"#/components/schemas/Role"},"my_permissions":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}},"ns_check_interval_seconds":{"type":"integer","description":"How often the background checker re-checks the delegation."},"billing_member":{"allOf":[{"$ref":"#/components/schemas/BillingMember"}],"description":"Whose wallet this domain's charges come out of. Always present —\nit falls back to the owner — so a client can name the payer\nwithout a second request. Only the owner can change it, in the\npanel — API keys cannot.\n"}}}]},"DomainSslSummary":{"type":"object","description":"The certificate the domain would serve for its own name, in brief.","properties":{"status":{"type":"string","enum":["valid","expired","pending","failed","none"],"description":"`valid` — serving a certificate that has not expired. `expired` —\nthe best certificate held has expired. `pending` — issuance is in\nprogress. `failed` — the last issuance failed. `none` — the domain\nholds no certificate.\n"},"expires_at":{"type":"string","format":"date-time","description":"Present for `valid` and `expired`."},"days_remaining":{"type":"integer","description":"Whole days left, rounded up. `0` unless `valid`."},"uncovered_hostnames":{"type":"array","items":{"type":"string"},"description":"Proxied names of this domain with no certificate behind them, sorted.\nAbsent when everything the domain proxies is covered. `status` still\ndescribes the certificate the domain does have, so a domain can be\n`valid` here and still list uncovered names.\n"}}},"DomainWithSsl":{"allOf":[{"$ref":"#/components/schemas/Domain"},{"type":"object","properties":{"ssl":{"$ref":"#/components/schemas/DomainSslSummary"},"subscription":{"type":"object","additionalProperties":true,"description":"The domain's active subscription, when it has one."},"verification":{"$ref":"#/components/schemas/DomainVerification"},"ssl_delegation":{"$ref":"#/components/schemas/SslDelegation"},"my_role":{"$ref":"#/components/schemas/Role"}}}]},"DomainCreate":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"The domain to add, without scheme or trailing dot.","examples":["example.com"]},"dns_mode":{"type":"string","enum":["managed","external"],"default":"managed","description":"How DNS is run for the domain. Any other value is treated as `managed`."},"import_mode":{"type":"string","enum":["auto","review","none"],"description":"What to do with the records found at the domain's current\nnameservers. `auto` writes them into the zone, `review` stages them\nin an import session to approve (see\n`GET /domains/{domain}/records/import-sessions/current`), `none`\nskips the scan. Omitted or unknown: `auto` for API keys, `review`\nfor the panel. An external-DNS domain that is not verified yet is\nalways staged for review, whatever is asked, except with `none`.\n"}}},"DomainUpdate":{"type":"object","description":"Every field is optional; omitted fields are left unchanged.\n","properties":{"dns_mode":{"type":"string","enum":["managed","external"],"description":"Switch how DNS is run. See the operation description for what happens."},"cache_l2_max_gb":{"type":"integer","minimum":1,"description":"Disk (L2) cache size cap in GB. At most the plan's ceiling."},"cache_l2_ttl_days":{"type":"integer","minimum":1,"maximum":7,"description":"Disk cache entry lifetime in days. At most the plan's ceiling."},"cache_cap_mb":{"type":"integer","enum":[128,256,512,2048,4096],"description":"Largest cacheable response body in MB. At most the plan's ceiling."},"sec_no_sniff":{"type":"boolean","description":"See the `sec_no_sniff` field on Domain."},"sec_referrer_policy":{"type":"boolean","description":"See the `sec_referrer_policy` field on Domain."},"sec_strip_headers":{"type":"boolean","description":"See the `sec_strip_headers` field on Domain."},"hsts_enabled":{"type":"boolean","description":"See the `hsts_enabled` field on Domain. Cannot be undone for\nbrowsers that have already seen the header.\n"},"hsts_max_age_sec":{"type":"integer","enum":[0,300,3600,86400,604800,2592000,31536000],"description":"See the `hsts_max_age_sec` field on Domain. May only be raised one\nstep per request; a bigger jump is rejected with `400` naming the\nnext allowed value.\n"},"hsts_include_subdomains":{"type":"boolean","description":"See the `hsts_include_subdomains` field on Domain."},"hsts_preload":{"type":"boolean","description":"See the `hsts_preload` field on Domain. Rejected with `400` unless\n`hsts_enabled`, `hsts_include_subdomains` and a `hsts_max_age_sec`\nof 31536000 are all in place after this update.\n"},"min_tls_version":{"type":"string","enum":["1.2","1.3"],"description":"See the `min_tls_version` field on Domain. `TLSv1.3` and `tls1.3` are accepted as spellings of `1.3`."},"markdown_for_agents":{"type":"boolean","description":"See the `markdown_for_agents` field on Domain. Turning it on requires an active plan."},"origin_protocol":{"type":"string","enum":["http1","http2","http3"],"description":"See the `origin_protocol` field on Domain. `h1`/`h2`/`h3` and `HTTP/2`-style spellings are accepted too."},"default_static_cache":{"type":"boolean","description":"See the `default_static_cache` field on Domain."},"bot_cache_enabled":{"type":"boolean","description":"See the `bot_cache_enabled` field on Domain. Turning it on, or\nchanging any `bot_cache_*` setting while it is on, requires the\nplan flag (`403` otherwise); turning it off never does.\n"},"bot_cache_fresh_sec":{"type":"integer","minimum":300,"maximum":86400,"description":"See the `bot_cache_fresh_sec` field on Domain."},"bot_cache_max_age_sec":{"type":"integer","minimum":300,"maximum":86400,"description":"Must be at least `bot_cache_fresh_sec`."},"bot_cache_kinds":{"type":"array","items":{"type":"string","enum":["googlebot","bingbot","applebot","duckduckbot","yandexbot"]},"minItems":1,"description":"Crawlers the bot cache serves. Case-insensitive; duplicates are dropped."},"bot_cache_path_excludes":{"type":"array","items":{"type":"string","maxLength":256,"pattern":"^/"},"maxItems":50,"description":"Wildcard path patterns (`/api/*`) never served from the bot cache. Blank entries are dropped. Replaces the whole list."}}},"OriginProtocols":{"type":"object","description":"What a domain's origins speak, from a TLS handshake (ALPN), a QUIC\nhandshake and one `HEAD /` request (for `Alt-Svc`) made from the NSIN\ncontrol plane. A result proves the origin speaks a protocol; whether\nUDP is open on the path from a given edge is decided at the edge, which\nfalls back to TCP per origin.\n","properties":{"current":{"type":"string","enum":["http1","http2","http3"],"description":"The domain's current `origin_protocol` setting."},"origins":{"type":"array","description":"One entry per distinct origin (destination, port, scheme) across the domain's proxied records. Gateway records are excluded.","items":{"type":"object","properties":{"host":{"type":"string"},"port":{"type":"integer"},"sni":{"type":"string","description":"The server name presented in the handshake."},"tls":{"type":"boolean","description":"`false` for a plain-HTTP origin, which can only be HTTP/1.1."},"http1":{"type":"boolean"},"http2":{"type":"boolean"},"http3":{"type":"boolean"},"http3_via":{"type":"string","enum":["quic","alt-svc"],"description":"How HTTP/3 support was established. Absent when `http3` is false."},"error":{"type":"string","description":"Why the TCP/TLS handshake failed, when it did."},"http3_error":{"type":"string","description":"Why the QUIC handshake failed. Absent when it succeeded. Present\nnext to `http3_via` = `alt-svc` when the origin advertises HTTP/3\nbut the control plane could not reach it over UDP.\n"},"checked_at":{"type":"string","format":"date-time"}}}},"supports":{"type":"object","description":"Whether EVERY TLS origin answered the protocol.","properties":{"http2":{"type":"boolean"},"http3":{"type":"boolean"}}},"recommended":{"type":"string","enum":["http1","http2","http3"],"description":"The highest protocol every origin supports."},"probed_from":{"type":"string","example":"control plane"}}},"DeveloperMode":{"type":"object","properties":{"active":{"type":"boolean"},"expires_at":{"type":"string","format":"date-time","description":"When developer mode switches itself off. Absent when inactive."}}},"AttackSettings":{"type":"object","properties":{"auto_attack_rules":{"type":"boolean","description":"Add a dry-run rule when an attack is detected (default true)."},"auto_under_attack":{"type":"boolean","description":"Switch Under Attack Mode on by itself during an attack nothing blocks, and off when it ends (default false)."},"behaviour_detection":{"type":"boolean","description":"Record an attack when the traffic suddenly behaves differently, even at normal volume (default true). Rules still need auto_attack_rules."},"detection_ready":{"type":"boolean","readOnly":true,"description":"False while the domain is younger than 3 days: automatic detection needs 3 days of normal traffic first. Ignored in PUT."}}},"AttackSignatureFeature":{"type":"object","properties":{"field":{"type":"string","enum":["ja4h","ja4","user_agent","cookie","header_set_hash","path","method","asn","country"]},"key":{"type":"string","description":"The cookie name for `cookie`; else empty."},"value":{"type":"string"},"coverage":{"type":"number","description":"Share of the attack's requests with this value (0–1)."},"baseline_share":{"type":"number","description":"Share of normal requests with this value (0–1)."}}},"AttackDrift":{"type":"object","properties":{"feature":{"type":"string","enum":["asset","html","api","no_referer","no_cookie","many_cookie","s2","s3","s4","s404","s5","post","other_method","h1","h2","h3","bot_low","bot_high","req_per_path","req_per_ip"]},"group":{"type":"string","enum":["assets","cookies","status","protocol","bot","paths","ips"]},"unit":{"type":"string","enum":["share","ratio"],"description":"`share`: 0–1 of requests. `ratio`: requests per path or per IP."},"normal":{"type":"number","description":"The usual value at this hour of day."},"now":{"type":"number","description":"The value during the attack."},"z":{"type":"number","description":"How unusual the change is (larger = stronger)."}}},"BehaviourSeries":{"type":"object","properties":{"available":{"type":"boolean","description":"False until behaviour data is collected."},"step_minutes":{"type":"integer","enum":[15,60]},"points":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string","format":"date-time"},"requests":{"type":"integer","description":"Requests judged (verified bots, Under Attack checks and requests your enforced rules blocked are left out)."},"asset_share":{"type":"number","nullable":true,"description":"Share of CSS / JS / image / font requests."},"cookie_share":{"type":"number","nullable":true,"description":"Share of requests with cookies; null before the edge logged cookie names."},"bot_low_share":{"type":"number","nullable":true,"description":"Share of requests with a bot score under 30; null where not scored."}}}}}},"Attack":{"type":"object","properties":{"id":{"type":"integer"},"domain_id":{"type":"integer"},"domain_name":{"type":"string"},"status":{"type":"string","enum":["detected","mitigating","ended","ignored"]},"kind":{"type":"string","enum":["volume","behaviour"],"description":"`volume`: a flood, far more requests than usual. `behaviour`: the\ntraffic suddenly behaves differently (for example no CSS/JS/image\nrequests, no cookies, one HTTP version only), even at normal\nvolume. A behaviour attack ends after 30 minutes without the change.\n"},"drift":{"type":"array","description":"What changed (behaviour attacks; empty for floods), strongest first, at most 8.","items":{"$ref":"#/components/schemas/AttackDrift"}},"started_at":{"type":"string","format":"date-time"},"ended_at":{"type":"string","format":"date-time","nullable":true},"calm_since":{"type":"string","format":"date-time","nullable":true},"peak_rpm":{"type":"integer","description":"Highest requests per minute seen."},"baseline_rpm":{"type":"number","description":"Usual requests per minute for this hour of day."},"signature":{"type":"object","properties":{"features":{"type":"array","items":{"$ref":"#/components/schemas/AttackSignatureFeature"}},"expression":{"type":"string","description":"The rule's conditions as text; empty without a rule."},"attack_requests":{"type":"integer"},"baseline_requests":{"type":"integer"},"baseline_window":{"type":"string","enum":["hour_before","day_before","reference_day","none"],"description":"`reference_day`: the same time on the most normal recent day (behaviour attacks)."}}},"coverage":{"type":"number","description":"Share of the attack the rule matches."},"fp_estimate":{"type":"number","description":"Share of normal requests the rule would have hit; -1 = unknown."},"rule_id":{"type":"integer","nullable":true},"rule":{"type":"object","nullable":true,"properties":{"id":{"type":"integer"},"name":{"type":"string"},"enabled":{"type":"boolean"},"action_mode":{"type":"string","enum":["enforce","dry_run"]}}},"enforced_by":{"type":"string","description":"\"\", \"user:<id>\" or \"admin:<id>\"."},"note":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"SecurityActions":{"type":"object","properties":{"available":{"type":"boolean"},"period":{"type":"string"},"series":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string","format":"date-time"},"family":{"type":"string"},"dry_run":{"type":"boolean"},"count":{"type":"integer"}}}},"families":{"type":"array","items":{"type":"object","properties":{"family":{"type":"string"},"enforced":{"type":"integer"},"dry_run":{"type":"integer"}}}},"totals":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"family":{"type":"string"},"dry_run":{"type":"boolean"},"count":{"type":"integer"}}}}}},"SecurityTopRules":{"type":"object","properties":{"available":{"type":"boolean"},"rules":{"type":"array","items":{"type":"object","properties":{"rule_id":{"type":"integer"},"domain_id":{"type":"integer"},"domain_name":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"managed_by":{"type":"string"},"action":{"type":"string"},"enforced":{"type":"integer"},"dry_run":{"type":"integer"},"total":{"type":"integer"},"deleted":{"type":"boolean"}}}}}},"SecurityRateKeys":{"type":"object","properties":{"available":{"type":"boolean"},"period":{"type":"string"},"keys":{"type":"array","items":{"type":"object","properties":{"rl_key":{"type":"string"},"rule_id":{"type":"integer"},"rule_name":{"type":"string"},"count":{"type":"integer"},"last_seen":{"type":"string","format":"date-time"}}}}}},"SecurityUnderAttack":{"type":"object","properties":{"available":{"type":"boolean"},"series":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string","format":"date-time"},"challenged":{"type":"integer"},"cleared":{"type":"integer"}}}},"challenged":{"type":"integer"},"cleared":{"type":"integer"}}},"SecurityBotScores":{"type":"object","properties":{"available":{"type":"boolean"},"buckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"integer"},"from":{"type":"integer"},"to":{"type":"integer"},"count":{"type":"integer"}}}},"scored":{"type":"integer"},"low":{"type":"integer"},"low_share":{"type":"number"},"top_ja4h":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"count":{"type":"integer"}}}},"top_asn":{"type":"array","items":{"type":"object","properties":{"asn":{"type":"integer"},"org":{"type":"string"},"count":{"type":"integer"}}}}}},"SecurityAttacks":{"type":"object","properties":{"available":{"type":"boolean","description":"False when rule hits cannot be read yet (they are then zeros)."},"attacks":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Attack"},{"type":"object","properties":{"rule_hits":{"type":"object","properties":{"enforced":{"type":"integer"},"dry_run":{"type":"integer"}}}}}]}}}},"UnderAttackMode":{"type":"object","properties":{"enabled":{"type":"boolean"},"bypass_paths":{"type":"array","items":{"type":"string"},"description":"Paths never challenged. Kept while the mode is off, for next time."},"bypass_ips":{"type":"array","items":{"type":"string"},"description":"Client IPs, CIDRs or ranges never challenged. Kept while the mode is off."},"bypass_hosts":{"type":"array","items":{"type":"string"},"description":"Hosts (wildcard patterns) never challenged. Kept while the mode is off."},"since":{"type":["string","null"],"format":"date-time","description":"When the mode was switched on. Null when off."},"until":{"type":["string","null"],"format":"date-time","description":"When the mode switches itself off. Null when off or with no timer."},"allowed":{"type":"boolean","description":"The domain's plan includes Under Attack Mode (`under_attack_allowed`)."}}},"UnderAttackModeBody":{"type":"object","properties":{"enabled":{"type":"boolean"},"bypass_paths":{"type":"array","maxItems":50,"items":{"type":"string","maxLength":256},"description":"Wildcard path patterns, each starting with `/` (`*` matches any\ncharacters; `/api/*` also matches `/api`). Replaces the list.\n"},"bypass_ips":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Client addresses never challenged: single IPs, CIDRs\n(`10.0.0.0/8`) or `lo-hi` ranges. `0.0.0.0/0` and `::/0` are\nrefused. Replaces the list.\n"},"bypass_hosts":{"type":"array","maxItems":50,"items":{"type":"string","maxLength":255},"description":"Host names or wildcard patterns never challenged\n(`api.example.com`, `*.api.example.com`), case-insensitive. A bare\n`*` is refused. Replaces the list.\n"},"auto_off_minutes":{"type":"integer","enum":[0,60,360,1440],"description":"Switch off after this many minutes, counted from now; 0 = never."}}},"CustomPage":{"type":"object","description":"One page the edge serves itself.","properties":{"mode":{"type":"string","enum":["nsin","custom","redirect"],"default":"nsin","description":"`nsin` — the branded NSIN page; `custom` — the HTML in `html`; `redirect` — a 302 to `url`."},"html":{"type":"string","description":"Your page, used in mode `custom`. At most 32 KiB, UTF-8."},"url":{"type":"string","description":"Full `http://` or `https://` address, used in mode `redirect`. At most 2048 characters."}}},"CustomPages":{"type":"object","properties":{"blocked":{"$ref":"#/components/schemas/CustomPage"},"waf":{"$ref":"#/components/schemas/CustomPage"},"rate_limit":{"$ref":"#/components/schemas/CustomPage"},"maintenance":{"allOf":[{"$ref":"#/components/schemas/CustomPage"},{"type":"object","properties":{"enabled":{"type":"boolean","description":"While true, the edge answers every request with 503 and the origin is not reached."},"bypass_ips":{"type":"array","maxItems":100,"items":{"type":"string"},"description":"Addresses that still reach the site during maintenance — single IPs, CIDR prefixes or `low-high` ranges."}}}]}}},"AnalyticsTag":{"type":"object","description":"A domain's NsinNabz tag. Both fields are `null` when there is no tag.","required":["tag","updated_at"],"properties":{"tag":{"type":["string","null"],"description":"The `<script>` tag the edge inserts into the domain's HTML pages."},"updated_at":{"type":["string","null"],"format":"date-time","description":"When the tag last changed (UTC)."}}},"ManualCheck":{"type":"object","description":"One manual check and its last outcome.","properties":{"kind":{"description":"Which check: `ns` delegation, `txt` verification, `dv` SSL delegation, `edge` proxied-record reachability, `email_dns` Email Routing records.","type":"string","enum":["ns","txt","dv","edge","email_dns"]},"state":{"type":"string","enum":["running","done","error"],"description":"`running` — the check is in flight; poll again.\n`done` — it completed and `ok` carries the verdict.\n`error` — it could not reach an answer (a resolver was unreachable).\nAn error is never a verdict about the domain's DNS.\n"},"ok":{"type":"boolean","description":"The verdict of a `done` check."},"message":{"type":"string","description":"What to show the user."},"started_at":{"type":"string","format":"date-time","description":"When the check started."},"finished_at":{"type":"string","format":"date-time","description":"When it finished. Absent while running."}}},"ManualChecks":{"type":"object","properties":{"checks":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ManualCheck"},"description":"Keyed by kind; kinds never checked are absent."},"running":{"type":"boolean","description":"Whether any check on this domain is in flight."}}},"NsCheckResult":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the delegation is acceptable: every NSIN node named, nothing foreign."},"status":{"$ref":"#/components/schemas/DomainStatus"},"message":{"type":"string"},"next_check_at":{"type":"string","format":"date-time"},"nsin_ns":{"type":"array","items":{"type":"string"},"description":"The nameservers the delegation is expected to match."},"current_ns":{"type":"array","items":{"type":"string"},"description":"The nameservers actually observed."}}},"SslDelegationCheckResult":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string","description":"Present when `ok` is false."},"next_check_at":{"type":"string","format":"date-time"},"ssl_delegation":{"$ref":"#/components/schemas/SslDelegation"},"domain":{"$ref":"#/components/schemas/DomainDetail"}}},"VerifyResult":{"type":"object","properties":{"verified":{"type":"boolean","const":true},"domain":{"$ref":"#/components/schemas/DomainDetail"}}},"SslCoverageGap":{"type":"object","description":"A proxied hostname that the domain's certificate does not cover yet.","properties":{"hostname":{"type":"string"},"status":{"type":"string","enum":["pending","failed","missing"],"description":"`pending` — being issued; `failed` — the last attempt failed; `missing` — not requested yet."},"failure_count":{"type":"integer","description":"Failed attempts so far for this name."},"max_retries":{"type":"integer","description":"Automatic retries a failing name gets."},"next_retry_at":{"type":"string","format":"date-time","description":"When the next automatic retry runs."},"last_error":{"type":"string","description":"The certificate authority's own reason for the last failure."}}},"SslInfo":{"type":"object","properties":{"status":{"type":"string","enum":["valid","expired","pending","failed","none"],"description":"State of the domain's own certificate: `valid`, `expired`,\n`pending` (an order is running), `failed` (the last order failed;\nsee `failure_count` and `next_retry_at`) or `none` (no certificate\nyet).\n"},"expires_at":{"type":"string","format":"date-time","description":"End of the certificate's validity."},"issued_at":{"type":"string","format":"date-time","description":"Start of its validity."},"days_remaining":{"type":"integer","description":"Whole days until expiry."},"issuer":{"type":"string","description":"The certificate's issuer."},"subject":{"type":"string","description":"The certificate's subject."},"serial_number":{"type":"string","description":"Serial number, hex."},"sans":{"description":"The names the certificate covers.","type":"array","items":{"type":"string"}},"signature_algorithm":{"type":"string","description":"Signature algorithm."},"key_size":{"type":"integer","description":"Public key size in bits."},"is_wildcard":{"type":"boolean","description":"The certificate carries a wildcard name."},"auto_renewal":{"type":"boolean","description":"Whether NSIN renews this certificate itself. True for managed-DNS\ndomains and for external-DNS domains whose `ssl_delegation` is in\nplace; false for an external-DNS domain that uploads its own.\n"},"has_private_key":{"type":"boolean","description":"NSIN holds the private key, so the certificate can be served."},"can_manual_issue":{"type":"boolean","description":"Whether `POST /domains/{domain}/ssl/issue` would be accepted right now."},"manual_issue_reason":{"type":"string","description":"Why manual issuance is unavailable, when `can_manual_issue` is false."},"next_manual_issue_at":{"type":"string","format":"date-time","description":"When the next manual issue is allowed (one per hour)."},"last_issue_attempt_at":{"type":"string","format":"date-time","description":"When a manual issue was last requested."},"failure_count":{"type":"integer","description":"Consecutive failed orders for the domain's own certificate. `status`\nflips to `failed` on the first one while retries continue; compare\nwith `max_retries` to tell \"still retrying\" from \"given up\". Absent\nwhen nothing has failed.\n"},"max_retries":{"type":"integer","description":"How many automatic retries a failing order gets. Absent when nothing has failed."},"next_retry_at":{"type":"string","format":"date-time","description":"When the next automatic retry runs. Absent when none is scheduled."},"last_error":{"type":"string","description":"Why the last order failed, in the certificate authority's words."},"hostname":{"type":"string","description":"The name the reported certificate is installed under — usually the\napex, but a domain may hold a certificate for one subdomain only.\n"},"covered_hostnames":{"type":"array","items":{"type":"string"},"description":"Every name of this domain with an active certificate, sorted."},"uncovered_hostnames":{"type":"array","items":{"type":"string"},"description":"Proxied names with no certificate behind them, sorted. External-DNS\ndomains only — for managed domains the same gaps arrive in\n`coverage`, with the retry schedule that applies when we can issue.\n"},"coverage":{"type":"array","description":"Proxied hostnames not yet on the certificate. Absent when coverage is\ncomplete.\n","items":{"$ref":"#/components/schemas/SslCoverageGap"}},"trusted":{"type":"boolean","description":"Whether the served certificate chains to a public root. `false` means\nno browser will accept it — a private CA (for example a Cloudflare\nOrigin CA certificate), a self-signed certificate, or an internal\nPKI. Absent when the bundle has not been evaluated, which is a\ndifferent state from `false` and should not be shown as a failure.\n"},"trust_note":{"type":"string","description":"Why the certificate is flagged, phrased for the certificate's owner.\nCan be present even when `trusted` is true — an otherwise genuine\ncertificate missing its intermediate is reported here.\n"},"leaf_only":{"type":"boolean","description":"The bundle carries no intermediate certificate. Clients that do not\nalready hold the issuer fail the handshake with \"unable to get local\nissuer certificate\". Independent of `trusted`. Absent when the bundle\nhas not been evaluated.\n"},"pinned":{"type":"boolean","description":"The certificate on display is one you chose, rather than whatever\nthe domain would serve by default. See\n`GET /domains/{domain}/ssl/certificates`.\n"},"source":{"type":"string","enum":["acme","acme-staging","uploaded"],"description":"Where the certificate being served came from."},"has_managed_cert":{"type":"boolean","description":"NSIN holds an unexpired certificate of its own for this domain —\ni.e. there is something to switch back to.\n"},"managed_requested":{"type":"boolean","description":"You have already asked NSIN to issue alongside your upload and the\norder is on its way.\n"},"can_request_managed":{"type":"boolean","description":"Whether `POST /domains/{domain}/ssl/certificates/request` would be\naccepted right now.\n"}}},"AcmeDnsAccount":{"type":"object","description":"A domain's acme-dns account. The password is never returned.\n","properties":{"configured":{"type":"boolean","description":"False, and nothing else set, when this domain has no account."},"domain":{"type":"string","description":"The domain this account was accepted for."},"api_base":{"type":"string","description":"The acme-dns instance challenge values are written to, derived from\nthe account's own fulldomain.\n"},"username":{"type":"string"},"full_domain":{"type":"string","description":"The name inside acme-dns that holds this domain's challenge values."},"allow_from":{"type":"string","description":"The account's IP allowlist as acme-dns reported it. Empty means the\naccount may be used from any address; that is fixed at registration\nand cannot be changed from here.\n"},"cname_name":{"type":"string","description":"The record that must exist in your own DNS.","example":"_acme-challenge.numberland.ir"},"cname_target":{"type":"string","example":"e940716e-147b-477c-80a1-3cff2e2fbccf.auth.acme-dns.io."},"updated_at":{"type":"string","format":"date-time"}}},"DomainCertificate":{"type":"object","description":"One certificate a domain holds. `id` is what\n`/ssl/certificates/{certificateId}/select` takes.\n","properties":{"id":{"type":"integer"},"source":{"description":"Where the certificate came from: `acme` (issued by NSIN), `acme-staging`, or `uploaded`.","type":"string","enum":["acme","acme-staging","uploaded"]},"managed":{"type":"boolean","description":"NSIN issues and renews this one."},"subject":{"type":"string","description":"The certificate's subject."},"issuer":{"type":"string","description":"The certificate's issuer."},"serial_number":{"type":"string","description":"Serial number, hex."},"sans":{"type":"array","items":{"type":"string"},"description":"Every name on the certificate."},"signature_algorithm":{"type":"string","description":"Signature algorithm."},"key_size":{"type":"integer","description":"Public key size in bits."},"is_wildcard":{"type":"boolean","description":"The certificate carries a wildcard name."},"issued_at":{"type":"string","format":"date-time","description":"Start of validity."},"expires_at":{"type":"string","format":"date-time","description":"End of validity."},"days_remaining":{"type":"integer","description":"Whole days until expiry, rounded up; `0` once expired."},"expired":{"type":"boolean","description":"Validity has ended."},"trusted":{"type":"boolean","description":"The certificate chains to a public root. Absent when it has not\nbeen evaluated.\n"},"trust_note":{"type":"string","description":"Why browsers would not accept it, phrased for the owner. Present when there is a problem."},"leaf_only":{"type":"boolean","description":"The bundle carries no intermediate certificate."},"has_private_key":{"type":"boolean","description":"The private key is stored. Without it the edge cannot complete a\nhandshake, so the certificate cannot be selected.\n"},"in_use_for":{"type":"array","items":{"type":"string"},"description":"The domain's hostnames this certificate is serving right now. Empty\nmeans the domain holds it but is serving something else.\n"},"covers":{"type":"array","items":{"type":"string"},"description":"The domain's hostnames this certificate could serve — what\nselecting it would switch over.\n"},"selectable":{"type":"boolean","description":"Whether this certificate can be selected right now."},"reason":{"type":"string","description":"Why it cannot be, when `selectable` is false."}}},"CustomCertificateUpload":{"type":"object","required":["certificate","private_key"],"properties":{"certificate":{"type":"string","description":"PEM-encoded certificate chain. Include intermediates — a leaf-only\nbundle makes clients fail chain verification.\n"},"private_key":{"type":"string","description":"PEM-encoded private key matching the certificate."},"hostnames":{"type":"array","items":{"type":"string"},"description":"Which of the certificate's SANs this upload should cover. Use the\n`eligible` list from `POST /domains/{domain}/ssl/parse`.\n"}}},"CustomCertificateResult":{"type":"object","properties":{"message":{"type":"string"},"domain":{"type":"string"},"hostnames":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time"},"issued_at":{"type":"string","format":"date-time"},"subject":{"type":"string"},"sans":{"type":"array","items":{"type":"string"}}}},"ParsedCertificate":{"type":"object","properties":{"subject":{"type":"string"},"issuer":{"type":"string"},"sans":{"type":"array","items":{"type":"string"},"description":"Every SAN on the certificate."},"eligible":{"type":"array","items":{"type":"string"},"description":"The SANs that belong to this domain and may be passed as `hostnames` on upload."},"default_selection":{"type":"array","items":{"type":"string"},"description":"The subset of `eligible` covering the apex and its wildcard."},"expires_at":{"type":"string","format":"date-time"},"issued_at":{"type":"string","format":"date-time"}}},"RecordType":{"type":"string","enum":["A","AAAA","CNAME","ANAME","NS","TXT","MX","SRV","PTR","CAA","TLSA","SSHFP","URI"]},"RecordScheme":{"type":"string","description":"Protocol the edge uses to reach the origin of a proxied record.\n\n* `Https` — TLS to `port` (443 when the port is unset or out of range).\n* `Http` — plain HTTP to `port` (80 when unset or out of range).\n* `Auto` — HTTPS on 443 first, falling back to plain HTTP. The port is\n  always 443.\n* `Default` — accepted on input, and so are an empty or unrecognised\n  value, but stored as `Auto` with port 443: a record never reads\n  back as `Default`.\n","enum":["Http","Https","Auto","Default"]},"Record":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"Record name relative to the domain. `@` is the apex.","examples":["www","@"]},"original_name":{"type":"string","description":"The fully-qualified name, with trailing dot.","examples":["www.example.com."]},"type":{"$ref":"#/components/schemas/RecordType"},"destination":{"type":"string","description":"The record's value. For a proxied record this is the **origin** the\nedge connects to, and the published DNS answer is the NSIN proxy IP\ninstead — see `dns_content`.\n"},"dns_content":{"type":"string","description":"What is actually published in DNS. Equals the proxy IP for proxied records."},"ttl":{"type":"integer","description":"TTL in seconds."},"proxied":{"type":"boolean","description":"Route this hostname through the NSIN edge. Only `A`, `AAAA`, `CNAME`\nand `ANAME` may be proxied.\n"},"captcha":{"type":"boolean","description":"Challenge visitors before passing them to the origin."},"editable":{"type":"boolean","description":"False for records NSIN manages on your behalf."},"managed_by":{"type":"string","description":"The platform feature that owns this record, or empty for a record\nyou created. `email_routing` marks the MX, SPF and DKIM rows Email\nRouting publishes; they are removed by disabling routing, never\nthrough the record endpoints (which refuse them while locked).\n"},"user_id":{"type":"integer"},"domain_id":{"type":"integer"},"scheme":{"$ref":"#/components/schemas/RecordScheme"},"port":{"type":"integer","description":"Origin port for proxied records: 443 for `Auto`, otherwise as set (default 443 for `Https`, 80 for `Http`)."},"host_header":{"type":"string","description":"Overrides the Host header (and SNI) sent to the origin."},"host_header_mode":{"type":"string","enum":["","target"],"description":"Which name a proxied `CNAME`/`ANAME` sends to its origin as the Host\nheader (and SNI) when `host_header` is empty: empty — the record's\nown hostname (the default); `target` — the hostname it points at.\n"},"gateway_preset_id":{"type":["integer","null"],"description":"The gateway this record was created for, or `null` for a record you\nmade. A gateway record is not editable here; rename or remove it\nthrough the gateway endpoints.\n"},"gateway_allowed_hosts":{"type":"string","description":"Gateway records only: a JSON array, as a string, of the other\nhostnames the gateway's service links to. The edge serves them\nunder `/_nsin/<host>/` on the gateway hostname.\n"},"gateway_rewrite_urls":{"type":"boolean","description":"Gateway records only — whether the edge rewrites URLs in responses to go through the gateway."},"monitor":{"type":"boolean","description":"Include this record in uptime monitoring."},"timeout":{"type":"integer","minimum":1,"maximum":1800,"default":60,"description":"How long an edge node waits for the origin to start responding before returning 504, in seconds. Default 60, maximum 1800 (30 minutes). Only applies to proxied records.\n"},"mx_priority":{"type":"integer","minimum":0,"maximum":65535,"description":"Only meaningful for `MX`."},"comment":{"type":"string","maxLength":1024,"description":"Free-form note."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"deleted_at":{"type":["string","null"],"format":"date-time","description":"Always `null` — deleted records are never returned."},"edge_status":{"type":"string","enum":["ok","miss","error"],"description":"**External-DNS domains, proxied records only.** Whether the name\nresolves to NSIN's edge, as last checked: `ok` — every address it\nresolves to is ours; `miss` — it resolves elsewhere, only partly to\nus, or not at all; `error` — the first lookup failed and nothing is\nknown yet. Absent until the first check, and always absent on a\nmanaged-DNS domain.\n"},"edge_via":{"type":"string","enum":["cname","a","proxy"],"description":"How an `ok` record reaches NSIN: through the CNAME target\n(`cname`), by publishing our address directly (`a`), or `proxy` —\nDNS points at another CDN or proxy, but that service forwards to\nNSIN and the edge is serving the host (judged from the last 24h of\nrequest logs). A CNAME keeps working when our addresses change; an\nA record does not.\n"},"edge_detail":{"type":"string","description":"What the name actually resolves to, for display."},"edge_checked_at":{"type":"string","format":"date-time"}}},"EdgeTarget":{"type":"object","description":"What an external-DNS owner should publish in their own zone so a\nproxied name reaches NSIN: always the shared hostname. `cname`\n(subdomains) is the hostname to CNAME at; `alias` (the apex, where a\nCNAME is not allowed) is the same hostname to use as an ANAME/ALIAS\nrecord. `ips` are the A addresses, carried only for the cases where no\nhostname applies — no target configured yet, or a record pinned to\ndedicated addresses (then neither hostname is set). A hostname keeps\nworking when NSIN's addresses change; an A record does not.\n","properties":{"cname":{"type":"string","example":"edge.nsin.ir","description":"For a subdomain: the hostname to CNAME it to."},"alias":{"type":"string","example":"edge.nsin.ir","description":"For the apex: the hostname to point an ANAME/ALIAS (flattened CNAME) at."},"ips":{"description":"The A addresses — the fallback when no hostname applies.","type":"array","items":{"type":"string"}}}},"GatewayTerms":{"type":"object","description":"Per-domain acceptance of the gateway terms of use. `accepted` is false\nuntil someone with records-edit permission accepts them.\n","properties":{"accepted":{"type":"boolean","description":"Whether this domain has accepted the gateway terms of use."},"accepted_at":{"type":"string","format":"date-time","description":"When they were accepted."},"accepted_by_id":{"type":"integer","description":"User id of whoever accepted them."},"accepted_by_name":{"type":"string","description":"Their name, when known."},"accepted_by_email":{"type":"string","description":"Their email, when known."},"version":{"type":"integer","description":"Revision of the terms that was accepted."}}},"OriginRuleTag":{"type":"object","description":"An enabled origin rule that overrides where a proxied record's traffic\ngoes, meaning the effective origin is not the record's `destination`.\n","properties":{"rule_id":{"type":"integer"},"type":{"type":"string","enum":["origin_route","origin_pool"]},"name":{"type":"string","description":"The rule's optional label. Absent when the rule is unnamed."},"zone_wide":{"type":"boolean","description":"True when the rule applies to every proxied record of the domain."},"dry_run":{"type":"boolean","description":"The rule is evaluated but not enforced."}}},"RecordWithOriginRules":{"allOf":[{"$ref":"#/components/schemas/Record"},{"type":"object","properties":{"origin_rules":{"type":"array","description":"Absent when nothing overrides this record's origin. Routes are listed before pools.","items":{"$ref":"#/components/schemas/OriginRuleTag"}},"edge_target":{"allOf":[{"$ref":"#/components/schemas/EdgeTarget"}],"description":"Only on a proxied record of an external-DNS domain."}}}]},"GatewayList":{"type":"object","description":"The gateway catalog for one domain, plus that domain's gateway quota.\n\nGateway traffic is metered separately from the domain's own traffic: a\nplan allows a fixed number of gateway requests per ROLLING 30 days.\nThere is no reset date — capacity returns gradually as older requests\nage out of the window. While the allowance is spent, only the gateway\nhostnames stop serving (they answer `429`); the rest of the domain is\nunaffected.\n","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Gateway"}},"available":{"type":"boolean","description":"Whether the domain's plan includes gateways. When false, switching a\nnew gateway on is refused; gateways already on stay listed and can\nstill be switched off.\n"},"max_requests_30d":{"type":["integer","null"],"description":"Requests allowed in the rolling 30-day window. Null means unlimited."},"max_gb_30d":{"type":["integer","null"],"description":"Egress allowed in the rolling 30-day window, in GB. Null means unlimited."},"requests_30d":{"type":"integer","format":"int64","description":"Requests served by this domain's gateways in the window, as of\n`counted_at`. The `429`s the quota itself produces are not counted.\n"},"bytes_30d":{"type":"integer","format":"int64","description":"Egress bytes served by the gateways in the same window. A meter for\nthe allowance, not a separate charge — the bytes are billed as the\ndomain's ordinary traffic.\n"},"quota_exceeded":{"type":"boolean","description":"Whether an allowance is currently spent, so the gateways are answering 429."},"quota_reason":{"type":"string","enum":["requests","bytes"],"description":"Which allowance ran out. Absent while neither has."},"counted_at":{"type":"string","format":"date-time","description":"When the count was last recomputed. Absent before the first count."},"dns_mode":{"type":"string","enum":["managed","external"],"description":"This domain's DNS mode. Gateways need `managed`: on an `external`\ndomain the record would live in a zone NSIN does not serve, so\nswitching one on is refused whatever the plan says. Gateways already\non stay listed and can still be switched off.\n"}}},"Gateway":{"type":"object","description":"One entry in the gateway catalog, plus whether it is switched on for the\ndomain you asked about. The origin and upstream Host header behind a\ngateway are NSIN's and are not exposed.\n","properties":{"id":{"type":"integer","description":"Pass this as `gatewayId` to switch the gateway on or off."},"title":{"type":"string","description":"Display name."},"slug":{"type":"string","description":"Prefix of the generated hostname — the record is named `<slug>-<5 digits>`."},"description":{"type":"string","description":"Short explanatory line. May be empty."},"upstream":{"type":"string","description":"The service this gateway forwards to, e.g. `api.openai.com`. Sent as\nthe `Host` header upstream. The origin address behind it is not\nexposed.\n","example":"api.push.apple.com"},"icon":{"type":"string","description":"Icon as a base64 `data:` URI, ready to use as an `<img>` source. May\nbe empty. Empty when the list was asked for with `icons=url`.\n"},"icon_url":{"type":"string","description":"Only with `icons=url`: the icon's content-addressed path on the API\norigin (`/gateway-presets/{id}/icon?v=…`), cacheable for a year.\nEmpty when the gateway has no icon.\n","example":"/gateway-presets/12/icon?v=3kx9q1m2r7a"},"category":{"type":"string","description":"Group the gateway is filed under on the Gateways page. Empty means uncategorised."},"enabled":{"type":"boolean","description":"Whether this gateway is currently on for this domain."},"blocked":{"type":"boolean","description":"The gateway is on but its hostname is answering `429` right now,\nbecause the domain's gateway allowance is spent (or its plan no\nlonger includes gateways).\n"},"retired":{"type":"boolean","description":"The gateway is no longer offered but is still on for this domain.\nIt keeps working and can be switched off; it cannot be switched on\nagain.\n"},"record":{"allOf":[{"$ref":"#/components/schemas/GatewayRecordRef"}],"description":"The record created for this gateway. Absent when `enabled` is false."}}},"GatewayRecordRef":{"type":"object","properties":{"id":{"type":"integer","description":"Record id."},"name":{"type":"string","description":"Name relative to the domain, e.g. `chatgpt-84213`."},"original_name":{"type":"string","description":"Fully qualified name, e.g. `chatgpt-84213.example.com.`"}}},"GatewayStat":{"type":"object","properties":{"gateway_id":{"type":"integer","description":"The gateway this traffic belongs to."},"hostname":{"type":"string","description":"Hostname the requests were made to, e.g. `chatgpt-84213.example.com`."},"requests":{"type":"integer","description":"Total requests over the period."},"bytes":{"type":"integer","description":"Egress bytes over the period — already billed as the domain's ordinary traffic, not a separate charge."},"series":{"type":"array","description":"One point per bucket, oldest first. The last point is the current, partial bucket.","items":{"type":"object","properties":{"t":{"type":"string","format":"date-time","description":"Bucket start (UTC)."},"c":{"type":"integer","description":"Requests in the bucket."},"b":{"type":"integer","description":"Egress bytes in the bucket."}}}}}},"GatewayName":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Hostname relative to the domain — letters, digits and hyphens.\nWildcards and `@` are rejected. On `apply` this field is optional;\nleave it out and a name is generated for you.\n","example":"my-chatgpt"}}},"RecordCreate":{"type":"object","required":["name","type","destination"],"properties":{"name":{"type":"string","description":"Name relative to the domain. Use `@` for the apex."},"type":{"$ref":"#/components/schemas/RecordType"},"destination":{"type":"string","description":"IP address, hostname or text content."},"mx_priority":{"type":"integer","minimum":0,"maximum":65535},"ttl":{"type":"integer","minimum":1,"maximum":604800,"default":120,"description":"Seconds resolvers may cache this record. Forced to 120 while `proxied` is true — a proxied record answers with our edge addresses, and traffic can only be moved between edges as fast as the slowest resolver still holding the old answer."},"proxied":{"type":"boolean","default":false,"description":"Route the name through the NSIN edge. Ignored (the record is created\nunproxied) for types other than `A`, `AAAA`, `CNAME` and `ANAME`.\nThe origin must be an address the edge accepts, and a name can\nhave only one proxied origin.\n"},"captcha":{"type":"boolean","default":false,"description":"Challenge visitors before passing them to the origin. Forced off for DNS-only types."},"scheme":{"$ref":"#/components/schemas/RecordScheme"},"port":{"type":"integer","description":"Origin port. Default 443 (80 for `Http`); always 443 with `Auto`."},"host_header":{"type":"string","description":"Host header (and SNI) to send to the origin instead of the record's\nname. Must be inside this domain or another active domain of the\nsame owner. Needs a plan with the Host-header override feature.\n"},"host_header_mode":{"type":"string","enum":["own","target"],"description":"`CNAME`/`ANAME` only: send the record's own name (`own`, the\ndefault) or the target it points at (`target`) as the Host header.\nCannot be combined with `host_header`, and `target` is refused when\nthe target is hosted on NSIN under another account.\n"},"monitor":{"type":"boolean","description":"Include this record in uptime monitoring."},"timeout":{"type":"integer","minimum":1,"maximum":1800,"default":60,"description":"Origin wait before 504, in seconds. Max 1800 (30 minutes)."},"comment":{"type":"string","maxLength":1024,"description":"Free-form note, trimmed."}}},"RecordUpdate":{"type":"object","description":"Every field is optional; omitted fields keep their current value.","properties":{"name":{"type":"string"},"destination":{"type":"string","description":"New value — see `destination` on Record."},"mx_priority":{"type":"integer","minimum":0,"maximum":65535,"description":"MX priority. `MX` only."},"ttl":{"type":"integer","minimum":1,"maximum":604800,"default":120,"description":"Seconds resolvers may cache this record. Forced to 120 while `proxied` is true — a proxied record answers with our edge addresses, and traffic can only be moved between edges as fast as the slowest resolver still holding the old answer."},"proxied":{"type":"boolean","description":"See `proxied` on RecordCreate."},"captcha":{"type":"boolean","description":"Challenge visitors before passing them to the origin."},"scheme":{"$ref":"#/components/schemas/RecordScheme"},"port":{"type":"integer","description":"See `port` on RecordCreate."},"host_header":{"type":"string","description":"See `host_header` on RecordCreate. An empty string removes the override."},"host_header_mode":{"type":"string","enum":["own","target"],"description":"See `host_header_mode` on RecordCreate."},"monitor":{"type":"boolean","description":"Include this record in uptime monitoring."},"timeout":{"type":"integer","minimum":1,"maximum":1800,"description":"Origin wait before 504, in seconds. Max 1800 (30 minutes)."},"comment":{"type":"string","maxLength":1024,"description":"Free-form note. An empty string removes it."}}},"BatchItemResult":{"type":"object","properties":{"id":{"type":"integer"},"ok":{"type":"boolean"},"error":{"type":"string","description":"Present only when `ok` is false."}}},"BatchResult":{"type":"object","description":"Outcome of a best-effort bulk operation. The status code is `200` even\nwhen some records failed — inspect `results`.\n","properties":{"succeeded":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"$ref":"#/components/schemas/BatchItemResult"}}}},"ImportPreviewRecord":{"type":"object","properties":{"name":{"type":"string"},"type":{"$ref":"#/components/schemas/RecordType"},"destination":{"type":"string","description":"The record's value."},"ttl":{"type":"integer","description":"TTL the record would be created with (120)."},"mx_priority":{"type":"integer","description":"MX priority. `MX` only."},"proxied":{"type":"boolean","description":"Whether the record would be proxied."},"status":{"type":"string","enum":["new","overwrite","unsupported"],"description":"`overwrite` means an NSIN record with the same name and type (for\n`MX`, `NS`, `SRV`, `CAA`, `TLSA`, `SSHFP` and `URI`: and the same\nvalue) already exists and would be replaced.\n"},"existing_id":{"type":"integer","description":"Set when `status` is `overwrite`."},"reason":{"type":"string","description":"Why an entry is `unsupported`."}}},"ImportRecordItem":{"type":"object","required":["name","type","destination"],"properties":{"name":{"type":"string"},"type":{"$ref":"#/components/schemas/RecordType"},"destination":{"type":"string","description":"The record's value."},"ttl":{"type":"integer","description":"TTL in seconds; missing or `0` becomes 120."},"mx_priority":{"type":"integer","description":"MX priority. `MX` only."},"proxied":{"type":"boolean","description":"Proxy the new record. Ignored for a record that already exists (it keeps its setting) and for types that cannot be proxied."}}},"ImportResult":{"type":"object","properties":{"created":{"type":"integer"},"failed":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"error":{"type":"string"}}}},"records":{"type":"array","description":"The domain's full record list after the import.","items":{"$ref":"#/components/schemas/Record"}}}},"ImportWarning":{"type":"object","description":"One reviewer-facing note on a staged row. `code` is stable — branch on\nit rather than on `message`, which is prose and may change.\n","properties":{"code":{"type":"string","enum":["unsupported","not_proxyable_type","private_address","points_at_nsin","proxy_ineligible_origin","mail_host","non_web_service","overwrite","wildcard"]},"severity":{"type":"string","enum":["info","warning","error"],"description":"Only `error` rows arrive unticked (`preselected: false`) — they are\nthe ones NSIN cannot import at all.\n"},"message":{"type":"string"}}},"ImportSessionRecord":{"type":"object","description":"One record the scan found, with the verdict a reviewer needs.","properties":{"id":{"type":"integer","description":"Staging row id. It is not a record id — it exists only until the\nsession is committed or discarded.\n"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/RecordType"},"destination":{"type":"string"},"ttl":{"type":"integer"},"mx_priority":{"type":"integer"},"proxied":{"type":"boolean","description":"Whether this row would be proxied — and, because a `mode: \"all\"`\ncommit (the unattended `auto_commit_at` one included) writes exactly\nthis flag, what happens to the row if nobody answers.\n\nIt is `true` for the rows the edge can carry: a proxyable type on a\nroutable origin. It is `false` wherever proxying would take a\nservice away rather than accelerate it — a mail host, the target of\nan in-zone `MX`, an underscored name (`_acme-challenge`,\n`selector1._domainkey`), or a label that names something that does\nnot speak HTTP (`ssh`, `vpn`, `mysql`, `ns1`, …). Those rows carry a\n`mail_host` or `non_web_service` warning saying so.\n\nAn `overwrite` row mirrors the record it would replace: an import\nrefreshes content and TTL and never changes an existing record's\nproxy setting.\n"},"status":{"type":"string","enum":["new","overwrite","unsupported"],"description":"`overwrite` means the domain already holds a record with this name\nand type and it would be replaced. TXT is never `overwrite`: many\nTXT records share one name.\n"},"existing_id":{"type":"integer","description":"The record that would be replaced. Set when `status` is `overwrite`."},"proxy_eligible":{"type":"boolean","description":"Whether this row *could* be proxied if you switched it on — a\nproxyable type pointing at an address the edge will accept.\n"},"preselected":{"type":"boolean","description":"Whether the row is included when you commit with `mode: \"all\"`.\nRows carrying an `error` warning arrive unticked.\n"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/ImportWarning"}},"reason":{"type":"string","description":"The first warning's message, kept for clients written against the\nflat scan preview.\n"}}},"ImportSessionCounts":{"type":"object","description":"The header line of a review screen.","properties":{"total":{"type":"integer"},"preselected":{"type":"integer","description":"Rows a `mode \"all\"` commit would write."},"proxied":{"type":"integer"},"warnings":{"type":"integer","description":"Rows carrying at least one warning."}}},"ImportSession":{"type":"object","description":"One scan-and-review cycle for a domain — the envelope every\nimport-session endpoint returns.\n","properties":{"id":{"type":"integer"},"domain_id":{"type":"integer"},"status":{"type":"string","enum":["scanning","ready","committing","committed","auto_committed","discarded","superseded","failed"],"description":"`scanning` — the sweep is running. `ready` — waiting for a commit or\na discard. `committing` — a commit is in flight and holds the claim.\n`auto_committed` — nobody answered before `auto_commit_at` and the\nrecords were written anyway, rather than leaving the zone empty.\n`superseded` — replaced by a rescan.\n"},"source":{"type":"string","enum":["manual_scan","domain_create","zone_file"]},"client":{"type":"string","enum":["panel","api"],"description":"What started the session. An API key has nowhere to show a review\nscreen, so adding a domain with a key still imports automatically;\nstaged review is the panel path.\n"},"method":{"type":"string","enum":["axfr","scan"],"description":"Which branch found the records — a full zone transfer, or a resolver\nsweep of common names. The first support question about a bad import\nis where the records came from.\n"},"source_ns":{"type":"array","items":{"type":"string"},"description":"The nameservers this scan read. Stored because a rescan has to reuse\nthem: once the domain is delegated to NSIN, resolving it again finds\nour own — still empty — zone.\n"},"error":{"type":"string","description":"Why the scan, or the last commit attempt, failed."},"started_at":{"type":"string","format":"date-time"},"finished_at":{"type":"string","format":"date-time","description":"When the scan finished and the session turned `ready`."},"committed_at":{"type":"string","format":"date-time"},"auto_commit_at":{"type":"string","format":"date-time","description":"When an unanswered `ready` session commits itself. Cleared by a\ncommit, a discard or a rescan.\n"},"counts":{"$ref":"#/components/schemas/ImportSessionCounts"},"records":{"type":"array","description":"Empty while `status` is `scanning`.","items":{"$ref":"#/components/schemas/ImportSessionRecord"}}}},"ImportSessionCommit":{"type":"object","description":"Omit the body entirely to commit the session's own preselected rows —\nthat is the same as `{\"mode\": \"all\"}`.\n","properties":{"mode":{"type":"string","enum":["all","selected"],"default":"all","description":"`selected` commits `records` exactly as posted. `all` — or an empty\n`records` — commits the rows the session preselected, with the proxy\ndefaults it staged.\n"},"records":{"type":"array","description":"The reviewed set. Rows may be dropped, and `proxied` may be switched\non per row, but a row must still be one the plan and the address\nrules accept.\n","items":{"$ref":"#/components/schemas/ImportRecordItem"}}}},"ImportSessionCommitResult":{"type":"object","properties":{"created":{"type":"integer"},"overwritten":{"type":"integer","description":"Existing records replaced by a staged row of the same name and type."},"failed":{"type":"array","description":"Per-row failures. They never abort the batch — everything else was\nstill written.\n","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"error":{"type":"string"}}}},"records":{"type":"array","description":"The domain's full record list after the commit.","items":{"$ref":"#/components/schemas/Record"}}}},"ImportSessionConflict":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"status":{"type":"string","description":"The session's status as it stands now, so a loser of the claim\nrace can tell \"already committed\" from \"discarded\".\n"}}}]},"ImportScanThrottledError":{"allOf":[{"$ref":"#/components/schemas/Error"},{"type":"object","properties":{"retry_after_seconds":{"type":"integer","description":"Seconds left on this domain's five-minute scan window."}}}]},"RuleType":{"type":"string","enum":["cache","drop","redirect","rewrite","waf","captcha","rate_limit","bot_route","origin_pool","origin_route","fingerprint","error_page","optimize","basic_auth","header"]},"HostMatchType":{"type":"string","description":"How the host filter — `host_pattern`, `host_includes` and\n`host_excludes` — is matched. One strategy covers all three, exactly as\none `path_match_type` covers both path lists.\n\nThe empty string means \"no host filter\", and is the only valid value\nwhen the pattern and both lists are empty. Set a list without a match\ntype and the API defaults it to `wildcard`.\n\nA `wildcard` entry matches subdomains, not the label itself:\n`*.example.com` covers `shop.example.com` but not `example.com` — the\nsame reading as the DNS wildcard. Add the bare name as its own entry to\ninclude it.\n","enum":["","exact","wildcard","regex"]},"ActionMode":{"type":"string","description":"* `enforce` — the rule acts (block, redirect, challenge, …).\n* `dry_run` — the rule matches and is logged as \"would have acted\", but\n  the request reaches the origin unchanged. Use it to test a rule\n  safely.\n\nNot every rule type honours this; cache ignores it.\n","enum":["enforce","dry_run"]},"RulePathMatchType":{"type":"string","description":"How `path_includes` and `path_excludes` are interpreted.","enum":["wildcard","regex"]},"RuleCommon":{"type":"object","description":"The fields every rule carries, whatever its type.","properties":{"id":{"type":"integer"},"domain_id":{"type":"integer"},"record_id":{"type":"integer","description":"Deprecated single-record scope. Prefer `record_ids`. Absent for\nzone-wide rules.\n"},"record_ids":{"type":"array","items":{"type":"integer"},"description":"The proxied DNS records this rule applies to. Empty or absent means\nzone-wide — every proxied record of the domain.\n"},"type":{"$ref":"#/components/schemas/RuleType"},"enabled":{"type":"boolean"},"priority":{"type":"integer","description":"Evaluation order; lower runs first. Defaults to 100."},"host_pattern":{"type":"string","description":"Legacy single-hostname filter, kept for rules written before\n`host_includes` existed. It is evaluated as one more entry of\n`host_includes`; prefer the lists.\n"},"host_match_type":{"$ref":"#/components/schemas/HostMatchType"},"host_includes":{"type":"array","items":{"type":"string"},"description":"Hostnames the rule applies to. Empty or absent means every host the\nscoped record(s) serve — which on a wildcard-proxied zone\n(`*.example.com`) is every subdomain.\n"},"host_excludes":{"type":"array","items":{"type":"string"},"description":"Hostnames carved back out of `host_includes`. An exclude always\nwins over an include, so \"everything except staging\" is an empty\ninclude list plus one exclude.\n"},"ip_includes":{"type":"array","items":{"type":"string"},"maxItems":256,"description":"Client addresses the rule applies to. Empty or absent means every\naddress — the rule is not scoped by IP at all unless `ip_excludes`\nis set.\n\nEntries are returned canonicalised, which may differ from what was\nsent: CIDR host bits are masked off (`10.0.0.5/8` reads back as\n`10.0.0.0/8`), range endpoints are ordered low-to-high, IPv4-mapped\nIPv6 is unmapped, and duplicates are dropped. The order of the\nremaining entries is preserved.\n\nThe address matched is the TCP peer seen by the edge. `X-Forwarded-For`\nis never consulted, so a visitor cannot spoof a header to put\nthemselves inside or outside a scope.\n"},"ip_excludes":{"type":"array","items":{"type":"string"},"maxItems":256,"description":"Client addresses carved back out of `ip_includes`. An exclude always\nwins over an include. Canonicalised on the way in, exactly like\n`ip_includes`.\n"},"action_mode":{"$ref":"#/components/schemas/ActionMode"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"RuleCommonBody":{"type":"object","description":"The shared rule fields accepted by every create and update body. All are\noptional — on create they fall back to defaults, on update an omitted\nfield is left unchanged.\n","properties":{"record_id":{"type":["integer","null"],"description":"Deprecated single-record scope. Prefer `record_ids`."},"record_ids":{"type":"array","items":{"type":"integer"},"description":"Scope the rule to these proxied records. Omit or send an empty array\nfor a zone-wide rule. Every id must belong to this domain.\n"},"enabled":{"type":"boolean","default":true},"priority":{"type":"integer","default":100,"minimum":0},"host_pattern":{"type":"string"},"host_match_type":{"$ref":"#/components/schemas/HostMatchType"},"host_includes":{"type":"array","items":{"type":"string"},"maxItems":200,"description":"Hostnames the rule applies to; empty or omitted means every host.\nSending an explicit empty array clears an existing list.\n"},"host_excludes":{"type":"array","items":{"type":"string"},"maxItems":200,"description":"Hostnames excluded from the rule; excludes beat includes."},"ip_includes":{"type":"array","items":{"type":"string"},"maxItems":256,"description":"Scope the rule to these client addresses. Empty or omitted means\nevery address; sending an explicit empty array clears an existing\nlist.\n\nTogether with `ip_excludes` these two lists express all four\nclient-IP semantics, so there is no separate match-type field:\n\n* **IP is in a list** — put the addresses in `ip_includes`.\n* **IP is not in a list** — put them in `ip_excludes` and leave\n  `ip_includes` empty.\n* **IP equals X** — a one-entry `ip_includes`.\n* **IP does not equal X** — a one-entry `ip_excludes`.\n\nEach entry is one of three forms:\n\n* a bare address, IPv4 or IPv6 — `203.0.113.7`, `2001:db8::1`\n* a CIDR prefix — `203.0.113.0/24`, `2001:db8::/32`\n* an inclusive low-high range — `203.0.113.10-203.0.113.40`. Both\n  endpoints must be the same IP version.\n\nEntries are canonicalised and de-duplicated on save (CIDR host bits\nmasked off, range endpoints ordered, IPv4-mapped IPv6 unmapped), so\nthe stored value is exactly what the edge will match. An entry that\nis not a valid address, CIDR or range is a `400`.\n\nAn empty `ip_includes` means **every** address, subject to\n`ip_excludes`; an exclude always beats an include. Matching is\nagainst the TCP peer at the edge, never `X-Forwarded-For`, so the\nscope cannot be spoofed with a request header.\n\n**Not accepted on `cache` and `optimize` rules** — a non-empty list\non either type is a `400`. One cached copy is shared by every visitor\nand the cache key carries no client-IP dimension, so an IP-scoped\ncache rule would serve one visitor's response to another.\n\nOn a `drop` rule, `ip_excludes` may not be used on its own:\nexclude-only would blackhole every visitor who is not named, so\n`ip_includes` must list at least one address.\n"},"ip_excludes":{"type":"array","items":{"type":"string"},"maxItems":256,"description":"Client addresses excluded from the rule; excludes beat includes.\nSame three entry forms, same canonicalisation and same `cache` /\n`optimize` refusal as `ip_includes`.\n"},"action_mode":{"$ref":"#/components/schemas/ActionMode"}}},"RulePathScope":{"type":"object","description":"Path matching shared by the rule types that filter on the URL path.","properties":{"path_match_type":{"$ref":"#/components/schemas/RulePathMatchType"},"path_includes":{"type":"array","items":{"type":"string"},"description":"Paths the rule applies to. Defaults to `[\"/*\"]` — everything."},"path_excludes":{"type":"array","items":{"type":"string"},"description":"Paths carved back out of `path_includes`."}}},"RuleReorderRequest":{"type":"array","description":"A bare array — not wrapped in an object.","items":{"type":"object","required":["id","priority"],"properties":{"id":{"type":"integer"},"priority":{"type":"integer","minimum":0}}}},"RuleReorderResult":{"type":"object","properties":{"updated":{"type":"integer","description":"How many rules were changed."}}},"CacheScope":{"type":"string","description":"What the rule caches among the paths it already matches.\n\n* `default` — static assets only, chosen by file extension.\n* `everything` — every cacheable response, HTML included.\n\nThere is no \"custom\" scope: narrow what you cache by scoping\n`path_includes` instead.\n","enum":["default","everything"]},"CacheRuleFields":{"type":"object","properties":{"ttl_sec":{"type":"integer","description":"How long an entry stays fresh, in seconds. `0` uses the default."},"refresh_sec":{"type":"integer","description":"Background refresh interval in seconds — the entry is re-fetched\nthis often while still being served. `0` disables it.\n"},"with_qs":{"type":"boolean","description":"Include the query string in the cache key. Off means `?a=1` and `?a=2` share one entry."},"scope":{"$ref":"#/components/schemas/CacheScope"},"bypass_authorization":{"type":"boolean","default":true,"description":"Skip caching requests that carry an `Authorization` header. Leave on\nunless you are certain the response is not user-specific.\n"},"bypass_set_cookie":{"type":"boolean","default":true,"description":"Skip caching responses that set a cookie. Turning this off can serve\none visitor's session to another — only do it for responses you know\nare anonymous.\n"},"respect_client_no_store":{"type":"boolean","default":true,"description":"Honour `Cache-Control: no-store` from the client."},"respect_origin_cache_control":{"type":"boolean","default":true,"description":"Honour the origin's `Cache-Control` directives."},"respect_origin_max_age":{"type":"boolean","default":true,"description":"Use the origin's `max-age` instead of `ttl_sec`."},"bypass_wp_admin":{"type":"boolean","default":true,"description":"Never cache WordPress admin and login paths."}}},"CacheRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/CacheRuleFields"}]},"CacheRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/CacheRuleFields"}]},"DropRuleFields":{"type":"object","properties":{"country_match_type":{"type":"string","enum":["include","exclude"],"description":"Whether `countries` is the set that IS dropped (`include`) or the\nonly set that is NOT dropped (`exclude`).\n"},"countries":{"type":"array","items":{"type":"string"},"description":"ISO 3166-1 alpha-2 country codes. Empty means no country filter."},"ip_match_type":{"type":"string","enum":["include","exclude"],"default":"include","description":"Whether `ips` is the set that IS dropped (`include`) or the only set\nthat is NOT dropped (`exclude` — an allowlist). An `exclude` rule\nmust list at least one entry; an empty allowlist would drop every\nrequest on the matched paths.\n"},"ips":{"type":"array","items":{"type":"string"},"maxItems":256,"description":"Client addresses the rule is scoped to. Empty means no IP filter.\nEach entry is a single address (`203.0.113.7`, `2001:db8::1`), a\nCIDR prefix (`10.0.0.0/8`), or an inclusive range\n(`10.0.0.1-10.0.0.50`). Entries are stored canonicalized — CIDR\nhost bits are masked off and reversed ranges are ordered.\n\nUnder `exclude`, a visitor whose address cannot be determined is\ndropped: it is provably not one of the allowed addresses.\n"}}},"DropRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/DropRuleFields"}]},"DropRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/DropRuleFields"}]},"CustomRuleCondition":{"type":"object","required":["field","op"],"description":"One test on the request. TRUE when ANY of `values` matches; `negate`\nflips the result. A missing cookie, header, query parameter or referer\nmakes every op except `exists` false — so a negated `contains` on a\nmissing cookie is true.\n","properties":{"field":{"type":"string","enum":["cookie","header","query","path","method","host","user_agent","referer","ip","country","asn","ja4","ja4h","bot_score"],"description":"What to test. `bot_score` is the edge's bot score of the request,\n1 (bot) to 99 (human-like); a request the edge did not score never\nmatches. `path` is the request path before any rewrite,\n`host` is lowercased without the port, `ip` is the TCP peer (never\n`X-Forwarded-For`), `country` the visitor's GeoIP country (`XX`\nwhen unknown), `asn` the client IP's autonomous system number (an\naddress with no known ASN never matches), `ja4`/`ja4h` NSIN's own\nfingerprints as shown in the request logs.\n"},"key":{"type":"string","maxLength":128,"description":"The cookie or header name — required for `cookie` and `header`.\nFor `query`, a parameter name, or empty for the whole raw query\nstring. Must be empty for every other field.\n"},"op":{"type":"string","enum":["exists","equals","contains","starts_with","ends_with","matches","in","lt","gt"],"description":"`bot_score` takes only `lt` or `gt` with exactly one value, a whole\nnumber 1–99 (expression `bot_score lt \"30\"`); it is accepted once the\nedge update that computes bot scores is live everywhere (until then\n400). `ip`, `country` and `asn` take only `in`. Every other field takes\n`exists`, `equals`, `contains`, `starts_with`, `ends_with` or\n`matches` (an RE2 regex of up to 256 characters). `exists` is only\nfor `cookie`, `header`, `referer` and `query` with a key.\n"},"values":{"type":"array","items":{"type":"string","maxLength":512},"maxItems":100,"description":"1–100 values, empty for `exists`. `ip`: single addresses or CIDRs\n(v4 or v6), stored canonicalized. `country`: ISO 3166-1 alpha-2\ncodes, stored uppercase. `asn`: AS numbers 1–4294967295 (an `AS`\nprefix is accepted), stored as plain decimals. An empty value is refused for `contains`,\n`starts_with`, `ends_with` and `matches` (it would match every\nrequest).\n"},"negate":{"type":"boolean","default":false,"description":"Flip the result — \"is not\", \"does not contain\", \"does not exist\"."},"ignore_case":{"type":"boolean","default":false,"description":"Compare text case-insensitively. Not allowed on `ip`, `country` or `asn`; `method` and `host` always compare case-insensitively."}}},"CustomRuleFields":{"type":"object","properties":{"name":{"type":"string","maxLength":80,"description":"Label the rule is listed under."},"match":{"type":"string","enum":["all","any"],"default":"all","description":"`all`: every condition must be true (AND); `any`: one is enough (OR)."},"conditions":{"type":"array","minItems":1,"maxItems":20,"items":{"$ref":"#/components/schemas/CustomRuleCondition"},"description":"1–20 conditions; at most 16 KB together as JSON."},"action":{"type":"string","enum":["block","captcha","log"],"default":"block","description":"`block` answers with the 403 block page (as a drop rule does);\n`captcha` challenges the visitor and lets them through once solved;\n`log` lets the request through and only records it. Request logs\ntag a match as `detectAction` `custom_block`, `custom_captcha` or\n`custom_log`; a `dry_run` match carries the dry-run flag.\n"},"skip_verified_bots":{"type":"boolean","default":false,"description":"`true` lets verified search engine and link-preview bots (Googlebot,\nBingbot …, checked at the edge by reverse DNS and their published\nIP ranges) pass a `block` or `captcha` rule untouched, so a country\nblock does not block Googlebot. A fake bot user agent is still\nacted on.\n"}}},"CustomRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/CustomRuleFields"},{"type":"object","properties":{"expression":{"type":"string","readOnly":true,"description":"The conditions as text, for display only — ignored on write.\nPer condition `[not ]<field>[[\"key\"]] <op> <value | {v1 v2}>`\nwith `equals` printed as `eq`, keys and values as JSON string\nliterals, one value bare and several (and every `in` list) in\nbraces, ` (ignore case)` appended when set; joined by ` and `\n(match `all`) or ` or ` (match `any`). Example:\n`cookie[\"padding\"] exists and not user_agent contains \"Chrome\"`.\n"}}}]},"CustomRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/CustomRuleFields"}]},"RedirectRuleFields":{"type":"object","properties":{"target":{"type":"string","description":"Where to send the visitor. Absolute URL, or a path when redirecting within the site."},"status_code":{"type":"integer","enum":[301,302,307,308],"default":302,"description":"The redirect status. `301`/`308` are permanent and cached hard by\nbrowsers — verify the rule with `302` first.\n"},"preserve_query":{"type":"boolean","default":true,"description":"Append the original query string to `target`."},"preserve_path":{"type":"boolean","description":"Append the original path to `target`."}}},"RedirectRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/RedirectRuleFields"},{"type":"object","properties":{"www_record":{"type":"string","enum":["covered","created","created_external","unproxied","no_apex","limit","failed"],"description":"Only present when *creating* the canonical `www.<domain>` →\napex (or apex → `www.<domain>`) redirect. Those rules are inert\nwithout a proxied DNS record for `www` — the edge evaluates\nrules only for hostnames it holds a record for — so the record\nis provisioned alongside the rule and this reports what\nhappened: `created` (a proxied www record mirroring the apex\nwas added), `created_external` (added, but the zone is hosted\nelsewhere so the owner must still point `www` at us),\n`covered` (one already existed), `unproxied` (a www\nrecord exists but bypasses the edge, so the redirect will not\nrun), `no_apex` (no apex address record to mirror), `limit`\n(the plan is out of record slots), `failed` (the DNS write\nfailed). The rule itself is created in every case.\n"}}}]},"RedirectRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/RedirectRuleFields"}]},"RewriteRuleFields":{"type":"object","properties":{"path_target":{"type":"string","description":"The path sent to the origin. With `path_match_type: regex` you may\nreference capture groups from `path_includes`.\n"},"query_mode":{"type":"string","enum":["preserve","replace","strip"],"description":"* `preserve` — pass the original query string through.\n* `replace` — substitute `query_target`.\n* `strip` — drop the query string entirely.\n"},"query_target":{"type":"string","description":"The replacement query string, used when `query_mode` is `replace`."}}},"RewriteRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/RewriteRuleFields"}]},"RewriteRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/RewriteRuleFields"}]},"HeaderOp":{"type":"object","required":["direction","action","name"],"description":"One header edit. A rule carries an ordered list of them and applies\nthem in slice order, so a later op beats an earlier one on the same\nname.\n","properties":{"direction":{"type":"string","enum":["request","response"],"description":"* `request` — applied on the way to the origin, after NSIN has\n  stamped its own forwarding headers.\n* `response` — applied on the way to the visitor, after the\n  response is retrieved from cache or origin. Nothing a response op\n  does reaches the stored copy, so editing a rule takes effect on\n  the very next cache hit rather than when the object expires.\n\nA 101 WebSocket handshake never passes the response chokepoint, so\nresponse ops do not apply to an upgrade.\n"},"action":{"type":"string","enum":["set","add","remove"],"description":"* `set` — replace every existing value with `value`.\n* `add` — append `value`, keeping what the client or origin sent.\n* `remove` — delete the header. The only action that accepts a\n  trailing `*` wildcard in `name`.\n"},"name":{"type":"string","maxLength":256,"description":"The header field name — an RFC 9110 token, matched\ncase-insensitively. A trailing `*` (`X-Debug-*`) is a prefix\nwildcard and is accepted on `remove` only; the edge re-checks the\nblocked list against every name a wildcard actually matches, so a\nwildcard can never strip a header NSIN owns.\n\nSome names are refused per `(direction, action)` rather than\noutright — see `ops` on the request body for the list and the\nreasoning.\n"},"value":{"type":"string","maxLength":4096,"description":"Required for `set` and `add`, and must be empty for `remove`.\n"}}},"HeaderRuleFields":{"type":"object","properties":{"name":{"type":"string","maxLength":64,"description":"Optional label for this rule, e.g. \"Security headers\", shown in the\npanel's rule table. Purely for identification. Omit or send an\nempty string for none.\n"},"ops":{"type":"array","minItems":1,"maxItems":16,"items":{"$ref":"#/components/schemas/HeaderOp"},"description":"The ordered edit list, applied in array order.\n\n**Caps**, all validated on save so an oversized rule fails as a\nclear `400` instead of as a 431 from the origin: 16 ops per rule,\n4096 bytes per `value`, and 8192 bytes summed over name+value of\nevery `set`/`add` op — 4 KB leaves room for a real\nContent-Security-Policy while staying under the 8 KB per-header\nlimit nginx and Apache default to.\n\n**Headers NSIN owns are refused**, per `(direction, action, name)`\nrather than by name alone. On the request: `Host`, the framing and\nhop-by-hop set (`Content-Length`, `Transfer-Encoding`,\n`Connection`, `Upgrade`, `Keep-Alive`, `Proxy-Connection`, `TE`,\n`Trailer`), the forwarding set (`X-Forwarded-*`, `X-Real-IP`,\n`Forwarded`, `True-Client-IP`, `CDN-Loop`), the conditional and\nnegotiation set (`Cache-Control`, `If-None-Match`,\n`If-Modified-Since`, `If-Match`, `If-Range`, `Range`,\n`Accept-Encoding`), `Sec-WebSocket-*`, `X-Mafar-*`, `X-Nsin-*` and\nthe whole `Nsn-*` prefix. On the\nresponse: `Content-Length`, the hop-by-hop set,\n`Content-Encoding`, `Vary`, `Server`, `Strict-Transport-Security`\n(managed by the HSTS ramp on the domain's Security page) and again\n`Nsn-*`.\n\nThree request headers are blocked for `set`/`add` but **allowed for\n`remove`**: `Cookie`, `Authorization` and `Nsn-Connecting-IP`.\nRe-adding a credential is what makes a personalised page cacheable\nin a shared slot; stripping one before it reaches the origin is a\nlegitimate privacy choice, and is how an owner makes a page\ncacheable that otherwise would not be.\n\nEach refusal returns a `400` naming the header, the action and the\nreason.\n\nTwo response names are **accepted but dangerous**, and the panel\nmakes a human type the header name to confirm before saving one:\n`Cache-Control`, which desyncs the browser's view of freshness from\nthe edge's, and `Set-Cookie`, which on a cacheable page is the shape\nof a cross-account session leak. The API applies no confirmation\nstep — an integration writing either one should know why.\n"}}},"HeaderRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/HeaderRuleFields"}]},"HeaderRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/HeaderRuleFields"},{"type":"object","description":"`ip_includes` / `ip_excludes` are refused with a `400` when any op\nin the rule is request-direction: a request op changes what is\nfetched from the origin without changing the cache key, so the\nfirst fill would win for every visitor in every other IP bucket —\nthe same defect that bars an IP scope on `cache` and `optimize`.\nResponse-direction ops are applied per request after retrieval and\nkeep full IP-scope parity.\n"}]},"OptimizeRuleFields":{"type":"object","properties":{"images":{"type":"boolean","default":false,"description":"Convert JPEG and PNG responses to WebP. Only visitors whose\n`Accept` header advertises WebP are served it — those requests\noccupy a separate cache slot — so a client that cannot decode WebP\nalways receives the original file.\n"},"image_quality":{"type":"integer","minimum":40,"maximum":100,"default":80,"description":"WebP encoder quality. Lower is smaller and lossier. 80 is the\nrecommended balance.\n"},"minify_js":{"type":"boolean","default":false,"description":"Strip comments and whitespace from JavaScript. Identifiers are\nnever renamed.\n\nNote: minifying a script breaks any page that loads it with a\nSubresource Integrity hash (`integrity=\"sha384-...\"`), because the\nbytes no longer match, and it invalidates published source maps.\nThe edge cannot detect either condition.\n"},"minify_css":{"type":"boolean","default":false,"description":"Strip comments and whitespace from CSS."},"compress_level":{"type":"integer","minimum":0,"maximum":11,"default":0,"description":"Brotli quality for cached text responses. `0` inherits the node\ndefault. Lossless, so it carries none of the risk of the other\nactions. Higher levels are applied in the background after the\nfirst response is served, so they never add latency.\n"}}},"OptimizeRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/OptimizeRuleFields"}]},"OptimizeRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/OptimizeRuleFields"}]},"WafRuleFields":{"type":"object","properties":{"paranoia":{"type":"integer","minimum":1,"maximum":4,"default":1,"description":"OWASP CRS paranoia level. Higher catches more attacks and produces\nmore false positives — raise it in `dry_run` first.\n"},"threshold":{"type":"integer","minimum":1,"maximum":100,"default":5,"description":"Anomaly score at which a request is blocked."},"body_cap_kb":{"type":"integer","minimum":0,"maximum":1024,"default":128,"description":"How much request body to inspect, in KB. `0` skips body inspection."},"rule_excludes":{"type":"array","items":{"type":"string"},"description":"CRS rule ids to disable, for tuning out false positives."},"mode":{"type":"string","enum":["full","critical_only","php2shell"],"default":"full","description":"`full` runs the whole Core Rule Set with anomaly scoring (paranoia,\nthreshold, body cap and excludes apply). `critical_only` checks only\nNSIN's short critical set — secret-file probes, path traversal, OS\nfile access, Log4Shell, known scanner tools — over the URL, query\nstring and headers; any single hit blocks and the body is never\nread. The default NSIN Shield rule uses `critical_only`.\n`php2shell` is PHP2Shell protection for PHP sites (CVE-2026-109618,\nCVE-2026-109619): on uploads (multipart requests) it blocks a session\nupload-progress field and an upload with no length, and only logs\nvery many parts, many empty file fields, deeply nested field names\nand compressed uploads. Free on every plan, one per domain (a second\ncreate answers 409), and a rule cannot be switched into or out of\nthis mode once created.\n"},"managed_by":{"type":"string","readOnly":true,"description":"`shield` on the default NSIN Shield rule the platform created for\nthis domain, `php2shell` on the PHP2Shell protection rule; empty on\nrules you created. A managed rule can be\nedited, disabled or deleted like any other.\n"}}},"WafRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/WafRuleFields"}]},"WafShieldStatus":{"type":"object","description":"State of the domain's default NSIN Shield rule.","properties":{"platform_enabled":{"type":"boolean","description":"Default protection is switched on across NSIN. When `false` the\nfeature is paused for everyone: the managed rule is still listed\nand keeps its settings, but nothing enforces it and `active` is\n`false`. It starts applying again on its own — nothing to do.\n"},"plan_allows":{"type":"boolean","description":"The domain's current plan includes default protection."},"present":{"type":"boolean","description":"A managed shield rule exists for this domain (it may be disabled)."},"rule_id":{"type":"integer","description":"The shield rule's id, when it exists."},"enabled":{"type":"boolean","description":"Whether the shield rule is switched on."},"action_mode":{"description":"The shield rule's action mode.","type":"string","enum":["enforce","dry_run"]},"dismissed":{"type":"boolean","description":"The rule was deleted by the owner and will not be re-created unless restored."},"dismissed_at":{"type":"string","format":"date-time","description":"When the default rule was deleted. Absent unless `dismissed`."},"active":{"type":"boolean","description":"Present, enabled, shipped to the edge — and both `plan_allows` and\n`platform_enabled` are true. This is the only field that answers\n\"is this rule actually protecting the domain right now?\".\n"},"default_action_mode":{"type":"string","enum":["enforce","dry_run"],"description":"The mode a restored rule is created with."}}},"WafRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/WafRuleFields"}]},"CaptchaRuleFields":{"type":"object","properties":{"ttl_sec":{"type":"integer","description":"How long a solved challenge is remembered for that visitor, in seconds."},"skip_verified_bots":{"type":"boolean","default":false,"description":"`true` lets verified search engine and link-preview bots (Googlebot,\nBingbot …, checked by reverse DNS and their published IP ranges)\npass without the challenge, so search ranking is not hurt. A fake\nbot user agent is still challenged.\n"}}},"CaptchaRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/CaptchaRuleFields"},{"type":"object","properties":{"managed_by":{"type":"string","enum":["","under_attack"],"readOnly":true,"description":"`under_attack` on Under Attack Mode's rule, which the rule\nendpoints refuse to change (403); empty on your own rules.\n"}}}]},"CaptchaRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/CaptchaRuleFields"}]},"BasicAuthUser":{"type":"object","description":"A credential as it is returned — username only.","properties":{"username":{"type":"string"},"has_password":{"type":"boolean","description":"Always true for a usable credential. Passwords are never returned."}}},"BasicAuthUserInput":{"type":"object","required":["username"],"properties":{"username":{"type":"string","maxLength":64,"description":"Must not contain `:` (RFC 7617 forbids it in the user-id)."},"password":{"type":"string","minLength":8,"maxLength":128,"description":"Write-only. Omit it for a username that already exists to keep that\nuser's current password; required for a new username.\n"}}},"BasicAuthCommonFields":{"type":"object","properties":{"realm":{"type":"string","maxLength":128,"default":"Restricted","description":"Shown in the browser's sign-in prompt. Must not contain `\"`, `\\`, or\ncontrol characters.\n"},"bypass_cidrs":{"type":"array","maxItems":32,"items":{"type":"string"},"description":"IPs or CIDRs whose requests skip the prompt entirely — an office\nnetwork, an uptime monitor. Bare IPs are stored as a full-length\nprefix (`203.0.113.7` → `203.0.113.7/32`).\n"}}},"BasicAuthRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/BasicAuthCommonFields"},{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/BasicAuthUser"}}}}]},"BasicAuthRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/BasicAuthCommonFields"},{"type":"object","properties":{"users":{"type":"array","minItems":1,"maxItems":32,"items":{"$ref":"#/components/schemas/BasicAuthUserInput"},"description":"The complete credential list. Sending it replaces what is\nstored, so any username you leave out is removed.\n"}}}]},"RateLimitRuleFields":{"type":"object","properties":{"limit":{"type":"integer","description":"Requests allowed per `window_sec` for one key."},"window_sec":{"type":"integer","default":60,"description":"Length of the counting window, in seconds."},"key_by":{"type":"string","enum":["ip","ip_path"],"default":"ip","description":"How requests are bucketed. `ip` counts everything from one address\ntogether; `ip_path` counts each path separately per address.\n"},"on_breach":{"type":"string","enum":["drop","captcha"],"default":"drop","description":"What happens to requests above the limit."},"burst":{"type":"integer","description":"Extra requests tolerated momentarily above `limit`."},"methods":{"type":"array","items":{"type":"string","enum":["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS"]},"description":"Only count requests with these HTTP methods. Empty or omitted\ncounts every method. A request with another method skips this rule\nand is checked against the next rate limit rule in priority order.\n"},"key_parts":{"type":"array","maxItems":4,"items":{"$ref":"#/components/schemas/RateLimitKeyPart"},"description":"What one counter is keyed by: up to 4 parts combined into one key.\nWhen set it replaces `key_by` (which is still returned, as `ip`, or\n`ip_path` for exactly `[ip, path]`, for edges that predate this\nfield). A part a request lacks counts as empty, so every request\nwithout that cookie or header shares one counter — often exactly\nwhat you want against bots. Counting is per edge location.\n"},"match":{"type":"string","enum":["all","any"],"default":"all","description":"How `match_conditions` combine."},"match_conditions":{"type":"array","maxItems":10,"items":{"$ref":"#/components/schemas/CustomRuleCondition"},"description":"Only count requests that match these conditions (the custom rule\ncondition objects). Empty means every request in scope counts.\n"},"block_for_sec":{"type":"integer","minimum":0,"maximum":86400,"default":0,"description":"After a key breaches the limit, keep answering `on_breach` for that\nkey this many seconds. 0 = only while it is over the limit.\n"}}},"RateLimitKeyPart":{"type":"object","required":["part"],"properties":{"part":{"type":"string","enum":["ip","ip_prefix","path","host","method","ja4","ja4h","country","asn","header","cookie","query","user_agent"],"description":"`ip_prefix` is the client's /24 (IPv4) or /64 (IPv6); `asn` the\nclient IP's AS number; `header`, `cookie` and `query` the value of\nthe one named in `key`.\n"},"key":{"type":"string","maxLength":128,"description":"The header, cookie or query parameter name. Required for those three parts, absent for every other."}}},"RateLimitRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/RateLimitRuleFields"}]},"RateLimitRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/RateLimitRuleFields"}]},"BotKind":{"type":"string","description":"A bot the edge classifier recognises. `*` matches any of them and is\naccepted in `bot_kinds` even though it is not itself a catalogue entry;\n`generic-bot` is the catch-all user-agent heuristic.\n","enum":["*","gptbot","oai-searchbot","chatgpt-user","claudebot","claude-user","perplexitybot","perplexity-user","googlebot","google-extended","bingbot","ccbot","bytespider","meta-externalagent","amazonbot","applebot","duckduckbot","yandexbot","ahrefsbot","semrushbot","mj12bot","generic-bot"]},"BotRouteRuleFields":{"type":"object","properties":{"match_mode":{"type":"string","enum":["only","except"],"default":"only","description":"* `only` — the rule acts on the bots in `bot_kinds`.\n* `except` — the rule acts on every bot EXCEPT the ones in\n  `bot_kinds` (\"block all bots, let these through\"). `bot_kinds`\n  may then be empty (every bot) and must not contain `*`.\n\nNormal visitors are never matched in either mode.\n"},"bot_kinds":{"type":"array","items":{"$ref":"#/components/schemas/BotKind"},"description":"Which bots this rule matches (`only`, must not be empty) or lets\nthrough (`except`).\n"},"require_verified":{"type":"boolean","description":"`only`: match only bots whose identity was verified (by reverse DNS\nor published IP ranges), not merely self-declared in the user\nagent. `except`: a request proven to fake one of the let-through\nbots gets the action too; one that cannot be checked yet is let\nthrough.\n"},"action":{"type":"string","enum":["block","alt_content","alt_origin","tag"],"description":"* `block` — refuse the request.\n* `alt_content` — serve `body` with `status` instead of the origin.\n* `alt_origin` — proxy to `alt_dest`:`alt_port` over `alt_scheme`.\n* `tag` — let it through, but tag it in telemetry.\n"},"status":{"type":"integer","default":200,"description":"Status code for `alt_content`."},"body":{"type":"string","description":"Response body for `alt_content`."},"alt_dest":{"type":"string","description":"Origin address for `alt_origin`."},"alt_port":{"type":"integer","description":"Origin port for `alt_origin`."},"alt_scheme":{"type":"string","enum":["http","https"],"description":"Scheme used to reach `alt_dest`."}}},"BotRouteRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/BotRouteRuleFields"}]},"BotRouteRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/BotRouteRuleFields"}]},"OriginEntry":{"type":"object","description":"One origin in a pool.","required":["address"],"properties":{"address":{"type":"string","description":"Origin IP address or hostname."},"port":{"type":"integer"},"scheme":{"type":"string","enum":["http","https"]},"weight":{"type":"integer","description":"Relative share of traffic under `round_robin` and `least_load`.\nUnder `ha` it still applies, weighting round-robin *within* a\npriority tier. Defaults to 1.\n"},"priority":{"type":"integer","default":1,"minimum":1,"maximum":100,"description":"Failover tier under `lb_type: ha`. **Lower is preferred** — 1 is the\nprimary tier, 2 the first standby, and so on, the same direction as\nthe rule's own `priority`. Origins sharing a number form one tier\nand load-balance across it.\n\nOnly `ha` reads this field; the other strategies ignore it and leave\nit untouched, so switching `lb_type` back and forth loses nothing.\nOmitted or `0` is normalised to 1.\n"},"node_ids":{"type":"array","items":{"type":"integer"},"description":"Under `lb_type: geo`, the edge nodes that use this origin."},"country":{"type":"string","description":"ISO country code of this origin."}}},"OriginPoolHealthCheck":{"type":"object","properties":{"enabled":{"type":"boolean"},"path":{"type":"string","default":"/","description":"Probe path."},"interval_sec":{"type":"integer","default":15,"description":"Seconds between active probes."},"timeout_sec":{"type":"integer","default":5,"description":"Probe timeout in seconds."},"unhealthy_threshold":{"type":"integer","default":3,"description":"Consecutive probe failures before an origin is marked down."},"healthy_threshold":{"type":"integer","default":2,"description":"Consecutive probe successes before an origin returns to service."},"eject_sec":{"type":"integer","default":30,"description":"How long a passively ejected origin stays out, in seconds."},"host":{"type":"string","description":"Host header override for the probe. Must be inside this domain or another active domain of the same owner."}}},"OriginPoolRuleFields":{"type":"object","properties":{"lb_type":{"type":"string","enum":["round_robin","least_load","geo","ha"],"default":"round_robin","description":"How traffic is spread across `origins`.\n\n* `round_robin` — weighted rotation across every origin.\n* `least_load` — the origin with the fewest in-flight requests.\n* `geo` — routes by edge node; see `node_ids` on each origin.\n* `ha` — active/passive failover. All traffic goes to the lowest\n  `priority` tier that still has a healthy origin, and cascades to\n  the next tier only once a whole tier is down.\n\n`ha` has two extra requirements, each a `400` when unmet:\n\n* at least **two distinct** `origins[].priority` values — a single\n  tier has nothing to fail over to;\n* `health_check.enabled` must be `true`. Standby origins take no\n  real traffic, so without active probes the edge can never observe\n  the primary going down, nor the standby recovering, and would pin\n  every request to tier 1 forever.\n"},"origins":{"type":"array","items":{"$ref":"#/components/schemas/OriginEntry"}},"health_check":{"$ref":"#/components/schemas/OriginPoolHealthCheck"},"host_header":{"type":"string","description":"Host header (and SNI) sent to the pool's origins. Must be inside this domain or another active domain of the same owner."},"name":{"type":"string","maxLength":64,"description":"Optional label for this pool, shown in the panel's rule table and\nnext to the records it overrides. Purely for identification — it\ndoes not affect routing. Omit or send an empty string for none.\n"}}},"OriginPoolRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/OriginPoolRuleFields"}]},"OriginPoolRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/OriginPoolRuleFields"}]},"OriginRouteRuleFields":{"type":"object","properties":{"address":{"type":"string","description":"Origin IP address or hostname for the matched paths."},"port":{"type":"integer"},"scheme":{"type":"string","enum":["http","https"]},"host_header":{"type":"string","description":"Host header (and SNI) sent to this origin. Must be inside this domain or another active domain of the same owner."},"country":{"type":"string","readOnly":true,"description":"ISO country code of the origin, detected by NSIN from `address`. Read-only."},"name":{"type":"string","maxLength":64,"description":"Optional label for this route, shown in the panel's rule table and\nnext to the records it overrides. Purely for identification — it\ndoes not affect routing. Omit or send an empty string for none.\n"}}},"OriginRouteRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/OriginRouteRuleFields"}]},"OriginRouteRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"$ref":"#/components/schemas/OriginRouteRuleFields"}]},"FingerprintRuleFields":{"type":"object","properties":{"match_ja4":{"type":"array","items":{"type":"string"},"description":"JA4 TLS fingerprints to match."},"match_ja4h":{"type":"array","items":{"type":"string"},"description":"JA4H HTTP fingerprints to match."},"action":{"type":"string","enum":["drop","captcha","tag"],"default":"captcha","description":"What to do with a matching request."}}},"FingerprintRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/FingerprintRuleFields"}]},"FingerprintRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/FingerprintRuleFields"}]},"ErrorPageRule":{"allOf":[{"$ref":"#/components/schemas/RuleCommon"},{"$ref":"#/components/schemas/RulePathScope"},{"type":"object","properties":{"mode":{"type":"string","enum":["nsin","custom","origin"],"description":"* `nsin` — the NSIN branded error page.\n* `custom` — your own HTML, from `content`.\n* `origin` — pass the origin's own response through untouched.\n"},"codes":{"type":"array","items":{"type":"integer"},"description":"The status codes this rule covers."},"content":{"type":"object","additionalProperties":{"type":"string"},"description":"Status code (as a decimal string) → HTML. The key `\"0\"` is the\nfallback used for any covered code without its own page.\n**Only populated when fetching a single rule** — the list\nendpoint omits it.\n"},"content_codes":{"type":"array","items":{"type":"integer"},"description":"Which codes have HTML, ascending (`0` first when present).\nAlways populated, including in the list response.\n"},"content_bytes":{"type":"object","additionalProperties":{"type":"integer"},"description":"Byte size per entry in `content`. Empty on the list endpoint."},"managed_by":{"type":"string","readOnly":true,"description":"`developer_mode` on the temporary rule that\n`POST /domains/{domain}/developer-mode` adds: `origin` mode for\nevery 5xx on every path, evaluated before every other rule. It\ncan be toggled or deleted but not updated, it is not counted\nagainst the plan's rule limit, and it is removed when developer\nmode ends. Empty on rules you created.\n"},"expires_at":{"type":"string","format":"date-time","readOnly":true,"description":"When a developer mode rule is removed (the domain's\n`developer_mode_until`). Absent on every other rule.\n"}}}]},"ErrorPageRuleBody":{"allOf":[{"$ref":"#/components/schemas/RuleCommonBody"},{"$ref":"#/components/schemas/RulePathScope"},{"type":"object","properties":{"mode":{"type":"string","enum":["nsin","custom","origin"]},"codes":{"type":"array","items":{"type":"integer"}},"content":{"type":"object","additionalProperties":{"type":"string"},"description":"Replaces the rule's entire HTML set. Keys are decimal status\ncodes; `\"0\"` is the fallback. Omit the field to leave existing\ncontent untouched.\n"}}}]},"OverviewItem":{"type":"object","properties":{"domain_id":{"type":"integer"},"domain_name":{"type":"string"},"total_requests":{"type":"integer"},"total_bandwidth":{"type":"integer","description":"Bytes."},"unique_visitors":{"type":"integer"}}},"OverviewSeriesPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"count":{"type":"integer"}}},"DomainsOverviewItem":{"type":"object","properties":{"domain_id":{"type":"integer"},"domain_name":{"type":"string"},"total_requests":{"type":"integer"},"total_bandwidth":{"type":"integer","description":"Bytes."},"error_rate":{"type":"number","description":"Share of requests that failed, 0–1."},"latest_event":{"type":"string","format":"date-time","description":"Most recent request seen for this domain or any subdomain. Null when there is no traffic."},"series":{"type":"array","description":"Requests over time, for a sparkline.","items":{"$ref":"#/components/schemas/OverviewSeriesPoint"}}}},"GlobalSummary":{"type":"object","properties":{"total_requests":{"type":"integer"},"total_bandwidth":{"type":"integer","description":"Bytes."},"unique_visitors":{"type":"integer"},"error_rate":{"type":"number","description":"Share of requests that failed, 0–1."},"cache_hit_rate":{"type":"number","description":"Share of cacheable requests served from cache, 0–1."},"domains":{"type":"integer","description":"How many domains contributed."}}},"GlobalSummaryPeak":{"type":"object","properties":{"peak_rps":{"type":"integer","description":"Highest request count in any single second of the period."}}},"AnalyticsSummary":{"type":"object","properties":{"total_requests":{"type":"integer"},"total_bandwidth":{"type":"integer","description":"Bytes."},"unique_visitors":{"type":"integer"},"error_rate":{"type":"number","minimum":0,"maximum":100,"description":"Percentage of requests answered with status 400 or above, 0–100."},"avg_response_time":{"type":"number","description":"Mean response time in milliseconds."},"p90":{"type":"number","description":"90th percentile response time, ms."},"p95":{"type":"number","description":"95th percentile response time, ms."},"p99":{"type":"number","description":"99th percentile response time, ms."}}},"RequestsDataPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"count":{"type":"integer"}}},"RequestsCompareDataPoint":{"type":"object","description":"One bucket of `/analytics/requests-compare`.","properties":{"timestamp":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$","description":"Bucket start as Asia/Tehran wall-clock time (UTC+03:30), with no\nzone designator — not RFC 3339.\n","example":"2026-09-28 00:00:00"},"count":{"type":"integer"}}},"BandwidthDataPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"bytes_in":{"type":"integer"},"bytes_out":{"type":"integer"}}},"OriginBandwidthPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"up":{"type":"integer","description":"Bytes sent to the origin."},"down":{"type":"integer","description":"Bytes received from the origin."}}},"DomainBandwidth":{"type":"object","properties":{"domain":{"type":"string"},"up":{"type":"integer"},"down":{"type":"integer"},"ratio":{"type":"number","description":"`min(up,down) / max(up,down)`."},"flagged":{"type":"boolean","description":"Set when `ratio` is close to 1.0, which is unusual for web traffic."}}},"OriginBandwidthResponse":{"type":"object","properties":{"series":{"type":"array","items":{"$ref":"#/components/schemas/OriginBandwidthPoint"}},"domains":{"type":"array","items":{"$ref":"#/components/schemas/DomainBandwidth"}}}},"TunnelSuspect":{"type":"object","properties":{"remote_addr":{"type":"string"},"network":{"type":"string","description":"The client's network operator (AS organisation)."},"country":{"type":"string"},"hostname":{"type":"string"},"transport":{"type":"string","enum":["httpupgrade","ws","grpc","xhttp","http"],"description":"Detected transport. `httpupgrade` is `Upgrade: websocket` without a real WebSocket handshake."},"reqs":{"type":"integer","description":"All requests from this client to this host."},"tunnel_reqs":{"type":"integer","description":"Requests with opaque payloads."},"tunnel_paths":{"type":"integer","description":"Distinct paths used — around 1 for a tunnel."},"up":{"type":"integer","description":"Client-to-edge bytes."},"down":{"type":"integer","description":"Edge-to-client bytes."},"balance":{"type":"number","description":"`min/max` of up and down. Informational only."},"max_secs":{"type":"integer","description":"Longest single connection, in seconds."},"sample_path":{"type":"string","description":"The heaviest single path."},"ja4":{"type":"string","description":"TLS fingerprint."},"ja4h":{"type":"string","description":"HTTP fingerprint."},"ua":{"type":"string","description":"The client's User-Agent."},"score":{"type":"integer","description":"Additive tunnel score from the matched signals; higher is more tunnel-like."},"severity":{"type":"string","enum":["high","medium","low",""],"description":"The score's band. Empty below the lowest band."},"signals":{"type":"array","description":"The signals that contributed to `score`.","items":{"type":"object","properties":{"name":{"type":"string","description":"Signal name."},"value":{"type":"number","description":"The measured value."},"points":{"type":"integer","description":"Points it added to the score."},"detail":{"type":"string","description":"Human-readable explanation, when there is one."}}}},"path_uniqueness":{"type":"number","description":"Distinct URIs per request. High is a tunnel signal — some tunnel software puts a random token in every URI."},"cache_hit_ratio":{"type":"number","description":"The client's cache hit ratio, 0–1. A tunnel is uncacheable, so this is about 0."},"bytes_per_req":{"type":"number","description":"Average bytes per request."},"ja4_cluster":{"type":"integer","description":"How many distinct client IPs in this result share this client's TLS fingerprint on the same host."},"httpupgrade_byte_share":{"type":"number","description":"Share of this client's bytes carried over the `httpupgrade` transport, 0–1."}}},"TunnelSuspectsResponse":{"type":"object","properties":{"suspects":{"type":"array","items":{"$ref":"#/components/schemas/TunnelSuspect"}},"as_of":{"type":"string","format":"date-time","description":"When the ranking was computed. It is served from a precomputed\nstore, so a `7d`/`30d` answer can be up to an hour old.\n"},"refreshing":{"type":"boolean","description":"Present (`true`) while a newer ranking is being computed behind this one."}}},"TopUri":{"type":"object","properties":{"uri":{"type":"string"},"request_count":{"type":"integer"}}},"TopRequestRow":{"type":"object","description":"One ranked row. Which fields are populated depends on the `metric` — the\nrest are omitted.\n","properties":{"key":{"type":"string","description":"The ranked value — path, country, user agent, hostname or `AS<number>`."},"label":{"type":"string","description":"Network operator name, for the `networks` metric."},"hostname":{"type":"string","description":"Owning host, for path-based metrics."},"asn":{"type":"integer"},"requests":{"type":"integer"},"bytes":{"type":"integer"},"avg_duration":{"type":"number","description":"Milliseconds."},"max_duration":{"type":"number","description":"Milliseconds."}}},"CountryStats":{"type":"object","properties":{"country":{"type":"string","description":"ISO country code."},"requests":{"type":"integer"},"bytes":{"type":"integer"},"unique_visitors":{"type":"integer"}}},"AsnStats":{"type":"object","properties":{"asn":{"type":"integer"},"asn_org":{"type":"string","description":"Network operator name."},"requests":{"type":"integer"},"bytes":{"type":"integer"}}},"ProtocolStats":{"type":"object","properties":{"protocol":{"type":"string","description":"`h1`, `h2`, `h3` or `other`."},"requests":{"type":"integer"}}},"TlsSummary":{"type":"object","properties":{"requests":{"type":"integer","description":"TLS-terminated requests in the period."},"resumed":{"type":"integer","description":"Requests whose TLS session was resumed rather than negotiated afresh."},"resumption_rate":{"type":"number","description":"`resumed / requests`, as a percentage; `0` when there were no TLS requests."}}},"TlsVersionStats":{"type":"object","properties":{"version":{"type":"string","description":"Negotiated version, e.g. `TLSv1.3`."},"requests":{"type":"integer"},"pct":{"type":"number","description":"Percentage share of all TLS requests."}}},"TlsCipherStats":{"type":"object","properties":{"cipher":{"type":"string","description":"Negotiated cipher suite, e.g. `TLS_AES_128_GCM_SHA256`."},"requests":{"type":"integer"},"pct":{"type":"number","description":"Percentage share of the returned suites, which sum to 100%."}}},"AiCrawlerSummary":{"type":"object","properties":{"requests":{"type":"integer"},"allowed":{"type":"integer","description":"Requests answered with a status below `400`."},"unsuccessful":{"type":"integer","description":"Requests answered with `4xx` or `5xx`."},"bytes":{"type":"integer","description":"Bytes served to crawlers."},"markdown_answered":{"type":"integer","description":"Responses the edge rewrote to Markdown."},"markdown_missed":{"type":"integer","description":"Eligible responses that were not rewritten."},"markdown_eligible":{"type":"integer","description":"Responses that could plausibly have been Markdown — status below `300`."}}},"AiCrawlerStats":{"type":"object","properties":{"kind":{"type":"string","description":"Bot kind, e.g. `gptbot` or `claudebot`."},"requests":{"type":"integer"},"allowed":{"type":"integer"},"unsuccessful":{"type":"integer"},"bytes":{"type":"integer"},"markdown":{"type":"integer","description":"Responses served to this crawler as Markdown."},"last_seen":{"type":"string","format":"date-time","description":"Most recent request from this crawler in the period."}}},"AiCrawlerDataPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"requests":{"type":"integer"},"allowed":{"type":"integer"},"unsuccessful":{"type":"integer"},"bytes":{"type":"integer"},"s2xx":{"type":"integer"},"s3xx":{"type":"integer"},"s4xx":{"type":"integer"},"s5xx":{"type":"integer"}}},"AiCrawlerPath":{"type":"object","properties":{"path":{"type":"string","description":"URL path, without the query string."},"hostname":{"type":"string"},"requests":{"type":"integer"}}},"StatusCodeStats":{"type":"object","properties":{"status_code":{"type":"integer"},"count":{"type":"integer"}}},"UnreachableReason":{"type":"object","properties":{"reason":{"type":"string","description":"Canonical key, e.g. `origin_closed`."},"label":{"type":"string","description":"Short headline."},"fault":{"type":"string","enum":["client","origin","network","config","nsin"],"description":"Who is responsible — `nsin` when NSIN's own edge or network failed."},"meaning":{"type":"string","description":"Plain-language explanation."},"count":{"type":"integer"},"status":{"type":"integer","description":"Representative HTTP status the visitor saw."}}},"UserAgentCategoryStats":{"type":"object","properties":{"category":{"type":"string"},"requests":{"type":"integer"}}},"CacheAnalytics":{"type":"object","properties":{"hits":{"type":"integer","description":"Requests answered from cache."},"misses":{"type":"integer","description":"Requests that missed the cache."},"bypass":{"type":"integer","description":"Requests that bypassed the cache."},"hit_rate":{"type":"number","description":"`hits / (hits + misses)`; `0` when there were no cache lookups."},"bypass_reasons":{"type":"object","additionalProperties":{"type":"integer"},"description":"Why requests bypassed the cache, by reason."}}},"BotCacheAnalytics":{"type":"object","properties":{"requests":{"type":"integer","description":"Requests from verified search-engine crawlers."},"hits":{"type":"integer","description":"Crawler requests answered from the bot cache."},"misses":{"type":"integer","description":"Crawler requests that missed it."},"bypass":{"type":"integer","description":"Crawler requests that bypassed it."},"hit_rate":{"type":"number","description":"`hits / (hits + misses)` as a percentage; `0` with no cache lookups."},"by_kind":{"type":"array","description":"The same counters per crawler, busiest first.","items":{"type":"object","properties":{"kind":{"type":"string","example":"googlebot"},"requests":{"type":"integer"},"hits":{"type":"integer"},"misses":{"type":"integer"},"bypass":{"type":"integer"},"hit_rate":{"type":"number"}}}}}},"TrafficByCacheDataPoint":{"type":"object","description":"One time bucket of traffic split by cache status. Bytes are egress to\nvisitors; the request counts are the same buckets counted in requests,\nwhich is what a hit ratio should be computed from — hits are small and\nmisses large, so a bytes split understates it.\n","properties":{"timestamp":{"type":"string","format":"date-time","description":"Start of the bucket (UTC)."},"cached_bytes":{"type":"integer","description":"Egress bytes of responses served from cache (cache status `hit`)."},"miss_bytes":{"type":"integer","description":"Egress bytes of responses that missed the cache and came from the origin."},"bypass_bytes":{"type":"integer","description":"Egress bytes of responses that bypassed the cache."},"hit_requests":{"type":"integer","description":"Requests answered from cache."},"miss_requests":{"type":"integer","description":"Requests that missed the cache and went to the origin."},"bypass_requests":{"type":"integer","description":"Requests that bypassed the cache."}}},"OverviewWindow":{"type":"object","description":"One window's totals in `/analytics/overview-compare`.","properties":{"requests":{"type":"integer","description":"Requests served in the window."},"bytes":{"type":"integer","description":"Egress bytes sent to visitors in the window."},"hits":{"type":"integer","description":"Requests with cache status `hit`."},"misses":{"type":"integer","description":"Requests with cache status `miss`."},"bypass":{"type":"integer","description":"Requests with cache status `bypass`."},"status_codes":{"type":"array","description":"Requests per HTTP status code, busiest first (ties by code).","items":{"$ref":"#/components/schemas/StatusCodeStats"}}}},"OverviewCompare":{"type":"object","properties":{"period":{"type":"string","description":"The window length that was asked for.","enum":["3h","6h","12h","24h"]},"since":{"type":"string","format":"date-time","description":"Start of the previous window (UTC) — `now − 2 × period`."},"boundary":{"type":"string","format":"date-time","description":"Start of the current window and end of the previous one (UTC) — `now − period`."},"current":{"$ref":"#/components/schemas/OverviewWindow"},"previous":{"$ref":"#/components/schemas/OverviewWindow"},"series":{"type":"array","description":"Hourly cache split across both windows, oldest first. Buckets are\nAsia/Tehran clock hours given as UTC instants; hours with no\ntraffic are absent rather than zero.\n","items":{"$ref":"#/components/schemas/TrafficByCacheDataPoint"}}}},"TrafficWindow":{"type":"object","description":"The window the answer covers, `[from, to)`: whole Asia/Tehran days.\n`from` is the Tehran midnight that starts the first day (20:30 UTC\nthe evening before); `to` is the Tehran midnight after the last day,\nor now when the last day is today.\n","required":["from","to","tz","days","granularity","partial_last"],"properties":{"from":{"type":"string","format":"date-time","example":"2026-09-21T20:30:00Z"},"to":{"type":"string","format":"date-time","example":"2026-09-28T14:20:00Z"},"tz":{"type":"string","const":"Asia/Tehran"},"days":{"type":"integer","description":"Tehran days in the window, a partial today included."},"granularity":{"type":"string","enum":["hour","day"],"description":"The bucket size the answer uses. On `traffic-trend` this is the\ngranularity actually drawn (see its `granularity` parameter); on\nthe other endpoints it is what `auto` would pick.\n"},"partial_last":{"type":"boolean","description":"The last day is today, so `to` is now and the last bucket is still filling."}}},"TrafficTotals":{"type":"object","description":"A window's totals.","required":["bytes","requests","cache_bytes","proxied_bytes","direct_bytes","cached_share","errors","error_rate"],"properties":{"bytes":{"type":"integer","description":"Billable bytes: `cache_bytes + proxied_bytes + direct_bytes`."},"requests":{"type":"integer","description":"Every request, billable or not."},"cache_bytes":{"type":"integer","description":"Egress bytes of requests served through the cache pipeline."},"proxied_bytes":{"type":"integer","description":"Egress bytes of requests that reached the origin through the edge proxy."},"direct_bytes":{"type":"integer","description":"Egress bytes of requests that reached the origin without it."},"cached_share":{"type":"number","minimum":0,"maximum":1,"description":"`cache_bytes / bytes`: the share of the traffic, by bytes, that came through the cache. A fraction 0–1; `0` with no traffic."},"errors":{"type":"integer","description":"Requests answered with status 400 or above."},"error_rate":{"type":"number","minimum":0,"maximum":1,"description":"`errors / requests`, a fraction 0–1 (unlike `/analytics/summary`, which returns a percentage); `0` with no requests."}}},"TrafficPrevious":{"description":"The totals of the window of equal length right before this one, with that window's bounds.","allOf":[{"$ref":"#/components/schemas/TrafficTotals"},{"type":"object","required":["from","to"],"properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time","description":"The current window's `from`."}}}]},"TrafficTrendBucket":{"type":"object","required":["t","bytes","requests","partial"],"properties":{"t":{"type":"string","format":"date-time","description":"Bucket start, UTC — a Tehran midnight (`day`) or a Tehran hour, which starts at `:30` UTC (`hour`)."},"bytes":{"type":"integer","description":"Billable bytes."},"requests":{"type":"integer"},"partial":{"type":"boolean","description":"`true` only on the bucket that holds now."},"split":{"type":"object","additionalProperties":{"type":"integer"},"description":"Billable bytes per series key — every key of `series_keys`, zeros\nincluded; they add up to `bytes`. Absent with `split=none`.\n","example":{"*.example.com":800000000000,"api.example.com":17000000000,"other":5900000000}}}},"DataNote":{"type":"object","description":"Days whose traffic data is known to be wrong. They are marked, not repaired.","required":["from","to","kind","note"],"properties":{"from":{"type":"string","format":"date","description":"First day (Asia/Tehran), inclusive."},"to":{"type":"string","format":"date","description":"Last day, inclusive."},"kind":{"type":"string","example":"incomplete"},"note":{"type":"string","description":"Text to show on the chart."}}},"TrafficTrend":{"type":"object","required":["window","totals","previous","series_keys","buckets","data_notes"],"properties":{"window":{"$ref":"#/components/schemas/TrafficWindow"},"totals":{"$ref":"#/components/schemas/TrafficTotals"},"previous":{"description":"With `compare=1`, the previous window's totals; otherwise `null`.","oneOf":[{"$ref":"#/components/schemas/TrafficPrevious"},{"type":"null"}]},"series_keys":{"type":"array","description":"The keys of every bucket's `split`, in drawing order: the 5 hosts\nwith the most bytes over the window, then `other` (left out when\nit is zero) for `split=host`; `cache`, `proxied`, `direct` for\n`split=tier`; empty for `split=none`.\n","items":{"type":"string"}},"buckets":{"type":"array","description":"Every bucket of the window, oldest first, empty ones as zeros.","items":{"$ref":"#/components/schemas/TrafficTrendBucket"}},"data_notes":{"type":"array","description":"The known-bad days that overlap the window; empty when none do.","items":{"$ref":"#/components/schemas/DataNote"}}}},"TrafficPeakDay":{"type":"object","required":["t","bytes","requests","top_host","top_host_bytes"],"properties":{"t":{"type":"string","format":"date-time","description":"Start of the Tehran day (UTC)."},"bytes":{"type":"integer","description":"Billable bytes that day."},"requests":{"type":"integer"},"top_host":{"type":"string","description":"The hostname with the most bytes that day."},"top_host_bytes":{"type":"integer"}}},"TrafficPeakHour":{"type":"object","required":["t","bytes","requests","avg_mbps","top_host","top_host_bytes"],"properties":{"t":{"type":"string","format":"date-time","description":"Start of the UTC hour."},"bytes":{"type":"integer","description":"Billable bytes in that hour."},"requests":{"type":"integer"},"avg_mbps":{"type":"number","description":"The hour's average rate: `bytes × 8 / 3600 / 10⁶`, one decimal."},"top_host":{"type":"string","description":"The hostname with the most bytes in that hour."},"top_host_bytes":{"type":"integer"}}},"TrafficChange":{"type":"object","description":"A host or file whose bytes per day moved between \"before\" and \"now\"\n(see `traffic-highlights`).\n","required":["kind","host","record","path","bytes_per_day_now","bytes_per_day_before","delta_per_day","share_now","first_seen"],"properties":{"kind":{"type":"string","enum":["host","file"]},"host":{"type":"string","description":"The hostname — for a file under a wildcard record, the real host it was requested on (the record itself when that is unknown)."},"record":{"type":"string","description":"The `hostname` value the traffic is logged under (a wildcard record: `*.example.com`)."},"path":{"type":"string","description":"A file's path, without query string; empty for a host."},"bytes_per_day_now":{"type":"integer","description":"Average billable bytes per day over \"now\". Files are sketch estimates."},"bytes_per_day_before":{"type":"integer","description":"The same over \"before\"."},"delta_per_day":{"type":"integer","description":"`bytes_per_day_now − bytes_per_day_before`; negative for a decrease."},"share_now":{"type":"number","description":"The item's share of the domain's bytes over \"now\", a fraction 0–1."},"first_seen":{"type":["string","null"],"format":"date-time","description":"For an increase, the first UTC hour (looking back up to 35 days\nfor a file, 90 for a host) whose bytes reached 10% of the item's\naverage hourly bytes over \"now\". `null` for a decrease.\n"}}},"TrafficHighlights":{"type":"object","required":["window","peak_day","peak_hour","changes"],"properties":{"window":{"$ref":"#/components/schemas/TrafficWindow"},"peak_day":{"description":"The Tehran day with the most bytes; `null` when the window carried none.","oneOf":[{"$ref":"#/components/schemas/TrafficPeakDay"},{"type":"null"}]},"peak_hour":{"description":"The UTC hour with the most bytes (whole hours of the window, plus the current one); `null` when none carried any.","oneOf":[{"$ref":"#/components/schemas/TrafficPeakHour"},{"type":"null"}]},"changes":{"type":"array","maxItems":5,"description":"Biggest move first. Empty when nothing moved enough, or the window has no full day.","items":{"$ref":"#/components/schemas/TrafficChange"}}}},"TopFileItem":{"type":"object","required":["host","record","path","bytes","bytes_error","share","requests","avg_bytes"],"properties":{"host":{"type":"string","description":"The host the file was requested on. Under a wildcard record this is the real host when the origin request named it, else the record."},"record":{"type":"string","description":"The `hostname` value it was logged under (with the most of its bytes)."},"path":{"type":"string","description":"The path without query string or fragment, cut to 300 characters."},"bytes":{"type":"integer","description":"Estimated egress bytes (the sketch's count)."},"bytes_error":{"type":"integer","description":"The sketch's error bound on `bytes`."},"share":{"type":"number","description":"`bytes / total_bytes`, a fraction 0–1."},"requests":{"type":["integer","null"],"description":"Estimated requests; `null` when the file is not in the request sketch."},"avg_bytes":{"type":["integer","null"],"description":"`bytes / requests`; `null` with `requests`."}}},"TopFiles":{"type":"object","required":["window","approx","available","clamped","total_bytes","items"],"properties":{"window":{"$ref":"#/components/schemas/TrafficWindow"},"approx":{"type":"boolean","const":true,"description":"The figures come from sketches and are estimates."},"available":{"type":"boolean","description":"`false` when the window cannot be answered (files are kept 35 days; see the endpoint); `items` is then empty."},"clamped":{"type":"boolean","description":"The window reached past the last 35 days and was cut to them."},"total_bytes":{"type":"integer","description":"Billable bytes of the same hour-aligned window, the denominator of `share`."},"items":{"type":"array","description":"Most bytes first.","items":{"$ref":"#/components/schemas/TopFileItem"}}}},"BreakdownItem":{"type":"object","required":["key","label","bytes","requests","share"],"properties":{"key":{"type":"string","description":"The value: a hostname, a content type (`\"\"` for none), an ISO\ncountry code, an AS number, an HTTP status code, or a client IP.\n"},"label":{"type":"string","description":"What to print: the network's name for `asn`, `network · country`\nfor `client`, `(none)` for a missing content type, `(unknown)` for\nan unresolved country; the key otherwise.\n"},"bytes":{"type":"integer"},"requests":{"type":"integer"},"share":{"type":"number","description":"`bytes / total_bytes`, a fraction 0–1."}}},"Breakdown":{"type":"object","required":["window","dim","approx","available","clamped","total_bytes","items"],"properties":{"window":{"$ref":"#/components/schemas/TrafficWindow"},"dim":{"type":"string","enum":["host","content_type","country","asn","status","client"]},"approx":{"type":"boolean","description":"`true` for `client`, whose winners come from a sketch."},"available":{"type":"boolean","description":"`false` when no table covers the window and it is longer than a day; `items` is then empty."},"clamped":{"type":"boolean","description":"The window reached past what the table keeps and was cut to it."},"total_bytes":{"type":"integer","description":"The window's billable bytes (after any clamp), the denominator of `share`."},"items":{"type":"array","description":"Most bytes first.","items":{"$ref":"#/components/schemas/BreakdownItem"}}}},"TrafficByReqStatusDataPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"cache_bytes":{"type":"integer","description":"Egress bytes of requests that went through the caching pipeline."},"proxied_bytes":{"type":"integer","description":"Egress bytes of requests that reached the origin through the edge proxy."},"direct_bytes":{"type":"integer","description":"Egress bytes of requests that reached the origin without it."}}},"TrafficByNodeStats":{"type":"object","properties":{"node":{"type":"string","description":"Edge node name."},"node_label":{"type":"string","description":"The node's display label."},"country":{"type":"string","description":"Country the node is in."},"requests":{"type":"integer"},"bytes_out":{"type":"integer","description":"Egress bytes the node sent to visitors."},"cached_bytes":{"type":"integer","description":"Of those, bytes served from cache."},"miss_bytes":{"type":"integer","description":"Bytes of responses that missed the cache."},"bypass_bytes":{"type":"integer","description":"Bytes of responses that bypassed the cache."},"cached_requests":{"type":"integer","description":"Requests answered from cache."},"miss_requests":{"type":"integer","description":"Requests that missed the cache."},"bypass_requests":{"type":"integer","description":"Requests that bypassed the cache."}}},"NodeSeriesPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"count":{"type":"integer"},"bytes":{"type":"integer","description":"Egress bytes in the bucket."}}},"NodeDomainStats":{"type":"object","properties":{"domain_id":{"type":"integer"},"domain_name":{"type":"string","description":"Empty when the traffic matched no registered domain."},"requests":{"type":"integer"},"bandwidth":{"type":"integer","description":"Egress bytes."}}},"NodeOverviewItem":{"type":"object","properties":{"node":{"type":"string","description":"Node identifier. Empty when the serving edge reported no node name."},"node_label":{"type":"string","description":"Human-readable name. Absent for a node that is not registered."},"country":{"type":"string","description":"ISO country code."},"registered":{"type":"boolean","description":"Whether the name matches a registered edge node."},"active":{"type":"boolean","description":"Whether the registered node is in service."},"requests":{"type":"integer"},"bandwidth":{"type":"integer","description":"Egress bytes."},"bytes_in":{"type":"integer","description":"Bytes received from clients."},"unique_visitors":{"type":"integer"},"error_rate":{"type":"number","description":"Percentage of requests that returned 4xx or 5xx, 0–100."},"errors_5xx":{"type":"integer"},"cache_hit_rate":{"type":"number","description":"Percentage of cache lookups served from cache, 0–100."},"cached_requests":{"type":"integer"},"avg_duration":{"type":"number","description":"Mean response time in milliseconds, WebSocket requests excluded."},"p95_duration":{"type":"number","description":"95th percentile response time in milliseconds, WebSocket requests excluded."},"latest_event":{"type":"string","format":"date-time","description":"Most recent request this node served in scope. Null when it served none."},"series":{"type":"array","description":"Traffic over time, one bucket per period step.","items":{"$ref":"#/components/schemas/NodeSeriesPoint"}},"top_domains":{"type":"array","description":"The busiest domains on this node, at most five.","items":{"$ref":"#/components/schemas/NodeDomainStats"}}}},"NodesOverviewResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NodeOverviewItem"}},"totals":{"type":"object","description":"What the per-node rows add up to over the same scope.","properties":{"requests":{"type":"integer"},"bandwidth":{"type":"integer","description":"Egress bytes."},"nodes_with_traffic":{"type":"integer"},"unattributed_requests":{"type":"integer","description":"Requests whose row carried no node name."}}}}},"OriginNodeStats":{"type":"object","properties":{"node":{"type":"string","description":"Edge node name."},"node_label":{"type":"string","description":"The node's display label."},"country":{"type":"string","description":"Country the node is in."},"requests":{"type":"integer"},"failed":{"type":"integer","description":"Requests that got no response from the origin."},"errors_5xx":{"type":"integer","description":"Requests the origin answered with a 5xx."},"avg_upstream":{"type":"number","description":"Mean origin response time, ms."},"bytes_down":{"type":"integer","description":"Bytes received from the origin."}}},"OriginStats":{"type":"object","properties":{"origin_addr":{"type":"string","description":"Origin address (`IP:port`) the edge connected to."},"requests":{"type":"integer"},"failed":{"type":"integer","description":"Requests that got no response from the origin."},"errors_5xx":{"type":"integer","description":"Requests the origin answered with a 5xx."},"avg_upstream":{"type":"number","description":"Mean origin response time, ms."},"p95_upstream":{"type":"number","description":"95th percentile origin response time, ms."},"bytes_down":{"type":"integer","description":"Bytes received from the origin."},"nodes":{"type":"array","description":"The per-edge-node split behind these totals.","items":{"$ref":"#/components/schemas/OriginNodeStats"}}}},"LogEntry":{"type":"object","description":"One request. Header and body fields are retained for a shorter window\nthan the rest of the row, so older entries return them empty.\n","properties":{"domain_id":{"type":"integer"},"timestamp":{"type":"string","format":"date-time"},"hostname":{"type":"string"},"method":{"type":"string","description":"HTTP method."},"uri":{"type":"string","description":"Percent-encoded exactly as the client sent it."},"status":{"type":"integer","description":"Status returned to the visitor."},"remote_addr":{"type":"string","description":"Client IP address, as the edge saw it."},"country":{"type":"string","description":"Client country (ISO code), resolved from the IP."},"duration":{"type":"number","description":"Total request duration in ms. For WebSockets this spans the whole connection."},"bytes_in":{"type":"integer","description":"Bytes received from the client."},"bytes_out":{"type":"integer","description":"Bytes sent to the client."},"cache_status":{"type":"string","enum":["hit","miss","bypass"],"description":"Cache outcome for the request."},"bypass_reason":{"type":"string","description":"Why the cache was bypassed, when it was."},"req_status":{"type":"string","enum":["cache","proxied","direct"],"description":"Serving path: `cache`, `proxied` (through the edge proxy) or `direct`."},"user_agent":{"type":"string","description":"The client's User-Agent."},"headers":{"type":"string","description":"Request headers as captured by the edge."},"origin_req_headers":{"type":"string","description":"Headers the edge sent to the origin."},"origin_headers":{"type":"string","description":"Headers the origin returned."},"client_resp_headers":{"type":"string","description":"Headers returned to the visitor."},"body":{"type":"string","description":"Body captured by the edge, when one was. Retained for a shorter window than the rest of the row."},"is_ws":{"type":"boolean","description":"The request was a connection upgrade (WebSocket or similar)."},"upgrade":{"type":"string","enum":["websocket","httpupgrade","other",""],"description":"What kind of upgrade `is_ws` was: a real WebSocket handshake,\n`httpupgrade` (`Upgrade: websocket` without the WebSocket key\nexchange), or `other`. Empty when unknown.\n"},"content_type":{"type":"string","description":"Response `Content-Type`."},"error":{"type":"string","description":"The raw error text when the request failed."},"err_reason":{"type":"string","description":"Why the request failed, as a stable key — `origin_timeout`,\n`origin_refused`, `origin_tls`, `client_closed`, `nsin_edge`, …, or\n`origin_status_NNN`. The same keys as `/analytics/unreachable-reasons`.\nEmpty when the request did not fail.\n"},"err_fault":{"type":"string","enum":["origin","nsin","network","client","config",""],"description":"Who was responsible for the failure."},"err_leg":{"type":"string","description":"Which hop failed: `client_edge`, `edge`, `edge_origin`, or — for\ntraffic carried over NSIN's internal tunnel — `edge_mafar`,\n`mafar_routing`, `mafar_tunnel`, `mafar_egress`, `egress_origin`.\nEmpty on older rows.\n"},"err_code":{"type":"string","description":"The three-digit status shown for the failure."},"err_source":{"type":"string","description":"How the failure was classified (`core_typed`, `core_string`, `mafar_connect`, `mafar_sideband`, `edge_local`). Empty on older rows."},"err_detail":{"type":"string","maxLength":256,"description":"Short extra detail about the failure."},"mafar_code":{"type":"integer","description":"Error code from NSIN's internal tunnel; 0 when it was not involved."},"stale_served":{"type":"boolean","description":"A stale cached copy was served."},"node":{"type":"string","description":"Edge node that served the request."},"ray_id":{"type":"string","description":"Unique id for this request."},"protocol":{"type":"string","description":"Client-to-edge protocol, e.g. `HTTP/2.0`."},"origin_protocol":{"type":"string","description":"Edge-to-origin protocol. Empty on a cache hit."},"origin_status":{"type":"integer","description":"Status the origin returned. `0` on a cache hit."},"origin_error_body":{"type":"string","description":"The body your origin sent with a 5xx, exactly as it sent it (a compressed body is decoded), whatever page the visitor was shown. Kept for 3 days. In a list this is the first 2 KB and `origin_error_body_preview` is `true` when there is more; query the request by `rayId` for the whole body. Empty when the body is not UTF-8: see `origin_error_body_base64`.\n"},"origin_error_body_base64":{"type":"string","description":"The same body, base64-encoded, when it is not valid UTF-8 (a binary body, or a page in another charset). Only returned for a query by `rayId`.\n"},"origin_error_body_bytes":{"type":"integer","description":"Size of the stored body in bytes."},"origin_error_body_state":{"type":"string","enum":["full","truncated","empty","not_read","expired"],"description":"What is known about the origin's error body. `full`: the whole body is stored. `truncated`: only its first part is, because it was larger than the edge keeps or the origin stopped sending it. `empty`: the origin sent the error with no body. `not_read`: the origin sent the status and the body never arrived. `expired`: the body was kept and has been deleted after 3 days. Absent when the origin did not answer with a 5xx.\n"},"origin_error_body_preview":{"type":"boolean","description":"`true` when `origin_error_body` holds only the start of the body. Query the request by `rayId` for all of it."},"origin_addr":{"type":"string","description":"Origin `IP:port` the edge connected to."},"tls_version":{"type":"string","description":"TLS version the client connected with."},"tls_cipher":{"type":"string","description":"TLS cipher suite the client connected with."},"tls_resumed":{"type":"boolean","description":"The client resumed an earlier TLS session."},"content_encoding":{"type":"string"},"referer":{"type":"string"},"cache_age":{"type":"integer","description":"Seconds the served object had been cached."},"asn":{"type":"integer"},"asn_org":{"type":"string"},"bot_kind":{"type":"string","description":"Bot classification, when the request was identified as one."},"bot_verified":{"type":"boolean","description":"Whether the bot's identity was verified, rather than merely claimed."},"detect_action":{"type":"string","description":"Action a detection rule took."},"detect_dry_run":{"type":"boolean","description":"True when the rule was in dry-run, so nothing was enforced."},"waf_score":{"type":"integer","description":"WAF anomaly score."},"waf_rule_ids":{"type":"string","description":"CRS rule ids that fired."},"ja4":{"type":"string"},"ja4h":{"type":"string"},"rule_id":{"type":"integer","description":"The rule that set `detect_action`. Absent when none (or on rows before 2026-10)."},"rl_key":{"type":"string","description":"The rate-limit key that tripped, short and readable (`ja4h=ge20cn09…|path=/ajax.php`)."},"cookie_names":{"type":"string","description":"The request's cookie names, sorted and comma-separated. Never values."},"header_set_hash":{"type":"string","description":"12 hex characters naming the request's set of header names; requests from one client build share it."},"bot_score":{"type":"integer","description":"The edge's bot score, 1 (bot) to 99 (human-like). Absent when the request was not scored."},"md_converted":{"type":"boolean","description":"The response was served as Markdown."},"md_tokens":{"type":"integer","description":"Token count of the Markdown served."},"orig_tokens":{"type":"integer","description":"Token count of the original HTML."},"md_fail_reason":{"type":"string","description":"Why a Markdown conversion was not served, when it was asked for."},"opt_kind":{"type":"string","enum":["webp","minify-js","minify-css"],"description":"The asset optimization applied to the response, if any."},"opt_orig_bytes":{"type":"integer","description":"Size before the optimization, uncompressed."},"opt_bytes":{"type":"integer","description":"Size after it, uncompressed."},"origin_conn_reused":{"type":"boolean","description":"The edge reused an open connection to the origin."},"origin_dial_ms":{"type":"number","description":"Time to connect to the origin, in ms. Absent when no new connection was made."},"origin_tls_ms":{"type":"number","description":"TLS handshake time with the origin, in ms."},"origin_ttfb_ms":{"type":"number","description":"Time to the origin's first response byte, in ms."},"origin_tls_version":{"type":"string","description":"TLS version used with the origin (`tls_version` is the visitor's)."}}},"LogsResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LogEntry"}},"total":{"type":"integer","description":"Rows matching the filters, before paging — meaningful only when `total_state` is `exact` or `capped`."},"total_state":{"type":"string","enum":["exact","capped","skipped","failed"],"description":"`exact` — `total` is the count. `capped` — more than `total`\n(10 000) rows match. `skipped` — `count=0` was sent. `failed` — the\ncount timed out; the rows are still valid.\n"},"has_more":{"type":"boolean","description":"At least one more row matches past this page."},"sort":{"type":"string","description":"The order the rows are in, as `key:dir`.","example":"time:desc"},"fields":{"type":"string","description":"`list` when the rows carry only the list columns."},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"WafLogEntry":{"type":"object","properties":{"ts":{"type":"string","format":"date-time"},"domainId":{"type":"integer"},"recordId":{"type":"integer"},"hostname":{"type":"string"},"node":{"type":"string"},"rayId":{"type":"string"},"clientIp":{"type":"string"},"country":{"type":"string"},"clientPort":{"type":"integer"},"method":{"type":"string"},"uri":{"type":"string"},"httpVersion":{"type":"string"},"action":{"type":"string"},"blocked":{"type":"boolean"},"dryRun":{"type":"boolean","description":"True when the rule only logged; the request was not blocked."},"score":{"type":"integer","description":"Anomaly score reached."},"paranoia":{"type":"integer"},"threshold":{"type":"integer"},"status":{"type":"integer"},"ja4":{"type":"string"},"ja4h":{"type":"string"},"userAgent":{"type":"string"},"headers":{"type":"string"},"body":{"type":"string"},"ruleIds":{"type":"array","items":{"type":"integer"}},"messages":{"type":"array","items":{"type":"string"}},"ruleData":{"type":"array","items":{"type":"string"}},"variables":{"type":"array","items":{"type":"string"}},"severities":{"type":"array","items":{"type":"integer"}},"tags":{"type":"array","items":{"type":"string"}}}},"MarkdownTesterFetch":{"type":"object","properties":{"status":{"type":"integer"},"content_type":{"type":"string"},"content_length":{"type":"integer","description":"Full body length observed, before truncation."},"body":{"type":"string"},"truncated":{"type":"boolean"},"binary":{"type":"boolean","description":"The body was not valid UTF-8, so `body` is omitted."},"cache_status":{"type":"string"},"markdown_tokens":{"type":"integer"},"original_tokens":{"type":"integer"},"converted":{"type":"boolean","description":"The response came back as `text/markdown`."},"error":{"type":"string"}}},"MarkdownTesterResult":{"type":"object","properties":{"url":{"type":"string","description":"The URL that was fetched."},"feature_enabled":{"type":"boolean","description":"The domain's `markdown_for_agents` setting at test time."},"html":{"$ref":"#/components/schemas/MarkdownTesterFetch"},"markdown":{"$ref":"#/components/schemas/MarkdownTesterFetch"}}},"AnalyticsQueryResult":{"type":"object","properties":{"columns":{"type":"array","description":"Column names, in result order.","items":{"type":"string"}},"rows":{"type":"array","description":"One entry per row, keyed by column name.","items":{"type":"object","additionalProperties":true}},"row_count":{"type":"integer"},"truncated":{"type":"boolean","description":"True when the 10 000-row cap was reached and results were cut short."}}},"OutageIncident":{"type":"object","properties":{"id":{"type":"integer"},"monitor_id":{"type":"integer","description":"The monitor that fired. Absent for the domain's default whole-host\nwatch. Two monitors on one hostname are otherwise indistinguishable\nin the history.\n"},"scope_label":{"type":"string","description":"Human name of the watch — the monitor's `name`, or its first\nincluded path when it has none. Empty string for the whole-host\nwatch.\n"},"hostname":{"type":"string"},"state":{"type":"string","description":"`open` while ongoing, `resolved` once recovered."},"ongoing":{"type":"boolean"},"started_at":{"type":"string","format":"date-time"},"resolved_at":{"type":"string","format":"date-time","description":"Absent while the incident is ongoing."},"duration_seconds":{"type":"integer"},"peak_err_pct":{"type":"number","description":"Highest origin-error percentage reached."},"sample_reqs":{"type":"integer","description":"Requests observed over the incident."}}},"UptimeLiveStatus":{"type":"object","properties":{"hostname":{"type":"string"},"monitor_id":{"type":"integer","description":"The monitor this row belongs to; `0` for the domain's default\nwhole-host watch. One hostname can appear on several rows — one per\nmatching monitor, plus the whole-host row — so key on\n(`hostname`, `monitor_id`), never on `hostname` alone.\n"},"monitor_name":{"type":"string","description":"Empty for the whole-host watch."},"scope_label":{"type":"string","description":"Human name of the watch, so two rows for one hostname do not read as\nduplicates. Empty for the whole-host watch.\n"},"requests":{"type":"integer"},"errors":{"type":"integer","description":"Origin-attributable 5xx responses."},"error_pct":{"type":"number","description":"Origin-error percentage across the window."},"down":{"type":"boolean","description":"Currently meets this domain's alert thresholds."},"incident":{"type":"boolean","description":"An incident is currently open for this scope."}}},"UptimeLive":{"type":"object","properties":{"window_min":{"type":"integer","description":"Length of the trailing window, in minutes."},"hosts":{"type":"array","items":{"$ref":"#/components/schemas/UptimeLiveStatus"}}}},"UptimeActive":{"type":"object","properties":{"count":{"type":"integer","description":"Number of outage incidents currently open."},"hostnames":{"type":"array","description":"The subdomains that are down right now.","items":{"type":"string"}},"since":{"type":"string","format":"date-time","description":"When the oldest open incident started. Absent when nothing is down."}}},"UptimeSettingsBounds":{"type":"object","description":"Valid range for each configurable field.","properties":{"threshold_pct_min":{"type":"integer","description":"Lowest accepted `threshold_pct`."},"threshold_pct_max":{"type":"integer","description":"Highest accepted `threshold_pct`."},"window_min_min":{"type":"integer","description":"Lowest accepted `window_min`."},"window_min_max":{"type":"integer","description":"Highest accepted `window_min`."},"min_requests_min":{"type":"integer","description":"Lowest accepted `min_requests`."},"recover_min_min":{"type":"integer","description":"Lowest accepted `recover_min`."},"recover_min_max":{"type":"integer","description":"Highest accepted `recover_min`."}}},"UptimeSettings":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether outage alerts are sent for this domain."},"threshold_pct":{"type":"integer","description":"Per-minute origin-error percentage that counts as down."},"window_min":{"type":"integer","description":"Minutes the host must stay down before an incident opens."},"min_requests":{"type":"integer","description":"Traffic floor — below this, no incident opens."},"min_active_min":{"type":"integer","description":"Minimum populated one-minute buckets required in the window."},"recover_min":{"type":"integer","description":"Consecutive clear minutes before an incident resolves."},"uptime_host_match_type":{"type":"string","description":"How `uptime_host_includes` / `uptime_host_excludes` are read. Empty\nwhen no host filter is set, which is the default and means every\nsubdomain is watched.\n","enum":["","exact","wildcard","regex"]},"uptime_host_includes":{"type":["array","null"],"description":"Which subdomains the default whole-host watch covers. `null` or empty\nmeans all of them. Same syntax as a rule's host scope.\n","items":{"type":"string"}},"uptime_host_excludes":{"type":["array","null"],"description":"Subdomains excluded from the whole-host watch. Excludes beat includes.","items":{"type":"string"}},"notify_email":{"type":"boolean","description":"Master switch for email alerts on this domain. It applies to the owner\nand to every member, on top of each member's own preferences. Default\n`true`.\n"},"notify_sms":{"type":"boolean","description":"Master switch for SMS alerts. Default `true`. SMS also needs a plan\nwith `uptime_sms` — on a plan without it no SMS is sent, whatever\nthis says.\n"},"notify_webhook":{"type":"boolean","description":"Whether outage events are POSTed to the domain's webhook. Default `false`."},"webhook_configured":{"type":"boolean","description":"Whether a webhook URL is saved. The URL itself and the signing secret\nare served by `GET /uptime/webhook`, which needs `domain.settings`.\n"},"bounds":{"$ref":"#/components/schemas/UptimeSettingsBounds"}}},"UptimeSettingsUpdate":{"type":"object","description":"Every field is optional; omitted fields keep their current value.","properties":{"enabled":{"type":"boolean","description":"Outage alerts on or off for the domain."},"threshold_pct":{"type":"integer","description":"Per-minute origin-error percentage that counts as down (see `bounds`)."},"window_min":{"type":"integer","description":"Minutes the error rate must stay above the threshold before an incident opens."},"min_requests":{"type":"integer","description":"Minimum origin-eligible requests in the window before an incident can open."},"min_active_min":{"type":"integer","description":"Minimum one-minute buckets with traffic required in the window (at most `window_min`)."},"recover_min":{"type":"integer","description":"Consecutive clear minutes before an incident resolves."},"uptime_host_match_type":{"type":"string","description":"Required to be `exact`, `wildcard` or `regex` once either host list\nis non-empty; it is forced back to empty when both lists are cleared.\n","enum":["","exact","wildcard","regex"]},"uptime_host_includes":{"type":"array","description":"Send an explicit `[]` to clear the list — omitting the field leaves\nit unchanged.\n","items":{"type":"string"},"maxItems":200},"uptime_host_excludes":{"type":"array","description":"Send an explicit `[]` to clear the list.","items":{"type":"string"},"maxItems":200},"notify_email":{"type":"boolean","description":"Master switch for email alerts, for every recipient."},"notify_sms":{"type":"boolean","description":"Master switch for SMS alerts. SMS also needs a plan with `uptime_sms_enabled`."},"notify_webhook":{"type":"boolean","description":"Turning it on requires a saved `webhook_url`."},"webhook_url":{"type":"string","maxLength":2048,"description":"`http://` or `https://`. No username/password, and no private,\nloopback or link-local address. Send `\"\"` to remove the webhook,\nwhich also switches `notify_webhook` off. The signing secret is\ngenerated when the first URL is saved and survives URL edits.\n"}}},"UptimeWebhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"url":{"type":"string","description":"Empty when no webhook is configured."},"secret":{"type":"string","description":"The HMAC signing secret, `whsec_…`. Empty until a URL has been saved."}}},"UptimeWebhookDelivery":{"type":"object","properties":{"id":{"type":"integer"},"incident_id":{"type":"integer","description":"`0` for a test delivery."},"event":{"type":"string","enum":["outage.opened","outage.resolved","test"],"description":"The event delivered."},"url":{"type":"string","description":"Where it was sent."},"ok":{"type":"boolean","description":"Whether any attempt got a 2xx."},"status_code":{"type":"integer","description":"Status of the last attempt; `0` when there was no response."},"attempts":{"type":"integer","description":"Attempts made (up to 3)."},"duration_ms":{"type":"integer","description":"Total time spent delivering, in milliseconds."},"error":{"type":"string","description":"Why it failed, when it did."},"created_at":{"type":"string","format":"date-time"}}},"UptimeWebhookEvent":{"type":"object","description":"The JSON body POSTed to a domain's uptime webhook.\n\nEvery request carries `X-Nsin-Event`, `X-Nsin-Timestamp` (unix seconds)\nand `X-Nsin-Signature: sha256=<hex>`, the HMAC-SHA256 of\n`<timestamp>.<raw body>` keyed with the domain's signing secret. Answer\nwith any 2xx within 5 seconds. Anything else is retried twice (after 5 s\nand 30 s). Redirects are not followed. Each incident sends each event at\nmost once.\n","properties":{"event":{"type":"string","enum":["outage.opened","outage.resolved","test"],"description":"What happened. `test` for `POST /uptime/webhook/test`."},"incident_id":{"type":"integer","description":"The incident this event is about. `0` on `test`."},"domain":{"type":"string"},"hostname":{"type":"string"},"monitor_id":{"type":["integer","null"],"description":"`null` for the default whole-host watch."},"scope":{"type":"string","description":"The monitor's name or path; empty for the whole-host watch."},"peak_error_pct":{"type":"number","description":"Highest per-minute origin-error percentage seen in the incident."},"started_at":{"type":"string","format":"date-time","description":"When the incident opened."},"resolved_at":{"type":["string","null"],"format":"date-time","description":"When it resolved. `null` on `outage.opened`."},"duration_sec":{"type":["integer","null"],"description":"How long it lasted, in seconds. `null` until resolved."},"sent_at":{"type":"string","format":"date-time","description":"When this delivery was signed — the same instant as `X-Nsin-Timestamp`."}}},"UptimeMonitor":{"type":"object","description":"A path-scoped uptime watch. It runs the SAME detector as the whole-host\nwatch — same thresholds, same window, same incident machinery — narrowed\nto the host and path scope declared here. Thresholds are inherited from\nthe domain's uptime settings and cannot be overridden per monitor.\n","properties":{"id":{"type":"integer"},"domain_id":{"type":"integer"},"name":{"type":"string","description":"Optional label, up to 64 characters. It is what the outage SMS and\nthe incident list call this watch, so a domain with two monitors on\none host sends two distinguishable alerts.\n"},"enabled":{"type":"boolean"},"host_pattern":{"type":"string","description":"Legacy single-entry host scope, kept for parity with rules. It is\nfolded into `host_includes` when the scope is compiled.\n"},"host_match_type":{"type":"string","description":"Empty when the monitor has no host scope, i.e. it watches every subdomain.","enum":["","exact","wildcard","regex"]},"host_includes":{"type":["array","null"],"description":"`null` or empty means every subdomain of this domain.","items":{"type":"string"}},"host_excludes":{"type":["array","null"],"description":"Excludes beat includes.","items":{"type":"string"}},"path_match_type":{"type":"string","description":"How the path lists are read.","enum":["wildcard","regex"]},"path_includes":{"type":"array","description":"Request paths this monitor watches. Defaults to `[\"/*\"]` — every\npath — when you send an empty list.\n","items":{"type":"string"}},"path_excludes":{"type":"array","description":"Paths dropped from the scope. Excludes beat includes.","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"UptimeMonitorList":{"type":"object","properties":{"monitors":{"type":"array","items":{"$ref":"#/components/schemas/UptimeMonitor"}},"max":{"type":"integer","description":"How many monitors this domain may have. A detection-cost ceiling —\nevery monitor adds one path match per scanned log row per tick — not\na plan entitlement, so it is the same number for every plan.\n"}}},"UptimeMonitorBody":{"type":"object","description":"Every field is optional. On create, omitted fields take their default;\non update, omitted fields keep their current value and an explicit `[]`\nclears a list.\n\nA monitor must narrow SOMETHING: one with no host scope and a path scope\nof every path duplicates the whole-host watch (a second incident and a\nsecond SMS for the same outage) and is rejected. Regex entries are\ncompiled at write time — an uncompilable pattern is refused here rather\nthan breaking detection later.\n","properties":{"name":{"type":"string","maxLength":64},"enabled":{"type":"boolean","default":true,"description":"Whether the monitor runs. New monitors are enabled."},"host_pattern":{"type":"string","description":"Legacy single host filter; prefer `host_includes`."},"host_match_type":{"type":"string","description":"Required to be `exact`, `wildcard` or `regex` once a host filter is\nset; defaults to `wildcard` if you set one without saying how to\nread it.\n","enum":["","exact","wildcard","regex"]},"host_includes":{"description":"Hostnames the monitor watches. Empty means every host of the domain.","type":"array","items":{"type":"string"},"maxItems":200},"host_excludes":{"description":"Hostnames carved out of `host_includes`.","type":"array","items":{"type":"string"},"maxItems":200},"path_match_type":{"description":"How `path_includes`/`path_excludes` match.","type":"string","default":"wildcard","enum":["wildcard","regex"]},"path_includes":{"type":"array","description":"Defaults to `[\"/*\"]` when empty.","items":{"type":"string"},"maxItems":50},"path_excludes":{"description":"Paths carved out of `path_includes`.","type":"array","items":{"type":"string"},"maxItems":50}}},"RecommendationAction":{"type":"object","description":"Where to go to act on the recommendation. Either `feature` (a screen in\nthe panel) or `url` (a page outside it), never both.\n","properties":{"label":{"type":"string"},"feature":{"type":"string","description":"Logical target, e.g. `cache`."},"url":{"type":"string","format":"uri","description":"Absolute link to a page outside the panel — the published edge IP\nlist, a documentation page — for a fix that is not a panel screen.\n"},"query":{"type":"object","additionalProperties":{"type":"string"},"description":"Parameters that pre-filter the target view."}}},"Recommendation":{"type":"object","properties":{"key":{"type":"string","description":"Stable identifier — pass it to the dismiss endpoints. New checks are\nadded over time, so treat this as an open set rather than a closed\nenum.\n","enum":["cache_off","slow_response","errors_5xx","images_not_webp","ssl_expiring","ssl_upload_expired","no_robots","no_sitemap","no_https_redirect","no_records","apex_unreachable","www_unreachable","www_redirect_bypassed","proxy_none","proxy_off","ai_markdown","bot_cache_off","origin_protocol","origin_ip_allowlist","gateway_quota","traffic_quota","uptime_sms","external_dns_unreachable","external_dns_use_cname"],"example":"cache_off"},"status":{"type":"string","enum":["ok","warn"],"description":"`ok` is a passing check; `warn` needs action."},"severity":{"type":"string","enum":["high","medium","low"],"description":"Also decides dismissal: `low` can be hidden for good, `medium` for\n7 days, `high` not at all.\n"},"category":{"type":"string","enum":["speed","seo","reachability","security","plan"],"description":"`plan` covers what a subscription buys — the gateway and traffic\nallowances, and entitlements such as uptime alerts by SMS.\n"},"title":{"type":"string"},"detail":{"type":"string"},"stats":{"type":"object","additionalProperties":true,"description":"Supporting figures behind the finding."},"action":{"$ref":"#/components/schemas/RecommendationAction"},"dismissed":{"type":"boolean","description":"Dismissed by the calling user. Dismissals are per user, not per domain."},"dismissible":{"type":"boolean","description":"Whether this item may be dismissed at all. False for every passing\ncheck and for every `high` warning — dismissing one of those is\nrefused with `409`, and has no effect even if a row exists.\n"},"dismissed_until":{"type":"string","format":"date-time","description":"Present only while a time-limited (`medium`) dismissal is in force:\nwhen the item comes back. A `low` dismissal never expires, so it has\nno date.\n"}}},"PurgeResult":{"type":"object","properties":{"deleted":{"type":"integer","description":"Entries removed. `0` while a background sweep is still running."},"accepted":{"type":"boolean","description":"The purge was queued to run in the background, so `deleted` is not yet known."},"unreached":{"type":"array","items":{"type":"string"},"description":"On a refused purge, what could not be reached and why."},"error":{"type":"string","description":"On a refused purge, the explanation to show."}}},"CacheKeyRow":{"type":"object","description":"One cached object. `host`/`path`/`query` are the readable request URL;\n`hostname`/`store_path`/`key_hash`/`node` are the stored identity to\necho back when purging this specific row.\n","properties":{"domain_id":{"type":"integer"},"domain":{"type":"string"},"host":{"type":"string","description":"Exact request host, e.g. `sub.example.com`."},"path":{"type":"string","description":"Exact request path, e.g. `/assets/app.js`."},"query":{"type":"string","description":"Raw query string, without the leading `?`."},"variant":{"type":"string","description":"Cache-key suffix separating this entry from other variants of the\nsame URL (device, image format, CORS origin, …). Empty for the plain\nvariant.\n"},"method":{"type":"string"},"node":{"type":"string","description":"Edge node that cached it."},"hostname":{"type":"string","description":"Storage namespace host — `*.example.com` for a wildcard record."},"store_path":{"type":"string","description":"Raw stored path. Needed for purging; not for display."},"key_hash":{"type":"string","description":"Hash identifying the stored object. Needed for purging and downloading."},"enc":{"type":"string","description":"Stored content-encoding variant: `id` (identity), `gz` or `br` —\none URL can be stored once per encoding. Empty on entries written\nbefore per-encoding storage.\n"},"cache_key":{"type":"string","description":"The full cache key the edge computed for the request."},"size":{"type":"integer","description":"Bytes."},"cached_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"}}},"CacheKeysPage":{"type":"object","properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/CacheKeyRow"}},"total":{"type":"integer","description":"Entries matching the filters. `0` when `count=0` was sent."},"limit":{"type":"integer"},"offset":{"type":"integer"},"count_skipped":{"type":"boolean","description":"Present (`true`) when `count=0` was sent and `total` was not computed."}}},"CacheNodeTotal":{"type":"object","properties":{"node":{"type":"string"},"entries":{"type":"integer"},"size_bytes":{"type":"integer"}}},"CacheTotals":{"type":"object","properties":{"entries":{"type":"integer"},"size_bytes":{"type":"integer"},"by_node":{"type":"array","items":{"$ref":"#/components/schemas/CacheNodeTotal"}}}},"CachePurgeTarget":{"type":"object","description":"One entry's stored identity. Note the camelCase field names — they differ\nfrom the snake_case used in the listing response.\n","required":["hostname","keyHash","node"],"properties":{"domainId":{"type":"integer"},"hostname":{"type":"string","description":"The listing's `hostname`."},"storePath":{"type":"string","description":"The listing's `store_path`."},"keyHash":{"type":"string","description":"The listing's `key_hash`."},"node":{"type":"string","description":"The listing's `node`."},"enc":{"type":"string","description":"The listing's `enc`. Optional — when omitted, every stored encoding of the entry is targeted."}}},"CachePurgeKeysRequest":{"type":"object","description":"Supply either `entries` or `filter`.","properties":{"mode":{"type":"string","enum":["delete","refresh"],"default":"delete","description":"`delete` removes the entry and drops it from the listing;\n`refresh` only evicts the stored copy so the next visitor re-fills it.\n"},"entries":{"type":"array","items":{"$ref":"#/components/schemas/CachePurgeTarget"}},"filter":{"type":"object","description":"Purge everything matching this filter.","properties":{"hostname":{"type":"string"},"node":{"type":"string"},"path":{"type":"string","description":"Path wildcard, e.g. `/assets/*`."}}}}},"CachePurgeKeysResult":{"type":"object","properties":{"deleted":{"type":"integer"},"mode":{"type":"string","enum":["delete","refresh"]},"truncated":{"type":"boolean","description":"The filter matched more entries than one call may touch. Repeat the\nrequest until this is false.\n"},"complete":{"type":"boolean","description":"Every storage node that could hold the entries confirmed. `false`\nonly on a `502`: the purge did not fully happen.\n"},"unreached":{"type":"array","items":{"type":"string"},"description":"What could not be reached and why. Present when `complete` is false."},"error":{"type":"string","description":"Explanation on a `502`."}}},"Member":{"type":"object","properties":{"user_id":{"type":"integer"},"email":{"type":"string"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"},"is_owner":{"type":"boolean"},"is_self":{"type":"boolean","description":"True for the account this key belongs to."},"joined_at":{"type":"string","format":"date-time"},"notify":{"allOf":[{"$ref":"#/components/schemas/NotifyMatrix"}],"description":"The member's effective notification matrix. Always all-on for the\nowner, who receives every category and cannot opt out.\n"},"notify_defaulted":{"type":"object","description":"Category → the channels still UNSET for this member, i.e. inherited\nfrom their role rather than chosen. Render them as inherited, not as\na box the member ticked: a role change moves them.\n","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/NotifyChannel"}}},"is_billing_member":{"type":"boolean","description":"True for the domain's nominated payer."}}},"MemberList":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/Member"}},"my_role":{"$ref":"#/components/schemas/Role"},"can_edit":{"type":"boolean","description":"Whether you may manage membership on this domain."}}},"GrantableRole":{"type":"string","description":"A role that may be assigned to a member or invitation. `owner` is not\ngrantable — it always follows domain ownership.\n","enum":["admin","editor","viewer"]},"MemberUpdate":{"type":"object","description":"Partial patch — send only what you want to change. At least one field is\nrequired.\n","properties":{"role":{"$ref":"#/components/schemas/GrantableRole"},"notify":{"type":"object","description":"Category → channel → tri-state. `true`/`false` records an explicit\nchoice; **`null` deletes** the stored choice so the pair falls back\nto the member's role default — that is how you reset a switch rather\nthan pinning it off. Unknown categories or channels are rejected, so\na typo can never read as \"no change made\".\n","additionalProperties":{"type":"object","additionalProperties":{"type":["boolean","null"]}}}}},"BillingMember":{"type":"object","description":"Whose wallet this domain's charges come out of. Always populated — with\nno nomination in force it describes the owner.\n","properties":{"user_id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"set_by":{"type":"integer","description":"Who made the nomination. Absent when the owner pays."},"set_at":{"type":"string","format":"date-time"},"is_owner":{"type":"boolean","description":"True when no nomination is in force and the domain owner pays. The\nowner being named explicitly is stored as *no* nomination, so this\nnever disagrees with ownership.\n"}}},"DomainPayer":{"type":"object","description":"The wallet a purchase or renewal on this domain will spend, and what is\nin it.\n","properties":{"user_id":{"type":"integer"},"name":{"type":"string","description":"Display name, falling back to the email address."},"email":{"type":"string"},"is_owner":{"type":"boolean","description":"True when the payer is the domain owner."},"is_self":{"type":"boolean","description":"True when the payer is the account this key belongs to."},"balance_rials":{"type":"integer","format":"int64","description":"The payer's wallet balance in rials — disclosed only through this\ngate, and only for this domain's payer.\n"}}},"NotifyCategory":{"type":"string","description":"A class of event a member can subscribe to: domain status, origin\noutages, certificates, plan and subscription changes, gateways,\ninvoices, and the weekly recommendations digest.\n\n`recommendation` is the only digest in the list — everything else fires\non an event. It is sent once a week to anyone whose domains still have\noutstanding recommendations, and it counts only the items that reader\nhas not dismissed.\n","enum":["domain","uptime","ssl","plan","gateway","invoice","recommendation"]},"NotifyChannel":{"type":"string","description":"An outbound delivery channel a member can switch off. The in-app feed is\ndeliberately not one — see `in_app_always_on`.\n","enum":["email","sms"]},"NotifyMatrix":{"type":"object","description":"Category → channel → enabled. The **effective** matrix: explicit choices\nmerged over the member's role defaults, so a client never has to\nreimplement the fallback.\n","additionalProperties":{"type":"object","additionalProperties":{"type":"boolean"}}},"NotifyCatalog":{"type":"object","properties":{"categories":{"type":"array","items":{"$ref":"#/components/schemas/NotifyCategory"}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/NotifyChannel"}},"role_defaults":{"type":"object","description":"Grantable role → category → whether a member holding that role\nreceives the category when they have chosen nothing. The default\napplies to every channel.\n","additionalProperties":{"type":"object","additionalProperties":{"type":"boolean"}}},"in_app_always_on":{"type":"boolean","description":"Always `true`. The in-app feed cannot be switched off — say so in\nyour UI, or the first question will be why muted notifications still\nappear.\n"}}},"MemberUpdateResult":{"type":"object","description":"The membership after a patch. Narrower than `Member` — it carries the\nmembership itself and the recomputed notification matrix, not the user\nprofile you already have from the member list.\n","properties":{"id":{"type":"integer","description":"Membership id."},"domain_id":{"type":"integer"},"user_id":{"type":"integer"},"role":{"$ref":"#/components/schemas/Role"},"notify":{"$ref":"#/components/schemas/NotifyMatrix"},"notify_defaulted":{"type":"object","additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/NotifyChannel"}}}}},"Invite":{"type":"object","properties":{"id":{"type":"integer"},"domain_id":{"type":"integer"},"email":{"type":"string","description":"The address the invitation is bound to."},"role":{"$ref":"#/components/schemas/GrantableRole"},"invited_by":{"type":"integer","description":"User id of the inviter."},"expires_at":{"type":"string","format":"date-time"},"max_uses":{"type":"integer"},"uses":{"type":"integer"},"revoked_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"link":{"type":"string","description":"The accept URL. Returned when the invitation is created or resent."},"is_link":{"type":"boolean","description":"True for a shareable link rather than an emailed invitation."},"exhausted":{"type":"boolean","description":"True when `uses` has reached `max_uses`."}}},"InviteCreate":{"type":"object","required":["email","role"],"properties":{"email":{"type":"string","format":"email"},"role":{"$ref":"#/components/schemas/GrantableRole"},"expires_in_hours":{"type":"integer","description":"Lifetime of the invitation. Omit for the default."}}},"InvitePreview":{"type":"object","properties":{"domain":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"},"inviter":{"type":"string","description":"Display name of whoever sent it."},"is_link":{"type":"boolean"},"email_match":{"type":"boolean","description":"Whether the invitation was addressed to the calling account.\nAccepting fails when this is false.\n"},"expires_at":{"type":"string","format":"date-time"},"already_member":{"type":"boolean","description":"You already have access; the other fields describe your existing role."},"is_owner":{"type":"boolean"},"invited_email":{"type":"string","description":"Masked target address. Present only when `email_match` is false."}}},"InviteAcceptResult":{"type":"object","properties":{"accepted":{"type":"boolean"},"already_member":{"type":"boolean","description":"Returned instead of `accepted` when you already had access."},"domain":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}}},"InviteMismatch":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","const":"invite_email_mismatch"},"invited_email":{"type":"string","description":"Masked address the invitation was actually sent to."}}},"Wallet":{"type":"object","properties":{"id":{"type":"integer"},"user_id":{"type":"integer"},"balance_rials":{"type":"integer"},"negative_since":{"type":"string","format":"date-time","description":"When the balance first went below zero in the current debt cycle.\nAbsent while non-negative. Staying negative past the grace window\nsuspends paid domains.\n"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"WalletTransaction":{"type":"object","properties":{"id":{"type":"integer"},"wallet_id":{"type":"integer"},"user_id":{"type":"integer"},"type":{"type":"string","enum":["topup","purchase","refund","admin_adjust","traffic_usage","signup_bonus"],"description":"`topup` — money added. `purchase` — a plan bought or renewed.\n`refund`. `admin_adjust` — a correction by NSIN support.\n`traffic_usage` — a traffic charge. `signup_bonus` — the credit\ngranted at signup.\n"},"amount_rials":{"type":"integer","description":"Signed — positive credits, negative debits."},"balance_after":{"type":"integer"},"description":{"type":"string"},"ref_type":{"type":"string","description":"What the row refers to — `payment`, `subscription`, `traffic` or `manual`."},"ref_id":{"type":"integer"},"ref_code":{"type":"string","description":"Payment gateway reference, for top-ups."},"origin_node":{"type":"string","description":"Internal — set on rows replicated from another NSIN region. Clients can ignore it."},"sync_key":{"type":"string","description":"Internal — the replication idempotency key of a replicated row. Clients can ignore it."},"created_at":{"type":"string","format":"date-time"},"domain_id":{"type":"integer","description":"The domain a traffic charge is attributed to. Only on rows of `GET /wallet/transactions`."},"domain_name":{"type":"string","description":"That domain's name. Only on rows of `GET /wallet/transactions`."}}},"TrafficDomainBreakdown":{"type":"object","description":"One domain's share of a single traffic charge.","properties":{"domain_id":{"type":"integer"},"domain_name":{"type":"string"},"cached_bytes":{"type":"integer"},"proxied_bytes":{"type":"integer"},"direct_bytes":{"type":"integer"},"bypass_bytes":{"type":"integer","description":"Legacy two-tier column, on historical rows only."},"charged_rials":{"type":"integer"}}},"WalletTransactionDetail":{"allOf":[{"$ref":"#/components/schemas/WalletTransaction"},{"type":"object","properties":{"node":{"type":"string"},"billing_window_key":{"type":"string","description":"Identifies the billing window a traffic charge covers."},"by_domain":{"type":"array","description":"Per-domain contribution to this charge. Traffic charges only.","items":{"$ref":"#/components/schemas/TrafficDomainBreakdown"}},"cached_bytes":{"type":"integer","description":"Total across `by_domain`."},"proxied_bytes":{"type":"integer","description":"Total across `by_domain`."},"direct_bytes":{"type":"integer","description":"Total across `by_domain`."},"bypass_bytes":{"type":"integer","description":"Total across `by_domain`."},"charged_rials":{"type":"integer","description":"Total charged across `by_domain`."}}}]},"Subscription":{"type":"object","description":"A plan attached to one domain. Entitlements are **not** read from the\nplan directly — use `GET /domains/{domain}/features`, which resolves any\nper-subscription overrides.\n","properties":{"id":{"type":"integer"},"user_id":{"type":"integer"},"domain_id":{"type":"integer"},"domain_name":{"type":"string"},"plan_id":{"type":"integer","description":"The plan this subscription is on."},"plan":{"type":"object","additionalProperties":true,"description":"The plan this subscription is on."},"plan_term_id":{"type":"integer","description":"The billing term purchased."},"plan_term":{"type":"object","additionalProperties":true,"description":"The billing term purchased."},"status":{"type":"string","description":"For example `active`, `expired`, `grace` or `cancelled`."},"started_at":{"type":"string","format":"date-time","description":"Start of the subscription term."},"expires_at":{"type":"string","format":"date-time","description":"End of the paid term."},"grace_until":{"type":"string","format":"date-time","description":"End of the grace period after expiry, during which the plan keeps working."},"auto_renew":{"type":"boolean","description":"Renew from the wallet at expiry."},"quota_reset_days":{"type":"integer","description":"Traffic-allowance reset cadence, frozen at purchase time so later\nplan changes cannot shift an existing subscriber's quota window.\n"},"is_trial":{"type":"boolean","description":"The free trial granted at signup. Downgrades to the free plan on\nexpiry rather than entering grace.\n"},"cancelled_at":{"type":"string","format":"date-time","description":"When the subscription was cancelled. Absent unless cancelled."},"cancel_reason":{"type":"string","enum":["domain_deleted","recycled_domain_id","plan_switch","trial_ended"],"description":"Why NSIN cancelled it, for a cancellation the system made. Absent otherwise."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"effective_features":{"type":"object","additionalProperties":true,"description":"The entitlements this subscription carries — its plan with any\noverrides applied. On single-subscription reads.\n"},"quota_period_start":{"type":"string","format":"date-time","description":"Start of the current traffic-allowance window. On single-subscription reads of an active or grace subscription."},"quota_period_end":{"type":"string","format":"date-time","description":"End of the current traffic-allowance window."},"quota_period_used_bytes":{"type":"integer","format":"int64","description":"Traffic used so far in the current allowance window, in bytes. Only on `GET /domains/{domain}/subscription`."},"override_max_records":{"type":"integer","description":"Support-set override of the plan's `max_records`. Present only when set."},"override_max_traffic_gb":{"type":"integer","description":"Support-set override of the plan's `max_traffic_gb`. Present only when set."},"override_max_rules_per_set":{"type":"integer","description":"Support-set override of the plan's `max_rules_per_set`. Present only when set."},"override_max_gateway_requests_30d":{"type":"integer","description":"Support-set override of the plan's `max_gateway_requests_30d`. Present only when set."},"override_max_gateway_gb_30d":{"type":"integer","description":"Support-set override of the plan's `max_gateway_gb_30d`. Present only when set."},"override_max_cache_cap_mb":{"type":"integer","description":"Support-set override of the plan's `max_cache_cap_mb`. Present only when set."},"override_max_cache_disk_gb":{"type":"integer","description":"Support-set override of the plan's `max_cache_disk_gb`. Present only when set."},"override_max_cache_ttl_days":{"type":"integer","description":"Support-set override of the plan's `max_cache_ttl_days`. Present only when set."},"override_max_email_rules":{"type":"integer","description":"Support-set override of the plan's `max_email_rules`. Present only when set."},"override_max_email_forwards_per_day":{"type":"integer","description":"Support-set override of the plan's `max_email_forwards_per_day`. Present only when set."},"override_max_email_sends_per_day":{"type":"integer","description":"Support-set override of the plan's `max_email_sends_per_day`. Present only when set."},"override_max_custom_rules":{"type":"integer","description":"Support-set override of the plan's `max_custom_rules`. Present only when set."},"override_disabled_rule_types":{"type":"string","description":"Support-set override of the plan's `disabled_rule_types`, as a JSON array in a string (`[]` lifts every restriction). Present only when set."},"override_gateways_enabled":{"type":"boolean","description":"Support-set override of the plan's `gateways_enabled`. Present only when set."},"override_logs_enabled":{"type":"boolean","description":"Support-set override of the plan's `logs_enabled`. Present only when set."},"override_monitoring_enabled":{"type":"boolean","description":"Support-set override of the plan's `monitoring_enabled`. Present only when set."},"override_rules_enabled":{"type":"boolean","description":"Support-set override of the plan's `rules_enabled`. Present only when set."},"override_cache_purge_enabled":{"type":"boolean","description":"Support-set override of the plan's `cache_purge_enabled`. Present only when set."},"override_custom_ssl_enabled":{"type":"boolean","description":"Support-set override of the plan's `custom_ssl_enabled`. Present only when set."},"override_ws_enabled":{"type":"boolean","description":"Support-set override of the plan's `ws_enabled`. Present only when set."},"override_host_header_edit_enabled":{"type":"boolean","description":"Support-set override of the plan's `host_header_edit_enabled`. Present only when set."},"override_uptime_sms_enabled":{"type":"boolean","description":"Support-set override of the plan's `uptime_sms_enabled`. Present only when set."},"override_dedicated_support_enabled":{"type":"boolean","description":"Support-set override of the plan's `dedicated_support_enabled`. Present only when set."},"override_shield_enabled":{"type":"boolean","description":"Support-set override of the plan's `shield_enabled`. Present only when set."},"override_bot_cache_enabled":{"type":"boolean","description":"Support-set override of the plan's `bot_cache_enabled`. Present only when set."},"override_under_attack_allowed":{"type":"boolean","description":"Support-set override of the plan's `under_attack_allowed`. Present only when set."},"override_email_routing_enabled":{"type":"boolean","description":"Support-set override of the plan's `email_routing_enabled`. Present only when set."},"override_email_sending_enabled":{"type":"boolean","description":"Support-set override of the plan's `email_sending_enabled`. Present only when set."}}},"DomainPlanSummary":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"plan_slug":{"type":"string"},"plan_name":{"type":"string"},"status":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}}},"DomainFeatures":{"type":"object","description":"The domain's effective entitlements, after per-subscription overrides.\nA `null` limit means unlimited.\n","properties":{"plan_id":{"type":"integer","description":"The plan in force. Absent without an active plan."},"plan_name":{"type":"string","description":"Its display name."},"plan_slug":{"type":"string","description":"Its stable identifier."},"has_active_plan":{"type":"boolean","description":"Whether the domain has an active (or grace) plan at all. Without one, plan-gated features answer `402`."},"max_records":{"type":"integer","description":"Null means unlimited."},"max_traffic_gb":{"type":"integer","description":"Null means unlimited."},"max_rules_per_set":{"type":"integer","description":"Rules allowed per rule type. Null means unlimited."},"max_gateway_requests_30d":{"type":["integer","null"],"description":"Requests this domain's gateway records may serve in a rolling 30-day\nwindow. Null means unlimited. See the gateway list endpoint for\nusage against it.\n"},"max_gateway_gb_30d":{"type":["integer","null"],"description":"Egress, in GB, this domain's gateway records may serve in a rolling 30-day window. Null means unlimited."},"max_cache_cap_mb":{"type":"integer","description":"Ceiling for the domain's `cache_cap_mb` — the largest response body cached."},"max_cache_disk_gb":{"type":"integer","description":"Ceiling for the domain's `cache_l2_max_gb` — the size of its cache pool."},"max_cache_ttl_days":{"type":"integer","description":"Ceiling for the domain's `cache_l2_ttl_days` — how long a cached entry may live."},"disabled_rule_types":{"type":"array","items":{"type":"string"},"description":"Rule types this plan does not include, by rule `type` string (for\nexample `origin_pool`, `origin_route`, `optimize`). A DENY list: any\ntype not listed is available. A rule of a listed type can still be\ncreated and edited, but it is saved switched off and cannot be\nswitched on; rules of a type the plan stops including are switched\noff (not deleted) when the plan changes.\n"},"gateways_enabled":{"type":"boolean","description":"Gates the Gateways feature."},"logs_enabled":{"type":"boolean","description":"Gates the raw-log and top-N analytics endpoints."},"monitoring_enabled":{"type":"boolean","description":"Gates most analytics sections."},"rules_enabled":{"type":"boolean","description":"Whether the plan includes edge rules at all. When `false`, every rule type is locked the way `disabled_rule_types` describes."},"cache_purge_enabled":{"type":"boolean","description":"Gates the cache purge endpoints."},"bot_cache_enabled":{"type":"boolean","description":"Gates the domain's bot cache (`bot_cache_enabled` on Domain)."},"email_routing_enabled":{"type":"boolean","description":"Gates Email Routing (the `/email-routing` endpoints)."},"max_email_rules":{"type":["integer","null"],"description":"Custom email addresses this domain may hold. Null means unlimited."},"max_email_forwards_per_day":{"type":["integer","null"],"description":"Messages this domain may forward per UTC day. Null means unlimited.\nPast it, the mail hosts defer (SMTP 452) until the day rolls over.\n"},"email_sending_enabled":{"type":"boolean","description":"Gates sending mail from the domain's addresses (the email routing send endpoint)."},"max_email_sends_per_day":{"type":["integer","null"],"description":"Recipients this domain may send to per UTC day. Null means unlimited."},"max_custom_rules":{"type":["integer","null"],"description":"Custom (expression) firewall rules this domain may hold. Null means\nunlimited, `0` that the plan has no custom rules. After a downgrade\nthe extra rules are kept, but no more can be created or switched\non. The current count is `domain_usage[].custom_rule_count`.\n"},"under_attack_allowed":{"type":"boolean","description":"The domain may switch on Under Attack Mode (`PUT /domains/{domain}/under-attack`). On for every plan unless support switches it off."},"custom_ssl_enabled":{"type":"boolean","description":"Gates custom certificate upload."},"ws_enabled":{"type":"boolean","description":"WebSocket support."},"host_header_edit_enabled":{"type":"boolean","description":"Gates the Host-header override on records (`host_header`)."},"uptime_sms_enabled":{"type":"boolean","description":"Whether uptime outage/recovery alerts may be delivered by SMS. When\nfalse they still go out by email and to the panel — uptime\nmonitoring itself is not gated.\n"},"dedicated_support_enabled":{"type":"boolean","description":"Direct support when true; ticket support when false."},"shield_enabled":{"type":"boolean","description":"Whether the plan includes the default NSIN Shield WAF rule (see `GET /domains/{domain}/rules/waf/shield/status`)."},"gateway_requests_30d":{"type":"integer","format":"int64","description":"Requests the domain's gateways served in the rolling 30-day window.\nPresent when the plan includes gateways, or while the domain is\nblocked by the gateway quota.\n"},"gateway_bytes_30d":{"type":"integer","format":"int64","description":"Egress bytes of the gateways over the same window — a meter, not a separate charge."},"gateway_quota_exceeded":{"type":"boolean","description":"The gateway allowance is spent; the gateway hostnames answer `429`."},"gateway_quota_reason":{"type":"string","enum":["requests","bytes"],"description":"Which gateway allowance ran out."},"gateway_quota_counted_at":{"type":"string","format":"date-time","description":"When the gateway usage was last counted."},"domain_usage":{"type":"array","description":"Current usage against the limits above.","items":{"type":"object","additionalProperties":true}},"plan_term_id":{"type":"integer"},"billing_duration_days":{"type":"integer"},"quota_reset_days":{"type":"integer"},"quota_period_start":{"type":"string","format":"date-time"},"quota_period_end":{"type":"string","format":"date-time"}}},"DomainTrafficUsageRow":{"type":"object","description":"One day's traffic for one domain.","properties":{"id":{"type":"integer"},"domain_id":{"type":"integer"},"user_id":{"type":"integer"},"date":{"type":"string","format":"date","description":"The day the row belongs to."},"billing_window_key":{"type":"string","description":"Identifies the billing window the row was billed in."},"cached_bytes":{"type":"integer","description":"Bytes served from cache."},"proxied_bytes":{"type":"integer","description":"Bytes fetched through the edge proxy."},"direct_bytes":{"type":"integer","description":"Bytes on the direct path."},"bypass_bytes":{"type":"integer","description":"Legacy two-tier column, present on historical rows. Folded into the\ndirect total for display.\n"},"charged_rials":{"type":"integer","description":"What this row cost, in rials — the sum of the three `charged_*_rials`."},"window_start":{"type":"string","format":"date-time","description":"Start of the billing window the row covers."},"window_end":{"type":"string","format":"date-time","description":"End of that window (exclusive)."},"billed_cached_bytes":{"type":"integer","description":"The portion above the plan's free allowance."},"billed_proxied_bytes":{"type":"integer","description":"The portion above the plan's free allowance."},"billed_direct_bytes":{"type":"integer","description":"The portion above the plan's free allowance."},"charged_cached_rials":{"type":"integer","description":"Cost of the cached tier's billed bytes."},"charged_proxied_rials":{"type":"integer","description":"Cost of the proxied tier's billed bytes."},"charged_direct_rials":{"type":"integer","description":"Cost of the direct tier's billed bytes."},"invoice_id":{"type":"integer","description":"The period invoice that itemized this row, once issued."},"processed_at":{"type":"string","format":"date-time","description":"When the row was billed."},"created_at":{"type":"string","format":"date-time"}}},"AccountTrafficUsage":{"type":"object","properties":{"usage":{"type":"array","items":{"$ref":"#/components/schemas/DomainTrafficUsageRow"}},"total_cached_bytes":{"type":"integer"},"total_proxied_bytes":{"type":"integer"},"total_direct_bytes":{"type":"integer"},"total_charged_rials":{"type":"integer"},"cached_price_per_gb":{"type":"integer","description":"Rials per GB of cache-served traffic."},"proxied_price_per_gb":{"type":"integer","description":"Rials per GB of proxied traffic."},"direct_price_per_gb":{"type":"integer","description":"Rials per GB of direct traffic."}}},"DomainTrafficUsageSummary":{"type":"object","description":"One domain's traffic usage, as `GET /domains/{domain}/traffic-usage` returns it.","properties":{"domain":{"type":"string"},"usage":{"type":"array","description":"The newest daily rows, up to 90, newest first.","items":{"$ref":"#/components/schemas/DomainTrafficUsageRow"}},"cached_price_per_gb":{"type":"integer","description":"Rials per GB of cache-served traffic."},"proxied_price_per_gb":{"type":"integer","description":"Rials per GB of proxied traffic."},"direct_price_per_gb":{"type":"integer","description":"Rials per GB of direct traffic."},"bypass_price_per_gb":{"type":"integer","description":"Legacy two-tier price, for historical rows."},"traffic_limit_gb":{"type":"integer","description":"The traffic allowance the subscription is billed against, in GB, with any override applied. Absent when unlimited or without a subscription."},"quota_period_start":{"type":"string","format":"date-time","description":"Start of the current allowance window. Present while the domain has an active or grace subscription."},"quota_period_end":{"type":"string","format":"date-time","description":"End of the current allowance window."},"quota_period_used_bytes":{"type":"integer","description":"Bytes metered in the current window (billed ledger plus the not-yet-billed tail)."},"cached_bytes":{"type":"integer","description":"The window's cache-served bytes."},"proxied_bytes":{"type":"integer","description":"The window's proxied bytes."},"direct_bytes":{"type":"integer","description":"The window's direct bytes."},"quota_period_charged_rials":{"type":"integer","description":"What the current window has cost so far: the rials actually debited\nfor billed windows, plus the not-yet-billed tail priced against the\nallowance that remains.\n"},"traffic_by_hostname":{"type":"array","description":"The window's traffic split by hostname. Left out with `hostnames=0` or `view=summary`.","items":{"type":"object","properties":{"hostname":{"type":"string"},"cached_bytes":{"type":"integer"},"proxied_bytes":{"type":"integer"},"direct_bytes":{"type":"integer"}}}},"traffic_by_hostname_bytes":{"type":"integer","description":"Total bytes attributed across `traffic_by_hostname`."},"all_time_cached_bytes":{"type":"integer","description":"Cache-served bytes over the domain's whole history."},"all_time_proxied_bytes":{"type":"integer","description":"Proxied bytes over the domain's whole history."},"all_time_direct_bytes":{"type":"integer","description":"Direct bytes over the domain's whole history."},"all_time_total_bytes":{"type":"integer","description":"The three all-time figures summed."},"quota_daily":{"description":"Only with `daily=1`. Null without an active or grace subscription, or when the window's usage could not be read.","oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DomainQuotaDaily"}]}}},"DomainQuotaDaily":{"type":"object","description":"The current allowance window day by day. `days` are the billed ledger\nrows grouped by UTC day, then one not-yet-billed tail up to now, so\ntheir `cumulative_bytes` ends at `used_bytes`, which always equals\n`quota_period_used_bytes`. All sizes are bytes; the allowance is\n`max_traffic_gb` × 1024³.\n","properties":{"period_start":{"type":"string","format":"date-time"},"period_end":{"type":"string","format":"date-time"},"limit_bytes":{"type":["integer","null"],"description":"The allowance in bytes, with any override applied. Null when unlimited."},"used_bytes":{"type":"integer","description":"Same as `quota_period_used_bytes`."},"days":{"type":"array","items":{"type":"object","properties":{"window_start":{"type":"string","format":"date-time","description":"The first day may start at `period_start`","the tail at the last billed instant.":null},"window_end":{"type":"string","format":"date-time","description":"The tail ends now."},"bytes":{"type":"integer"},"cumulative_bytes":{"type":"integer"},"billed":{"type":"boolean","description":"False only for the not-yet-billed tail."}}}},"avg_daily_bytes_7d":{"type":"integer","description":"Average of the last (up to) seven whole billed days of the window. 0 when there are none."},"ran_out_at":{"type":["string","null"],"format":"date-time","description":"When the running total reached the allowance, placed within the crossing day along its hourly traffic. Null if it has not."},"projected_run_out_at":{"type":["string","null"],"format":"date-time","description":"At the 7-day average, when the allowance will run out. Null once it has run out, when unlimited, or when that is after `period_end`."}}},"InvoiceItem":{"type":"object","properties":{"id":{"type":"integer"},"invoice_id":{"type":"integer"},"description":{"type":"string"},"quantity":{"type":"integer"},"unit_price_rials":{"type":"integer"},"total_rials":{"type":"integer"}}},"Invoice":{"type":"object","properties":{"id":{"type":"integer"},"number":{"type":"string","description":"Human-facing invoice number, sequential per Jalali year."},"user_id":{"type":"integer"},"domain_id":{"type":"integer"},"domain_name":{"type":"string"},"subscription_id":{"type":"integer"},"payment_id":{"type":"integer"},"kind":{"type":"string","enum":["subscription","period","topup","manual"],"description":"`subscription` — a plan purchase or renewal (taxed). `period` — the\ntraffic of a closed billing period, when it had metered traffic\n(no VAT). `topup` — a wallet top-up (no VAT). `manual` — issued by\nNSIN support (taxed).\n"},"status":{"type":"string","enum":["paid","unpaid","cancelled"]},"subtotal_rials":{"type":"integer","description":"Before tax, in rials."},"tax_rials":{"type":"integer","description":"VAT, in rials."},"total_rials":{"type":"integer","description":"What was charged, in rials."},"issued_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"},"notes":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceItem"}}}},"PeriodDomainTraffic":{"type":"object","description":"One domain's traffic in a period estimate.","properties":{"domain":{"type":"string"},"cached_bytes":{"type":"integer","description":"Bytes served from cache."},"proxied_bytes":{"type":"integer","description":"Bytes fetched through the edge proxy."},"direct_bytes":{"type":"integer","description":"Bytes sent directly to the origin path."},"estimated_charged_rials":{"type":"integer","description":"Estimated cost of this traffic at current rates."}}},"PeriodStatement":{"type":"object","description":"One billing period's cost. For the period in progress the traffic\nfigures are a running estimate.\n","properties":{"id":{"type":"integer"},"subscription_id":{"type":"integer"},"plan_id":{"type":"integer"},"plan_name":{"type":"string"},"plan_term_id":{"type":"integer"},"billing_duration_days":{"type":"integer"},"quota_reset_days":{"type":"integer"},"period_start":{"type":"string","format":"date-time"},"period_end":{"type":"string","format":"date-time"},"plan_price_rials":{"type":"integer","description":"What the plan cost for this period."},"traffic_cached_bytes":{"type":"integer","description":"Bytes served from cache in the period."},"traffic_proxied_bytes":{"type":"integer","description":"Bytes fetched through the edge proxy."},"traffic_direct_bytes":{"type":"integer","description":"Bytes on the direct path."},"traffic_bypass_bytes":{"type":"integer","description":"Legacy two-tier column, on historical periods only."},"traffic_charged_rials":{"type":"integer","description":"What the period's traffic cost."},"cached_price_rials_per_gb":{"type":"integer","description":"Price per GB of cached traffic in force for the period."},"proxied_price_rials_per_gb":{"type":"integer","description":"Price per GB of proxied traffic."},"direct_price_rials_per_gb":{"type":"integer","description":"Price per GB of direct traffic."},"bypass_price_rials_per_gb":{"type":"integer","description":"Legacy two-tier price, on historical periods only."},"traffic_by_domain":{"type":"array","description":"Per-domain split. Only on an estimate for a running period.","items":{"$ref":"#/components/schemas/PeriodDomainTraffic"}},"created_at":{"type":"string","format":"date-time","description":"When the statement was closed."},"is_estimate":{"type":"boolean","description":"`true` for a running period's estimate; `false` for a closed period."},"not_a_tax_invoice":{"type":"boolean","const":true,"description":"This is a statement, not a tax invoice."},"traffic_realtime":{"type":"boolean","description":"Present (`true`) on an estimate whose traffic figures run up to now."}}},"TicketAttachmentUpload":{"type":"object","description":"The file part of a `multipart/form-data` ticket or reply. Send the files\nunder `files` — `file`, `attachments`, `images` and `image` are accepted\nas aliases for older clients, and files sent under several of them are\ncombined, not deduplicated.\n\nAccepted: JPEG, PNG, GIF and WebP images, and `.txt`, `.log` and `.json`\ntext files. Caps are per kind — 3 MB per image, 1 MB per text file — and\neight files per message across all kinds.\n\nRefused, and they will stay refused: `.html`, `.xml`, `.svg` (an image\nformat that can execute script, which from an API origin is same-origin\nXSS) and every archive format, whose contents we cannot inspect. The\nextension must also agree with the bytes: an image is sniffed by magic\nnumber, text must be valid UTF-8 with no NUL bytes, and `.json` must\nparse. Double extensions such as `payload.html.txt` are rejected.\n","properties":{"files":{"type":"array","description":"Up to 8 files per message.","items":{"type":"string","format":"binary"},"maxItems":8}}},"TicketAttachment":{"type":"object","properties":{"id":{"type":"integer"},"message_id":{"type":"integer"},"original_name":{"type":"string"},"content_type":{"type":"string"},"size_bytes":{"type":"integer"},"url":{"type":"string","description":"Where to download the attachment."}}},"TicketMessage":{"type":"object","properties":{"id":{"type":"integer"},"ticket_id":{"type":"integer"},"author_user_id":{"type":"integer"},"author":{"type":"object","additionalProperties":true,"description":"The message author."},"body":{"type":"string"},"is_staff":{"type":"boolean","description":"True when written by support staff."},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/TicketAttachment"}},"created_at":{"type":"string","format":"date-time"},"edited_at":{"type":"string","format":"date-time","description":"When the message was last edited. Absent on a message that has never\nbeen edited — render the \"edited\" marker off this field, not off\n`updated_at`.\n"},"edited_by_user_id":{"type":"integer","description":"Who made the last edit. Absent on a message that has never been edited."},"edit_count":{"type":"integer","description":"How many times the message has been edited. `0` for an untouched message."}}},"Ticket":{"type":"object","properties":{"id":{"type":"integer"},"user_id":{"type":"integer"},"subject":{"type":"string"},"status":{"type":"string","enum":["open","closed"]},"closed_at":{"type":"string","format":"date-time"},"closed_by_user_id":{"type":"integer"},"closed_reason":{"type":"string","description":"Why the ticket is closed: `staff` when a person closed it, `auto` when it closed itself after `ticket_auto_close_days` without a new message. Absent while open. Posting a message to an `auto` closed ticket reopens it; a `staff` close is final."},"user_last_read_message_id":{"type":"integer","description":"The newest message you have read; replies after it are unread."},"staff_last_read_message_id":{"type":"integer","description":"The newest message support has read."},"messages":{"type":"array","description":"The thread. Populated when fetching a single ticket.","items":{"$ref":"#/components/schemas/TicketMessage"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"TicketListItem":{"allOf":[{"$ref":"#/components/schemas/Ticket"},{"type":"object","properties":{"is_unread":{"type":"boolean","description":"There are replies you have not read."}}}]},"Notification":{"type":"object","properties":{"id":{"type":"integer"},"kind":{"type":"string","description":"The specific event, for example `domain_active`, `origin_outage`,\n`plan_traffic_high` or `invoice_issued`.\n"},"category":{"type":"string","description":"The group the kind belongs to.","enum":["domain","uptime","ssl","plan","billing","ticket","gateway","email","recommendation"]},"domain_id":{"type":"integer","description":"The domain this is about. Absent for account-wide notifications."},"domain_name":{"type":"string","description":"Name of `domain_id`, resolved for convenience."},"subject":{"type":"string","description":"Short title, in the language your account receives email in —\nPersian by default, English when chosen (and by default for an\naccount with a non-Iranian phone number).\n"},"message":{"type":"string","description":"The notification body, in the same language as `subject`."},"is_unread":{"type":"boolean","description":"You have not marked this seen yet."},"created_at":{"type":"string","format":"date-time"}}}}}}
