Update a DNS record
const url = 'https://api.nsin.ir/domains/example.com/records/1';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","destination":"example","mx_priority":1,"ttl":120,"proxied":true,"captcha":true,"scheme":"Http","port":1,"host_header":"example","host_header_mode":"own","monitor":true,"timeout":1,"comment":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.nsin.ir/domains/example.com/records/1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "destination": "example", "mx_priority": 1, "ttl": 120, "proxied": true, "captcha": true, "scheme": "Http", "port": 1, "host_header": "example", "host_header_mode": "own", "monitor": true, "timeout": 1, "comment": "example" }'Partial update — omitted fields keep their current value. The type
cannot be changed. The same rules as creating apply to the new values
(see POST .../records/); DNS is republished, a proxied change reaches
the edge at once, and on an external-DNS domain the edge check runs
again in the background. Records NSIN manages (editable: false —
gateway records, locked Email Routing records) cannot be changed here.
Requires records.edit.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The domain name (for example example.com) — not a numeric id.
Example
example.comNumeric id of the DNS record.
Request Body required
Section titled “Request Body required ”Every field is optional; omitted fields keep their current value.
object
New value — see destination on Record.
MX priority. MX only.
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.
See proxied on RecordCreate.
Challenge visitors before passing them to the origin.
Protocol the edge uses to reach the origin of a proxied record.
Https— TLS toport(443 when the port is unset or out of range).Http— plain HTTP toport(80 when unset or out of range).Auto— HTTPS on 443 first, falling back to plain HTTP. The port is always 443.Default— accepted on input, and so are an empty or unrecognised value, but stored asAutowith port 443: a record never reads back asDefault.
See port on RecordCreate.
See host_header on RecordCreate. An empty string removes the override.
See host_header_mode on RecordCreate.
Include this record in uptime monitoring.
Origin wait before 504, in seconds. Max 1800 (30 minutes).
Free-form note. An empty string removes it.
Responses
Section titled “ Responses ”Updated record.
object
Record name relative to the domain. @ is the apex.
The fully-qualified name, with trailing dot.
The record’s value. For a proxied record this is the origin the
edge connects to, and the published DNS answer is the NSIN proxy IP
instead — see dns_content.
What is actually published in DNS. Equals the proxy IP for proxied records.
TTL in seconds.
Route this hostname through the NSIN edge. Only A, AAAA, CNAME
and ANAME may be proxied.
Challenge visitors before passing them to the origin.
False for records NSIN manages on your behalf.
The platform feature that owns this record, or empty for a record
you created. email_routing marks the MX, SPF and DKIM rows Email
Routing publishes; they are removed by disabling routing, never
through the record endpoints (which refuse them while locked).
Protocol the edge uses to reach the origin of a proxied record.
Https— TLS toport(443 when the port is unset or out of range).Http— plain HTTP toport(80 when unset or out of range).Auto— HTTPS on 443 first, falling back to plain HTTP. The port is always 443.Default— accepted on input, and so are an empty or unrecognised value, but stored asAutowith port 443: a record never reads back asDefault.
Origin port for proxied records: 443 for Auto, otherwise as set (default 443 for Https, 80 for Http).
Overrides the Host header (and SNI) sent to the origin.
Which name a proxied CNAME/ANAME sends to its origin as the Host
header (and SNI) when host_header is empty: empty — the record’s
own hostname (the default); target — the hostname it points at.
The gateway this record was created for, or null for a record you
made. A gateway record is not editable here; rename or remove it
through the gateway endpoints.
Gateway records only: a JSON array, as a string, of the other
hostnames the gateway’s service links to. The edge serves them
under /_nsin/<host>/ on the gateway hostname.
Gateway records only — whether the edge rewrites URLs in responses to go through the gateway.
Include this record in uptime monitoring.
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.
Only meaningful for MX.
Free-form note.
Always null — deleted records are never returned.
External-DNS domains, proxied records only. Whether the name
resolves to NSIN’s edge, as last checked: ok — every address it
resolves to is ours; miss — it resolves elsewhere, only partly to
us, or not at all; error — the first lookup failed and nothing is
known yet. Absent until the first check, and always absent on a
managed-DNS domain.
How an ok record reaches NSIN: through the CNAME target
(cname), by publishing our address directly (a), or proxy —
DNS points at another CDN or proxy, but that service forwards to
NSIN and the edge is serving the host (judged from the last 24h of
request logs). A CNAME keeps working when our addresses change; an
A record does not.
What the name actually resolves to, for display.
Example
{ "name": "www", "original_name": "www.example.com.", "type": "A", "scheme": "Http", "host_header_mode": "", "timeout": 60, "edge_status": "ok", "edge_via": "cname"}Malformed body or an invalid value (see POST .../records/).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}Missing, malformed, revoked or expired API key. (A valid key whose
account has been deactivated gets 403 account is inactive instead.)
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}Setting host_header on a domain with no active plan.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}Read-only key, insufficient role, the record is not editable, or a
new host_header on a plan without the Host-header override
feature.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}Domain or record not found.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The domain is disabled or banned.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}The DNS servers refused the write; retry in a moment.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}