Showing Logs in the Docs


This requires API Metrics

You can learn more about setting up API Metrics here.

One of the best parts of API Metrics is the ability for your users to construct an API request, make the request, and view the full log of the API request and response, all without leaving the documentation.

For authenticated users, API Metrics will display their logs right inside your documentation in the following places:

  1. In a section called API Logs.
  2. Next to each endpoint in the API Reference (requires an OpenAPI document - see Make Your Metrics Even Better With OpenAPI below).

This includes all interactions that the user made with your API, not just the ones made inside ReadMe. In other words, if a user made a failed API call via cURL, then navigated to your API reference to read the docs and understand why the call failed, they would see that failed cURL request in your documentation!

Logs for Each Endpoint


This requires an OpenAPI document

See Make Your Metrics Even Better With OpenAPI below for more information.

For more granularity, the logs also display per endpoint in the API Reference section:

Your users can view their logs directly in the API Explorer.Your users can view their logs directly in the API Explorer.

Your users can view their logs directly in the API Explorer.

If a customer has an issue with a particular endpoint, now they can see what has worked in the past and self-diagnose!

There is also a Logs section where the user will see all of their API calls for all endpoints. There, they can filter by response status code, request method, or endpoint.

Enabling API Logs in Docs

Follow these steps to enable users to see their own API logs in the docs:

  1. (Highly Recommended!) Upload an OpenAPI document to ReadMe β€” see the section titled Make Your Metrics Even Better With OpenAPI below.
  2. Send your API logs to ReadMe β€” see Getting Started With API Metrics for more information on this.


Scrub your API logs of confidential information before sending to ReadMe

API logs are viewable by anyone with ReadMe admin privileges. You can find out how to remove secure information from the logs at Getting Started With API Metrics.

  1. Set Up Authentication In Docs β€” ReadMe supports logging in with JWT, which you can set up with this guide. All you need to do is pass in an id in the user's JWT object that matches the user's id passed into the API Metrics middleware. Then that user will be able to see all of the matching logs.

Need help getting this setup? Send us an email at [email protected].

Make Your Metrics Even Better With OpenAPI

ReadMe has a variety of upload and synchronization workflows available to make it easy to keep your API Reference up-to-date, which you can read about here.

In addition to the benefits of our interactive API Explorer, your API Metrics become even more powerful when you upload an OpenAPI document. Here are a few reasons why:

  • Your users can view their API logs underneath the endpoints in the reference guides.
  • Individual logs will auto-populate a link to the corresponding reference documentation for that endpoint.
  • Headers will be automatically hidden that aren't explicitly listed in the OpenAPI document.
  • URLs are parameterized based on the OpenAPI document.
  • And many more to come!

Did this page help you?