Created - October 27, 2020

If you are an API Developer or an API consumer, you know how important it is to keep your contracts up-to-date all the time. If you change something and don't update the contract, someone somewhere gets mad 😡 !

So here's a tool to help make friends of API consumers 👫 .


Optic is a "Git-like version control system for API contracts". It makes it easier to create API documentation and update it as you go on merrily change your API request and response. All you have to do is review the change and approve it.


You can install the CLI as an npm global package or using homebrew. Link here.

It works with most of the languages - Java, NodeJS, Go, Rust, etc.


Optic uses a proxy to monitor the API over the network. It detects any change in your API and suggests changes in your API documentation.

You navigate to your Project's root and run

api init

This creates a optic.yml in your project that you then navigate to and update with a couple of things

  1. command - Command that runs your API Project. You also need to set the server port to be $OPTIC_API_PORT. This is a sample for a Maven Java project

    export SERVER_PORT=$OPTIC_API_PORT; mvn exec:java -Dexec.mainClass="com.test.Application"`
  2. inboundUrl - Your API hostname and port. Like http://localhost:8080

Then there is a way to check if your configuration is working ok.