Same endpoint for anonymous and authenticated users

I want to add this endpoint /graphql in kong for both anonymous and authenticated users :

if the apikey is provided consider it as authenticated
othwerwise consider it as anonymous

The configuration you are looking for is explained step by step here:

The gist is:

To configure a Service like this, you first apply your selected authentication plugin, then create a new consumer to represent annonymous users, then configure your authentication plugin to allow anonymous access.