For programmatic checking of modern HTML documents, you probably want to instead use the API provided by the W3C HTML Checker. To do that, call https://validator.w3.org/nu/ or the URL for another instance of the W3C HTML Checker, and consult the following documentation:

HTML5

If for some reason rather than using the W3C HTML Checker API, you want to use the W3C Markup Validator API, the simplest way to do that is just to call https://validator.w3.org/check? with a query string that includes the "uri" parameter and the URL for the document to check, and with the "output=json" parameter appended; for example: https://validator.w3.org/check?uri=https://example.com/&output=json. The W3C Markup Validator will return the results as JSON, in the same JSON format used by the W3C HTML Checker. You can specify other W3C Markup Validator options as additional query parameters. The names of the query parameters are listed in the section Controlling the behavior of the W3C Markup Validator, in parentheses after the name of each option described. All values for query parameters should be encoded in UTF-8 (before percent-encoding them). Separate the query parameters with either ";" (semicolon) characters or with "&" (ampersand) characters.