Skip to main content
Sealgap

What is an Anon Key?

The anon key is the public API key of a Supabase project, which an app sends with its requests to identify itself before any user has signed in. It is designed to be visible: it ships inside the JavaScript of the app, and anyone who opens the developer tools in a browser can read it.

What the anon key does

Every request to a Supabase project carries an API key. The key tells Supabase which project the request is for and which database role to use. With the anon key and no signed-in user, the request runs as a role called anon. Once a user signs in, their requests also carry their own login token and run as a role called authenticated. As the Supabase documentation on API keys puts it, an API key tells applications apart, not users.

Why a public key is not a problem in itself

Finding the anon key in the code of an app is expected and is not a finding. The key is not what protects the data. That job belongs to Row Level Security, the rules in the database that decide which rows the anon and authenticated roles may read or change. The key opens the door to the project, and the policies decide what is behind it.

The consequence is that the anon key can do exactly as much as the policies allow. If a table is exposed through the API without Row Level Security, or with a policy that lets the anon role read everything, then anyone holding the key can read that table without logging in. The useful question is never whether the key is exposed, but what a stranger can do with it.

Anon key and publishable key

Supabase has introduced a newer key format. The public key is now called the publishable key and starts with sb_publishable_, while the anon key is the legacy version, a long token that starts with eyJ. Supabase has announced that it is deprecating the legacy anon and service_role keys by the end of 2026, so older apps need to move to the new keys. The role of the key is the same under either name.

How it differs from the service role key

The anon key has a counterpart that must never appear in a browser. The service role key, now called the secret key, skips Row Level Security entirely. The two legacy keys look alike at a glance, which is a good reason to compare any key found in shipped code against the keys listed in the Supabase dashboard.

What to check

For an app you deliver, check two things. The only Supabase key in the shipped code should be the public one. And a request made with that key and no login should return nothing that is meant to be private.

Also known as

anonymous key publishable key public API key

Free check

See what one of your apps answers.

Certificate, browser protections and keys in public code. No account needed.

See what one of your own apps answers.

The free check looks at an app from the outside: whether it answers, its certificate, its browser protections and keys in its public code.