CDN API

The NOC CDN 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).

OperationDescription
cdn/activateActivates the CDN for a domain name.
cdn/addAdds a website to our CDN. Only to be used for domains without the DNS at NOC.org.
cdn/deactivateDeactivates the CDN for a website.
cdn/deleteDeletes the CDN for a website – only for domains without the DNS at NOC.org.
cdn/listList all active websites with the CDN.
cdn/getGet the CDN & WAF config for a website.
cdn/statsGet the CDN & WAF stats for a specific day.
cdn/logsDownload the WAF logs for a specific day.
cdn/logs/lastGet the last logs available.
cdn/logs/queryGet the last logs since a specified date.
cdn/uploadsslUpload a SSL cert/key to be used before the Let’s encrypt certificate is issued. Prevents any down time during the activation.
cdn_alias_domain/addAdds an alias domain to redirect to this site.
cdn/cache/purgePurge CDN cache for a specific website.
cdn/set/protectedurlsSet the list of protected URLs (space separated).
cdn/set/botprotectedurlsSet the list of bot protected URLs (space separated).
cdn/set/readonlyurlsSet the list of read-only URLs (space separated).
cdn/set/whitelistedurlsSet the list of whitelistedurls URLs (space separated).
cdn/set/whitelistedipsSet the list of whitelistedurls IPs (space separated).
cdn/set/blacklistedipsSet the list of blacklistedips IPs (space separated).
cdn/set/websocketsurlsSet the list of websocket URLs (space separated).
cdn/set/noncacheurlsSet the list of noncacheurls URLs (space separated).
cdn/set/hosting_read_timeoutSet the timeout for reading from the hosting server.
cdn/set/cachingSet the caching level of the CDN.
cdn/set/ipSet the hosting IP address.
cdn/set/cachingtimestaticSet the caching period for static assets.
cdn/set/cachingtimepages   Set the caching period for the website
cdn/set/OPTIONEnables or disables WAF/CDN options.

CDN/Activate

Activates the CDN for a website.

ParameterArgument
Actioncdn/activate
Required Valuedomain=(valid_domain_name), subdomain=(sub domain or @ for apex)
Results {“status” = “success”}
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

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

CDN/Add

Adds a website to the WAF/CDN. Only to be used for domains with the DNS not at NOC.org. It will require that you create a CNAME (or ALIAS) record pointing to our CDN address .

ParameterArgument
Actioncdn/add
Required Valuewebsite=(valid_website), hosting_ip(hosting IP address for the CDN to proxy)
Results {“status” = “success”}
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

https://my.noc.org/api?apikey=[API_KEY]&action=cdn/add&website=<https://DOMAINNAME>&hosting_ip=IPADDRESS

CDN/Deactivate

Disables the CDN for a website.

ParameterArgument
Actioncdn/deactivate
Required Valuewebsite=(valid_website)
Results {“status” = “success”}
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

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

CDN/Delete

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

ParameterArgument
Actioncdn/delete
Required Valuewebsite=(valid_website)
Results {“status” = “success”}
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

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

CDN/list

List all websites with the CDN activated in your account.

ParameterArgument
Actioncdn/list
Required ValueN/A
Results{“status”:”success”,”domains”:[“mytestdomain.com”,”globo.com”]}
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

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

CDN/get

Get the CDN & WAF config for a website.

ParameterArgument
Actioncdn/get
Required Valuewebsite=(valid_website)
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}}
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

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

CDN/stats

Get the CDN & WAF stats for a specific day.

ParameterArgument
Actioncdn/stats
Required Valuewebsite=(valid_website), 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},..
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

https://my.noc.org/api?apikey=[API_KEY]&action=cdn/stats&website=<https://DOMAINNAME>&date=2021-06-22

CDN/logs

Download the CDN & WAF logs for a specific day.

ParameterArgument
Actioncdn/logs
Required Valuewebsite=(valid_website), date=yyyy-mm-dd
Results2021-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 ..
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

https://my.noc.org/api?apikey=[API_KEY]&action=cdn/logs&website=<https://DOMAINNAME>&date=2021-06-22

CDN/logs/last

Get the last CDN & WAF logs for a specific site (in reverse order – last one is displayed first).

ParameterArgument
Actioncdn/logs/last
Required Valuewebsite=(valid_website)
Optional Valuelimit=(number of log entries) – default is 200
Results2021-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 ..
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

https://my.noc.org/api?apikey=[API_KEY]&action=cdn/logs/last&website=<https://DOMAINNAME>&limit=10

CDN/logs/query

Get the last CDN & WAF logs for a specific site since a specified time.

ParameterArgument
Actioncdn/logs/query
Required Value website=(valid_website),since=yyyy-mm-dd HH:MM:SS
Optional Valuelimit=(number of log entries) – default is 200
Results2021-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 ..
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

https://my.noc.org/api?apikey=[API_KEY]&action=cdn/logs/query&website=<https://DOMAINNAME>&limit=10&since=2022-09-09%2013:21:10

