I don't need to use sessions in my rest(stateless) api and if I turn off them, it's causing an error.
You may try using stateless
for certain path
security.yml
security:
firewalls:
main:
stateless: true
Hope it's the thing you are looking for.