When you add or update web forwarding via the API, the request body must comply with specific validation rules. If any required field is missing or does not meet these rules, the API returns a 422 VALIDATION_ERROR instead of applying the change. In most cases, this indicates that the destination URL or type (redirection type) is not formatted correctly in your payload.
A 422 VALIDATION_ERROR is returned when the web forwarding payload violates business rules enforced by the API.
For web forwarding, the API requires:
-
The destination URL must start with http:// or https://.
-
The type (redirection type) must be either ‘301’ or ‘cloak’.
If either of these conditions is not met, the request is rejected with a validation error.
Example response (422 Validation Error):
{
"status": "error",
"code": "VALIDATION_ERROR",
"message": "The given data was invalid.",
"errors": {
"destination": [
"The field destination must be a valid URL starting with http:// or https://."
]
}
}
To resolve this, update your request body so that the destination is a properly formatted URL with http:// or https://, and ensure the type field is set to "301" or "cloak".