Validate Hostname Documentation

Shared Validate Throttle: 500/Hour

Object: Hostname

Hostname
Supports:
print
Object: Print

Example

"print": {
	"unicode": "😻.😻.😻",
	"idna": "xn--238h.xn--238h.xn--238h",
	"percent-encoded": "%F0%9F%98%BB.%F0%9F%98%BB.%F0%9F%98%BB"
}
labels
[]Object: Label

Example

"labels": [
	{
		"print": {
			"unicode": "😻"
		},
		"encoding": {
			"unicode": true,
			"idna-excluded": true
		},
		"delimiter": 2,
		"correct": true
	},
	{
		"print": {
			"unicode": "😻"
		},
		"encoding": {
			"idna": true,
			"idna-excluded": true
		},
		"delimiter": 4,
		"correct": true
	},
	{
		"print": {
			"unicode": "😻"
		},
		"encoding": {
			"pe-necessary": true,
			"idna-excluded": true
		},
		"correct": true
	}
]
tld
Boolean
Is the entirety of the Hostname a TLD?

Single Labels are considered a TLD
Hexadecimal, Decimals, and Octals are Invalid, are not TLDs!

Example

"tld": false
tld-invalid
Boolean
Is the TLD Invalid for Personal Use?

Hexadecimal, Decimals, and Octals are Invalid, they conflict with IP Addresses!

Example

"tld-invalid": false
tld-real
Boolean
Does this Hostname contain a real TLD?

Example

"tld-real": false
tld-root
Boolean
Does this Hostname have a Root Server TLD?

Root Server TLDs are A-Z and are NOT single Unicode characters
Hexadecimal, Decimals, and Octals are Invalid, are not TLDs!

Example

"tld-root": false
tld-pos
Number
Does this Hostname contain a real TLD, and if so what is the Label Position of the starting TLD?

If Hostname does not contain a real TLD, POS is -1
If the tld-pos Option is disabled, POS is -2 to differentiate results

www.juandefu.ca would return 2
juandefu.ca would return 1
ca would return 0
faketld would return -1

Example

"tld-pos": -1
email-toolong
Boolean
Is this Hostname Longer than the Email RFC Allows?

Hostnames are allowed to be up to 255 characters.
Emails are allowed to be up to 254 characters. Email Hostnames are allowed to be up to 252 characters.

Example

"email-toolong": false
dangerous
Boolean
Is this Potentially Dangerous?

Example

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

Example

"correct": true
correct-email
Boolean
Was Input Correct to the Email Spec?

Example

"correct-email": true

Object Examples: Hostname

Invalid TLD Input: "0"
{
	"print": {
		"unicode": "0",
		"idna": "0",
		"percent-encoded": "0"
	},
	"labels": [
		{
			"print": {
				"unicode": "0"
			},
			"encoding": {},
			"correct": true
		}
	],
	"dangerous": true,
	"tld-invalid": true,
	"tld-pos": -1
}
ASCII Input: "www.juandefu.ca"
{
	"print": {
		"unicode": "www.juandefu.ca",
		"idna": "www.juandefu.ca",
		"percent-encoded": "www.juandefu.ca"
	},
	"labels": [
		{
			"print": {
				"unicode": "www"
			},
			"encoding": {},
			"delimiter": 1,
			"correct": true
		},
		{
			"print": {
				"unicode": "juandefu"
			},
			"encoding": {},
			"delimiter": 1,
			"correct": true
		},
		{
			"print": {
				"unicode": "ca"
			},
			"encoding": {},
			"correct": true
		}
	],
	"correct": true,
	"correct-email": true,
	"tld-real": true,
	"tld-pos": 2
}
Unicode.IDNA.PercentEncoded UTS #46 Delimiters Input: "πŸ˜»γ€‚xn--238hq%F0%9F%98%BB"
{
	"print": {
		"unicode": "😻.😻.😻",
		"idna": "xn--238h.xn--238h.xn--238h",
		"percent-encoded": "%F0%9F%98%BB.%F0%9F%98%BB.%F0%9F%98%BB"
	},
	"labels": [
		{
			"print": {
				"unicode": "😻"
			},
			"encoding": {
				"unicode": true,
				"idna-excluded": true
			},
			"delimiter": 2,
			"correct": true
		},
		{
			"print": {
				"unicode": "😻"
			},
			"encoding": {
				"idna": true,
				"idna-excluded": true
			},
			"delimiter": 4,
			"correct": true
		},
		{
			"print": {
				"unicode": "😻"
			},
			"encoding": {
				"pe-necessary": true,
				"idna-excluded": true
			},
			"correct": true
		}
	],
	"tld-pos": -1
}

