About the Subnets API

API Version: 1.9

The Subnets API allows you to save subnets and manage your saved subnets.

This is the API for Subnets.

See also: Subnet Calculator API

Endpoints

GET
https://networkcalc.com/api/account/subnets/{subnet_id}

List subnets

. List one or more of the subnets saved to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Parameters

{subnet_id}

(Optional) The unique ID of the subnet.

Example: https://networkcalc.com/api/account/subnets/12345

Response Codes

200
OK - Success.
401
INVALID_REQUEST - The authorization header is missing.
401
INVALID_GRANT - The given access token is expired or invalid.
400
MISSING_HEADER - A required header is missing.
400
MISSING_VALUES - One of the required parameters is missing from the body.
400
NOT_UPDATED - The subnet could not be saved. Verify the request and try again.
400
NOT_DELETED - The subnet could not be deleted. Verify the request and try again.
400
NOT_FOUND - A subnet with the given ID could not be found.
400
NETWORK_ADDRESS_INVALID - The supplied network address is incorrectly formatted or otherwise invalid.
400
SYSTEM_ERROR - A system error occurred. Try the request again.
POST
https://networkcalc.com/api/account/subnets/

Save a subnet

. Save a subnet to your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Request Headers

Content-Type
(Required) application/json

Request Body

{
  "network_address": "[string] The network address in dotted decimal notation. Also accepts any IP address in the subnet.",
  "subnet_bits": "[number] The number of bits representing the subnet mask.",
  "name": "[string] A display name for the subnet."
}

Response Codes

200
OK - Success.
401
INVALID_REQUEST - The authorization header is missing.
401
INVALID_GRANT - The given access token is expired or invalid.
400
MISSING_HEADER - A required header is missing.
400
MISSING_VALUES - One of the required parameters is missing from the body.
400
NOT_UPDATED - The subnet could not be saved. Verify the request and try again.
400
NOT_DELETED - The subnet could not be deleted. Verify the request and try again.
400
NOT_FOUND - A subnet with the given ID could not be found.
400
NETWORK_ADDRESS_INVALID - The supplied network address is incorrectly formatted or otherwise invalid.
400
SYSTEM_ERROR - A system error occurred. Try the request again.
PATCH
https://networkcalc.com/api/account/subnets/

Edit a subnet

. Edit a subnet in your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Request Headers

Content-Type
(Required) application/json

Request Body

{
  "network_address": "[string] The network address in dotted decimal notation. Also accepts any IP address in the subnet.",
  "subnet_bits": "[number] The number of bits representing the subnet mask.",
  "name": "[string] A display name for the subnet."
}

Response Codes

200
OK - Success.
401
INVALID_REQUEST - The authorization header is missing.
401
INVALID_GRANT - The given access token is expired or invalid.
400
MISSING_HEADER - A required header is missing.
400
MISSING_VALUES - One of the required parameters is missing from the body.
400
NOT_UPDATED - The subnet could not be saved. Verify the request and try again.
400
NOT_DELETED - The subnet could not be deleted. Verify the request and try again.
400
NOT_FOUND - A subnet with the given ID could not be found.
400
NETWORK_ADDRESS_INVALID - The supplied network address is incorrectly formatted or otherwise invalid.
400
SYSTEM_ERROR - A system error occurred. Try the request again.
DELETE
https://networkcalc.com/api/account/subnets/

Delete a subnet

. Delete a subnet in your account.
This endpoint requires authorization. Read about API authorization or see NetworkCalc Pro pricing.

Request Headers

Content-Type
(Required) application/json

Response Codes

200
OK - Success.
401
INVALID_REQUEST - The authorization header is missing.
401
INVALID_GRANT - The given access token is expired or invalid.
400
MISSING_HEADER - A required header is missing.
400
MISSING_VALUES - One of the required parameters is missing from the body.
400
NOT_UPDATED - The subnet could not be saved. Verify the request and try again.
400
NOT_DELETED - The subnet could not be deleted. Verify the request and try again.
400
NOT_FOUND - A subnet with the given ID could not be found.
400
NETWORK_ADDRESS_INVALID - The supplied network address is incorrectly formatted or otherwise invalid.
400
SYSTEM_ERROR - A system error occurred. Try the request again.

Response Formats

SubnetListResponse

{
  "status": "[string] The status of the request.",
  "subnets": "[array] An array of all subnets matching the request. See SubnetResponse."
}

SubnetResponse

{
  "octet_1": "[number] The first octet in the subnet address (decimal representation).",
  "octet_2": "[number] The second octet in the subnet address (decimal representation).",
  "octet_3": "[number] The third octet in the subnet address (decimal representation).",
  "octet_4": "[number] The fourth octet in the subnet address (decimal representation).",
  "subnet_bits": "[number] The number of bits representing the subnet mask.",
  "cidr_notation": "[string] The requested address in CIDR notation, per RFC 4632.",
  "subnet_mask": {
    "octet_1": "[string] The first octet in the subnet mask (decimal representation).",
    "octet_2": "[string] The second octet in the subnet mask (decimal representation).",
    "octet_3": "[string] The third octet in the subnet mask (decimal representation).",
    "octet_4": "[string] The fourth octet in the subnet mask (decimal representation)."
  },
  "assignable_hosts": "[number] The number of assignable hosts in the subnet.",
  "id": "[number] The subnet's unique identifier.",
  "is_active": "[number] 1 if the subnet is active, 0 otherwise.",
  "network_address": "[string] The network ID for the subnet (first address in the subnet; unassignable).",
  "name": "[string] The display name given to the subnet."
}

SubnetUpdateResponse

{
  "status": "[string] The status of the request.",
  "message": "[string] A detailed description of the request status.",
  "errors": "[array] A list of error messages. Only included if errors occurred."
}

SubnetDeleteResponse

{
  "status": "[string] The status of the request."
}