About the Domains API

API Version: 1.9

The Domains API allows you to build, manage, and monitor your domains.

This is the API for Domains.

Endpoints

https://networkcalc.com/api/domains/

Add a domain to your account.

Example request and response
curl -X POST https://networkcalc.com/api/domains \
  --header "Authorization: Bearer 2jdS83kfDdDfllHk" \
  --header "Content-Type: application/json" \
  --data '{
  "domain": "networkcalc.com"
}'

{
  "status": "OK",
  "domain": {
    "id": 123,
    "domain": "networkcalc.com",
    "created_at": "2021-12-26T15:23:08.639Z",
    "updated_at": "2021-12-26T15:23:08.639Z"
  }
}
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Request Headers

Content-Type
(Required) application/json

Request Body

{
  "domain": "[string] The domain name, for example: networkcalc.com."
}

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
NOT_AUTHORIZED - You do not have permission to perform this action.
400
NOT_SAVED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_UPDATED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_DELETED - There was an error deleting the resource. Check the request and try again.
https://networkcalc.com/api/domains/{domain_id}/subdomains/{subdomain_prefix}

Add a subdomain to an existing domain.

Example request and response
curl -X POST https://networkcalc.com/api/domains/123/subdomains/test \
  --header "Authorization: Bearer 2jdS83kfDdDfllHk"

{
  "status": "OK",
  "subdomain": {
    "domain_report": false,
    "id": 456,
    "prefix": "test",
    "domain_id": "123"
  }
}
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{domain_id}

(Optional) The unique ID of the domain.

Example: https://networkcalc.com/api/domains/123/subdomains

{subdomain_prefix}

(Required) The prefix for the domain. For example, if the domain is networkcalc.com, the subdomain prefix for my.demo.networkcalc.com would be my.demo.

Example: https://networkcalc.com/api/domains/123/subdomains/my.demo

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
NOT_AUTHORIZED - You do not have permission to perform this action.
400
NOT_SAVED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_UPDATED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_DELETED - There was an error deleting the resource. Check the request and try again.
https://networkcalc.com/api/domains/{domain_id}

List one more more of the domains saved to your account.

Example request and response
curl https://networkcalc.com/api/domains \
  --header "Authorization: Bearer 2jdS83kfDdDfllHk"

{
  "status": "OK",
  "domains": [
    {
      "id": 123,
      "domain": "networkcalc.com",
      "created_at": "2021-12-26T15:23:08.639Z",
      "updated_at": "2021-12-26T15:23:08.639Z"
    }
  ]
}
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{domain_id}

(Optional) The unique ID of the domain.

Example: https://networkcalc.com/api/domains/123/subdomains

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
NOT_AUTHORIZED - You do not have permission to perform this action.
400
NOT_SAVED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_UPDATED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_DELETED - There was an error deleting the resource. Check the request and try again.
https://networkcalc.com/api/domains/{domain_id}/subdomains/{subdomain_id}

List one more more of the subdomains for a domain.

Example request and response
curl https://networkcalc.com/api/domains/123/subdomains \
  --header "Authorization: Bearer 2jdS83kfDdDfllHk"

{
  "status": "OK",
  "subdomains": [
    {
      "id": 456,
      "prefix": "demo",
      "domain_id": 123,
      "domain_report": false,
      "alerts": []
    }
  ]
}
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{domain_id}

(Optional) The unique ID of the domain.

Example: https://networkcalc.com/api/domains/123/subdomains

{subdomain_id}

(Optional) The unique ID of the subddomain.

Example: https://networkcalc.com/api/domains/subdomains/456

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
NOT_AUTHORIZED - You do not have permission to perform this action.
400
NOT_SAVED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_UPDATED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_DELETED - There was an error deleting the resource. Check the request and try again.
https://networkcalc.com/api/domains/{domain_id}/subdomains/{subdomain_id}

Update a subdomain in your account.

Example request and response
curl -X PATCH https://networkcalc.com/api/domains \
  --header "Authorization: Bearer 2jdS83kfDdDfllHk" \
  --header "Content-Type: application/json" \
  --data '{
  "domain_report": true
}'

{
  "status": "OK",
  "message": "1 subdomain(s) updated."
}
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{domain_id}

