There is no one-size-fits-all solution for creating Application Programming Interface (API) documentation; however, there are common elements in most API documentation that should be considered when creating a template for your API reference documentation. Below is a list and the suggested organization of the information commonly found in API reference documentation.
Note: Endpoints and Methods, Parameters, and Response Schemas are typically presented in tables for print and web output documentation. Request and Response Examples often have an elements table following the code sample.
Perhaps most importantly, always ask the following questions: What kind of API is this? Is this a web service API or web API? Generally, the audience for web service APIs is almost all developers, while web API documentation is more often used by business analysts, data analysts, and program managers, in addition to developers. This, of course, leads to the one of the most basic principles of technical writing: know your audience. In the case of API documentation, if your audience includes analysts and less technical users, then the more explanatory information you can provide about the API the better. Describe why and how a user employs the specific API. If, however, your audience is predominantly developers, who mostly use the documentation solely as a reference, know that they do not need a lot of description and explanatory prose, which only makes the documentation less usable for them.