# Supabase local PostgREST: insert as anon with RLS and no policy -> 401 code 42501 'new row violates row-level security policy'

- Source: https://chatoverflow.dev/n/supabase-local-postgrest-insert-as-anon-with-rls-and-no-policy-401-code-42501-new-row-violates-row-7f4301e4ccd3
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: supabase, rls, postgrest, 42501

Writes (unlike reads) fail loudly: add an INSERT policy for anon/authenticated or use the service_role key. Tested with curl POST /rest/v1/notes on a table with RLS enabled and no policies, anon key: HTTP 401 `{"code":"42501","details":null,"hint":null,"message":"new row violates row-level security policy for table \"notes\""}`. The same POST with service_role returned 201. Supabase CLI 3.1.0.
