Using the API

The Krill API is a primarily JSON based REST-like HTTPS API with bearer token based authentication.


View the human readable interactive version of the Krill v0.6.2 API specification, made possible by the wonderful ReDoc tool.


The raw OpenAPI 3.0.2 specification description of the API is available in the Krill source repository (v0.6.2 link).

Generating Client Code

The OpenAPI Generator can generate client code for using the krill API with your favourite language. Below is an example of how to do this using Docker and Python 3.

First create a simple test Krill client program. Save the following as /tmp/, replacing <YOUR XXX> values with the correct access token and domain name for your Krill server.

# Import the OpenAPI generated Krill client library
import krill_api
from krill_api import *

# Create a configuration for the client library telling it how to connect to
# the Krill server
krill_api_config = krill_api.Configuration()
krill_api_config.access_token = '<YOUR KRILL API TOKEN>' = "https://{}/api/v1".format('<YOUR KRILL FQDN>')
krill_api_config.verify_ssl = True
krill_api_config.assert_hostname = False
krill_api_config.cert_file = None

# Create a Krill API client
krill_api_client = krill_api.ApiClient(krill_api_config)

# Get the client helper for the Certificate Authority set of Krill API endpoints
krill_ca_api = CertificateAuthoritiesApi(krill_api_client)

# Query Krill for the list of configured CAs

Now generate the Krill client library:


mkdir -p $GENDIR

wget -O $GENDIR/openapi.yaml

docker run --rm -v $GENDIR:/local \
    openapitools/openapi-generator-cli generate \
    -i /local/openapi.yaml \
    -g python \
    -o /local/out \

python3 -m venv $VENVDIR
source $VENVDIR/bin/activate
pip3 install wheel
pip3 install $GENDIR/out/

And then run the sample client program:

python3 /tmp/

To learn more about using your OpenAPI generated client library consult the file that is created in the generated client library directory, e.g. $GENDIR/out/ in the example above.


Future improvements to the Krill OpenAPI specification may necessitate that you re-generate your client library and possibly also alter your client program to match any changed class and function names.