simplify code: use ``endpoint`` kwargs