Skip to main content

Introduction

Supabase provides a RESTful API that is automatically generated from your PostgreSQL database schema. The API is powered by PostgREST, which provides instant RESTful APIs for your database.

Base URL

Your API is available at:
Replace <PROJECT_REF> with your project reference ID found in your project settings.

Auto-Generated API

Every time you create or modify a table, view, or function in your database, the REST API is automatically updated to reflect those changes. No additional configuration is required.

Example

If you create a table named countries with the following schema:
The following endpoints are automatically available:
  • GET /rest/v1/countries - List all countries
  • POST /rest/v1/countries - Create a new country
  • PATCH /rest/v1/countries?id=eq.1 - Update a country
  • DELETE /rest/v1/countries?id=eq.1 - Delete a country

API Documentation

You can view the auto-generated API documentation for your project at:
This provides an interactive OpenAPI/Swagger documentation interface.

Common Headers

All API requests require specific headers:
string
required
Your Supabase API key (anon key for client requests, service role key for server requests).
string
Bearer token for authenticated requests: Bearer <JWT_TOKEN>
string
Set to application/json for POST/PATCH requests.
string
Control the response format:
  • return=representation - Return the full object after insert/update
  • return=minimal - Return no content (204 response)
  • return=headers-only - Return only headers

Example Request

Response Format

Success Responses

Successful responses return JSON data:

Error Responses

Error responses include a message and details:
string
PostgREST error code.
string
Human-readable error message.
string | null
Additional error details if available.
string | null
Suggested fix for the error.

HTTP Status Codes

Filtering and Querying

The REST API supports powerful filtering using query parameters:

Basic Filters

Combining Filters

Multiple filters are combined with AND logic:

Ordering

Pagination

Selecting Columns

Vertical Filtering (Relationships)

Query related data using foreign keys:

Stored Procedures

Call PostgreSQL functions via the API:

Performance Tips

Only request the columns you need to reduce payload size:
Create database indexes on columns you frequently filter by:
Always use pagination for large datasets:
Only request total counts when necessary as it can be expensive:

Rate Limits

API rate limits vary by plan:
  • Free tier: Unlimited requests (with CPU limits)
  • Pro tier: Unlimited requests (higher CPU limits)
  • Enterprise: Custom limits
See Rate Limits for more information.

Next Steps

Authentication

Learn how to authenticate API requests

Database Operations

Explore CRUD operations

Storage API

Work with file storage

Edge Functions

Call serverless functions