Does this support YAML definitions?

Yes! YAML definitions will be automatically converted to JSON when they're fetched for either SDK code generation or dynamic api usage.

Does this support Swagger 2.0 definitions?

At the moment it does not. If you wish to use an API that has a Swagger 2.0 file, you'll need to first convert it to an OpenAPI 3 definition.

Does this support OpenAPI 3.1 definitions?


Does this support OpenAPI 4 (Moonwalk) definitions?

No! Since v4 is still in the early planning stages we don't support it but once it's finalized we will.

Does this support traditional OAuth 2 flows of creating tokens?

Not yet, unfortunately. For APIs that use OAuth 2, you'll need a fully-qualified token already for api to make requests.

Does this support APIs that use multiple forms of authentication on a single request?

Not yet! This is something we're thinking about how to handle, but it's difficult with the simplified nature of the .auth() method as it by design does not ask the user to inform the SDK of what kind of authentication scheme the token they're supplying it should match up against.

If you have ideas on how to handle this we'd love to hear them.

Will this work in browsers?

If you generate an SDK with the CLI installation process then yes! If you're having trouble getting autogenerated SDKs working in a browser, please let us know!

Unfortunately the dynamic version of api will not work in browsers as it requires access to the filesystem for handling and managing its cache state.

Will this validate my data before it reaches the API?

Not yet! This is something we're thinking about in the future.

Does this support fetching OpenAPI definitions that require authentication to download?

Not yet! The URL that you give the module must be publicly accessible. If it isn't, you can download it to your computer or server and then use the absolute path to that file instead.

$ npx api install ./path/to/downloaded.json
const sdk = require('api')('./path/to/downloaded.json');

Where is the cache stored?

See How does it work? for some information on how, when, and where api caches its data.