Switch a gateway on
const url = 'https://api.nsin.ir/domains/example.com/gateways/1/apply';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"my-chatgpt"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.nsin.ir/domains/example.com/gateways/1/apply \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "my-chatgpt" }'Creates the gateway’s record on this domain and returns it. The record is proxied through the NSIN edge and counts against your plan’s record limit, but it is not editable — updating or deleting it through the DNS record endpoints returns 403. Use the rename and delete endpoints below instead.
Send a name to choose the hostname yourself; omit the body entirely and
one is generated as <slug>-<5 digits>.
A gateway can be on at most once per domain. 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 gateway, from the gateway list.
Request Body
Section titled “Request Body ”object
Hostname relative to the domain — letters, digits and hyphens.
Wildcards and @ are rejected. On apply this field is optional;
leave it out and a name is generated for you.
Example
my-chatgptResponses
Section titled “ Responses ”Gateway switched on; the created 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.
Protocol the edge uses to reach the origin for a proxied record.
Default follows the request’s own scheme; Auto probes.
Origin port for proxied records. Default: 443.
Overrides the Host header (and SNI) sent to the origin.
Include this record in uptime monitoring.
ISO country code of the destination, detected by NSIN.
How long an edge node waits for the origin to start responding before returning 504, in seconds. Default 15, maximum 1800 (30 minutes). Only applies to proxied records.
Only meaningful for MX.
Free-form note.
Example
{ "name": "www", "original_name": "www.example.com.", "type": "A", "scheme": "Http", "timeout": 15}Missing, malformed, revoked or expired API key — or the owning account is inactive.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}Insufficient permission, no active plan, or the plan’s record limit is already reached.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}Domain not found, or no such gateway is on offer.
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, uses external DNS (error_code: external_dns), or this gateway is already on — in that last case
the response carries the existing record under record.
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"}