403 - Invalid format

A validation error is an error due to invalid client requests.
All validation errors correspond with a 403 HTTP status code.

A validation error occurs when:

  • Request body is ill-formed
    e.g. invalid JSON
  • Required parameters are missing (either in body or in query string)
    e.g. endpoint required a field which is (empty or) not specified in the request
  • Endpoint validation rules are not matched
    e.g. minimum/maximum length constraint doesn't match

VALIDATION ERROR OBJECT

PropertyTypeDescription

property

string

Request property which originated the error

message

string

Message to the user explaining what happened

verbose

string

Message to the developer futher explaining what happened

code

string enum

  • InvalidFormat
  • RequiredField
  • InvalidLength
  • InvalidMinLength
  • InvalidMaxLength
  • InvalidEmailAddress
  • OutOfRange
  • PatternMismatch
  • PrefixMismatch
  • InvalidCharacter
  • MustBeLowerCase
  • MustBeUpperCase

Machine readable code to handle the error

Example validation error: missing required field

// HTTP status 403
{
	"code": "RequiredField",
  "message": "Cannot be empty",
  "property": "slashtag"
}

Example of validation error: invalid min length

// HTTP status 403
{
  "property": "slashtag",
  "message": "Value cannot be less than 2 characters long",
	"code": "InvalidMinLength",
  "input": "a",
  "minLength": 2
}

Example of validation error: OutOfRange

// HTTP status 403
{
	"property": "regType",
  "message": "Value is not allowed",
  "code": "OutOfRange",
  "input": "cat",
  "range": ["individual", "business"]
}

Following additional properties may appear in validation errors:

PropertyTypeDescription

input

object

Original input value for property

minLength

numerical
Positive

Minimum length allowed

maxLength

numerical
Strictly positive

Maximum length allowed

length

numerical
Strictly positive

Length to match

range

array of objects

Set of allowed values

pattern

string regex

Regex to test the input with

prefix

string

Prefix that input has to match

character

string

Character given in input

Validation error codes

CodeAdditional propertiesMessageDescription
InvalidFormatnoneInvalid formatGeneric invalid format error with respect to the property value
RequiredFieldnoneCannot be emptyField indicated in property was empty or not specified in the request
InvalidLengthinput, lengthValue cannot be different than length characters longNumber of characters of property value not matching length
InvalidMinLengthinput, minLengthValue cannot be less than minLength characters longValue for field indicated in property was too short with respect to minLength
InvalidMaxLengthinput, maxLengthValue cannot be more than maxLength characters longValue for field indicated in property was too long with respect to maxLength
InvalidEmailAddressinputValue is not a valid email addressValue for field indicated in property was not a valid email address
OutOfRangeinput, rangeValue is not allowedValue for field indicated in property was not included in range
PatternMismatchinput, patternInvalid formatValue for field indicated in property does not match regex in pattern
PrefixMismatchinput, prefixPrefix mismatchPrefix of value for field indicated in property does not match prefix
InvalidCharacterinput, characterInvalid character: 'character'Value for field indicated in property contains invalid character
MustBeLowerCaseinputValue must be lowercaseValue for field indicated in property is not lowercased
MustBeUpperCaseinputValue must be uppercaseValue for field indicated in property is not uppercased