Skip to main content

Code Generation

We provide an OpenAPI Spec (read more on the Specification page) that represents a formal specification of our API Interface. A powerful side effect of OpenAPI is that you can perform code generation to generate your own (often strongly-typed) library to work with it.

We'll show you how to do it with TypeScript here, but solutions exist for most languages out there. OpenAPI is very well support across most languages - see here for a starting point for virtually every language.

JavaScript / TypeScript Example

openapi-typescript-codegen is a popular solution for generating a TypeScript client in order to interface with our API in a programmatic, type-safe way.

First, install the library into your project as a dev dependency.

npm install -D openapi-typescript-codegen

Then, add a script to your package.json scripts tag that will perform code generation from our specification.

{
"scripts": {
"generate:akkio": "openapi --input https://api.akkio.com/api/v1/api.yaml --output generated/"
}
}

When run with npm run generate:akkio, this will generate a strongly typed client through which you can easily make type-safe queries.

Keeping Up-To-Date

We recommend you regularly regenerate your client at a cadence in order to catch updates to our spec. We will flag any breaking changes in our Changelog and also do our best to communicate them to you via email.