Skip to content

ALLOW_ANONYMOUS

Allow unauthenticated access to the endpoint, overriding the global RequiresAuthorization setting.

Keywords

allow_anonymous, anonymous, allow_anon, anon

Syntax

allow_anonymous

Examples

Public Endpoint

sql
create function get_public_info()
returns json
language sql
as $$select '{"version": "1.0"}'::json$$;

comment on function get_public_info() is
'HTTP GET
allow_anonymous';

Short Form

sql
comment on function health_check() is
'HTTP GET
anon';

Public Read, Protected Write Pattern

sql
-- Anyone can read
comment on function get_products() is
'HTTP GET
allow_anonymous';

-- Only authenticated users can create
comment on function create_product(text, numeric) is
'HTTP POST
authorize';

Behavior

  • Overrides the global RequiresAuthorization: true setting
  • Allows requests without authentication tokens
  • Useful for public APIs, health checks, and login endpoints

Released under the MIT License.