Database

Data API


The Supabase Data API is a standalone server that sits between your application client code and your database. It automatically generates a fully RESTful API based on your database structure, allowing you to interact with your database through HTTP endpoints.

With the Data API, you have granular control over exposure: expose specific tables and functions by granting Data API roles the access they need, or enable Default privileges for new entities to automatically grant access to new tables and functions in public.

In Data API integrations settings, expose specific tables and functions and grant only the privileges each role needs.

1
grant select on table public.your_table to anon;
2
grant select, insert, update, delete on table public.your_table to authenticated;
3
grant execute on function public.your_function to anon, authenticated;

Use default privileges for new entities in public#

If you want new entities in public to be accessible automatically, enable Default privileges for new entities in the Integrations > Data API section of the Dashboard. This applies only to new tables and functions in public.

1
alter default privileges for role postgres in schema public
2
grant select, insert, update, delete on tables to anon, authenticated, service_role;
3
4
alter default privileges for role postgres in schema public
5
grant execute on functions to anon, authenticated, service_role;

Disable the Data API completely#

If your app never uses Supabase client libraries, REST, or GraphQL data endpoints:

  1. In the Integrations > Data API section of the Dashboard.
  2. Turn Enable Data API off.

Learn more#

To learn more about the Data API, see the full guide.