To create an API in Python with Flask, we have to indicate: the endpoint, the method and the function that should be executed on that endpoint . Let’s see an example with an API that simply returns the text “Hello world!”. from flask import Flask, jsonify, request,send_file app = Flask() @app.