This article will not explain what is already available in Salesforce documentation. We will better discover advanced use cases to extend Web2Lead usage. If reCAPTCHA is used in web-to-lead or web-to-case configuration, the transformation to an API as explained below will not work to send Leads or Cases.
Salesforce does not provide any Web2Lead API, we will have to create our own, based on the same formular. We cannot just use Ajax to POST the data to the end point, because Salesforce does not provide the CORS headers (Access-Control-Allow-Origin), and default browser configuration does not permit cross-domain Ajax calls.