Add optional support for api
Adapt readme to api