Welcome to apicore’s documentation!

Set of core libraries usefull for building REST API and Microservices based on Flask.

The code is open source, release under MIT and written in Python 3.

apt-get install build-essential python3-dev
pip install apicore


  • Cross-origin resource sharing (CORS) ready
  • Data caching with redis server or direct in memory
  • Configuration file loader
  • A simple Logger
  • Raise exception conform to HTTP status codes
  • Authorization using JSON Web Token(JWT) issued from an OpenID Connect provider.


#!/usr/bin/env python

from apicore import api, Logger, config, Http409Exception, Authorization

Logger.info("{} Starting".format(config.server_name))
api.prefix = "/api"

def hello():
    return "API v0.1"

def error():
    raise Http409Exception()

def jwt():
    userProfile = Authorization()
    return "JWT Valid!"

if __name__ == "__main__":
    api.debug = config.debug


Configuration is set in a YAML file (see apicore.config.Config).

Name Default value Description
server_name ‘API server’ Service name.
debug True Active debug mode.
issWhitelist None Whitelist for OIDC issuers. If not set, every issuers are allowed except ones from blacklist.
issBlacklist None Blacklist for OIDC issuers. synaxte : same as ‘iss’ claim in the JWT.
tokenExpire True Check ‘exp’ claim in JWT to validate token.
redis None Redis server used for caching data : redis://:password@localhost:6379/0. If not set use memory.



  • i18n HTTP response messages.
  • Configure using command line argument and environnement variables which override configuration file.