Skip to main content

REST (PostgREST)

Supabase exposes every table in the public schema as a REST endpoint via PostgREST. This is the surface for reads — filtered queries, embedded relations, ordering, pagination. For writes, prefer the workflow RPCs.

All examples assume the two auth headers are set. RLS scopes every response to your project memberships.

Reading rows

# Publications in the reviewing status, newest first
curl "https://jionfqfmjinkrmzlsghf.supabase.co/rest/v1/publications\
?status=eq.reviewing&order=created_at.desc&select=id,title,status,scheduled_for" \
-H "apikey: $CP_PUBLISHABLE_KEY" \
-H "Authorization: Bearer $CP_ACCESS_TOKEN"

Common query parameters:

ParamExampleMeaning
selectselect=id,title,statuschoose columns (and embeds)
<col>=eq.<v>status=eq.draftfilter (eq, neq, gt, lt, in, like, …)
orderorder=created_at.descsort
limit / offsetlimit=20&offset=40paginate

Embedding relations

PostgREST resolves foreign keys, so you can pull a publication with its promos and media in one call:

curl "https://jionfqfmjinkrmzlsghf.supabase.co/rest/v1/publications\
?id=eq.<uuid>&select=*,promos(*),publication_media(position,media(*))" \
-H "apikey: $CP_PUBLISHABLE_KEY" \
-H "Authorization: Bearer $CP_ACCESS_TOKEN"

Tables you'll read most

TableHolds
projectsthe three tenants (slug, name, default_channels)
collectionscampaigns and sections
publicationsarticles and their status
promoschannel-ready copy per publication
channelsthe seeded channel lookup (limits, upload_post_platform)
mediaasset rows (Storage paths)
reviewsreview verdicts + notes
status_eventsappend-only transition audit

See Data model for the full column lists and relationships.

Don't write status directly

PostgREST will happily accept a PATCH — but a status change that isn't a legal transition is rejected by a trigger, and a legal one still skips the intent, audit actor, and side effects the RPCs handle. Route every write through an RPC.