Validate IP Documentation

Shared Validate Throttle: 500/Hour

Object: IP

IP can be any of the following Types:

IPv4: "127.0.0.1"
IPv4Historic: "1.0x2.01404"
IPv6: "::A:b:C:d:E:f"
IPv6v4: "d0d:d0d:d0d:d0d:d0d:d0d:13.13.13.13"

print
Object: Print

Example

"print": {
	"parsed": "a:b:c:d:e:0:0.0.1.2",
	"ipv4": "0.0.1.2",
	"ipv4historic": "0.0.1.2",
	"ipv6short": "a:b:c:d:e::102",
	"ipv6v4short": "a:b:c:d:e:0:0.0.1.2",
	"ipv6long": "000a:000b:000c:000d:000e:0000:0000:0102",
	"ipv6v4long": "000a:000b:000c:000d:000e:0000:0.0.1.2"
}
blocks
[]Object: Block

Example

"blocks": [
	{
		"size": 16,
		"base": 16,
		"number": 10,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 11,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 12,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 13,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 14,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"number": 1,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"number": 2,
		"correct": true
	}
]
bytes
[]Number
Bytes are Numbers! Bytes are NOT Base64 Encoded!

Example

"bytes": [
	0,
	10,
	0,
	11,
	0,
	12,
	0,
	13,
	0,
	14,
	0,
	0,
	0,
	0,
	1,
	2
]
version
Number

Constants

Key Value
4 IPv4
6 IPv6


Example

"version": 6
doublecolon-v6
Number
IPv6 DoubleColon Starting Point
Only Exists for IPv6, Default is 0 for non IPv6
IPv6 Double Colon Exists: Starts at 0
IPv6 Double Colon Does NOT Exist: -1

Example

"doublecolon-v6": 5
doublecolon-v6v4
Number
IPv6v4 DoubleColon Starting Point
Only Exists for IPv6, Default is 0 for non IPv6
IPv6v4 Double Colon Exists: Starts at 0
IPv6v4 Double Colon Does NOT Exist: -1

Example

"doublecolon-v6v4": -1
private
Boolean
Does this IP Address belong to a Private Network?

Example

"private": false
loopback
Boolean
Does this IP Address belong to a Loopback Network?

Example

"loopback": false
linklocal
Boolean
Does this IP Address belong to a Link-local Network?

Example

"linklocal": false
reserved
Boolean
Does this IP Address belong to a Reserved Network?

Example

"reserved": false
correct
Boolean
Was Input Correct to the Spec?

Example

"correct": true

Object Examples: IP

IPv4 Input: "127.009.09.9"
{
	"print": {
		"parsed": "127.009.09.9",
		"ipv4": "127.9.9.9",
		"ipv4historic": "127.9.9.9",
		"ipv6short": "::ffff:7f09:909",
		"ipv6v4short": "::ffff:127.9.9.9",
		"ipv6long": "0000:0000:0000:0000:0000:ffff:7f09:0909",
		"ipv6v4long": "0000:0000:0000:0000:0000:ffff:127.9.9.9"
	},
	"blocks": [
		{
			"size": 8,
			"base": 10,
			"number": 127,
			"correct": true
		},
		{
			"size": 8,
			"base": 10,
			"number": 9,
			"pads": 2
		},
		{
			"size": 8,
			"base": 10,
			"number": 9,
			"pads": 1
		},
		{
			"size": 8,
			"base": 10,
			"number": 9,
			"correct": true
		}
	],
	"bytes": [
		127,
		9,
		9,
		9
	],
	"version": 4,
	"loopback": true,
	"reserved": true
}
IPv6v4 Input: "13:d0d::1337:0.0.208.13"
{
	"print": {
		"parsed": "13:d0d::1337:0.0.208.13",
		"ipv4": "0.0.208.13",
		"ipv4historic": "0.0.208.13",
		"ipv6short": "13:d0d::1337:0:d00d",
		"ipv6v4short": "13:d0d::1337:0.0.208.13",
		"ipv6long": "0013:0d0d:0000:0000:0000:1337:0000:d00d",
		"ipv6v4long": "0013:0d0d:0000:0000:0000:1337:0.0.208.13"
	},
	"blocks": [
		{
			"size": 16,
			"base": 16,
			"number": 19,
			"correct": true
		},
		{
			"size": 16,
			"base": 16,
			"number": 3341,
			"correct": true
		},
		{
			"base": 16,
			"correct": true,
			"position": 1
		},
		{
			"base": 16,
			"correct": true,
			"position": 1
		},
		{
			"base": 16,
			"correct": true,
			"position": 1
		},
		{
			"size": 16,
			"base": 16,
			"number": 4919,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"number": 208,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"number": 13,
			"correct": true,
			"position": 2
		}
	],
	"bytes": [
		0,
		19,
		13,
		13,
		0,
		0,
		0,
		0,
		0,
		0,
		19,
		55,
		0,
		0,
		208,
		13
	],
	"version": 6,
	"doublecolon-v6": 2,
	"doublecolon-v6v4": 2,
	"correct": true
}

