DNS
托管 DNS 区与记录,含域名归属验证,覆盖 Cloudflare / Route53 / AliDNS。(非域名注册。)
概览
https://api.infrai.cc/v1/dnsAuthorization: Bearer $INFRAI_API_KEY# Call any /v1/dns capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/dns/... \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json"方法
dns.domain.add
通过在 vendor(Cloudflare / Route53 / AliDNS)创建托管 DNS 区来绑定自定义域名;返回 zone_id 与名称服务器。非域名注册。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
domain | string | 必填 | 顶级域名,如 example.com。 |
vendor | string | 可选 | 锁定到某 DNS vendor(BYOK / 显式)。 |
account_id | string | 可选 | vendor 账户 id / 调用方引用。 |
metadata | Record<string, unknown> | 可选 | 任意键值元数据。 |
返回
Zone { zone_id, domain, nameservers, status }示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/dns/domain/add \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "..."}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/dns/domain/add",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'domain': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/add",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/add",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.domain.get
按 zone_id 或名称获取已绑定域名(区),返回其状态与名称服务器。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
domain | string | 必填 | 顶级域名,如 example.com。 |
zone_id | string | 可选 | vendor 区 id(get/verify/delete 优先使用)。 |
vendor | string | 可选 | 锁定到某 DNS vendor(BYOK / 显式)。 |
返回
Zone示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/dns/domain/get \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/dns/domain/get",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/get",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/get",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.domain.list
在配置的 DNS vendor 上列出账户已绑定的自定义域名(托管区)。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
cursor | string | 可选 | 不透明分页游标。 |
limit | number | 可选 | 返回条目的最大数量。 |
返回
{ items: Zone[], next_cursor?: string }示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/dns/domain/list \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/dns/domain/list",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.domain.verify
在创建该区的同一 vendor(sticky_resource)上校验已绑定域名的激活 / 委派;只读查询区状态。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
domain | string | 必填 | 顶级域名,如 example.com。 |
zone_id | string | 可选 | vendor 区 id(get/verify/delete 优先使用)。 |
vendor | string | 可选 | 锁定到某 DNS vendor(BYOK / 显式)。 |
返回
{ verified: boolean, status }示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/dns/domain/verify \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "..."}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/dns/domain/verify",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'domain': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/verify",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/verify",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.domain.delete
在 vendor 删除已绑定域名的托管区(需 zone_id)。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
domain | string | 必填 | 顶级域名,如 example.com。 |
zone_id | string | 可选 | vendor 区 id(get/verify/delete 优先使用)。 |
vendor | string | 可选 | 锁定到某 DNS vendor(BYOK / 显式)。 |
返回
{ ok: boolean }示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/dns/domain/delete \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.delete(
"https://api.infrai.cc/v1/dns/domain/delete",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/delete",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/delete",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.record.create
在已绑定区中创建 DNS 记录(A/AAAA/CNAME/TXT/MX),含 TTL 与可选 MX 优先级 / Cloudflare 代理。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
zone_id | string | 必填 | vendor 区 id(get/verify/delete 优先使用)。 |
record_type | "A" | "AAAA" | "CNAME" | "MX" | "TXT" | "NS" | "SRV" | 必填 | 记录类型——A、AAAA、CNAME、MX、TXT、NS、SRV。 |
name | string | 必填 | 记录名称,如 www 或 www.example.com。 |
content | string | 必填 | IP / 目标 / 文本值。 |
ttl | number | 可选 | 记录 TTL(秒)。 |
priority | number | 可选 | MX 优先级(仅 MX)。 |
proxied | boolean | 可选 | Cloudflare 橙云代理(仅 A/AAAA/CNAME)。 |
metadata | Record<string, unknown> | 可选 | 任意键值元数据。 |
返回
Record { record_id, type, name, content, ttl }示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X POST https://api.infrai.cc/v1/dns/record/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}'import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/dns/record/create",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'zone_id': '...', 'record_type': 'A', 'name': '...', 'content': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.record.list
列出已绑定区中的 DNS 记录。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
zone_id | string | 必填 | vendor 区 id(get/verify/delete 优先使用)。 |
record_type | string | 可选 | 记录类型——A、AAAA、CNAME、MX、TXT、NS、SRV。 |
name | string | 可选 | 记录名称,如 www 或 www.example.com。 |
返回
{ items: Record[] }示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X GET https://api.infrai.cc/v1/dns/record/list \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/dns/record/list",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.record.update
更新已有 DNS 记录(按 record_id;Route53 使用 UPSERT)。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
zone_id | string | 必填 | vendor 区 id(get/verify/delete 优先使用)。 |
record_id | string | 可选 | 记录 id(用于更新 / 删除)。 |
record_type | string | 必填 | 记录类型——A、AAAA、CNAME、MX、TXT、NS、SRV。 |
name | string | 必填 | 记录名称,如 www 或 www.example.com。 |
content | string | 必填 | IP / 目标 / 文本值。 |
ttl | number | 可选 | 记录 TTL(秒)。 |
priority | number | 可选 | MX 优先级(仅 MX)。 |
proxied | boolean | 可选 | Cloudflare 橙云代理(仅 A/AAAA/CNAME)。 |
返回
Record示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X PATCH https://api.infrai.cc/v1/dns/record/update \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}'import os, requests
resp = requests.patch(
"https://api.infrai.cc/v1/dns/record/update",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'zone_id': '...', 'record_type': 'A', 'name': '...', 'content': '...'},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/update",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/update",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);dns.record.delete
从已绑定区删除 DNS 记录(需 record_id)。
参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
zone_id | string | 必填 | vendor 区 id(get/verify/delete 优先使用)。 |
record_id | string | 可选 | 记录 id(用于更新 / 删除)。 |
record_type | string | 可选 | 记录类型——A、AAAA、CNAME、MX、TXT、NS、SRV。 |
name | string | 可选 | 记录名称,如 www 或 www.example.com。 |
返回
{ ok: boolean }示例
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."curl -X DELETE https://api.infrai.cc/v1/dns/record/delete \
-H "Authorization: Bearer $INFRAI_API_KEY"import os, requests
resp = requests.delete(
"https://api.infrai.cc/v1/dns/record/delete",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/delete",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/delete",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);高级:指定 vendor
默认情况下 infrai 会把每次调用智能路由到最佳可用供应商——无需自己挑选 vendor。作为高级逃生口,本能力支持可选的 vendor 入参以锁定某个供应商。本能力当前所有可用 vendor 可通过该能力 id 对应的 discovery 端点实时获取——参见 discovery API。
GET /v1/discovery/{capability}dns.domain.add
dns.domain.get
dns.domain.verify
dns.domain.delete
全部能力
本模块全部已路由能力——完整的对外 REST 契约。上方方法是带讲解的入门示例,此表是完整参考。
| 能力 | 端点 | 说明 |
|---|---|---|
dns.domain.add | POST /v1/dns/domain/add | Bind a custom domain by creating a managed DNS zone at the vendor (Cloudflare / Route53 / AliDNS); returns zone_id + name servers. Not domain registration. |
dns.domain.delete | DELETE /v1/dns/domain/delete | Delete a bound domain's managed zone at the vendor (requires zone_id). |
dns.domain.get | GET /v1/dns/domain/get | Fetch a bound domain (zone) by zone_id or name, returning its state and name servers. |
dns.domain.list | GET /v1/dns/domain/list | List the bound custom domains (managed zones) for the account at the configured DNS vendor. |
dns.domain.verify | POST /v1/dns/domain/verify | Verify a bound domain's activation/delegation against the same vendor zone it was created on (sticky_resource); read-only lookup of zone state. |
dns.record.create | POST /v1/dns/record/create | Create a DNS record (A/AAAA/CNAME/TXT/MX) in a bound zone with TTL and optional MX priority / Cloudflare proxying. |
dns.record.delete | DELETE /v1/dns/record/delete | Delete a DNS record from a bound zone (requires record_id). |
dns.record.list | GET /v1/dns/record/list | List DNS records in a bound zone. |
dns.record.update | PATCH /v1/dns/record/update | Update an existing DNS record (by record_id; Route53 uses UPSERT). |
完整示例
本模块的生产级端到端范例:先一次性配置,再运行业务流程,尽量覆盖本模块的多数 API。
单文件可运行 Python 程序(仅标准库、无 SDK):拷贝后填入 INFRAI_API_KEY 运行,即可按真实业务流逐步体验本模块核心 API——每一步都真实调用并计费,后续步骤复用前一步返回的真实字段。12 行 helper 就是全部集成代码。
#!/usr/bin/env python3
"""Infrai · dns — runnable real-app example (single file, zero deps).
Copy this file, set your key, run it: every step is a REAL call to
api.infrai.cc, billed at the real (tiny) per-call price, printing the
live JSON response. Get a key at https://console.infrai.cc (Google/
GitHub sign-in grants $2 free credit). No SDK — the 12-line helper
below is the entire integration."""
import json
import os
from urllib import error, request
KEY = os.environ.get("INFRAI_API_KEY") or "ifr_pk_proj_..." # <- your key
BASE = "https://api.infrai.cc"
# Same raw HTTPS POST/GET as every per-method example on this page —
# wrapped once for reuse. There is nothing else to it: no SDK.
def infrai(method, path, body=None):
req = request.Request(
BASE + path, method=method,
data=json.dumps(body).encode() if body is not None else None,
headers={"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json"})
try:
with request.urlopen(req, timeout=60) as r:
return json.loads(r.read())
except error.HTTPError as e:
return json.loads(e.read())
def show(label, resp):
print(f"\n== {label} ==")
print(json.dumps(resp, indent=2, ensure_ascii=False))
return resp
# 1) dns.domain.add — POST /v1/dns/domain/add · Bind a custom domain by creating a managed DNS zone at the vendor (Cloudflare / Route53 / AliDNS); returns zone_id + name servers. Not domain registration.
r1 = show("dns.domain.add", infrai("POST", "/v1/dns/domain/add", {"domain":"..."}))
# 2) dns.domain.verify — POST /v1/dns/domain/verify · Verify a bound domain's activation/delegation against the same vendor zone it was created on (sticky_resource); read-only lookup of zone state.
r2 = show("dns.domain.verify", infrai("POST", "/v1/dns/domain/verify", {"domain":"..."}))
# 3) dns.record.create — POST /v1/dns/record/create · Create a DNS record (A/AAAA/CNAME/TXT/MX) in a bound zone with TTL and optional MX priority / Cloudflare proxying.
r3 = show("dns.record.create", infrai("POST", "/v1/dns/record/create", {"zone_id":"...","record_type":"A","name":"...","content":"..."}))
# 4) dns.domain.get — GET /v1/dns/domain/get · Fetch a bound domain (zone) by zone_id or name, returning its state and name servers.
r4 = show("dns.domain.get", infrai("GET", "/v1/dns/domain/get"))
一次性前置(每个范例都假定已完成):
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
# only your project key. No SDK, no install.
# Get your key: sign in with Google/GitHub at the console for a project key
# + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..." # from the console
# 2) dns.domain.add
curl -X POST https://api.infrai.cc/v1/dns/domain/add \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "..."}'
# 3) dns.domain.get
curl -X GET https://api.infrai.cc/v1/dns/domain/get \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 4) dns.domain.list
curl -X GET https://api.infrai.cc/v1/dns/domain/list \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 5) dns.domain.verify
curl -X POST https://api.infrai.cc/v1/dns/domain/verify \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "..."}'
# 6) dns.domain.delete
curl -X DELETE https://api.infrai.cc/v1/dns/domain/delete \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 7) dns.record.create
curl -X POST https://api.infrai.cc/v1/dns/record/create \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}'
# 8) dns.record.list
curl -X GET https://api.infrai.cc/v1/dns/record/list \
-H "Authorization: Bearer $INFRAI_API_KEY"
# 9) dns.record.update
curl -X PATCH https://api.infrai.cc/v1/dns/record/update \
-H "Authorization: Bearer $INFRAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}'
# 1) Auth: every call is a raw HTTPS request carrying only your project key.
# No SDK to install — just the `requests` library.
import os, requests
BASE = "https://api.infrai.cc"
HEADERS = {
"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}",
"Content-Type": "application/json",
}
# 2) dns.domain.add
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/dns/domain/add",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'domain': '...'},
)
resp.raise_for_status()
print(resp.json())
# 3) dns.domain.get
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/dns/domain/get",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
# 4) dns.domain.list
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/dns/domain/list",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
# 5) dns.domain.verify
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/dns/domain/verify",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'domain': '...'},
)
resp.raise_for_status()
print(resp.json())
# 6) dns.domain.delete
import os, requests
resp = requests.delete(
"https://api.infrai.cc/v1/dns/domain/delete",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
# 7) dns.record.create
import os, requests
resp = requests.post(
"https://api.infrai.cc/v1/dns/record/create",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'zone_id': '...', 'record_type': 'A', 'name': '...', 'content': '...'},
)
resp.raise_for_status()
print(resp.json())
# 8) dns.record.list
import os, requests
resp = requests.get(
"https://api.infrai.cc/v1/dns/record/list",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
)
resp.raise_for_status()
print(resp.json())
# 9) dns.record.update
import os, requests
resp = requests.patch(
"https://api.infrai.cc/v1/dns/record/update",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
json={'zone_id': '...', 'record_type': 'A', 'name': '...', 'content': '...'},
)
resp.raise_for_status()
print(resp.json())
// 1) Auth: every call is a raw HTTPS request carrying only your project key.
// No SDK to install — just the built-in fetch().
const BASE = "https://api.infrai.cc";
const HEADERS = {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
};
// 2) dns.domain.add
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/add",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
console.log(await resp.json());
// 3) dns.domain.get
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/get",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 4) dns.domain.list
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 5) dns.domain.verify
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/verify",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
console.log(await resp.json());
// 6) dns.domain.delete
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/delete",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 7) dns.record.create
const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
console.log(await resp.json());
// 8) dns.record.list
const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
console.log(await resp.json());
// 9) dns.record.update
const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/update",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
console.log(await resp.json());
// 1) Auth: every call is a raw HTTPS request carrying only your project key.
// No SDK to install — just the built-in fetch(), typed.
const BASE = "https://api.infrai.cc";
const HEADERS: Record<string, string> = {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
};
// 2) dns.domain.add
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/add",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 3) dns.domain.get
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/get",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 4) dns.domain.list
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 5) dns.domain.verify
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/verify",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"domain": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 6) dns.domain.delete
const resp = await fetch(
"https://api.infrai.cc/v1/dns/domain/delete",
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 7) dns.record.create
const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/create",
{
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 8) dns.record.list
const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/list",
{
method: "GET",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
},
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);
// 9) dns.record.update
const resp = await fetch(
"https://api.infrai.cc/v1/dns/record/update",
{
method: "PATCH",
headers: {
"Authorization": `Bearer ${process.env.INFRAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"zone_id": "...", "record_type": "A", "name": "...", "content": "..."}),
},
);
if (!resp.ok) throw new Error(`infrai ${resp.status}`);
const data: unknown = await resp.json();
console.log(data);