diff --git a/apps/docs/components/MDX/database_setup.mdx b/apps/docs/components/MDX/database_setup.mdx
index c54b9b32f846b..314b27e482955 100644
--- a/apps/docs/components/MDX/database_setup.mdx
+++ b/apps/docs/components/MDX/database_setup.mdx
@@ -15,4 +15,4 @@ Your database will be available in less than a minute.
You can find your project credentials inside the project [settings](https://supabase.com/dashboard/project/_/settings/), including:
- [Database credentials](https://supabase.com/dashboard/project/_/settings/database): connection strings and connection pooler details.
-- [API credentials](https://supabase.com/dashboard/project/_/settings/database): your serverless API URL and `anon` / `service_role` keys.
+- [API credentials](https://supabase.com/dashboard/project/_/settings/database): your serverless API URL and / `service_role` keys.
diff --git a/apps/docs/components/MDX/kotlin_project_setup.mdx b/apps/docs/components/MDX/kotlin_project_setup.mdx
index 717f5b0389214..594898ccd71d9 100644
--- a/apps/docs/components/MDX/kotlin_project_setup.mdx
+++ b/apps/docs/components/MDX/kotlin_project_setup.mdx
@@ -40,10 +40,10 @@ Now we are going to set up the database schema. You can just copy/paste the SQL
### Get the API Keys
Now that you've created some database tables, you are ready to insert data using the auto-generated API.
-We just need to get the Project URL and `anon` key from the API settings.
+We just need to get the Project URL and key from the API settings.
1. Go to the [API Settings](https://app.supabase.com/project/_/settings/api) page in the Dashboard.
-2. Find your Project `URL`, `anon`, and `service_role` keys on this page.
+2. Find your Project `URL`, , and `service_role` keys on this page.
### Set up Google Authentication
diff --git a/apps/docs/components/MDX/partials.tsx b/apps/docs/components/MDX/partials.tsx
index 1f6133c6e4fa6..c6c13e38f96e7 100644
--- a/apps/docs/components/MDX/partials.tsx
+++ b/apps/docs/components/MDX/partials.tsx
@@ -10,6 +10,7 @@ import KotlinProjectSetup from './kotlin_project_setup.mdx'
import MigrationWarnings from './migration_warnings.mdx'
import OAuthPkceFlow from './oauth_pkce_flow.mdx'
import ProjectSetup from './project_setup.mdx'
+import PublishableKey from './publishable_key.mdx'
import QuickstartDbSetup from './quickstart_db_setup.mdx'
import QuickstartIntro from './quickstart_intro.mdx'
import SocialProviderSettingsSupabase from './social_provider_settings_supabase.mdx'
@@ -25,6 +26,7 @@ export {
KotlinProjectSetup,
MigrationWarnings,
ProjectSetup,
+ PublishableKey,
OAuthPkceFlow,
QuickstartDbSetup,
QuickstartIntro,
diff --git a/apps/docs/components/MDX/project_setup.mdx b/apps/docs/components/MDX/project_setup.mdx
index e1ad3a97ba7dc..fcd16b3e9fa2b 100644
--- a/apps/docs/components/MDX/project_setup.mdx
+++ b/apps/docs/components/MDX/project_setup.mdx
@@ -62,7 +62,7 @@ supabase migration new user_management_starter
### Get the API Keys
Now that you've created some database tables, you are ready to insert data using the auto-generated API.
-We just need to get the Project URL and `anon` key from the API settings.
+We just need to get the Project URL and key from the API settings.
1. Go to the [API Settings](https://supabase.com/dashboard/project/_/settings/api) page in the Dashboard.
-1. Find your Project `URL`, `anon`, and `service_role` keys on this page.
+1. Find your Project `URL`, , and `service_role` keys on this page.
diff --git a/apps/docs/components/MDX/publishable_key.mdx b/apps/docs/components/MDX/publishable_key.mdx
new file mode 100644
index 0000000000000..ea7607bdcc788
--- /dev/null
+++ b/apps/docs/components/MDX/publishable_key.mdx
@@ -0,0 +1,10 @@
+import { TooltipProvider_Shadcn_, Tooltip_Shadcn_, TooltipTrigger_Shadcn_, TooltipContent_Shadcn_ } from 'ui'
+
+
+
+ `publishable`
+
+
equivalent to the `anon` key
+
+
+
diff --git a/apps/docs/content/guides/api/api-keys.mdx b/apps/docs/content/guides/api/api-keys.mdx
index 33c869cf01116..dbdb537cf25ca 100644
--- a/apps/docs/content/guides/api/api-keys.mdx
+++ b/apps/docs/content/guides/api/api-keys.mdx
@@ -4,23 +4,20 @@ title: 'Understanding API Keys'
description: 'Securing your Data API with Postgres Row Level Security.'
---
-Supabase provides two default keys when you create a project: an `anon` key, and a `service_role` key. You can find both keys in the [API Settings](https://supabase.com/dashboard/project/_/settings/api).
+Supabase provides 2 default keys when you create a project: a key, and a `secret` key. You can find both keys in the [API Settings](https://supabase.com/dashboard/project/_/settings/api).
-The data APIs are designed to work with Postgres Row Level Security (RLS). These keys both map to Postgres roles. You can find an `anon` user and a `service_role` user in the [Roles](http://supabase.com/dashboard/project/_/database/roles) section of the dashboard.
+The data APIs are designed to work with Postgres Row Level Security (RLS). These keys map to the following Postgres roles:
-The keys are both long-lived JWTs. If you decode these keys, you will see that they contain the "role", an "issued date", and an "expiry date" ~10 years in the future.
+| Key | Postgres Role |
+| ------------- | -------------- |
+| `publishable` | `anon` |
+| `secret` | `service_role` |
-```json
-{
- "role": "anon",
- "iat": 1625137684,
- "exp": 1940713684
-}
-```
+You can find an `anon` user and a `service_role` user in the [Roles](http://supabase.com/dashboard/project/_/database/roles) section of the dashboard.
-## The `anon` key
+## Publishable key
-The `anon` key has very few privileges. You can use it in your [RLS policies](/docs/guides/database/postgres/row-level-security) to allow unauthenticated access. For example, this policy will allow unauthenticated access to the `profiles` table:
+The `publishable` key maps to the `anon` Postgres role, which has very few privileges. You can use it in your [RLS policies](/docs/guides/database/postgres/row-level-security) to allow unauthenticated access. For example, this policy will allow unauthenticated access to the `profiles` table:
```sql
create policy "Allow public access" on profiles to anon for
@@ -44,17 +41,17 @@ select
using (true);
```
-## The `service_role` key
+## Secret key
-The "service_role" is a predefined Postgres role with elevated privileges, designed to perform various administrative and service-related tasks. It can bypass Row Level Security, so it should only be used on a private server.
+The `secret` key maps to the `service_role` Postgres role, which is a predefined Postgres role with elevated privileges, designed to perform various administrative and service-related tasks. It can bypass Row Level Security, so it should only be used on a private server.
-Never expose the `service_role` key in a browser or anywhere where a user can see it.
+Never expose the `secret` key in a browser or anywhere where a user can see it.
-A common use case for the `service_role` key is running data analytics jobs on the backend. To support joins on user id, it is often useful to grant the service role read access to `auth.users` table.
+A common use case for the `secret` key is running data analytics jobs on the backend. To support joins on user id, it is often useful to grant the service role read access to `auth.users` table.
```sql
grant
@@ -62,5 +59,27 @@ select
on table auth.users to service_role;
```
+## Legacy API Keys
+
+
+
+The `anon` and `service_role` keys are being deprecated on 1st May 2025 for new and restored projects. For existing projects, these keys will be deprecated on 1st October 2025. For more information, read the [announcement](https://github.com/orgs/supabase/discussions/29260).
+
+
+
+You can find the `anon` and `service_role` keys in the [API Settings](https://supabase.com/dashboard/project/_/settings/api).
+
+The data APIs are designed to work with Postgres Row Level Security (RLS). These keys both map to Postgres roles. You can find an `anon` user and a `service_role` user in the [Roles](http://supabase.com/dashboard/project/_/database/roles) section of the dashboard.
+
+The keys are both long-lived JWTs. If you decode these keys, you will see that they contain the "role", an "issued date", and an "expiry date" ~10 years in the future.
+
+```json
+{
+ "role": "anon",
+ "iat": 1625137684,
+ "exp": 1940713684
+}
+```
+
We have [partnered with GitHub](https://github.blog/changelog/2022-03-28-supabase-is-now-a-github-secret-scanning-partner/) to scan for Supabase `service_role` keys pushed to public repositories.
If they detect any keys with service_role privileges being pushed to GitHub, they will forward the API key to us, so that we can automatically revoke the detected secrets and notify you, protecting your data against malicious actors.
diff --git a/apps/docs/content/guides/api/creating-routes.mdx b/apps/docs/content/guides/api/creating-routes.mdx
index 43e78a99f8475..bf9ab0167690e 100644
--- a/apps/docs/content/guides/api/creating-routes.mdx
+++ b/apps/docs/content/guides/api/creating-routes.mdx
@@ -54,7 +54,7 @@ Every Supabase project has a unique API URL. Your API is secured behind an API g
1. Go to the [Settings](https://supabase.com/dashboard/project/_/settings/general) page in the Dashboard.
2. Click **API** in the sidebar.
-3. Find your API `URL`, `anon`, and `service_role` keys on this page.
+3. Find your API `URL`, , and `service_role` keys on this page.