Object: Hostname_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
labels
Object: Label_Options
tld
Boolean
tld-invalid
Boolean
tld-real
Boolean
tld-root
Boolean
tld-pos
Boolean
email-toolong
Boolean
dangerous
Boolean
correct
Boolean
correct-email
Boolean

Object Examples: Hostname_Options

Default Options:
{
	"print": {
		"unicode": true,
		"idna": true,
		"percent-encoded": true
	},
	"labels": {
		"print": {
			"unicode": true,
			"idna": false,
			"percent-encoded": false
		},
		"encoding": {
			"cleaned": true,
			"unicode": true,
			"pe-necessary": true,
			"pe-unnecessary": true,
			"pe-partial": true,
			"idna": true,
			"idna-invalid": true,
			"idna-normalized": true,
			"idna-normalize-failed": true,
			"idna-excluded": true
		},
		"delimiter": true,
		"correct": true
	},
	"email-toolong": true,
	"dangerous": true,
	"correct": true,
	"correct-email": true,
	"tld": true,
	"tld-invalid": true,
	"tld-real": true,
	"tld-root": true,
	"tld-pos": true
}

Object: Label

Label

print
Object: Print

Example

"print": {
	"unicode": "😻",
	"idna": "xn--238h",
	"percent-encoded": "%F0%9F%98%BB"
}
encoding
Object: Encoding

Example

"encoding": {
	"unicode": true,
	"idna-excluded": true
}
delimiter
Number
UTS #46 Delimiter.
This is the Delimiter that came after the current label!

"A.B"
A has the . Delimiter: 1
B has no Delimiter: 0


Constants

Key Value
0 No Delimiter
1 U+002E ( . ) FULL STOP
2 U+3002 ( 。 ) IDEOGRAPHIC FULL STOP
3 U+FF0E ( . ) FULLWIDTH FULL STOP
4 U+FF61 ( q ) HALFWIDTH IDEOGRAPHIC FULL STOP


Example

"delimiter": 1 // .
correct
Boolean
Was Input Correct to the Spec?

Example

"correct": true

Object Examples: Label

Invalid TLD Input: "0"
{
	"print": {
		"unicode": "0"
	},
	"encoding": {},
	"correct": true
}
Root TLD Input: "a.x"
{
	"print": {
		"unicode": "a"
	},
	"encoding": {},
	"delimiter": 1,
	"correct": true
}
Country Code TLD Input: "ca。x"
{
	"print": {
		"unicode": "ca"
	},
	"encoding": {},
	"delimiter": 2,
	"correct": true
}
ASCII Input: "juandefu.x"
{
	"print": {
		"unicode": "juandefu"
	},
	"encoding": {},
	"delimiter": 3,
	"correct": true
}
Unicode Input: "😻qx"
{
	"print": {
		"unicode": "😻"
	},
	"encoding": {
		"unicode": true,
		"idna-excluded": true
	},
	"delimiter": 4,
	"correct": true
}

Object: Label_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
encoding
Object: Encoding_Options
delimiter
Boolean
correct
Boolean

Object: Print

Hostname and Label both use this Object for Printing

uri
String
URI Output

Unicode and Unsafe ASCII Characters are Percent Encoded

Example

"uri": "ascii"
"uri": "%25" // ascii % character
"uri": "%F0%9F%98%BB" // 😻
iri
String
IRI Output