CDN/UploadSSL

Uploads a SSL certificate and private key to be used before our certificates are issued. It is used to prevent any downtime during the migration due to the delay of certificate issuance. Note that the SSL certificate should be the full chain.

ParameterArgument
Actioncdn/uploadssl
Required Valuewebsite=(valid_domain), public_key=@FILE, private_key=@FILE
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/uploadssl&website=<https://DOMAINNAME>" -F 'public_key=@./fullchain.pem' -F 'private_key=@./privkey.pem'

CDN/Alias_domain/Add

Adds an additional site to the WAF/CDN as an alias. This site will 301 to the main domain name.

ParameterArgument
Actioncdn/alias_domain/add
Required Valuewebsite=(valid_domain), alias_domain=(alias_domain)
Optional Valuealias_type=301 (recommended) or alias_type=direct
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/uploadssl&website=<https://DOMAINNAME>&alias_domain=domain.net" 

CDN/Cache/Purge

Purges cache for a website.

ParameterArgument
Actioncdn/cache/purge
Required Valuewebsite=(valid_domain)
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/cache/purge&website=<https://DOMAINNAME>" 

CDN/Set/protectedurls

Sets protectedurls.

ParameterArgument
Actioncdn/set/protectedurls
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/protectedurls&website=<https://DOMAINNAME>&value=/temporary" 

CDN/Set/botprotectedurls

Sets bot protected urls.

ParameterArgument
Actioncdn/set/botprotectedurls
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/botprotectedurls&website=<https://DOMAINNAME>&value=/temporary" 

CDN/Set/readonlyurls

Sets ready only urls.

ParameterArgument
Actioncdn/set/readonlyurls
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/readonlyurls&website=<https://DOMAINNAME>&value=/temporary" 

CDN/Set/whitelistedurls

Sets whitelistedurls.

ParameterArgument
Actioncdn/set/whitelistedurls
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/whitelistedurls&website=<https://DOMAINNAME>&value=/temporary" 

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.

ParameterArgument
Actioncdn/set/whitelistedips
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/whitelistedips&website=<https://DOMAINNAME>&value=/temporary" 

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.

ParameterArgument
Actioncdn/set/blacklistedips
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/whitelistedips&website=<https://DOMAINNAME>&value=/temporary" 

CDN/Set/websocketurls

Sets websocketsurls.

ParameterArgument
Actioncdn/set/websocketurls
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/websocketsurls&website=<https://DOMAINNAME>&value=/temporary" 

CDN/Set/noncacheurls

Sets noncacheurls.

ParameterArgument
Actioncdn/set/noncacheurls
Required Valuewebsite=(valid_domain) value=[URLs space separated, eg: /admin or /api]
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/noncacheurls&website=<https://DOMAINNAME>&value=/temporary" 

CDN/Set/hosting_read_timeout

Sets the timeout when reading the responses from the hosting server (default to 45s).

ParameterArgument
Actioncdn/set/hosting_read_timeout
Required Valuewebsite=(valid_domain) value=10s,30s,45s,60s,120s,180s,300s
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/hosting_read_timeout&website=<https://DOMAINNAME>&value=7d" 

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.

ParameterArgument
Actioncdn/set/caching
Required Valuewebsite=(valid_domain) value=aggressive or default
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/caching&website=<https://DOMAINNAME>&value=default" 

CDN/Set/caching_time_static

Sets the CDN caching period for static assets for your site. It includes images, js and css files.

ParameterArgument
Actioncdn/set/caching_time_static
Required Valuewebsite=(valid_domain) value=10m,30m,60m,120m,240m,360m,720m,1d,2d,3d,7d,14d,30d
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/caching_time_static&website=<https://DOMAINNAME>&value=7d" 

CDN/Set/caching_time_pages

Sets the CDN caching period for your site.

ParameterArgument
Actioncdn/set/caching_time_pages
Required Valuewebsite=(valid_domain) value=10m,30m,60m,120m,240m,360m,720m,1d,2d,3d,7d,14d,30d
Optional ValueN/A
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/caching_time_pages&website=<https://DOMAINNAME>&value=7d" 

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.

ParameterArgument
Actioncdn/set/https_redirect
Actioncdn/set/upgrade_insecure
Actioncdn/set/gzip
Action cdn/set/floc_out
Actioncdn/set/optmize_images
Actioncdn/set/secure_cookie_flags
Actioncdn/set/waf
Actioncdn/set/waf_virtual_hardening
Actioncdn/set/waf_admin_lockdown
Required Valuewebsite=(valid_domain) value=[true or false]
Results{“status” = “success”};
In case of error: {“status”:”failed”, “reason”:”reason why”}

Example URL:

curl -D - "https://my.noc.org/api?apikey=[API_KEY]&action=cdn/set/gzip&website=<https://DOMAINNAME>&value=true" 
Updated on February 8, 2024

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Email: support@noc.org