API

The NOC API uses basic CRUD operations. It’s designed to be simple and can be accessed any HTTPS library (e.g., cURL). Access control is managed via an authentication key, denoted as the “API Key”. This key should be present in all requests and should be managed using encryption protocols (e.g., HTTPS).

Operation Description
domain/add Adds a new domain.
domain/remove Deletes a domain name.
domain/list List all domains in your account.
record/add Adds a new DNS record to a domain.
record/list List all DNS records for a domain
cdn/activate Activates the CDN for a domain name.
cdn/add Adds a domain to our CDN. Only to be used for domains not using the NOC Auth DNS.
cdn/deactivate Deactivates the CDN for a domain.
cdn/delete Deletes the CDN for a domain – only for domains without the NOC AuthDNS
cdn/list List all active domains with the CDN.
cdn/get Get the CDN & WAF config for a domain.
cdn/stats Get the CDN & WAF status for a specific day
cdn/logs Get the WAF logs for a specific day.
cdn/cache/purge Purge CDN cache for a specific domain.
cdn/set/noncacheurls Set the list of non-cached urls URLs (Space separated).
cdn/set/caching Set the caching level of the CDN
cdn/set/protectedurls Set the list of protected URLs (space separated).
cdn/set/botprotectedurls Set the list of bot protected URLs (space separated).
cdn/set/whitelistedurls Set the list of whitelisted URLs (space separated).
cdn/set/whitelistedips Set the list of whitelisted Ips (space separated).
cdn/set/option Enables or disables WAF/CDN options.

AuthDNS API Parameters

DOMAIN/add

Adds a new domain to your NOC DNS Account.

Parameter Argument
Action domain/add
Required Value domain_name=(valid_domain_name)
Results {"status" = "success"};
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=domain/add&domain_name=<DOMAINNAME>

DOMAIN/remove

Deletes a domain from your account. You need to remove all DNS records before this action is authorized.

Parameter Argument
Action domain/remove
Required Value domain_name=(valid_domain_name)
Results {"status" = "success"};
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=domain/remove&domain_name=<DOMAINNAME>

DOMAIN/list

Deletes a domain from your account. You need to remove all DNS records before this action is authorized.

Parameter Argument
Action domain/list
Required Value N/A
Results {"status":"success","domains":["mytestdomain.com","globo.com"]}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=domains/list

RECORD/add

Adds a new DNS record.

Parameter Argument
Action record/add
Required Value domain_name=(valid_domain), sub_domain=(valid_subdomain), record_type=(DNS Type: A,AAAA. MX, etc), address=(valid IP address)
Optional Value  ttl=(DNS TTL), default to 3600 seconds when not provided.
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=record/add&domain_name=domain.com&sub_domain=www&ttl=120&record_type=A&address=192.168.1.1

RECORD/delete

Deletes a DNS record.

Parameter Argument
Action record/delete
Required Value recordid=(Domain record), domain_name=(valid_domain), sub_domain=(valid_subdomain)
Results {"status" = "success"};
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=record/delete&domain_name=domain.com&recordid=X&sub_domain=SUBDOMAIN

RECORD/list

Deletes a DNS record.

Parameter Argument
Action record/list
Required Value domain_name=(valid_domain_name) or "all"
Results {"status" = "success"};
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=records/list&domain_name=domain.com

CDN API Parameters

CDN/Activate

This activates the CDN on your website.

Parameter Argument
Action cdn/activate
Required Value domain=(valid_domain_name), subdomain=(sub domain or @ for apex)
Results {"status" = "success"};
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/activate&domain=<DOMAINNAME>&subdomain=@

CDN/Delete

Deletes the CDN for a website - if the DNS is not pointed at NOC.org.

Parameter Argument
Action cdn/delete
Required Value website=(valid_domain_name)
Results {"status" = "success"};
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/delete&website=<https://DOMAINNAME>

CDN/list

List all websites with the CDN activated in your account.

Parameter Argument
Action cdn/list
Required Value N/A
Results {"status":"success","domains":["mytestdomain.com","globo.com"]}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/list

CDN/get

Get the CDN & WAF config for a website.

Parameter Argument
Action cdn/get
Required Value website=(valid_domain_name)
Results {"status":"success","config":{"ip":["2.3.4.5"],"proxyto":"80","https_redirect":true,"upgrade_insecure":true,"caching_time_static":"30d",

"caching_time_pages":"720m","gzip":true,"http2":true,"optmize_images":false,"secure_cookie_flags":false,"floc_out":false,"waf":true,

"waf_virtual_hardening":true,"waf_admin_lockdown":false,"whitelistedips":"","blacklistedips":"","noncacheurls":"","protectedurls":"",

"whitelistedurls":"","whitelisting_url":"https:\/\/domain_name\/noc-cdn\/authenticate\/[whitelistkey]"}}

Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/get&website=DOMAIN