Unicode is Unencoded, Unsafe ASCII Characters are Percent Encoded

Example

"iri": "unicode"
"iri": "%25" // ascii % character
"iri": "😻"
percent-encoded
String
Percent Encoded Output

Example

"percent-encoded": "output"
"percent-encoded": "%F0%9F%98%BB"

Object Examples: Print

ASCII Input: "juandefu.ca"
{
	"unicode": "juandefu.ca",
	"idna": "juandefu.ca",
	"percent-encoded": "juandefu.ca"
}
ASCII Input: "a-b-c"
{
	"unicode": "a-b-c",
	"idna": "a-b-c",
	"percent-encoded": "a-b-c"
}
Unicode.IDNA.PercentEncoded Input: "😻.xn--238h.%F0%9F%98%BB"
{
	"unicode": "😻.😻.😻",
	"idna": "xn--238h.xn--238h.xn--238h",
	"percent-encoded": "%F0%9F%98%BB.%F0%9F%98%BB.%F0%9F%98%BB"
}

Object: Print_Options

Hostname and Label 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.
unicode
Boolean
idna
Boolean
percent-encoded
Boolean

Object: Encoding

cleaned
Boolean
Was the Input Cleaned?
Control Character or other Blacklisted Characters may be removed!

Example

"cleaned": false
unicode
Boolean
Did the Input contain Unicode?

Example

"unicode": true
pe-necessary
Boolean
Did the Input contain Percent Encoding - was a Character Necessarily Encoded?

Example

"pe-necessary": false
pe-unnecessary
Boolean
Did the Input contain Percent Encoding - was a Character Unnecessarily Encoded?

Example

"pe-unnecessary": false
pe-partial
Boolean
Did the Input contain Percent Encoding - was a Unicode Character Partially Encoded?

Example

"pe-partial": false
idna
Boolean
Was the Input IDNA Encoded?

Example

"unicode": true
idna-invalid
Boolean
Was the Input an Invalid IDNA Label?

Example

"idna-invalid": false
idna-normalized
Boolean
Was the Input UTS #46 Normalized?

Example

"idna-normalized": true
idna-normalize-failed
Boolean
Did Input contain a Disallowed or Invalid UTS #46 Character?

Example

"idna-normalize-failed": false
idna-excluded
Boolean
Does the Input contain a UTS #46 Character that is Excluded from use with IDNA 2008?

Example

"idna-excluded": false

Object Examples: Encoding

ASCII Input: "juandefu.ca"
{}
Unicode Input: "😻"
{
	"unicode": true,
	"idna-excluded": true
}
IDNA Input: "xn--238h"
{
	"idna": true,
	"idna-excluded": true
}
PercentEncoded Input: "%F0%9F%98%BB"
{
	"pe-necessary": true,
	"idna-excluded": true
}

Object: Encoding_Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
cleaned
Boolean
unicode
Boolean
pe-necessary
Boolean
pe-unnecessary
Boolean
pe-partial
Boolean
idna
Boolean
idna-invalid
Boolean
idna-normalized
Boolean
idna-normalize-failed
Boolean
idna-excluded
Boolean

POST /api;v1.0/validate/hostname

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!
The Default/Invalid Validator is LOOSE

Constants

Key Value
STRICT 1
LOOSE 2
EMAIL_STRICT 3
EMAIL_LOOSE 4


Example

"validator": 0
options
Object: Hostname_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: Hostname
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/hostname

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!
The Default/Invalid Validator is LOOSE

Constants

Key Value
STRICT 1
LOOSE 2
EMAIL_STRICT 3
EMAIL_LOOSE 4


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: Hostname
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/hostname/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/hostname/after;jsonp=Whoa;shorten;validator=2?juandefu.ca
Parameters: ;jsonp=Whoa;shorten;validator=2
Validate: juandefu.ca

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!
The Default/Invalid Validator is LOOSE

Constants

Key Value
STRICT 1
LOOSE 2
EMAIL_STRICT 3
EMAIL_LOOSE 4


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: Hostname
Always returned!

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