Object: IP Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
print
Object: Print_Options
blocks
Object: Block_Options
bytes
Boolean
version
Boolean
doublecolon-v6
Boolean
doublecolon-v6v4
Boolean
private
Boolean
loopback
Boolean
linklocal
Boolean
reserved
Boolean
correct
Boolean

Object Examples: IP Options

Default Options:
{
	"print": {
		"parsed": true,
		"ipv4": true,
		"ipv4historic": true,
		"ipv6short": true,
		"ipv6v4short": true,
		"ipv6long": true,
		"ipv6v4long": true
	},
	"blocks": {
		"print": null,
		"size": true,
		"base": true,
		"number": true,
		"pads": true,
		"correct": true,
		"position": true
	},
	"bytes": true,
	"version": true,
	"doublecolon-v6": true,
	"doublecolon-v6v4": true,
	"correct": true,
	"private": true,
	"loopback": true,
	"linklocal": true,
	"reserved": true
}

Object: Block

Blocks can be any of the following Types:
IPv4
Size: uint8
Base: Decimal
IPv4Historic
Size: uint8, uint16, uint24, or uint32
Base: Octal, Decimal, or Hexadecimal
IPv6
Size: uint16
Base: Hexadecimal
IPv6v4
Size: uint8
Base: Decimal
print
Object: Print

Example

"print": {
	"parsed": "0d0d",
	"ipv4": "13.13",
	"ipv4historic": "13.13",
	"ipv6short": "d0d",
	"ipv6v4short": "13.13",
	"ipv6long": "0d0d",
	"ipv6v4long": "13.13"
}
size
Number

Constants

Key Value
8 uint8
16 uint16
24 uint24
32 uint32


Example

"size": 16
base
Number

Constants

Key Value
8 OCTAL
10 DECIMAL
16 HEXADECIMAL


Example

"base": 16
number
Number
Decimal Value of Block

Example

"number": 3341
pads
Number
Number of Zeroes Padded
IPv4/IPv4H Padding is not a part of the standard. IPv6 Padding is allowed but is not considered Valid.

Example

"pads": 1
correct
Boolean
Was Input Correct to the Spec?

Example

"correct": true
position
Number
IPv6/IPv6v4 Block Position


Constants

Key Value
0 Before Double Colon
This is the default for IPv4/IPv4Historic
1 Padding Inside of a Double Colon
2 After Double Colon
If the last block is Before Double Colon, Double Colon doesn't exist!


Example

"position": 0

Object Examples: Block

IPv4 Input: "127.0.0.1"
{
	"size": 8,
	"base": 10,
	"number": 127,
	"correct": true
}
IPv4Historic Hexadecimal Input: "0x12345678"
{
	"size": 32,
	"base": 16,
	"number": 305419896,
	"correct": true
}
IPv4Historic Octal Input: "255.07654321"'
{
	"size": 24,
	"base": 8,
	"number": 2054353,
	"correct": true
}
IPv6 Input: "::ABC"'
{
	"size": 16,
	"base": 16,
	"number": 2748,
	"correct": true
}

Object: Block Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
print
Object: Print_Options
size
Boolean
base
Boolean
number
Boolean
pads
Boolean
correct
Boolean
position
Boolean

Object: Print

IP and Block both use this Object for Printing

parsed
String
Print as Parsed

If Block was Padded, Value will contain Pads!
If Block contained an invalid Double Colon its invalid position will be included.

Example

"parsed": "0x12345678" // no padding
"parsed": "0x012345678" // padded
"parsed": "00cc" // padded
"parsed": "1:00ff:0:000:0000:1337::255.013.64.001" // padded
ipv4
String
Print as IPv4

If IP is an IPv6, all but the last 32 bits are trimmed.

Example

"ipv4": "18.52.86.120"
"ipv4": "255.13.64.1" // ipv6
ipv4historic
String
Print as IPv4Historic

Only IPv4Historic of types Octal/Hexadecimal will be printed in their Original Type. All others will be printed in Decimal.
If IP is an IPv6, all but the last 32 bits are trimmed.

Example