CDN/stats

Get the CDN & WAF stats for a specific day.

Parameter Argument
Action cdn/stats
Required Value website=(valid_domain_name), date=yyyy-mm-dd
Results {"requests":{"2021-06-22 00:00":{"received":128,"blocked":12,"bytes":873477,"bytes_cached":655017},"2021-06-22 01:00":{"received":61,"blocked":1,"bytes":386041,"bytes_cached":300497},"2021-06-22 02:00":{"received":59,"blocked":5,"bytes":341446,"bytes_cached":227979}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/stats&website=DOMAIN&date=2021-06-22

CDN/logs

Get the CDN & WAF logs for a specific day.

Parameter Argument
Action cdn/logs
Required Value website=(valid_domain_name), date=yyyy-mm-dd
Results 2021-06-22 19:41:17 noc.org cdn-edge-usa-east-ny1 159.89.190.105 403 183 HIT waf:exploit_blocked3 GET /sitio/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin HTTP/1.1 - Mozilla/5.0 ..
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/logs&website=DOMAIN&date=2021-06-22

CDN/cahce/purge

Purges cache for a website.

Parameter Argument
Action cdn/cache/purge
Required Value website=(valid_domain)
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/cache/purge&website=<https://domain>

CDN/Set/protectedurls

Sets protected URLs.

Parameter Argument
Action cdn/set/protectedurls
Required Value website=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/protectedurls&website=<https://domain>&value=/wp-admin

CDN/Set/botprotectedurls

Sets bot protected URLs.

Parameter Argument
Action cdn/set/botprotectedurls
Required Value website=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/botprotectedurls&website=<https://domain>&value=/wp-admin

CDN/Set/whitelistedurls

Sets whitelisted URLs.

Parameter Argument
Action cdn/set/whitelistedurls
Required Value website=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/whitelistedurls&website=<https://domain>&value=/wp-admin

CDN/Set/whitelistedips

Sets a list of IP addresses always allowed (space separated). Partial regexes are allowed. You can specify ^1.1., for example to allow 1.1.0.0/16. If you need only one IP, you can do: ^1.2.3.4.

Parameter Argument
Action cdn/set/whitelistedips
Required Value website=(valid_domain) value=[URLs space separated, eg: ^2.3.4. 5.6.7.8]
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/whitelistedips&website=<https://domain>&value=1.2.3.4

CDN/Set/blacklistedips

Sets a list of IP addresses always blocked (space separated). Partial regexes are allowed. You can specify ^1.1., for example to block 1.1.0.0/16. If you need only one IP, you can do: ^1.2.3.4.

Parameter Argument
Action cdn/set/blacklistedips
Required Value website=(valid_domain) value=[URLs space separated, eg: ^2.3.4. 5.6.7.8]
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/blacklistedips&website=<https://domain>&value=1.2.3.4

CDN/Set/noncacheurls

Sets noncacheurls.

Parameter Argument
Action cdn/set/noncacheurls
Required Value website=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/noncacheurls&website=<https://domain>&value=/temporary

CDN/Set/caching

Sets the CDN caching level. We support two modes: default and aggressive. The default caches your static files and pages, respecting your site headers. The aggressive mode (full) tries to cache as much as possible, including some dynamic pages.

Parameter Argument
Action cdn/set/caching
Required Value website=(valid_domain) value=aggressive or default
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/caching&website=<https://domain>&value=default

CDN/Set/OPTION

Enables or disables some WAF/CDN options. Setting to "true" will enable it and to "false" to disable. Available actions: https_redirect (to force HTTP to HTTPS), upgrade_insecure (to upgrade HTTP resources to HTTPS), gzip, floc_out (to block Google's FLOC proposal), optmize_images, secure_cookie_flags, waf, waf_virtual_hardening, waf_admin_lockdown.

 

Parameter Argument
Action cdn/set/https_redirect

cdn/set/upgrade_insecure

cdn/set/gzip

cdn/set/floc_out

cdn/set/optmize_images

cdn/set/secure_cookie_flags

cdn/set/waf

cdn/set/waf_virtual_hardening

cdn/set/waf_admin_lockdown

Required Value website=(valid_domain) value=[true or false]
Results {"status" = "success"}
Error {"status":"failed", "reason":"reason why"}

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/gzip&website=<https://domain>&value=true

Example URL:

https://my.noc.org/api?apikey=[key]&action=cdn/set/floc_out&website=<https://domain>&value=true

Was this article helpful?

Related Articles