Skip to content


While browsing the documentation a lot of examples where used using the Request object from Esmerald.

Well, the Request is actually inherited from Lilya and some extas were added to tune it to the needs of the framework.

Importing is as simple as:

from esmerald import Request

API Reference

You can learn more about the Request by checking the API Reference.

You can also read more about the request in the Official Lilya documentation.

The Request

The request is what is used (generally) to get the data from the path_parameters, cookies, headers or even the user current logged in.

As Esmerald uses Lilya under the hood, using the Request from it, it won't cause any damage but you won't be able to access the whole scope of what Esmerald can do for you as well as the unique way of handling the .json().

Why this object then? Well, it is in the name, you might want to access the properties of the request directly.


from esmerald import Esmerald, Gateway, get, Request

def read_request(request: Request, id: str):
    host =
    return {"host": host, "user_id": id}

app = Esmerald(

Esmerald automatically will know the path parameters of the handler by the way it is declared but you can also access them via request.path_params.