JavaScript: Insert data

Perform an INSERT into the table or view.

Parameters

Examples

Create a record

const \{ error \} = await supabase
  .from('countries')
  .insert(\{ id: 1, name: 'Denmark' \})

Create a record and return it

const \{ data, error \} = await supabase
  .from('countries')
  .insert(\{ id: 1, name: 'Denmark' \})
  .select()

Bulk create

const \{ error \} = await supabase
  .from('countries')
  .insert([
    \{ id: 1, name: 'Nepal' \},
    \{ id: 1, name: 'Vietnam' \},
  ])