Skip to main content

Use Real Traffic to Document your API

Get visibility into how your API works today. Optic learns your API's current behavior by observing traffic.

  • How many endpoints are in your API?
  • Is your current API specification accurate? complete? How do you know?

Outcome#

Add an Optic specification to your API project#


Capture API Traffic for Optic to Learn From#

Capture Traffic by using your API / App:

Setup an api start command for your framework. Requests to the API when its run with Optic's CLI will be captured

Intercept traffic from your browser's network tab. Just run api intercept and API calls you see in the Network Tab will be captured by Optic.


Document your existing API endpoints#

Let's check if we've captured enough traffic to start documenting our API. Run api status -- we should see some new URLs to document:

$ api status
Computing API diffs... Done!โœ“  No diffs observed for existing endpoints   Undocumented URLs observed      (use "api status --review" to start documenting them          GET   /todos        PATCH   /todos/mc6ttk3vv         POST   /todos/

Nice work! Let's move to the next step: Documenting!