"ipv4historic": "127.0.0.1" // ipv4 decimal
"ipv4historic": "0x12345678" // ipv4h hex
"ipv4historic": "037777777777" // ipv4h octal
"ipv4historic": "255.13.64.1" // ipv6
ipv6short
String
Print as IPv6Short

Example

"ipv6short": "1234:5678" // ipv4
"ipv6short": "1:ff::1337:ff0d:4001"
ipv6v4short
String
Print as IPv6v4Short

Example

"ipv6v4short": "18.52.86.120" // ipv4
"ipv6v4short": "1:ff::1337:255.13.64.1"
ipv6long
String
Print as IPv6Long

Example

"ipv6long": "1234:5678" // ipv4
"ipv6long": "0001:00ff:0000:0000:0000:1337:ff0d:4001"
ipv6v4long
String
Print as IPv6v4Long

Example

"ipv6v4long": "18.52.86.120" // ipv4
"ipv6v4long": "0001:00ff:0000:0000:0000:1337:255.13.64.1"

Object Examples: Print

IPv4 Input: "127.0.0.1"
{
	"parsed": "127.0.0.1",
	"ipv4": "127.0.0.1",
	"ipv4historic": "127.0.0.1",
	"ipv6short": "::ffff:7f00:1",
	"ipv6v4short": "::ffff:127.0.0.1",
	"ipv6long": "0000:0000:0000:0000:0000:ffff:7f00:0001",
	"ipv6v4long": "0000:0000:0000:0000:0000:ffff:127.0.0.1"
}
IPv4Historic Input: "0xFFFFFFFF"
{
	"parsed": "0xffffffff",
	"ipv4": "255.255.255.255",
	"ipv4historic": "0xffffffff",
	"ipv6short": "::ffff:ffff:ffff",
	"ipv6v4short": "::ffff:255.255.255.255",
	"ipv6long": "0000:0000:0000:0000:0000:ffff:ffff:ffff",
	"ipv6v4long": "0000:0000:0000:0000:0000:ffff:255.255.255.255"
}
IPv6v4 Input: "1:00ff:0:000:0000:1337::255.013.64.001"
{
	"parsed": "1:00ff:0:000:0000:1337::255.013.64.001",
	"ipv4": "255.13.64.1",
	"ipv4historic": "255.13.64.1",
	"ipv6short": "1:ff::1337:ff0d:4001",
	"ipv6v4short": "1:ff::1337:255.13.64.1",
	"ipv6long": "0001:00ff:0000:0000:0000:1337:ff0d:4001",
	"ipv6v4long": "0001:00ff:0000:0000:0000:1337:255.13.64.1"
}

Object: Print_Options

IP and Block both use this Object for Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
parsed
Boolean
ipv4
Boolean
ipv4historic
Boolean
ipv6short
Boolean
ipv6v4short
Boolean
ipv6long
Boolean
ipv6v4long
Boolean

POST /api;v1.0/validate/ip

JSON POST endpoint. Supports Validator Options!

Request

Parameters

raw
String
Raw Input to Validate

Example

"raw": "http://juandefu.ca/"
validator
Number
Optional
Method of Validation to use.
STRICT Validation will not allow Incorrect Spec Validation to occur! It's recommended to use LOOSE_ANY!
The Default/Invalid Validator is LOOSE_ANY

Constants

Key Value
STRICT 1
STRICT_ANY 2
STRICT_IPV4 3
STRICT_IPV4HISTORIC 4
STRICT_IPV6 5
LOOSE 6
LOOSE_ANY 7
LOOSE_IPV4 8
LOOSE_IPV4HISTORIC 9
LOOSE_IPV6 10


Example

"validator": 0
options
Object: IP_Options
Optional
Validator Options
Default Options will be used when nil

shorten
Boolean
Optional
Shorten Validated Object
Shortened Object may include other URI Compments needed to create a Valid URI Object
Validated must be Valid and Shorten must not be Throttled!

Example

"shorten": true
shorten-private
Boolean
Optional
If this is set you will only be able to access the Shortened Link with a Private Key!
Private is a very large Random Integer up to 2^64 (18,446,744,073,709,551,615) and should be very hard to brute force!
DO NOT RELY SOLEY ON THIS FOR SECURITY!

Example

"private": true

Response

errors
[]String
This is only returned on Internal Errors! Always check the Response Header Content-Type before parsing!

Example

"errors": [
	"internal server error"
]
shortened
Object: Shortened
If Validated is Throttled or an error occurs Shortened will be ignored!

validated
Object: IP
Always returned!

If Throttled, returns an Object containing the Attribute "throttle" with a value of the Throttle Expiration Timestamp RFC 3339


GET /api;v1.0/validate/ip

GET endpoint that only uses Query String Parameters. Supports JSONP!
Content must be properly encoded to fit within the Query String Field Variable "raw"!

