For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
Perform an INSERT into the table or view.
By default, inserted rows are not returned. To return it, chain the call with .select().
The values to insert. Pass an object to insert a single row or an array to insert multiple rows.
Named parameters
const { error } = await supabase
.from('countries')
.insert({ id: 1, name: 'Mordor' })
const { error } = await supabase.from('countries').insert({ id: 1, name: 'Mordor' })
if (error) console.error(error)
const { data, error } = await supabase
.from('countries')
.insert({ id: 1, name: 'Mordor' })
.select()
const { error } = await supabase
.from('countries')
.insert([
{ id: 1, name: 'Mordor' },
{ id: 1, name: 'The Shire' },
])