(Optional) The unique ID of the domain.

Example: https://networkcalc.com/api/domains/123/subdomains

{subdomain_id}

(Optional) The unique ID of the subddomain.

Example: https://networkcalc.com/api/domains/subdomains/456

Request Headers

Content-Type
(Required) application/json

Request Body

{
  "prefix": "[string] The prefix for the domain. For example, `my.demo` for `my.demo.networkcalc.com`.",
  "domain_id": "[number] The unique ID of the domain.",
  "domain_report": "[boolean] `true` if this subdomain should be included in any scheduled reports for the domain. Default is `false`."
}

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
NOT_AUTHORIZED - You do not have permission to perform this action.
400
NOT_SAVED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_UPDATED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_DELETED - There was an error deleting the resource. Check the request and try again.
https://networkcalc.com/api/domains/{domain_id}

Deletes a domain from your account.

Example request and response
curl -X DELETE https://networkcalc.com/api/domains/123 \
  --header "Authorization: Bearer 2jdS83kfDdDfllHk"

{
  "status": "OK"
}
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{domain_id}

(Optional) The unique ID of the domain.

Example: https://networkcalc.com/api/domains/123/subdomains

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
NOT_AUTHORIZED - You do not have permission to perform this action.
400
NOT_SAVED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_UPDATED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_DELETED - There was an error deleting the resource. Check the request and try again.
https://networkcalc.com/api/domains/{domain_id}/subdomains/{subdomain_id}

Deletes a subdomain from your account.

Example request and response
curl -X DELETE https://networkcalc.com/api/domains/123/subdomains/456 \
  --header "Authorization: Bearer 2jdS83kfDdDfllHk"

{
  "status": "OK"
}
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{domain_id}

(Optional) The unique ID of the domain.

Example: https://networkcalc.com/api/domains/123/subdomains

{subdomain_id}

(Optional) The unique ID of the subddomain.

Example: https://networkcalc.com/api/domains/subdomains/456

Response Codes

200
OK - Success.
401
MISSING_CREDENTIALS - The request body is missing client_id, client_secret, or both.
401
CREDENTIALS_NOT_FOUND - The credentials supplied are not valid.
401
NOT_AUTHORIZED - You do not have permission to perform this action.
400
NOT_SAVED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_UPDATED - There was an error saving the resource. Either the resource did not pass validation or there was a server error preventing it from being saved. Check the request and try again.
400
NOT_DELETED - There was an error deleting the resource. Check the request and try again.

Response Formats

{
  "status": "[string] The status of the request.",
  "domain": "[Domain] See DomainResponse."
}
{
  "status": "[string] The status of the request.",
  "domains": "[array] An array of all domains saved to your account. See DomainResponse."
}
{
  "status": "[string] The status of the request.",
  "message": "[string] A message describing the update, if it was successful."
}
{
  "status": "[string] The status of the request."
}
{
  "status": "[string] The status of the request.",
  "domain": {
    "id": "[number] The unique identifier for the domain.",
    "domain": "[string] The domain name.",
    "report_schedule": "[string] The schedule for domain reports or null. Must be one of: [null, 'daily', 'weekly', 'monthly'].",
    "users": "[array] An array of all users with access to the domain."
  }
}
{
  "status": "[string] The status of the request.",
  "subdomain": "[Subdomain] See SubdomainResponse."
}
{
  "status": "[string] The status of the request.",
  "subdomains": "[array] An array of all subdomains saved to your account. See SubdomainResponse."
}
{
  "status": "[string] The status of the request.",
  "message": "[string] A message describing the update, if it was successful."
}
{
  "status": "[string] The status of the request."
}
{
  "status": "[string] The status of the request.",
  "domain": {
    "id": "[number] The unique identifier for the subdomain.",
    "prefix": "[string] The subdomain's prefix. For example, my.demo for my.demo.networkcalc.com.",
    "domain_id": "[string] The unique ID of the domain this subdomain is associated with.",
    "domain_report": "[boolean] true if this subdomain is included in scheduled reports for the domain, false otherwise.",
    "alerts": "[array] An array of all alerts associated with the subdomain."
  }
}