Take a look at the specification OpenAPI which is the way to define "these contracts" (as is WSDL)
For example, one of the tools we use in WebAPI to define our APIs and make them more "readable for us humans is" Swagger (la more popular), only with decorators generates the necessary scheme so that it can be read in these tools. That is, generates the contract.
You can also see Autorest which is the tool that with an OpenAPI specification generates the client to access this API! That is, to write less code;)
Links that can help you