Request

Parameters

raw
String
Raw Input to Validate

Example

"raw": "http://juandefu.ca/"
validator
Number
Optional
Method of Validation to use.
STRICT Validation will not allow Incorrect Spec Validation to occur! It's recommended to use LOOSE_ANY!
The Default/Invalid Validator is LOOSE_ANY

Constants

Key Value
STRICT 1
STRICT_ANY 2
STRICT_IPV4 3
STRICT_IPV4HISTORIC 4
STRICT_IPV6 5
LOOSE 6
LOOSE_ANY 7
LOOSE_IPV4 8
LOOSE_IPV4HISTORIC 9
LOOSE_IPV6 10


Example

validator=2
shorten
Exists
Optional
Shorten Validated Object
Shortened Object may include other URI Compments needed to create a Valid URI Object
Validated must be Valid and Shorten must not be Throttled!

shorten-private
Exists
Optional
If this is set you will only be able to access the Shortened Link with a Private Key!
Private is a very large Random Integer up to 2^64 (18,446,744,073,709,551,615) and should be very hard to brute force!
DO NOT RELY SOLEY ON THIS FOR SECURITY!

jsonp
String
Optional
JSONP will be used to pad the JSON payload with a Function.
Must be a-zA-Z and 15 characters or less.
If JSONP is set and is empty or invalid "ZeroOut" will be used!

Example

jsonp=Whoa
Whoa({});
pd
Exists
Optional
Should Input be Percent Decoded before being passed to the Validator?
Most Validators will do their own Percent Decoding of Input.
This should only be used if necessary or if the Validator does not support Percent Decoding.

Response

errors
[]String
This is only returned on Internal Errors! Always check the Response Header Content-Type before parsing!

Example

"errors": [
	"internal server error"
]
shortened
Object: Shortened
If Validated is Throttled or an error occurs Shortened will be ignored!

validated
Object: IP
Always returned!

If Throttled, returns an Object containing the Attribute "throttle" with a value of the Throttle Expiration Timestamp RFC 3339


GET /api;v1.0/validate/ip/after?

GET endpoint that uses Directory Parameters and the whole content of Query String (?) as the Raw Parameter. Supports JSONP!
This is useful if you are unsure or unable to properly encode a Query String Variable.
This will not support Fragments if # is not encoded! Fragments are client side only!
Variables are appended to the Directory 'after' with the ; Delimiter and before the Query String! Order of parameters is not important.
Example:
Request: /api;v1.0/validate/ip/after;jsonp=Whoa;shorten;validator=2?127.0.0.1
Parameters: ;jsonp=Whoa;shorten;validator=2
Validate: 127.0.0.1

Request

Parameters

validator
Number
Optional
Method of Validation to use.
STRICT Validation will not allow Incorrect Spec Validation to occur! It's recommended to use LOOSE_ANY!
The Default/Invalid Validator is LOOSE_ANY

Constants

Key Value
STRICT 1
STRICT_ANY 2
STRICT_IPV4 3
STRICT_IPV4HISTORIC 4
STRICT_IPV6 5
LOOSE 6
LOOSE_ANY 7
LOOSE_IPV4 8
LOOSE_IPV4HISTORIC 9
LOOSE_IPV6 10


Example

validator=2
shorten
Exists
Optional
Shorten Validated Object
Shortened Object may include other URI Compments needed to create a Valid URI Object
Validated must be Valid and Shorten must not be Throttled!

shorten-private
Exists
Optional
If this is set you will only be able to access the Shortened Link with a Private Key!
Private is a very large Random Integer up to 2^64 (18,446,744,073,709,551,615) and should be very hard to brute force!
DO NOT RELY SOLEY ON THIS FOR SECURITY!

jsonp
String
Optional
JSONP will be used to pad the JSON payload with a Function.
Must be a-zA-Z and 15 characters or less.
If JSONP is set and is empty or invalid "ZeroOut" will be used!

Example

jsonp=Whoa
Whoa({});
pd
Exists
Optional
Should Input be Percent Decoded before being passed to the Validator?
Most Validators will do their own Percent Decoding of Input.
This should only be used if necessary or if the Validator does not support Percent Decoding.

Response

errors
[]String
This is only returned on Internal Errors! Always check the Response Header Content-Type before parsing!

Example

"errors": [
	"internal server error"
]
shortened
Object: Shortened
If Validated is Throttled or an error occurs Shortened will be ignored!

validated
Object: IP
Always returned!

If Throttled, returns an Object containing the Attribute "throttle" with a value of the Throttle Expiration Timestamp RFC 3339